Migrate Hazelcast module from JUnit 4

This commit is contained in:
Artem Bilan
2025-05-20 12:21:16 -04:00
parent 8f1ed20bdc
commit bd7f0db3c7
16 changed files with 124 additions and 413 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2022 the original author or authors.
* Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,16 +22,15 @@ import java.util.Set;
import com.hazelcast.collection.IList;
import com.hazelcast.core.DistributedObject;
import com.hazelcast.instance.impl.HazelcastInstanceFactory;
import org.junit.AfterClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
/**
* Hazelcast Integration Definition Validator Test Class
@@ -41,8 +40,7 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @since 6.0
*/
@RunWith(SpringRunner.class)
@ContextConfiguration
@SpringJUnitConfig
@DirtiesContext
@SuppressWarnings({"rawtypes"})
public class HazelcastIntegrationDefinitionValidatorTests {
@@ -50,7 +48,7 @@ public class HazelcastIntegrationDefinitionValidatorTests {
@Autowired
private IList distList;
@AfterClass
@AfterAll
public static void shutdown() {
HazelcastInstanceFactory.terminateAll();
}
@@ -67,11 +65,11 @@ public class HazelcastIntegrationDefinitionValidatorTests {
}
}
@Test(expected = IllegalArgumentException.class)
@Test
public void testValidateEnumTypeWithInvalidValue() {
final String cacheEventTypes = "Invalid_Enum_Type";
HazelcastIntegrationDefinitionValidator
.validateEnumType(CacheEventType.class, cacheEventTypes);
assertThatIllegalArgumentException()
.isThrownBy(() -> HazelcastIntegrationDefinitionValidator
.validateEnumType(CacheEventType.class, "Invalid_Enum_Type"));
}
@Test
@@ -83,12 +81,13 @@ public class HazelcastIntegrationDefinitionValidatorTests {
.validateCacheEventsByDistributedObject(this.distList, cacheEventTypeSet);
}
@Test(expected = IllegalArgumentException.class)
@Test
public void testValidateCacheEventsByDistributedObjectWithInvalidValue() {
Set<String> cacheEventTypeSet = new HashSet<>(1);
cacheEventTypeSet.add("Invalid_Cache_Event_Type");
HazelcastIntegrationDefinitionValidator
.validateCacheEventsByDistributedObject(this.distList, cacheEventTypeSet);
assertThatIllegalArgumentException()
.isThrownBy(() -> HazelcastIntegrationDefinitionValidator
.validateCacheEventsByDistributedObject(this.distList, cacheEventTypeSet));
}
@Test
@@ -97,32 +96,35 @@ public class HazelcastIntegrationDefinitionValidatorTests {
.validateCacheTypeForEventDrivenMessageProducer(this.distList);
}
@Test(expected = IllegalArgumentException.class)
@Test
public void testValidateCacheTypeForEventDrivenMessageProducerWithUnexpectedDistObject() {
HazelcastIntegrationDefinitionValidator
.validateCacheTypeForEventDrivenMessageProducer(new DistributedObject() {
DistributedObject distributedObject = new DistributedObject() {
@Override
public String getPartitionKey() {
return null;
}
@Override
public String getPartitionKey() {
return null;
}
@Override
public String getName() {
return null;
}
@Override
public String getName() {
return null;
}
@Override
public String getServiceName() {
return null;
}
@Override
public String getServiceName() {
return null;
}
@Override
public void destroy() {
@Override
public void destroy() {
}
}
});
};
assertThatIllegalArgumentException()
.isThrownBy(() -> HazelcastIntegrationDefinitionValidator
.validateCacheTypeForEventDrivenMessageProducer(distributedObject));
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2022 the original author or authors.
* Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +18,7 @@ package org.springframework.integration.hazelcast.inbound;
import com.hazelcast.core.EntryEventType;
import com.hazelcast.map.IMap;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.hazelcast.HazelcastHeaders;
@@ -29,8 +28,7 @@ import org.springframework.integration.hazelcast.message.EntryEventMessagePayloa
import org.springframework.messaging.Message;
import org.springframework.messaging.PollableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import static org.assertj.core.api.Assertions.assertThat;
@@ -40,8 +38,7 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Eren Avsarogullari
* @since 6.0
*/
@RunWith(SpringRunner.class)
@ContextConfiguration
@SpringJUnitConfig
@DirtiesContext
@SuppressWarnings({"unchecked", "rawtypes"})
public class HazelcastCQDistributedMapInboundChannelAdapterTests {

View File

@@ -1,170 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xmlns:int-hazelcast="http://www.springframework.org/schema/integration/hazelcast"
xsi:schemaLocation="http://www.springframework.org/schema/beans
https://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration
https://www.springframework.org/schema/integration/spring-integration.xsd
http://www.springframework.org/schema/integration/hazelcast
https://www.springframework.org/schema/integration/hazelcast/spring-integration-hazelcast.xsd">
<int:channel id="cmChannel1">
<int:queue/>
</int:channel>
<int:channel id="cmChannel2">
<int:queue/>
</int:channel>
<int:channel id="cmChannel3">
<int:queue/>
</int:channel>
<int:channel id="cmChannel4">
<int:queue/>
</int:channel>
<int:channel id="cmChannel5">
<int:queue/>
</int:channel>
<int:channel id="cmChannel6">
<int:queue/>
</int:channel>
<int-hazelcast:cm-inbound-channel-adapter
channel="cmChannel1"
hazelcast-instance="hazelcastInstance"
monitor-types="MEMBERSHIP" />
<int-hazelcast:cm-inbound-channel-adapter
channel="cmChannel2"
hazelcast-instance="hazelcastInstance"
monitor-types="DISTRIBUTED_OBJECT" />
<int-hazelcast:cm-inbound-channel-adapter
channel="cmChannel3"
hazelcast-instance="hazelcastInstance"
monitor-types="MIGRATION" />
<int-hazelcast:cm-inbound-channel-adapter
channel="cmChannel4"
hazelcast-instance="hazelcastInstance2"
monitor-types="LIFECYCLE" />
<int-hazelcast:cm-inbound-channel-adapter
channel="cmChannel5"
hazelcast-instance="hazelcastInstance"
monitor-types="CLIENT" />
<int-hazelcast:cm-inbound-channel-adapter
channel="cmChannel6"
hazelcast-instance="hazelcastInstance"
monitor-types="MEMBERSHIP,DISTRIBUTED_OBJECT" />
<bean id="hazelcastInstance" class="com.hazelcast.core.Hazelcast" factory-method="newHazelcastInstance"
destroy-method="shutdown">
<constructor-arg>
<bean class="com.hazelcast.config.Config">
<property name="groupConfig">
<bean class="com.hazelcast.config.GroupConfig">
<property name="name" value="Test_Group_Name1"/>
<property name="password" value="dev-pass"/>
</bean>
</property>
<property name="networkConfig">
<bean class="com.hazelcast.config.NetworkConfig">
<property name="port" value="5701"/>
<property name="portAutoIncrement" value="false"/>
<property name="join">
<bean class="com.hazelcast.config.JoinConfig">
<property name="multicastConfig">
<bean class="com.hazelcast.config.MulticastConfig">
<property name="enabled" value="false" />
</bean>
</property>
<property name="tcpIpConfig">
<bean class="com.hazelcast.config.TcpIpConfig">
<property name="members" value="127.0.0.1:5701,127.0.0.1:5703" />
<property name="enabled" value="true" />
</bean>
</property>
</bean>
</property>
</bean>
</property>
</bean>
</constructor-arg>
</bean>
<bean id="hazelcastInstance2" class="com.hazelcast.core.Hazelcast" factory-method="newHazelcastInstance"
destroy-method="shutdown">
<constructor-arg>
<bean class="com.hazelcast.config.Config">
<property name="groupConfig">
<bean class="com.hazelcast.config.GroupConfig">
<property name="name" value="Test_Group_Name2"/>
</bean>
</property>
<property name="networkConfig">
<bean class="com.hazelcast.config.NetworkConfig">
<property name="port" value="5702"/>
<property name="portAutoIncrement" value="false"/>
<property name="join">
<bean class="com.hazelcast.config.JoinConfig">
<property name="multicastConfig">
<bean class="com.hazelcast.config.MulticastConfig">
<property name="enabled" value="false" />
</bean>
</property>
<property name="tcpIpConfig">
<bean class="com.hazelcast.config.TcpIpConfig">
<property name="members" value="127.0.0.1:5702" />
<property name="enabled" value="true" />
</bean>
</property>
</bean>
</property>
</bean>
</property>
</bean>
</constructor-arg>
</bean>
<bean id="hazelcastInstance3" class="com.hazelcast.core.Hazelcast" factory-method="newHazelcastInstance"
destroy-method="shutdown">
<constructor-arg>
<bean class="com.hazelcast.config.Config">
<property name="groupConfig">
<bean class="com.hazelcast.config.GroupConfig">
<property name="name" value="Test_Group_Name1"/>
<property name="password" value="dev-pass"/>
</bean>
</property>
<property name="networkConfig">
<bean class="com.hazelcast.config.NetworkConfig">
<property name="port" value="5703"/>
<property name="portAutoIncrement" value="false"/>
<property name="join">
<bean class="com.hazelcast.config.JoinConfig">
<property name="multicastConfig">
<bean class="com.hazelcast.config.MulticastConfig">
<property name="enabled" value="false" />
</bean>
</property>
<property name="tcpIpConfig">
<bean class="com.hazelcast.config.TcpIpConfig">
<property name="members" value="127.0.0.1:5701,127.0.0.1:5703" />
<property name="enabled" value="true" />
</bean>
</property>
</bean>
</property>
</bean>
</property>
</bean>
</constructor-arg>
</bean>
</beans>

View File

@@ -1,111 +0,0 @@
/*
* Copyright 2015-2022 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.integration.hazelcast.inbound;
import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.LifecycleEvent;
import com.hazelcast.core.LifecycleEvent.LifecycleState;
import com.hazelcast.instance.impl.HazelcastInstanceFactory;
import org.junit.AfterClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.hazelcast.inbound.util.HazelcastInboundChannelAdapterTestUtils;
import org.springframework.messaging.Message;
import org.springframework.messaging.PollableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.springframework.test.context.junit4.SpringRunner;
import static org.assertj.core.api.Assertions.assertThat;
/**
* Hazelcast Cluster Monitor Inbound Channel Adapter Unit Test Class
*
* @author Eren Avsarogullari
* @author Artem Bilan
*/
@RunWith(SpringRunner.class)
@SpringJUnitConfig
@DirtiesContext
@Ignore("Hard to reach CP consensus with limited number of members in two clusters")
public class HazelcastClusterMonitorInboundChannelAdapterTests {
private static final String TEST_GROUP_NAME1 = "Test_Group_Name1";
@Autowired
private PollableChannel cmChannel1;
@Autowired
private PollableChannel cmChannel2;
@Autowired
private PollableChannel cmChannel3;
@Autowired
private PollableChannel cmChannel4;
@Autowired
private PollableChannel cmChannel5;
@Autowired
private PollableChannel cmChannel6;
@Autowired
private HazelcastInstance hazelcastInstance;
@Autowired
private HazelcastInstance hazelcastInstance2;
@Autowired
private HazelcastInstance hazelcastInstance3;
@AfterClass
public static void shutdown() {
HazelcastInstanceFactory.terminateAll();
}
@Test
public void testDistributedObjectEvent() {
HazelcastInboundChannelAdapterTestUtils
.testDistributedObjectEventByChannelAndHazelcastInstance(cmChannel2,
hazelcastInstance, "Test_Distributed_Map4");
}
@Test
public void testLifecycleEvent() {
hazelcastInstance2.getLifecycleService().terminate();
Message<?> msg =
cmChannel4.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
verifyLifecycleEvent(msg, LifecycleState.SHUTTING_DOWN);
msg = cmChannel4.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
verifyLifecycleEvent(msg, LifecycleState.SHUTDOWN);
}
private void verifyLifecycleEvent(final Message<?> msg,
final LifecycleState lifecycleState) {
assertThat(msg).isNotNull();
assertThat(msg.getPayload()).isNotNull();
assertThat(msg.getPayload() instanceof LifecycleEvent).isTrue();
assertThat(((LifecycleEvent) msg.getPayload()).getState()).isEqualTo(lifecycleState);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2022 the original author or authors.
* Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +18,7 @@ package org.springframework.integration.hazelcast.inbound;
import com.hazelcast.collection.IList;
import com.hazelcast.core.EntryEventType;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.hazelcast.HazelcastHeaders;
@@ -28,8 +27,7 @@ import org.springframework.integration.hazelcast.inbound.util.HazelcastInboundCh
import org.springframework.messaging.Message;
import org.springframework.messaging.PollableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import static org.assertj.core.api.Assertions.assertThat;
@@ -37,10 +35,11 @@ import static org.assertj.core.api.Assertions.assertThat;
* Hazelcast Distributed List Event Driven Inbound Channel Adapter Test Class
*
* @author Eren Avsarogullari
* @author Artem Bilan
*
* @since 6.0
*/
@RunWith(SpringRunner.class)
@ContextConfiguration
@SpringJUnitConfig
@DirtiesContext
@SuppressWarnings({"unchecked", "rawtypes"})
public class HazelcastDistributedListEventDrivenInboundChannelAdapterTests {
@@ -70,7 +69,8 @@ public class HazelcastDistributedListEventDrivenInboundChannelAdapterTests {
assertThat(msg).isNotNull();
assertThat(msg.getPayload()).isNotNull();
assertThat(msg.getHeaders().get(HazelcastHeaders.MEMBER)).isNotNull();
assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString()).isEqualTo(EntryEventType.ADDED.toString());
assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString())
.isEqualTo(EntryEventType.ADDED.toString());
assertThat(((HazelcastIntegrationTestUser) msg.getPayload()).getId()).isEqualTo(1);
assertThat(((HazelcastIntegrationTestUser) msg.getPayload()).getName()).isEqualTo("TestName1");
assertThat(((HazelcastIntegrationTestUser) msg.getPayload()).getSurname()).isEqualTo("TestSurname1");
@@ -85,7 +85,8 @@ public class HazelcastDistributedListEventDrivenInboundChannelAdapterTests {
assertThat(msg).isNotNull();
assertThat(msg.getPayload()).isNotNull();
assertThat(msg.getHeaders().get(HazelcastHeaders.MEMBER)).isNotNull();
assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString()).isEqualTo(EntryEventType.REMOVED.toString());
assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString())
.isEqualTo(EntryEventType.REMOVED.toString());
assertThat(((HazelcastIntegrationTestUser) msg.getPayload()).getId()).isEqualTo(2);
assertThat(((HazelcastIntegrationTestUser) msg.getPayload()).getName()).isEqualTo("TestName2");
assertThat(((HazelcastIntegrationTestUser) msg.getPayload()).getSurname()).isEqualTo("TestSurname2");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2022 the original author or authors.
* Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +18,7 @@ package org.springframework.integration.hazelcast.inbound;
import com.hazelcast.core.EntryEventType;
import com.hazelcast.map.IMap;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.hazelcast.HazelcastHeaders;
@@ -29,8 +28,7 @@ import org.springframework.integration.hazelcast.message.EntryEventMessagePayloa
import org.springframework.messaging.Message;
import org.springframework.messaging.PollableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import static org.assertj.core.api.Assertions.assertThat;
@@ -38,10 +36,11 @@ import static org.assertj.core.api.Assertions.assertThat;
* Hazelcast Distributed Map Event Driven Inbound Channel Adapter Test
*
* @author Eren Avsarogullari
* @author Artem Bilan
*
* @since 6.0
*/
@RunWith(SpringRunner.class)
@ContextConfiguration
@SpringJUnitConfig
@DirtiesContext
@SuppressWarnings({"unchecked", "rawtypes"})
public class HazelcastDistributedMapEventDrivenInboundChannelAdapterTests {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2022 the original author or authors.
* Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +18,7 @@ package org.springframework.integration.hazelcast.inbound;
import com.hazelcast.collection.IQueue;
import com.hazelcast.core.EntryEventType;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.hazelcast.HazelcastHeaders;
@@ -28,8 +27,7 @@ import org.springframework.integration.hazelcast.inbound.util.HazelcastInboundCh
import org.springframework.messaging.Message;
import org.springframework.messaging.PollableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import static org.assertj.core.api.Assertions.assertThat;
@@ -37,10 +35,11 @@ import static org.assertj.core.api.Assertions.assertThat;
* Hazelcast Distributed Queue Event Driven Inbound Channel Adapter Test
*
* @author Eren Avsarogullari
* @author Artem Bilan
*
* @since 6.0
*/
@RunWith(SpringRunner.class)
@ContextConfiguration
@SpringJUnitConfig
@DirtiesContext
@SuppressWarnings({"unchecked", "rawtypes"})
public class HazelcastDistributedQueueEventDrivenInboundChannelAdapterTests {
@@ -72,7 +71,8 @@ public class HazelcastDistributedQueueEventDrivenInboundChannelAdapterTests {
assertThat(msg).isNotNull();
assertThat(msg.getPayload()).isNotNull();
assertThat(msg.getHeaders().get(HazelcastHeaders.MEMBER)).isNotNull();
assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString()).isEqualTo(EntryEventType.ADDED.toString());
assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString())
.isEqualTo(EntryEventType.ADDED.toString());
assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getId())).isEqualTo(1);
assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getName())).isEqualTo("TestName1");
assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getSurname())).isEqualTo("TestSurname1");
@@ -89,7 +89,8 @@ public class HazelcastDistributedQueueEventDrivenInboundChannelAdapterTests {
assertThat(msg).isNotNull();
assertThat(msg.getPayload()).isNotNull();
assertThat(msg.getHeaders().get(HazelcastHeaders.MEMBER)).isNotNull();
assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString()).isEqualTo(EntryEventType.REMOVED.toString());
assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString())
.isEqualTo(EntryEventType.REMOVED.toString());
assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getId())).isEqualTo(2);
assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getName())).isEqualTo("TestName2");
assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getSurname())).isEqualTo("TestSurname2");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2022 the original author or authors.
* Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,24 +17,23 @@
package org.springframework.integration.hazelcast.inbound;
import com.hazelcast.map.IMap;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.hazelcast.inbound.util.HazelcastInboundChannelAdapterTestUtils;
import org.springframework.messaging.PollableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
/**
* Hazelcast Distributed SQL Inbound Channel Adapter Test
*
* @author Eren Avsarogullari
* @author Artem Bilan
*
* @since 6.0
*/
@RunWith(SpringRunner.class)
@ContextConfiguration
@SpringJUnitConfig
@DirtiesContext
@SuppressWarnings({"unchecked", "rawtypes"})
public class HazelcastDistributedSQLInboundChannelAdapterTests {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2022 the original author or authors.
* Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +18,7 @@ package org.springframework.integration.hazelcast.inbound;
import com.hazelcast.collection.ISet;
import com.hazelcast.core.EntryEventType;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.hazelcast.HazelcastHeaders;
@@ -28,8 +27,7 @@ import org.springframework.integration.hazelcast.inbound.util.HazelcastInboundCh
import org.springframework.messaging.Message;
import org.springframework.messaging.PollableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import static org.assertj.core.api.Assertions.assertThat;
@@ -37,10 +35,11 @@ import static org.assertj.core.api.Assertions.assertThat;
* Hazelcast Distributed Set Event Driven Inbound Channel Adapter Test
*
* @author Eren Avsarogullari
* @author Artem Bilan
*
* @since 6.0
*/
@RunWith(SpringRunner.class)
@ContextConfiguration
@SpringJUnitConfig
@DirtiesContext
@SuppressWarnings({"unchecked", "rawtypes"})
public class HazelcastDistributedSetEventDrivenInboundChannelAdapterTests {
@@ -72,7 +71,8 @@ public class HazelcastDistributedSetEventDrivenInboundChannelAdapterTests {
assertThat(msg).isNotNull();
assertThat(msg.getPayload()).isNotNull();
assertThat(msg.getHeaders().get(HazelcastHeaders.MEMBER)).isNotNull();
assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString()).isEqualTo(EntryEventType.ADDED.toString());
assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString())
.isEqualTo(EntryEventType.ADDED.toString());
assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getId())).isEqualTo(1);
assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getName())).isEqualTo("TestName1");
assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getSurname())).isEqualTo("TestSurname1");
@@ -89,7 +89,8 @@ public class HazelcastDistributedSetEventDrivenInboundChannelAdapterTests {
assertThat(msg).isNotNull();
assertThat(msg.getPayload()).isNotNull();
assertThat(msg.getHeaders().get(HazelcastHeaders.MEMBER)).isNotNull();
assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString()).isEqualTo(EntryEventType.REMOVED.toString());
assertThat(msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString())
.isEqualTo(EntryEventType.REMOVED.toString());
assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getId())).isEqualTo(2);
assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getName())).isEqualTo("TestName2");
assertThat((((HazelcastIntegrationTestUser) msg.getPayload()).getSurname())).isEqualTo("TestSurname2");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2022 the original author or authors.
* Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,24 +17,23 @@
package org.springframework.integration.hazelcast.inbound;
import com.hazelcast.topic.ITopic;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.hazelcast.inbound.util.HazelcastInboundChannelAdapterTestUtils;
import org.springframework.messaging.PollableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
/**
* Hazelcast Distributed Topic Event Driven Inbound Channel Adapter Test
*
* @author Eren Avsarogullari
* @author Artem Bilan
*
* @since 6.0
*/
@RunWith(SpringRunner.class)
@ContextConfiguration
@SpringJUnitConfig
@DirtiesContext
@SuppressWarnings({"unchecked", "rawtypes"})
public class HazelcastDistributedTopicEventDrivenInboundChannelAdapterTests {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2022 the original author or authors.
* Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +18,7 @@ package org.springframework.integration.hazelcast.inbound;
import com.hazelcast.core.EntryEventType;
import com.hazelcast.multimap.MultiMap;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.hazelcast.HazelcastHeaders;
@@ -29,8 +28,7 @@ import org.springframework.integration.hazelcast.message.EntryEventMessagePayloa
import org.springframework.messaging.Message;
import org.springframework.messaging.PollableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import static org.assertj.core.api.Assertions.assertThat;
@@ -39,10 +37,10 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Eren Avsarogullari
* @author Artem Bilan
*
* @since 6.0
*/
@RunWith(SpringRunner.class)
@ContextConfiguration
@SpringJUnitConfig
@DirtiesContext
@SuppressWarnings({"unchecked", "rawtypes"})
public class HazelcastMultiMapEventDrivenInboundChannelAdapterTests {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2022 the original author or authors.
* Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,8 +18,7 @@ package org.springframework.integration.hazelcast.inbound;
import com.hazelcast.core.EntryEventType;
import com.hazelcast.replicatedmap.ReplicatedMap;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.hazelcast.HazelcastHeaders;
@@ -29,8 +28,7 @@ import org.springframework.integration.hazelcast.message.EntryEventMessagePayloa
import org.springframework.messaging.Message;
import org.springframework.messaging.PollableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import static org.assertj.core.api.Assertions.assertThat;
@@ -38,10 +36,11 @@ import static org.assertj.core.api.Assertions.assertThat;
* Hazelcast Replicated Map Event Driven Inbound Channel Adapter Test
*
* @author Eren Avsarogullari
* @author Artem Bilan
*
* @since 6.0
*/
@RunWith(SpringRunner.class)
@ContextConfiguration
@SpringJUnitConfig
@DirtiesContext
@SuppressWarnings({"unchecked", "rawtypes"})
public class HazelcastReplicatedMapEventDrivenInboundChannelAdapterTests {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2022 the original author or authors.
* Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,26 +17,25 @@
package org.springframework.integration.hazelcast.inbound.config;
import com.hazelcast.map.IMap;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.hazelcast.HazelcastIntegrationTestUser;
import org.springframework.integration.hazelcast.inbound.util.HazelcastInboundChannelAdapterTestUtils;
import org.springframework.messaging.PollableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.springframework.test.context.support.AnnotationConfigContextLoader;
/**
* Hazelcast Continuous Query Inbound Channel Adapter JavaConfig driven Unit Test Class
*
* @author Eren Avsarogullari
* @author Artem Bilan
*
* @since 6.0
*/
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = HazelcastIntegrationInboundTestConfiguration.class,
@SpringJUnitConfig(classes = HazelcastIntegrationInboundTestConfiguration.class,
loader = AnnotationConfigContextLoader.class)
@DirtiesContext
public class HazelcastCQDistributedMapInboundChannelAdapterConfigTests {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2022 the original author or authors.
* Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,25 +17,24 @@
package org.springframework.integration.hazelcast.inbound.config;
import com.hazelcast.core.HazelcastInstance;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.hazelcast.inbound.util.HazelcastInboundChannelAdapterTestUtils;
import org.springframework.messaging.PollableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
/**
* Hazelcast Cluster Monitor Inbound Channel Adapter JavaConfig driven Unit Test Class
*
* @author Eren Avsarogullari
* @author Artem Bilan
*
* @since 6.0
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = HazelcastIntegrationInboundTestConfiguration.class)
@SpringJUnitConfig(classes = HazelcastIntegrationInboundTestConfiguration.class)
@DirtiesContext
public class HazelcastClusterMonitorInboundChannelAdapterConfigTests {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2022 the original author or authors.
* Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,26 +17,25 @@
package org.springframework.integration.hazelcast.inbound.config;
import com.hazelcast.map.IMap;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.hazelcast.HazelcastIntegrationTestUser;
import org.springframework.integration.hazelcast.inbound.util.HazelcastInboundChannelAdapterTestUtils;
import org.springframework.messaging.PollableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.springframework.test.context.support.AnnotationConfigContextLoader;
/**
* Hazelcast Distributed SQL Inbound Channel Adapter JavaConfig driven Unit Test Class
*
* @author Eren Avsarogullari
* @author Artem Bilan
*
* @since 6.0
*/
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = HazelcastIntegrationInboundTestConfiguration.class,
@SpringJUnitConfig(classes = HazelcastIntegrationInboundTestConfiguration.class,
loader = AnnotationConfigContextLoader.class)
@DirtiesContext
public class HazelcastDistributedSQLInboundChannelAdapterConfigTests {

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2015-2022 the original author or authors.
* Copyright 2015-2025 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -23,26 +23,25 @@ import com.hazelcast.map.IMap;
import com.hazelcast.multimap.MultiMap;
import com.hazelcast.replicatedmap.ReplicatedMap;
import com.hazelcast.topic.ITopic;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.integration.hazelcast.HazelcastIntegrationTestUser;
import org.springframework.integration.hazelcast.inbound.util.HazelcastInboundChannelAdapterTestUtils;
import org.springframework.messaging.PollableChannel;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.test.context.junit.jupiter.SpringJUnitConfig;
import org.springframework.test.context.support.AnnotationConfigContextLoader;
/**
* Hazelcast Event Driven Inbound Channel Adapter JavaConfig driven Unit Test Class
*
* @author Eren Avsarogullari
* @author Artem Bilan
*
* @since 6.0
*/
@RunWith(SpringRunner.class)
@ContextConfiguration(classes = HazelcastIntegrationInboundTestConfiguration.class,
@SpringJUnitConfig(classes = HazelcastIntegrationInboundTestConfiguration.class,
loader = AnnotationConfigContextLoader.class)
@DirtiesContext
public class HazelcastEventDrivenInboundChannelAdapterConfigTests {