Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependency io.dropwizard:dropwizard-dependencies to v2.1.10 (release/2.1.x) #241

Merged
merged 2 commits into from
Dec 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
<sonar.host.url>https://sonarcloud.io</sonar.host.url>

<javadoc.doclint.none>-Xdoclint:none</javadoc.doclint.none>
<dropwizard.version>2.0.29</dropwizard.version>
<dropwizard.version>2.1.10</dropwizard.version>
<curator.version>5.5.0</curator.version>
<error_prone.javac.version>9+181-r4173-1</error_prone.javac.version>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@
import org.apache.curator.test.TestingServer;
import org.apache.curator.x.discovery.ServiceInstance;
import org.apache.curator.x.discovery.details.InstanceSerializer;
import org.junit.ClassRule;
import org.junit.Test;

import org.junit.jupiter.api.extension.ExtendWith;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.core.type.TypeReference;

import io.dropwizard.discovery.core.InstanceMetadata;
import io.dropwizard.discovery.core.JacksonInstanceSerializer;
import io.dropwizard.discovery.testutil.TestApplication;
import io.dropwizard.discovery.testutil.TestConfiguration;
import io.dropwizard.testing.ResourceHelpers;
import io.dropwizard.testing.junit.DropwizardAppRule;
import io.dropwizard.testing.junit5.DropwizardAppExtension;
import io.dropwizard.testing.junit5.DropwizardExtensionsSupport;

