You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by nf...@apache.org on 2022/11/10 09:30:43 UTC
[camel] branch main updated: CAMEL-18608: camel-hazelcast - Fix port issue in HazelcastConfigurationTest
This is an automated email from the ASF dual-hosted git repository.
nfilotto pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git
The following commit(s) were added to refs/heads/main by this push:
new 04f4ae3783d CAMEL-18608: camel-hazelcast - Fix port issue in HazelcastConfigurationTest
04f4ae3783d is described below
commit 04f4ae3783d014339c4487cd246d3dca2257d465
Author: Nicolas Filotto <nf...@talend.com>
AuthorDate: Thu Nov 10 10:30:02 2022 +0100
CAMEL-18608: camel-hazelcast - Fix port issue in HazelcastConfigurationTest
---
.../hazelcast/HazelcastConfigurationTest.java | 28 +++++++++++-----------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastConfigurationTest.java b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastConfigurationTest.java
index 162c8884369..fa7d7c5fcf3 100644
--- a/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastConfigurationTest.java
+++ b/components/camel-hazelcast/src/test/java/org/apache/camel/component/hazelcast/HazelcastConfigurationTest.java
@@ -38,21 +38,21 @@ import static org.junit.jupiter.api.Assertions.assertNull;
import static org.junit.jupiter.api.Assertions.assertSame;
import static org.junit.jupiter.api.Assertions.assertTrue;
-public class HazelcastConfigurationTest {
+class HazelcastConfigurationTest {
@AfterEach
- public void tearDown() throws Exception {
+ public void tearDown() {
Hazelcast.shutdownAll();
}
@Test
- public void testNamedInstance() throws Exception {
+ void testNamedInstance() {
DefaultCamelContext context = null;
- try {
+ try (AvailablePortFinder.Port port = AvailablePortFinder.find()) {
String instanceName = UUID.randomUUID().toString();
Config config = new Config();
config.setInstanceName(instanceName);
- config.getNetworkConfig().setPort(6789);
+ config.getNetworkConfig().setPort(port.getPort());
config.getNetworkConfig().getJoin().getAwsConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(true);
config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(false);
@@ -80,7 +80,7 @@ public class HazelcastConfigurationTest {
assertFalse(hz.getConfig().getNetworkConfig().getJoin().getAwsConfig().isEnabled());
assertTrue(hz.getConfig().getNetworkConfig().getJoin().getMulticastConfig().isEnabled());
assertFalse(hz.getConfig().getNetworkConfig().getJoin().getTcpIpConfig().isEnabled());
- assertEquals(6789, hz.getConfig().getNetworkConfig().getPort());
+ assertEquals(port.getPort(), hz.getConfig().getNetworkConfig().getPort());
}
} finally {
if (context != null) {
@@ -90,7 +90,7 @@ public class HazelcastConfigurationTest {
}
@Test
- public void testDefaultConfiguration() throws Exception {
+ void testDefaultConfiguration() {
DefaultCamelContext context = null;
try {
@@ -122,7 +122,7 @@ public class HazelcastConfigurationTest {
}
@Test
- public void testNamedInstanceWithConfigurationUri() throws Exception {
+ void testNamedInstanceWithConfigurationUri() {
DefaultCamelContext context = null;
try {
@@ -155,7 +155,7 @@ public class HazelcastConfigurationTest {
}
@Test
- public void testCustomConfigurationUri() throws Exception {
+ void testCustomConfigurationUri() {
DefaultCamelContext context = null;
try {
@@ -190,12 +190,12 @@ public class HazelcastConfigurationTest {
}
@Test
- public void testCustomConfigurationReference() throws Exception {
+ void testCustomConfigurationReference() {
DefaultCamelContext context = null;
- try {
+ try (AvailablePortFinder.Port port = AvailablePortFinder.find()) {
Config config = new Config();
- config.getNetworkConfig().setPort(6789);
+ config.getNetworkConfig().setPort(port.getPort());
config.getNetworkConfig().getJoin().getAwsConfig().setEnabled(false);
config.getNetworkConfig().getJoin().getMulticastConfig().setEnabled(true);
config.getNetworkConfig().getJoin().getTcpIpConfig().setEnabled(false);
@@ -217,7 +217,7 @@ public class HazelcastConfigurationTest {
assertFalse(hz.getConfig().getNetworkConfig().getJoin().getAwsConfig().isEnabled());
assertTrue(hz.getConfig().getNetworkConfig().getJoin().getMulticastConfig().isEnabled());
assertFalse(hz.getConfig().getNetworkConfig().getJoin().getTcpIpConfig().isEnabled());
- assertEquals(6789, hz.getConfig().getNetworkConfig().getPort());
+ assertEquals(port.getPort(), hz.getConfig().getNetworkConfig().getPort());
} finally {
if (context != null) {
@@ -227,7 +227,7 @@ public class HazelcastConfigurationTest {
}
@Test
- public void testMix() throws Exception {
+ void testMix() {
DefaultCamelContext context = null;
try (AvailablePortFinder.Port port1 = AvailablePortFinder.find();