Skip to content

Commit

Permalink
update dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
jenschude committed Dec 7, 2022
1 parent d8f0fc1 commit 5f9bcea
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 34 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Expand Up @@ -12,7 +12,7 @@ plugins {
id 'java'
id 'java-library' // needed to make sure that transitive deps have 'compile' scope

id "com.diffplug.spotless" version "6.10.0"
id "com.diffplug.spotless" version "6.12.0"

id 'io.github.gradle-nexus.publish-plugin' version '1.1.0'
id 'com.github.jk1.dependency-license-report' version '2.0'
Expand All @@ -22,7 +22,7 @@ plugins {

configurations {
taglet {
resolutionStrategy.force("net.sourceforge.plantuml:plantuml:1.2022.12")
resolutionStrategy.force("net.sourceforge.plantuml:plantuml:1.2022.13")
}
}

Expand Down
4 changes: 2 additions & 2 deletions buildSrc/build.gradle
@@ -1,12 +1,12 @@
plugins {
id 'org.jetbrains.kotlin.jvm' version "1.7.20"
id 'org.jetbrains.kotlin.jvm' version "1.7.22"
}

repositories {
mavenCentral()
}

dependencies {
implementation "com.github.javaparser:javaparser-symbol-solver-core:3.24.7"
implementation "com.github.javaparser:javaparser-symbol-solver-core:3.24.8"
implementation "com.google.code.gson:gson:2.10"
}
Expand Up @@ -13,11 +13,6 @@
import com.fasterxml.jackson.databind.node.LongNode;
import com.fasterxml.jackson.databind.node.ObjectNode;

import dev.failsafe.Failsafe;
import dev.failsafe.FailsafeExecutor;
import dev.failsafe.RetryPolicy;
import dev.failsafe.event.ExecutionAttemptedEvent;

import io.vrap.rmf.base.client.*;
import io.vrap.rmf.base.client.http.InternalLogger;
import io.vrap.rmf.base.client.utils.json.JsonException;
Expand All @@ -26,6 +21,11 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import dev.failsafe.Failsafe;
import dev.failsafe.FailsafeExecutor;
import dev.failsafe.RetryPolicy;
import dev.failsafe.event.ExecutionAttemptedEvent;

public class ConcurrentModificationMiddlewareImpl implements ConcurrentModificationMiddleware {
static final String loggerName = ClientBuilder.COMMERCETOOLS + ".retry.concurrent_modification";
private static final InternalLogger logger = InternalLogger.getLogger(loggerName);
Expand Down Expand Up @@ -93,7 +93,7 @@ public CompletableFuture<ApiHttpResponse<byte[]>> invoke(ApiHttpRequest request,
if (context.isFirstAttempt()) {
return next.apply(request);
}
return fn.apply(context.getLastFailure());
return fn.apply(context.getLastException());
});
}

Expand All @@ -102,7 +102,7 @@ private void logEventFailure(ExecutionAttemptedEvent<ApiHttpResponse<byte[]>> ev

logger.info(() -> "ConcurrentModification Retry #" + attempt);
logger.trace(() -> {
final Throwable failure = event.getLastFailure();
final Throwable failure = event.getLastException();
if (failure instanceof ApiHttpException) {
final ApiHttpException httpException = (ApiHttpException) failure;
final ApiHttpRequest request = httpException.getRequest();
Expand Down
18 changes: 9 additions & 9 deletions gradle-scripts/extensions.gradle
Expand Up @@ -31,10 +31,10 @@ ext {
]

jackson_core = [
annotations: 'com.fasterxml.jackson.core:jackson-annotations:2.13.4',
databind: 'com.fasterxml.jackson.core:jackson-databind:2.13.4.2',
core: 'com.fasterxml.jackson.core:jackson-core:2.13.4',
datatype: 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.4',
annotations: 'com.fasterxml.jackson.core:jackson-annotations:2.14.1',
databind: 'com.fasterxml.jackson.core:jackson-databind:2.14.1',
core: 'com.fasterxml.jackson.core:jackson-core:2.14.1',
datatype: 'com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.14.1',
]

google = [
Expand All @@ -51,19 +51,19 @@ ext {
]

junit = [
junit: 'org.junit.jupiter:junit-jupiter:5.8.2',
dataprovider: 'com.tngtech.junit.dataprovider:junit-jupiter-dataprovider:2.8',
junit: 'org.junit.jupiter:junit-jupiter:5.9.1',
dataprovider: 'com.tngtech.junit.dataprovider:junit-jupiter-dataprovider:2.9',
jsonassert: 'org.skyscreamer:jsonassert:1.5.1',
assertj: 'org.assertj:assertj-core:3.23.1'
]

mockito = [
inline: 'org.mockito:mockito-inline:4.2.0',
junit: 'org.mockito:mockito-junit-jupiter:4.2.0',
inline: 'org.mockito:mockito-inline:4.9.0',
junit: 'org.mockito:mockito-junit-jupiter:4.9.0',
]

failsafe = [
failsafe: 'dev.failsafe:failsafe:3.2.0',
failsafe: 'dev.failsafe:failsafe:3.2.4',
]

spotify = [
Expand Down
Expand Up @@ -5,15 +5,15 @@
import java.util.concurrent.*;
import java.util.function.Function;

import dev.failsafe.*;
import dev.failsafe.event.ExecutionAttemptedEvent;
import dev.failsafe.spi.Scheduler;

import io.vrap.rmf.base.client.*;
import io.vrap.rmf.base.client.error.UnauthorizedException;
import io.vrap.rmf.base.client.oauth2.AuthException;
import io.vrap.rmf.base.client.oauth2.TokenSupplier;

import dev.failsafe.*;
import dev.failsafe.event.ExecutionAttemptedEvent;
import dev.failsafe.spi.Scheduler;

/**
* Default implementation for the {@link OAuthMiddleware} with automatic retry upon expired access
*/
Expand Down Expand Up @@ -61,8 +61,9 @@ public OAuthMiddlewareImpl(final Scheduler scheduler, final OAuthHandler oauthHa
final Fallback<ApiHttpResponse<byte[]>> fallback = Fallback
.builderOfException((ExecutionAttemptedEvent<? extends ApiHttpResponse<byte[]>> event) -> {
logger.debug(() -> "Convert CircuitBreakerOpenException to AuthException");
logger.trace(event::getLastFailure);
return new AuthException(400, "", null, "Authentication failed", null, event.getLastFailure());
logger.trace(event::getLastException);
return new AuthException(400, "", null, "Authentication failed", null,
event.getLastException());
})
.handleIf(throwable -> throwable instanceof CircuitBreakerOpenException)
.build();
Expand All @@ -83,7 +84,7 @@ public OAuthMiddlewareImpl(final Scheduler scheduler, final OAuthHandler oauthHa
.onClose(event -> logger.debug(() -> "The authentication circuit breaker was closed"))
.onOpen(event -> logger.debug(() -> "The authentication circuit breaker was opened"))
.onHalfOpen(event -> logger.debug(() -> "The authentication circuit breaker was half-opened"))
.onFailure(event -> logger.trace(() -> "Authentication failed", event.getFailure()))
.onFailure(event -> logger.trace(() -> "Authentication failed", event.getException()))
.build();
this.failsafeExecutor = Failsafe.with(fallback, retry, circuitBreaker).with(scheduler);
}
Expand Down
Expand Up @@ -9,19 +9,19 @@
import java.util.concurrent.ScheduledExecutorService;
import java.util.function.Function;

import dev.failsafe.Failsafe;
import dev.failsafe.FailsafeExecutor;
import dev.failsafe.RetryPolicy;
import dev.failsafe.event.ExecutionAttemptedEvent;
import dev.failsafe.spi.Scheduler;

import io.vrap.rmf.base.client.*;
import io.vrap.rmf.base.client.utils.json.JsonException;
import io.vrap.rmf.base.client.utils.json.JsonUtils;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import dev.failsafe.Failsafe;
import dev.failsafe.FailsafeExecutor;
import dev.failsafe.RetryPolicy;
import dev.failsafe.event.ExecutionAttemptedEvent;
import dev.failsafe.spi.Scheduler;

/**
* Implementation for a retry of a requests upon configured response status codes
*/
Expand Down Expand Up @@ -145,7 +145,7 @@ private void logEventFailure(ExecutionAttemptedEvent<ApiHttpResponse<byte[]>> ev

logger.info(() -> "Retry #" + attempt);
logger.trace(() -> {
final Throwable failure = event.getLastFailure();
final Throwable failure = event.getLastException();
if (failure instanceof ApiHttpException) {
final ApiHttpException httpException = (ApiHttpException) failure;
final ApiHttpRequest request = httpException.getRequest();
Expand Down

0 comments on commit 5f9bcea

Please sign in to comment.