@ExtendWith(DropwizardExtensionsSupport.class)
public class DiscoveryBundleIntegrationTest {
private static final String NAMESPACE = "dropwizard";
private static final String SERVICE_NAME = "test-service";
private static final String SERVICE_PATH = "/service/" + SERVICE_NAME;

@ClassRule
public static final DropwizardAppRule<TestConfiguration> RULE = new DropwizardAppRule<TestConfiguration>(
public static final DropwizardAppExtension<TestConfiguration> RULE = new DropwizardAppExtension<TestConfiguration>(
TestApplication.class, ResourceHelpers.resourceFilePath("test-config.yaml"));

InstanceSerializer<InstanceMetadata> serializer = new JacksonInstanceSerializer<InstanceMetadata>(
Expand All @@ -40,7 +40,7 @@ private String instancePath(String instanceNode) {
}

@Test
public void testRegistration() throws Exception {
void testRegistration() throws Exception {
// use a separate instance of curator to pull out the app's data
TestingServer testingServer = RULE.getConfiguration().getTestingServer();
try (final CuratorFramework curatorFramework = CuratorFrameworkFactory
Expand All @@ -60,4 +60,4 @@ public void testRegistration() throws Exception {
assertThat(serviceInstanceMetadata.getName()).isEqualTo(SERVICE_NAME);
}
}
}
}
32 changes: 16 additions & 16 deletions src/test/java/io/dropwizard/discovery/DiscoveryFactoryTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import io.dropwizard.util.Duration;
import org.apache.curator.RetryPolicy;
import org.apache.curator.retry.ExponentialBackoffRetry;
import org.junit.Test;
import org.junit.jupiter.api.Test;

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown;
Expand All @@ -12,22 +12,22 @@ public class DiscoveryFactoryTest {
private final DiscoveryFactory factory = new DiscoveryFactory();

@Test
public void testGetHosts() {
void testGetHosts() {
assertThat(factory.getHosts()).containsOnly("localhost");
}

@Test
public void testGetPort() {
void testGetPort() {
assertThat(factory.getPort()).isEqualTo(2181);
}

@Test
public void testGetQuorumSpec() {
void testGetQuorumSpec() {
assertThat(factory.getQuorumSpec()).isEqualTo("localhost:2181");
}

@Test
public void testServiceNameAccessors() {
void testServiceNameAccessors() {
assertThat(factory.getServiceName()).isEqualTo("");
factory.setServiceName("test-service-name");
try {
Expand All @@ -39,7 +39,7 @@ public void testServiceNameAccessors() {
}

@Test
public void testNamespaceAccessors() {
void testNamespaceAccessors() {
assertThat(factory.getNamespace()).isEqualTo("dropwizard");
factory.setNamespace("test-namespace");
try {
Expand All @@ -51,7 +51,7 @@ public void testNamespaceAccessors() {
}

@Test
public void testBasePathAccessors() {
void testBasePathAccessors() {
assertThat(factory.getBasePath()).isEqualTo("service");
factory.setBasePath("test-base-path");
try {
Expand All @@ -63,7 +63,7 @@ public void testBasePathAccessors() {
}

@Test
public void testListenAddressAccessors() {
void testListenAddressAccessors() {
assertThat(factory.getListenAddress()).isEqualTo("");
factory.setListenAddress("0.0.0.0");
try {
Expand All @@ -75,7 +75,7 @@ public void testListenAddressAccessors() {
}

@Test
public void testConnectionTimeoutAccessors() {
void testConnectionTimeoutAccessors() {
assertThat(factory.getConnectionTimeout()).isEqualTo(Duration.seconds(6));
factory.setConnectionTimeout(Duration.minutes(30));
try {
Expand All @@ -87,7 +87,7 @@ public void testConnectionTimeoutAccessors() {
}

@Test
public void testSessionTimeoutAccessors() {
void testSessionTimeoutAccessors() {
assertThat(factory.getSessionTimeout()).isEqualTo(Duration.seconds(6));
factory.setSessionTimeout(Duration.minutes(30));
try {
Expand All @@ -99,28 +99,28 @@ public void testSessionTimeoutAccessors() {
}

@Test
public void testIsDisabledAccessors() {
void testIsDisabledAccessors() {
assertThat(factory.isDisabled()).isFalse();
factory.setIsDisabled(true);
assertThat(factory.isDisabled()).isTrue();
}

@Test
public void testIsReadOnlyAccessors() {
void testIsReadOnlyAccessors() {
assertThat(factory.isReadOnly()).isFalse();
factory.setIsReadOnly(true);
assertThat(factory.isReadOnly()).isTrue();
}

@Test
public void testMaxRetriesAccessors() {
void testMaxRetriesAccessors() {
assertThat(factory.getMaxRetries()).isEqualTo(5);
factory.setMaxRetries(20);
assertThat(factory.getMaxRetries()).isEqualTo(20);
}

@Test
public void testBaseSleepTimeAccessors() {
void testBaseSleepTimeAccessors() {
assertThat(factory.getBaseSleepTime()).isEqualTo(Duration.seconds(1));
factory.setBaseSleepTime(Duration.minutes(30));
try {
Expand All @@ -132,7 +132,7 @@ public void testBaseSleepTimeAccessors() {
}

@Test
public void testGetRetryPolicy() {
void testGetRetryPolicy() {
DiscoveryFactory factory = new DiscoveryFactory();
RetryPolicy retryPolicy = factory.getRetryPolicy();
assertThat(retryPolicy).isInstanceOf(ExponentialBackoffRetry.class);
Expand All @@ -142,7 +142,7 @@ public void testGetRetryPolicy() {
}

@Test
public void testGetCompressionProvider() {
void testGetCompressionProvider() {
assertThat(factory.getCompressionProvider()).isEqualTo(DiscoveryFactory.CompressionCodec.GZIP.getProvider());
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
package io.dropwizard.discovery.client;

import org.junit.Test;

import static org.assertj.core.api.Assertions.failBecauseExceptionWasNotThrown;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

import org.junit.jupiter.api.Test;

public class DiscoveryClientManagerTest {

@SuppressWarnings("unchecked")
Expand All @@ -14,7 +14,7 @@ public class DiscoveryClientManagerTest {
DiscoveryClientManager<String> manager = new DiscoveryClientManager<String>(client);

@Test
public void testConstructorInvalidClient() {
void testConstructorInvalidClient() {
try {
new DiscoveryClientManager<String>(null);
failBecauseExceptionWasNotThrown(NullPointerException.class);
Expand All @@ -23,13 +23,13 @@ public void testConstructorInvalidClient() {
}

@Test
public void testStart() throws Exception {
void testStart() throws Exception {
manager.start();
verify(client).start();
}

@Test
public void testStop() throws Exception {
void testStop() throws Exception {
manager.stop();
verify(client).close();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package io.dropwizard.discovery.client;

import org.apache.curator.x.discovery.*;
import org.junit.Before;
import org.junit.Test;

import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.io.IOException;
import java.util.Arrays;

Expand Down Expand Up @@ -34,7 +33,7 @@ public class DiscoveryClientTest {
@SuppressWarnings("unchecked")
ServiceCache<String> serviceCache = mock(ServiceCache.class);

@Before
@BeforeEach
public void setup() throws Exception {
@SuppressWarnings("unchecked")
ServiceProviderBuilder<String> serviceProviderBuilder = mock(ServiceProviderBuilder.class);
Expand All @@ -61,7 +60,7 @@ public void setup() throws Exception {

@SuppressWarnings("resource")
@Test
public void testConstructorInvalidServiceName() {
void testConstructorInvalidServiceName() {
try {
new DiscoveryClient<String>(null, discovery, downInstancePolicy, providerStrategy);
failBecauseExceptionWasNotThrown(NullPointerException.class);
Expand All @@ -77,7 +76,7 @@ public void testConstructorInvalidServiceName() {

@SuppressWarnings("resource")
@Test
public void testConstructorInvalidProviderStrategy() {
void testConstructorInvalidProviderStrategy() {
try {
new DiscoveryClient<String>(SERVICE_NAME, discovery, downInstancePolicy, null);
failBecauseExceptionWasNotThrown(NullPointerException.class);
Expand All @@ -87,7 +86,7 @@ public void testConstructorInvalidProviderStrategy() {

@SuppressWarnings("resource")
@Test
public void testConstructorInvalidServiceDiscovery() {
void testConstructorInvalidServiceDiscovery() {
try {
new DiscoveryClient<String>(SERVICE_NAME, null, downInstancePolicy, providerStrategy);
failBecauseExceptionWasNotThrown(NullPointerException.class);
Expand All @@ -96,55 +95,55 @@ public void testConstructorInvalidServiceDiscovery() {
}

@Test
public void testGetServices() throws Exception {
void testGetServices() throws Exception {
assertThat(client.getServices()).containsOnly("service-one", "service-two", "service-three");
}

@Test
public void testGetInstancesByName() throws Exception {
void testGetInstancesByName() throws Exception {
assertThat(client.getInstances("service-one")).containsOnly(instanceOne, instanceTwo, instanceThree);
}

@Test
public void testGetInstances() {
void testGetInstances() {
assertThat(client.getInstances()).containsOnly(instanceOne, instanceTwo, instanceThree);
}

@Test
public void testGetInstance() throws Exception {
void testGetInstance() throws Exception {
assertThat(client.getInstance()).isEqualTo(instanceOne);
}

@Test
public void testNoteError() {
void testNoteError() {
client.noteError(instanceOne);
verify(serviceProvider).noteError(instanceOne);
}

@Test
public void testStart() throws Exception {
void testStart() throws Exception {
client.start();
verify(serviceProvider).start();
verify(serviceCache).start();
}

@Test
public void testClose() throws Exception {
void testClose() throws Exception {
client.close();
verify(serviceCache).close();
verify(serviceProvider).close();
}

@Test
public void testCloseWithExceptionInCacheClose() throws Exception {
void testCloseWithExceptionInCacheClose() throws Exception {
doThrow(IOException.class).when(serviceCache).close();
client.close();
verify(serviceCache).close();
verify(serviceProvider).close();
}

@Test
public void testCloseWithExceptionInProviderClose() throws Exception {
void testCloseWithExceptionInProviderClose() throws Exception {
doThrow(IOException.class).when(serviceProvider).close();
client.close();
verify(serviceCache).close();
Expand Down
Loading