Skip to content

Commit

Permalink
Implemented #53 (#54)
Browse files Browse the repository at this point in the history
* Implemented #53
  • Loading branch information
ckunki authored Feb 7, 2023
1 parent 134032a commit 54fdbe8
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 30 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/broken_links_checker.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .github/workflows/ci-build-next-java.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dependencies.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions doc/changes/changelog.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions doc/changes/changes_0.6.8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Udf Debugging Java 0.6.8, released 2023-02-07

Code name: Improved LocalServiceExposer

## Summary

Enhanced interface `LocalServiceExposer` and simplified usage.

## Features

* #53: Enhanced interface `LocalServiceExposer` and simplified usage.

## Dependency Updates

### Compile Dependency Updates

* Updated `com.exasol:bucketfs-java:2.6.0` to `3.0.0`

### Test Dependency Updates

* Updated `com.exasol:exasol-testcontainers:6.5.0` to `6.5.1`
* Updated `org.mockito:mockito-junit-jupiter:5.0.0` to `5.1.1`

### Plugin Dependency Updates

* Updated `com.exasol:error-code-crawler-maven-plugin:1.2.1` to `1.2.2`
* Updated `com.exasol:project-keeper-maven-plugin:2.9.1` to `2.9.3`
* Updated `org.apache.maven.plugins:maven-failsafe-plugin:3.0.0-M7` to `3.0.0-M8`
* Updated `org.apache.maven.plugins:maven-surefire-plugin:3.0.0-M7` to `3.0.0-M8`
* Updated `org.codehaus.mojo:versions-maven-plugin:2.13.0` to `2.14.2`
12 changes: 7 additions & 5 deletions pk_generated_parent.pom

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 7 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>udf-debugging-java</artifactId>
<version>0.6.7</version>
<version>0.6.8</version>
<name>udf-debugging-java</name>
<description>Utilities for debugging, profiling and code coverage measure for UDFs.</description>
<url>https://github.com/exasol/udf-debugging-java/</url>
Expand Down Expand Up @@ -55,7 +53,7 @@
<dependency>
<groupId>com.exasol</groupId>
<artifactId>bucketfs-java</artifactId>
<version>2.6.0</version>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>com.exasol</groupId>
Expand Down Expand Up @@ -95,7 +93,7 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>5.0.0</version>
<version>5.1.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -108,7 +106,7 @@
<dependency>
<groupId>com.exasol</groupId>
<artifactId>exasol-testcontainers</artifactId>
<version>6.5.0</version>
<version>6.5.1</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -153,7 +151,7 @@
<plugin>
<groupId>com.exasol</groupId>
<artifactId>project-keeper-maven-plugin</artifactId>
<version>2.9.1</version>
<version>2.9.3</version>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -187,7 +185,7 @@
<parent>
<artifactId>udf-debugging-java-generated-parent</artifactId>
<groupId>com.exasol</groupId>
<version>0.6.7</version>
<version>0.6.8</version>
<relativePath>pk_generated_parent.pom</relativePath>
</parent>
</project>
12 changes: 11 additions & 1 deletion src/main/java/com/exasol/udfdebugging/LocalServiceExposer.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,19 @@
@FunctionalInterface
public interface LocalServiceExposer {

/**
* Create an instance of {@code LocalServiceExposer} for a host that does not require port mapping.
*
* @param host host name or IP address of host (but without port) providing the service to expose
* @return new instance of {@code LocalServiceExposer}
*/
public static LocalServiceExposer forHost(final String host) {
return port -> new InetSocketAddress(host, port);
}

/**
* Get the address for the network scope inside of the Exasol database for a given local service.
*
*
* @param port port number
* @return proxy
*/
Expand Down
14 changes: 5 additions & 9 deletions src/main/java/com/exasol/udfdebugging/UdfTestSetup.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.exasol.udfdebugging;

import java.net.InetSocketAddress;
import java.sql.Connection;
import java.util.List;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -32,12 +31,12 @@ public class UdfTestSetup implements AutoCloseable {
* @param exasolConnection connection to the Exasol database. Make sure that your tests use the same connection
*/
public UdfTestSetup(final String testHostIpAddress, final Bucket bucket, final Connection exasolConnection) {
this(port -> new InetSocketAddress(testHostIpAddress, port), bucket, exasolConnection);
this(LocalServiceExposer.forHost(testHostIpAddress), bucket, exasolConnection);
}

/**
* Create a new instance of {@link UdfTestSetup}.
*
*
* @param localServiceExposer Proxy factory that makes ports of the test host available in the container
* @param bucket BucketFS bucket to upload resource to
* @param exasolConnection connection to the Exasol database. Make sure that your tests use the same connection
Expand All @@ -52,20 +51,17 @@ private UdfTestSetup(final LocalServiceExposer localServiceExposer, final Bucket

/**
* Create a new instance of {@link UdfTestSetup}.
*
*
* @param testSetup Exasol test setup
* @param exasolConnection connection to the Exasol database. Make sure that your tests use the same connection
*/
public UdfTestSetup(final ExasolTestSetup testSetup, final Connection exasolConnection) {
this(port -> {
final InetSocketAddress serviceAddress = testSetup.makeLocalTcpServiceAccessibleFromDatabase(port);
return new InetSocketAddress(serviceAddress.getHostName(), serviceAddress.getPort());
}, testSetup.getDefaultBucket(), exasolConnection);
this(testSetup::makeLocalTcpServiceAccessibleFromDatabase, testSetup.getDefaultBucket(), exasolConnection);
}

/**
* Get JVM options required for this setup.
*
*
* @return array of JVM options
*/
public String[] getJvmOptions() {
Expand Down
3 changes: 1 addition & 2 deletions src/test/java/com/exasol/udfdebugging/modules/TestSetup.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.exasol.udfdebugging.modules;

import java.io.Closeable;
import java.net.InetSocketAddress;
import java.sql.*;
import java.util.stream.Stream;

Expand All @@ -27,7 +26,7 @@ public TestSetup() throws SQLException {
}

public LocalServiceExposer getHostPortProxy() {
return port -> new InetSocketAddress(this.exasol.getHostIp(), port);
return LocalServiceExposer.forHost(this.exasol.getHostIp());
}

public Bucket getDefaultBucket() {
Expand Down

0 comments on commit 54fdbe8

Please sign in to comment.