Skip to content

Commit

Permalink
Catch up to Java 11
Browse files Browse the repository at this point in the history
  • Loading branch information
vietnguyen-td committed Jan 10, 2024
1 parent 2b765ec commit 6b40048
Show file tree
Hide file tree
Showing 14 changed files with 231 additions and 188 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.6.26
- Catch up to Java 11

## 0.6.25 - 2022-09-21
- Properly shutdown ThreadExecutor when an unexpected error occurs

Expand Down
55 changes: 28 additions & 27 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
id "checkstyle"
id "jacoco"
id "signing"
id "org.embulk.embulk-plugins" version "0.4.2"
id "org.embulk.embulk-plugins" version "0.5.5"
}

repositories {
Expand All @@ -13,7 +13,7 @@ repositories {

group = "com.treasuredata.embulk.plugins"
description = "Loads records from Marketo."
version = "0.6.25"
version = "0.6.26"

sourceCompatibility = 1.8
targetCompatibility = 1.8
Expand All @@ -29,7 +29,7 @@ dependencies {
compileOnly "org.embulk:embulk-api:$embulkVersion"
compileOnly "org.embulk:embulk-spi:$embulkVersion"

compile('org.embulk:embulk-util-config:0.3.1') {
implementation('org.embulk:embulk-util-config:0.3.2') {
// Conflict with Embulk Core
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-annotations'
exclude group: 'com.fasterxml.jackson.core', module: 'jackson-core'
Expand All @@ -38,32 +38,33 @@ dependencies {
exclude group: 'javax.validation', module: 'validation-api'
}

compile "org.embulk:embulk-util-json:0.1.1"
compile "org.embulk:embulk-util-text:0.1.1"
compile "org.embulk:embulk-util-timestamp:0.2.1"
implementation "org.embulk:embulk-util-json:0.1.1"
implementation "org.embulk:embulk-util-text:0.1.1"
implementation "org.embulk:embulk-util-timestamp:0.2.1"

// Explicit dependencies for embulk-util-* that matches with Embulk
compile 'com.fasterxml.jackson.core:jackson-core:2.6.7'
compile 'com.fasterxml.jackson.core:jackson-annotations:2.6.7'
compile 'com.fasterxml.jackson.core:jackson-databind:2.6.7'
compile 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.6.7'
compile 'javax.validation:validation-api:1.1.0.Final'
compile('org.apache.bval:bval-jsr303:0.5'){
exclude group: 'org.apache.commons', module: 'commons-lang'
}

compile 'org.embulk:embulk-base-restclient:0.10.1'
compile 'org.embulk:embulk-util-retryhelper-jetty92:0.8.2'

compile 'com.google.guava:guava:18.0'
compile "com.google.code.findbugs:annotations:3.0.1"
compile 'org.apache.commons:commons-lang3:3.4'

testCompile "junit:junit:4.+"
testCompile "org.embulk:embulk-core:$embulkVersion:tests"
testCompile "org.embulk:embulk-junit4:$embulkVersion"
testCompile "org.embulk:embulk-deps:$embulkVersion"
testCompile "org.mockito:mockito-core:2.+"
implementation 'com.fasterxml.jackson.core:jackson-core:2.6.7'
implementation 'com.fasterxml.jackson.core:jackson-annotations:2.6.7'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.6.7'
implementation 'com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.6.7'
implementation 'javax.validation:validation-api:1.1.0.Final'
implementation 'org.apache.bval:bval-jsr303:0.5'
implementation 'org.embulk:embulk-base-restclient:0.10.1'
implementation 'org.embulk:embulk-util-retryhelper-jetty94:0.9.0'

implementation 'com.google.guava:guava:18.0'
implementation "com.google.code.findbugs:annotations:3.0.1"
implementation 'org.apache.commons:commons-lang3:3.12.0'
implementation "javax.xml.bind:jaxb-api:2.2.11"
implementation "com.sun.xml.bind:jaxb-core:2.2.11"
implementation "com.sun.xml.bind:jaxb-impl:2.2.11"
implementation "javax.activation:activation:1.1.1"

testImplementation "junit:junit:4.+"
testImplementation "org.embulk:embulk-core:$embulkVersion:tests"
testImplementation "org.embulk:embulk-junit4:$embulkVersion"
testImplementation "org.embulk:embulk-deps:$embulkVersion"
testImplementation "org.mockito:mockito-core:2.+"
}

embulkPlugin {
Expand Down
36 changes: 36 additions & 0 deletions gradle/dependency-locks/compileClasspath.lockfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# This is a Gradle generated file for dependency locking.
# Manual edits can break the build and are not advised.
# This file is expected to be part of source control.
com.fasterxml.jackson.core:jackson-annotations:2.6.7
com.fasterxml.jackson.core:jackson-core:2.6.7
com.fasterxml.jackson.core:jackson-databind:2.6.7
com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.6.7
com.google.code.findbugs:annotations:3.0.1
com.google.code.findbugs:jsr305:3.0.1
com.google.guava:guava:18.0
com.sun.xml.bind:jaxb-core:2.2.11
com.sun.xml.bind:jaxb-impl:2.2.11
commons-beanutils:commons-beanutils-core:1.8.3
javax.activation:activation:1.1.1
javax.validation:validation-api:1.1.0.Final
javax.xml.bind:jaxb-api:2.2.11
net.jcip:jcip-annotations:1.0
org.apache.bval:bval-core:0.5
org.apache.bval:bval-jsr303:0.5
org.apache.commons:commons-lang3:3.12.0
org.eclipse.jetty:jetty-client:9.4.51.v20230217
org.eclipse.jetty:jetty-http:9.4.51.v20230217
org.eclipse.jetty:jetty-io:9.4.51.v20230217
org.eclipse.jetty:jetty-util:9.4.51.v20230217
org.embulk:embulk-api:0.10.29
org.embulk:embulk-base-restclient:0.10.1
org.embulk:embulk-spi:0.10.29
org.embulk:embulk-util-config:0.3.2
org.embulk:embulk-util-file:0.1.3
org.embulk:embulk-util-json:0.1.1
org.embulk:embulk-util-retryhelper-jetty94:0.9.0
org.embulk:embulk-util-retryhelper:0.9.0
org.embulk:embulk-util-text:0.1.1
org.embulk:embulk-util-timestamp:0.2.1
org.msgpack:msgpack-core:0.8.11
org.slf4j:slf4j-api:1.7.30
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,26 @@ com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.6.7
com.google.code.findbugs:annotations:3.0.1
com.google.code.findbugs:jsr305:3.0.1
com.google.guava:guava:18.0
com.sun.xml.bind:jaxb-core:2.2.11
com.sun.xml.bind:jaxb-impl:2.2.11
commons-beanutils:commons-beanutils-core:1.8.3
javax.activation:activation:1.1.1
javax.validation:validation-api:1.1.0.Final
javax.xml.bind:jaxb-api:2.2.11
net.jcip:jcip-annotations:1.0
org.apache.bval:bval-core:0.5
org.apache.bval:bval-jsr303:0.5
org.apache.commons:commons-lang3:3.4
org.eclipse.jetty:jetty-client:9.2.14.v20151106
org.eclipse.jetty:jetty-http:9.2.14.v20151106
org.eclipse.jetty:jetty-io:9.2.14.v20151106
org.eclipse.jetty:jetty-util:9.2.14.v20151106
org.apache.commons:commons-lang3:3.12.0
org.eclipse.jetty:jetty-client:9.4.51.v20230217
org.eclipse.jetty:jetty-http:9.4.51.v20230217
org.eclipse.jetty:jetty-io:9.4.51.v20230217
org.eclipse.jetty:jetty-util:9.4.51.v20230217
org.embulk:embulk-base-restclient:0.10.1
org.embulk:embulk-util-config:0.3.1
org.embulk:embulk-util-config:0.3.2
org.embulk:embulk-util-file:0.1.3
org.embulk:embulk-util-json:0.1.1
org.embulk:embulk-util-retryhelper-jetty92:0.8.2
org.embulk:embulk-util-retryhelper:0.8.2
org.embulk:embulk-util-retryhelper-jetty94:0.9.0
org.embulk:embulk-util-retryhelper:0.9.0
org.embulk:embulk-util-rubytime:0.3.2
org.embulk:embulk-util-text:0.1.1
org.embulk:embulk-util-timestamp:0.2.1
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Mon Mar 27 16:55:11 ICT 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-all.zip
2 changes: 1 addition & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,4 @@ APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

exec "$JAVACMD" "$@"
exec "$JAVACMD" "$@"
2 changes: 1 addition & 1 deletion gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@ exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
:omega
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
import org.embulk.input.marketo.model.MarketoAccessTokenResponse;
import org.embulk.input.marketo.model.MarketoError;
import org.embulk.spi.DataException;
import org.embulk.util.retryhelper.jetty92.Jetty92ResponseReader;
import org.embulk.util.retryhelper.jetty92.Jetty92RetryHelper;
import org.embulk.util.retryhelper.jetty92.Jetty92SingleRequester;
import org.embulk.util.retryhelper.jetty92.StringJetty92ResponseEntityReader;
import org.embulk.util.retryhelper.jetty94.Jetty94ResponseReader;
import org.embulk.util.retryhelper.jetty94.Jetty94RetryHelper;
import org.embulk.util.retryhelper.jetty94.Jetty94SingleRequester;
import org.embulk.util.retryhelper.jetty94.StringJetty94ResponseEntityReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -35,7 +35,7 @@

import static com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS;
import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
import static org.embulk.input.marketo.rest.MarketoResponseJetty92EntityReader.jsonResponseInvalid;
import static org.embulk.input.marketo.rest.MarketoResponseJettyEntityReader.jsonResponseInvalid;

/**
* Marketo base rest client
Expand All @@ -59,7 +59,7 @@ public class MarketoBaseRestClient implements AutoCloseable

private int marketoLimitIntervalMillis;

private Jetty92RetryHelper retryHelper;
private Jetty94RetryHelper retryHelper;

protected long readTimeoutMillis;

Expand All @@ -73,7 +73,7 @@ public class MarketoBaseRestClient implements AutoCloseable
Optional<String> partnerApiKey,
int marketoLimitIntervalMillis,
long readTimeoutMillis,
Jetty92RetryHelper retryHelper)
Jetty94RetryHelper retryHelper)
{
this.identityEndPoint = identityEndPoint;
this.clientId = clientId;
Expand Down Expand Up @@ -115,7 +115,7 @@ private String requestAccessToken()
params.put("partner_id", partnerApiKey.get());
}

String response = retryHelper.requestWithRetry(new StringJetty92ResponseEntityReader(readTimeoutMillis), new Jetty92SingleRequester()
String response = retryHelper.requestWithRetry(new StringJetty94ResponseEntityReader(readTimeoutMillis), new Jetty94SingleRequester()
{
@Override
public void requestOnce(HttpClient client, Response.Listener responseListener)
Expand Down Expand Up @@ -165,12 +165,12 @@ protected boolean isExceptionToRetry(Exception exception)
return accessTokenResponse.getAccessToken();
}

protected <T> T doGet(final String target, final Map<String, String> headers, final Multimap<String, String> params, Jetty92ResponseReader<T> responseReader)
protected <T> T doGet(final String target, final Map<String, String> headers, final Multimap<String, String> params, Jetty94ResponseReader<T> responseReader)
{
return doRequestWithWrappedException(target, HttpMethod.GET, headers, params, null, responseReader);
}

protected <T> T doPost(final String target, final Map<String, String> headers, final Multimap<String, String> params, final String content, Jetty92ResponseReader<T> responseReader)
protected <T> T doPost(final String target, final Map<String, String> headers, final Multimap<String, String> params, final String content, Jetty94ResponseReader<T> responseReader)
{
StringContentProvider contentProvider = null;
if (content != null) {
Expand All @@ -179,7 +179,7 @@ protected <T> T doPost(final String target, final Map<String, String> headers, f
return doPost(target, headers, params, responseReader, contentProvider);
}

protected <T> T doPost(final String target, final Map<String, String> headers, final Multimap<String, String> params, Jetty92ResponseReader<T> responseReader, final ContentProvider content)
protected <T> T doPost(final String target, final Map<String, String> headers, final Multimap<String, String> params, Jetty94ResponseReader<T> responseReader, final ContentProvider content)
{
return doRequestWithWrappedException(target, HttpMethod.POST, headers, params, content, responseReader);
}
Expand All @@ -200,7 +200,7 @@ private String getAccessTokenWithWrappedException()
}
}

private <T> T doRequestWithWrappedException(final String target, final HttpMethod method, final Map<String, String> headers, final Multimap<String, String> params, final ContentProvider contentProvider, Jetty92ResponseReader<T> responseReader)
private <T> T doRequestWithWrappedException(final String target, final HttpMethod method, final Map<String, String> headers, final Multimap<String, String> params, final ContentProvider contentProvider, Jetty94ResponseReader<T> responseReader)
{
try {
return doRequest(target, method, headers, params, contentProvider, responseReader);
Expand All @@ -216,9 +216,9 @@ private <T> T doRequestWithWrappedException(final String target, final HttpMetho
}
}

protected <T> T doRequest(final String target, final HttpMethod method, final Map<String, String> headers, final Multimap<String, String> params, final ContentProvider contentProvider, Jetty92ResponseReader<T> responseReader)
protected <T> T doRequest(final String target, final HttpMethod method, final Map<String, String> headers, final Multimap<String, String> params, final ContentProvider contentProvider, Jetty94ResponseReader<T> responseReader)
{
return retryHelper.requestWithRetry(responseReader, new Jetty92SingleRequester()
return retryHelper.requestWithRetry(responseReader, new Jetty94SingleRequester()
{
@Override
public void requestOnce(HttpClient client, Response.Listener responseListener)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.eclipse.jetty.http.HttpHeader;
import org.embulk.input.marketo.exception.MarketoAPIException;
import org.embulk.input.marketo.model.MarketoResponse;
import org.embulk.util.retryhelper.jetty92.Jetty92ResponseReader;
import org.embulk.util.retryhelper.jetty94.Jetty94ResponseReader;

import java.io.InputStream;
import java.io.InputStreamReader;
Expand All @@ -19,7 +19,7 @@
/**
* Created by tai.khuu on 9/5/17.
*/
public class MarketoInputStreamResponseEntityReader implements Jetty92ResponseReader<InputStream>
public class MarketoInputStreamResponseEntityReader implements Jetty94ResponseReader<InputStream>
{
private static final ObjectReader OBJECT_READER = new ObjectMapper().readerFor(new TypeReference<MarketoResponse<ObjectNode>>(){ });

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.embulk.input.marketo.exception.MarketoAPIException;
import org.embulk.input.marketo.model.MarketoResponse;
import org.embulk.spi.DataException;
import org.embulk.util.retryhelper.jetty92.Jetty92ResponseReader;
import org.embulk.util.retryhelper.jetty94.Jetty94ResponseReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand All @@ -23,26 +23,26 @@
/**
* Created by tai.khuu on 9/1/17.
*/
public class MarketoResponseJetty92EntityReader<T> implements Jetty92ResponseReader<MarketoResponse<T>>
public class MarketoResponseJettyEntityReader<T> implements Jetty94ResponseReader<MarketoResponse<T>>
{
private InputStreamResponseListener listener;

private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);

private static final Logger LOGGER = LoggerFactory.getLogger(MarketoResponseJetty92EntityReader.class);
private static final Logger LOGGER = LoggerFactory.getLogger(MarketoResponseJettyEntityReader.class);
private final Long timeout;

private final JavaType javaType;

public static String jsonResponseInvalid = "Exception when parse json content";

public MarketoResponseJetty92EntityReader(long timeout)
public MarketoResponseJettyEntityReader(long timeout)
{
this.timeout = timeout;
javaType = OBJECT_MAPPER.getTypeFactory().constructParametrizedType(MarketoResponse.class, MarketoResponse.class, ObjectNode.class);
}

public MarketoResponseJetty92EntityReader(long timeout, Class<T> resultClass)
public MarketoResponseJettyEntityReader(long timeout, Class<T> resultClass)
{
this.listener = new InputStreamResponseListener();
this.timeout = timeout;
Expand Down
Loading

0 comments on commit 6b40048

Please sign in to comment.