Skip to content

Commit

Permalink
updates deps and test cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: Luca Burgazzoli <lburgazzoli@gmail.com>
  • Loading branch information
lburgazzoli committed Jun 10, 2023
1 parent dbd35a5 commit 36f3421
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 36 deletions.
16 changes: 8 additions & 8 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ guava = "32.0.1-jre"
assertj = "3.24.2"
junit = "5.9.3"
testcontainers = "1.18.3"
protoc = "3.21.10"
protoc = "3.23.2"
failsafe = "2.4.4"
awaitility = "4.2.0"
commonsIo = "2.13.0"
Expand All @@ -17,15 +17,15 @@ errorprone = "2.19.1"
vertx = "4.4.3"
picocli = "4.7.4"

versionsPlugin = "0.46.0"
errorPronePlugin = "3.0.1"
spotlessPlugin = "6.16.0"
versionsPlugin = "0.47.0"
errorPronePlugin = "3.1.0"
spotlessPlugin = "6.19.0"
shadowPlugin = "8.1.1"
testLoggerPlugin = "3.2.0"
protobufPlugin = "0.9.3"
nexusPublishPlugin = "1.2.0"
axionReleasePlugin = "1.14.4"
testRetryPlugin = "1.5.2"
nexusPublishPlugin = "1.3.0"
axionReleasePlugin = "1.15.3"
testRetryPlugin = "1.5.3"

[libraries]
slf4j = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }
Expand Down Expand Up @@ -63,7 +63,7 @@ autoServiceProcessor = { module = "com.google.auto.service:auto-service", versio

errorprone = { module = "com.google.errorprone:error_prone_core", version.ref = "errorprone" }
errorproneAnnotations = { module = "com.google.errorprone:error_prone_annotations", version.ref = "errorprone" }
errorproneJavac = { module = "com.google.errorprone:javac", version = "1+" }
errorproneJavac = { module = "com.google.errorprone:javac", version = "9+" }

[bundles]
grpc = [ "grpcCore", "grpcNetty", "grpcProtobuf", "grpcStub", "grpcGrpclb" ]
Expand Down
1 change: 1 addition & 0 deletions gradle/quality.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ tasks.withType(JavaCompile).configureEach {
excludedPaths = '.*/generated/.*'
disableWarningsInGeneratedCode = true
}
options.deprecation = true
}

pmd {
Expand Down
40 changes: 19 additions & 21 deletions jetcd-core/src/main/java/io/etcd/jetcd/Txn.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@
* <pre>
* {@code
* txn.If(
* new Cmp(KEY, Cmp.Op.GREATER, CmpTarget.value(VALUE)),
* new Cmp(KEY, cmp.Op.EQUAL, CmpTarget.version(2))
* ).Then(
* Op.put(KEY2, VALUE2, PutOption.DEFAULT),
* Op.put(KEY3, VALUE3, PutOption.DEFAULT)
* ).Else(
* Op.put(KEY4, VALUE4, PutOption.DEFAULT),
* Op.put(KEY4, VALUE4, PutOption.DEFAULT)
* ).commit();
* new Cmp(KEY, Cmp.Op.GREATER, CmpTarget.value(VALUE)),
* new Cmp(KEY, cmp.Op.EQUAL, CmpTarget.version(2))).Then(
* Op.put(KEY2, VALUE2, PutOption.DEFAULT),
* Op.put(KEY3, VALUE3, PutOption.DEFAULT))
* .Else(
* Op.put(KEY4, VALUE4, PutOption.DEFAULT),
* Op.put(KEY4, VALUE4, PutOption.DEFAULT))
* .commit();
* }
* </pre>
*
Expand All @@ -48,18 +47,17 @@
* <pre>
* {@code
* txn.If(
* new Cmp(KEY, Cmp.Op.GREATER, CmpTarget.value(VALUE))
* ).If(
* new Cmp(KEY, cmp.Op.EQUAL, CmpTarget.version(VERSION))
* ).Then(
* Op.put(KEY2, VALUE2, PutOption.DEFAULT)
* ).Then(
* Op.put(KEY3, VALUE3, PutOption.DEFAULT)
* ).Else(
* Op.put(KEY4, VALUE4, PutOption.DEFAULT)
* ).Else(
* Op.put(KEY4, VALUE4, PutOption.DEFAULT)
* ).commit();
* new Cmp(KEY, Cmp.Op.GREATER, CmpTarget.value(VALUE))).If(
* new Cmp(KEY, cmp.Op.EQUAL, CmpTarget.version(VERSION)))
* .Then(
* Op.put(KEY2, VALUE2, PutOption.DEFAULT))
* .Then(
* Op.put(KEY3, VALUE3, PutOption.DEFAULT))
* .Else(
* Op.put(KEY4, VALUE4, PutOption.DEFAULT))
* .Else(
* Op.put(KEY4, VALUE4, PutOption.DEFAULT))
* .commit();
* }
* </pre>
*/
Expand Down
13 changes: 7 additions & 6 deletions jetcd-core/src/test/java/io/etcd/jetcd/impl/MaintenanceTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;
import java.util.stream.Collectors;

import org.apache.commons.io.output.NullOutputStream;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -55,14 +56,14 @@ public class MaintenanceTest {

private static Client client;
private static Maintenance maintenance;
private static List<URI> endpoints;
private static List<String> endpoints;

@TempDir
static Path tempDir;

@BeforeEach
public void setUp() {
endpoints = cluster.clientEndpoints();
endpoints = cluster.clientEndpoints().stream().map(URI::toString).collect(Collectors.toList());
client = TestUtil.client(cluster).build();
maintenance = client.getMaintenanceClient();
}
Expand Down Expand Up @@ -92,7 +93,7 @@ public void testSnapshotToOutputStream() throws ExecutionException, InterruptedE

@Test
public void testSnapshotChunks() throws ExecutionException, InterruptedException {
final Long bytes = maintenance.snapshot(NullOutputStream.NULL_OUTPUT_STREAM).get();
final Long bytes = maintenance.snapshot(NullOutputStream.INSTANCE).get();
final AtomicLong count = new AtomicLong();
final CountDownLatch latcht = new CountDownLatch(1);

Expand Down Expand Up @@ -135,11 +136,11 @@ public void testDefragment() throws ExecutionException, InterruptedException {
maintenance.defragmentMember(endpoints.get(0)).get();
}

//@Test
@Test
public void testMoveLeader() throws ExecutionException, InterruptedException {
URI leaderEndpoint = null;
String leaderEndpoint = null;
List<Long> followers = new ArrayList<>();
for (URI ep : endpoints) {
for (String ep : endpoints) {
StatusResponse statusResponse = maintenance.statusMember(ep).get();
long memberId = statusResponse.getHeader().getMemberId();
if (memberId == statusResponse.getLeader()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public void testConnectionError() {
}
});

assertThatThrownBy(() -> maintenance.snapshot(NullOutputStream.NULL_OUTPUT_STREAM).get())
assertThatThrownBy(() -> maintenance.snapshot(NullOutputStream.INSTANCE).get())
.isInstanceOf(ExecutionException.class).hasCauseInstanceOf(EtcdException.class);
}

Expand Down

0 comments on commit 36f3421

Please sign in to comment.