Start version 3.0.0
* Upgrade dependencies * Fix deprecations; logic according new Hazelcast * Upgrade Gradle
This commit is contained in:
@@ -5,8 +5,7 @@ plugins {
|
||||
id 'jacoco'
|
||||
id 'org.sonarqube' version '2.8'
|
||||
id 'checkstyle'
|
||||
id 'org.ajoberstar.grgit' version '3.1.1'
|
||||
id "io.spring.dependency-management" version '1.0.8.RELEASE'
|
||||
id "io.spring.dependency-management" version '1.0.10.RELEASE'
|
||||
}
|
||||
description = 'Spring Integration Hazelcast Support'
|
||||
|
||||
@@ -15,7 +14,7 @@ apply from: "${rootProject.projectDir}/publish-maven.gradle"
|
||||
group = 'org.springframework.integration'
|
||||
|
||||
repositories {
|
||||
if (version.endsWith('BUILD-SNAPSHOT') || project.hasProperty('platformVersion')) {
|
||||
if (version.endsWith('SNAPSHOT')) {
|
||||
maven { url 'https://repo.spring.io/libs-snapshot' }
|
||||
}
|
||||
maven { url 'https://repo.spring.io/libs-milestone' }
|
||||
@@ -27,15 +26,15 @@ compileJava {
|
||||
}
|
||||
|
||||
ext {
|
||||
hazelcastVersion = '3.12.4'
|
||||
slf4jVersion = '1.7.28'
|
||||
springIntegrationVersion = '5.2.1.RELEASE'
|
||||
hazelcastVersion = '4.0.3'
|
||||
slf4jVersion = '1.7.30'
|
||||
springIntegrationVersion = '5.4.0-SNAPSHOT'
|
||||
|
||||
idPrefix = 'hazelcast'
|
||||
|
||||
linkHomepage = 'https://github.com/spring-projects/spring-integration-extensions'
|
||||
linkCi = 'https://build.spring.io/browse/INTEXT'
|
||||
linkIssue = 'https://jira.spring.io/browse/INTEXT'
|
||||
linkIssue = 'https://github.com/spring-projects/spring-integration-extensions/issues'
|
||||
linkScmUrl = 'https://github.com/spring-projects/spring-integration-extensions'
|
||||
linkScmConnection = 'https://github.com/spring-projects/spring-integration-extensions.git'
|
||||
linkScmDevConnection = 'git@github.com:spring-projects/spring-integration-extensions.git'
|
||||
@@ -52,12 +51,12 @@ sourceSets {
|
||||
}
|
||||
|
||||
jacoco {
|
||||
toolVersion = '0.8.4'
|
||||
toolVersion = '0.8.6'
|
||||
}
|
||||
|
||||
checkstyle {
|
||||
configFile = file("$rootDir/src/checkstyle/checkstyle.xml")
|
||||
toolVersion = '8.25'
|
||||
configDirectory.set(rootProject.file("src/checkstyle"))
|
||||
toolVersion = '8.36.2'
|
||||
}
|
||||
|
||||
// enable all compiler warnings; individual projects may customize further
|
||||
@@ -67,8 +66,6 @@ dependencies {
|
||||
compile "org.springframework.integration:spring-integration-core:$springIntegrationVersion"
|
||||
compile "com.hazelcast:hazelcast:$hazelcastVersion"
|
||||
|
||||
testCompile "com.hazelcast:hazelcast-client:$hazelcastVersion"
|
||||
|
||||
testCompile "org.springframework.integration:spring-integration-test:$springIntegrationVersion"
|
||||
|
||||
testRuntime "org.slf4j:slf4j-log4j12:$slf4jVersion"
|
||||
@@ -80,20 +77,18 @@ test {
|
||||
jvmArgs '-Dhazelcast.logging.type=slf4j'
|
||||
|
||||
maxHeapSize = '1024m'
|
||||
jacoco {
|
||||
append = false
|
||||
destinationFile = file("$buildDir/jacoco.exec")
|
||||
}
|
||||
}
|
||||
|
||||
jacocoTestReport {
|
||||
dependsOn test
|
||||
reports {
|
||||
xml.enabled false
|
||||
csv.enabled false
|
||||
html.destination file("${buildDir}/reports/jacoco/html")
|
||||
html.destination file("$buildDir/reports/jacoco/html")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
task sourcesJar(type: Jar) {
|
||||
archiveClassifier = 'sources'
|
||||
from sourceSets.main.allJava
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
version=2.0.1.BUILD-SNAPSHOT
|
||||
version=3.0.0-SNAPSHOT
|
||||
org.gradle.jvmargs=-Xmx1536m -Dfile.encoding=UTF-8
|
||||
org.gradle.caching=true
|
||||
org.gradle.parallel=true
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1,5 +1,5 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
||||
31
spring-integration-hazelcast/gradlew
vendored
31
spring-integration-hazelcast/gradlew
vendored
@@ -82,6 +82,7 @@ esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
@@ -129,6 +130,7 @@ fi
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
@@ -154,19 +156,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
@@ -175,14 +177,9 @@ save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
||||
25
spring-integration-hazelcast/gradlew.bat
vendored
25
spring-integration-hazelcast/gradlew.bat
vendored
@@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
if "%ERRORLEVEL%" == "0" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
@@ -51,7 +54,7 @@ goto fail
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
if exist "%JAVA_EXE%" goto execute
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
@@ -61,28 +64,14 @@ echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
|
||||
@@ -11,9 +11,7 @@
|
||||
<property name="headerFile" value="src/checkstyle/checkstyle-header.txt" />
|
||||
<property name="fileExtensions" value="java" />
|
||||
</module>
|
||||
<module name="NewlineAtEndOfFile">
|
||||
<property name="lineSeparator" value="lf"/>
|
||||
</module>
|
||||
<module name="NewlineAtEndOfFile"/>
|
||||
|
||||
<!-- TreeWalker Checks -->
|
||||
<module name="TreeWalker">
|
||||
|
||||
@@ -48,6 +48,11 @@ public enum CacheEventType {
|
||||
*/
|
||||
EVICTED,
|
||||
|
||||
/**
|
||||
* The Hazelcast EXPIRED event.
|
||||
*/
|
||||
EXPIRED,
|
||||
|
||||
/**
|
||||
* The Hazelcast EVICT_ALL event.
|
||||
*/
|
||||
|
||||
@@ -25,11 +25,8 @@ package org.springframework.integration.hazelcast;
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @see org.springframework.integration.hazelcast.inbound.HazelcastClusterMonitorMessageProducer
|
||||
* @see com.hazelcast.core.MembershipListener
|
||||
* @see com.hazelcast.core.DistributedObjectListener
|
||||
* @see com.hazelcast.core.MigrationListener
|
||||
* @see com.hazelcast.core.LifecycleListener
|
||||
* @see com.hazelcast.core.ClientListener
|
||||
*/
|
||||
public enum ClusterMonitorType {
|
||||
|
||||
|
||||
@@ -25,27 +25,27 @@ package org.springframework.integration.hazelcast;
|
||||
* @since 1.0.0
|
||||
*
|
||||
* @see org.springframework.integration.hazelcast.inbound.HazelcastDistributedSQLMessageSource
|
||||
* @see com.hazelcast.core.IMap
|
||||
* @see com.hazelcast.map.IMap
|
||||
*/
|
||||
public enum DistributedSQLIterationType {
|
||||
|
||||
/**
|
||||
* The {@link com.hazelcast.core.IMap#entrySet()} to iterate.
|
||||
* The {@link com.hazelcast.map.IMap#entrySet()} to iterate.
|
||||
*/
|
||||
ENTRY,
|
||||
|
||||
/**
|
||||
* The {@link com.hazelcast.core.IMap#keySet()} to iterate.
|
||||
* The {@link com.hazelcast.map.IMap#keySet()} to iterate.
|
||||
*/
|
||||
KEY,
|
||||
|
||||
/**
|
||||
* The {@link com.hazelcast.core.IMap#localKeySet()} to iterate.
|
||||
* The {@link com.hazelcast.map.IMap#localKeySet()} to iterate.
|
||||
*/
|
||||
LOCAL_KEY,
|
||||
|
||||
/**
|
||||
* The {@link com.hazelcast.core.IMap#values()} to iterate.
|
||||
* The {@link com.hazelcast.map.IMap#values()} to iterate.
|
||||
*/
|
||||
VALUE
|
||||
|
||||
|
||||
@@ -23,14 +23,14 @@ import java.util.Set;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.hazelcast.collection.IList;
|
||||
import com.hazelcast.collection.IQueue;
|
||||
import com.hazelcast.collection.ISet;
|
||||
import com.hazelcast.core.DistributedObject;
|
||||
import com.hazelcast.core.IList;
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.core.IQueue;
|
||||
import com.hazelcast.core.ISet;
|
||||
import com.hazelcast.core.ITopic;
|
||||
import com.hazelcast.core.MultiMap;
|
||||
import com.hazelcast.core.ReplicatedMap;
|
||||
import com.hazelcast.map.IMap;
|
||||
import com.hazelcast.multimap.MultiMap;
|
||||
import com.hazelcast.replicatedmap.ReplicatedMap;
|
||||
import com.hazelcast.topic.ITopic;
|
||||
|
||||
/**
|
||||
* Common Validator for Hazelcast Integration. It validates cache types and events.
|
||||
|
||||
@@ -25,14 +25,15 @@ import org.apache.commons.logging.LogFactory;
|
||||
import org.springframework.beans.factory.SmartInitializingSingleton;
|
||||
import org.springframework.integration.hazelcast.listener.HazelcastMembershipListener;
|
||||
|
||||
import com.hazelcast.cluster.MembershipListener;
|
||||
import com.hazelcast.core.Hazelcast;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.hazelcast.core.MultiMap;
|
||||
import com.hazelcast.multimap.MultiMap;
|
||||
|
||||
/**
|
||||
* This class creates an internal configuration {@link MultiMap} to cache Hazelcast instances' socket
|
||||
* address information which used Hazelcast event-driven inbound channel adapter(s). It
|
||||
* also enables a Hazelcast {@link com.hazelcast.core.MembershipListener} to listen for
|
||||
* also enables a Hazelcast {@link MembershipListener} to listen for
|
||||
* membership updates.
|
||||
*
|
||||
* @author Eren Avsarogullari
|
||||
|
||||
@@ -23,6 +23,7 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import org.springframework.integration.endpoint.MessageProducerSupport;
|
||||
import org.springframework.integration.hazelcast.CacheEventType;
|
||||
@@ -34,15 +35,15 @@ import org.springframework.integration.hazelcast.message.EntryEventMessagePayloa
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.hazelcast.core.AbstractIMapEvent;
|
||||
import com.hazelcast.core.DistributedObject;
|
||||
import com.hazelcast.core.EntryEvent;
|
||||
import com.hazelcast.core.EntryListener;
|
||||
import com.hazelcast.core.Hazelcast;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.hazelcast.core.MapEvent;
|
||||
import com.hazelcast.core.MultiMap;
|
||||
import com.hazelcast.instance.EndpointQualifier;
|
||||
import com.hazelcast.map.AbstractIMapEvent;
|
||||
import com.hazelcast.map.MapEvent;
|
||||
import com.hazelcast.multimap.MultiMap;
|
||||
|
||||
/**
|
||||
* Hazelcast Base Event-Driven Message Producer.
|
||||
@@ -58,7 +59,7 @@ public abstract class AbstractHazelcastMessageProducer extends MessageProducerSu
|
||||
|
||||
private volatile CacheListeningPolicyType cacheListeningPolicy = CacheListeningPolicyType.SINGLE;
|
||||
|
||||
private volatile String hazelcastRegisteredEventListenerId;
|
||||
private volatile UUID hazelcastRegisteredEventListenerId;
|
||||
|
||||
private Set<String> cacheEvents = Collections.singleton(CacheEventType.ADDED.name());
|
||||
|
||||
@@ -89,11 +90,11 @@ public abstract class AbstractHazelcastMessageProducer extends MessageProducerSu
|
||||
this.cacheListeningPolicy = cacheListeningPolicy;
|
||||
}
|
||||
|
||||
protected String getHazelcastRegisteredEventListenerId() {
|
||||
protected UUID getHazelcastRegisteredEventListenerId() {
|
||||
return this.hazelcastRegisteredEventListenerId;
|
||||
}
|
||||
|
||||
protected void setHazelcastRegisteredEventListenerId(String hazelcastRegisteredEventListenerId) {
|
||||
protected void setHazelcastRegisteredEventListenerId(UUID hazelcastRegisteredEventListenerId) {
|
||||
this.hazelcastRegisteredEventListenerId = hazelcastRegisteredEventListenerId;
|
||||
}
|
||||
|
||||
@@ -177,6 +178,11 @@ public abstract class AbstractHazelcastMessageProducer extends MessageProducerSu
|
||||
processEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void entryExpired(EntryEvent<K, V> event) {
|
||||
processEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mapEvicted(MapEvent event) {
|
||||
processEvent(event);
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.springframework.integration.hazelcast.inbound;
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.springframework.integration.endpoint.MessageProducerSupport;
|
||||
@@ -26,18 +27,18 @@ import org.springframework.integration.hazelcast.ClusterMonitorType;
|
||||
import org.springframework.integration.hazelcast.HazelcastIntegrationDefinitionValidator;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.hazelcast.core.Client;
|
||||
import com.hazelcast.core.ClientListener;
|
||||
import com.hazelcast.client.Client;
|
||||
import com.hazelcast.client.ClientListener;
|
||||
import com.hazelcast.cluster.MembershipEvent;
|
||||
import com.hazelcast.cluster.MembershipListener;
|
||||
import com.hazelcast.core.DistributedObjectEvent;
|
||||
import com.hazelcast.core.DistributedObjectListener;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.hazelcast.core.LifecycleEvent;
|
||||
import com.hazelcast.core.LifecycleListener;
|
||||
import com.hazelcast.core.MemberAttributeEvent;
|
||||
import com.hazelcast.core.MembershipEvent;
|
||||
import com.hazelcast.core.MembershipListener;
|
||||
import com.hazelcast.core.MigrationEvent;
|
||||
import com.hazelcast.core.MigrationListener;
|
||||
import com.hazelcast.partition.MigrationListener;
|
||||
import com.hazelcast.partition.MigrationState;
|
||||
import com.hazelcast.partition.ReplicaMigrationEvent;
|
||||
|
||||
/**
|
||||
* Hazelcast Cluster Monitor Event Driven Message Producer is a message producer which
|
||||
@@ -45,6 +46,8 @@ import com.hazelcast.core.MigrationListener;
|
||||
* listener in order to listen cluster related events and sends events to related channel.
|
||||
*
|
||||
* @author Eren Avsarogullari
|
||||
* @author Artem Bilan
|
||||
*
|
||||
* @since 1.0.0
|
||||
*/
|
||||
public class HazelcastClusterMonitorMessageProducer extends MessageProducerSupport {
|
||||
@@ -53,7 +56,7 @@ public class HazelcastClusterMonitorMessageProducer extends MessageProducerSuppo
|
||||
|
||||
private Set<String> monitorTypes = Collections.singleton(ClusterMonitorType.MEMBERSHIP.name());
|
||||
|
||||
private final Map<ClusterMonitorType, String> hazelcastRegisteredListenerIdMap = new ConcurrentHashMap<>(5);
|
||||
private final Map<ClusterMonitorType, UUID> hazelcastRegisteredListenerIdMap = new ConcurrentHashMap<>(5);
|
||||
|
||||
public HazelcastClusterMonitorMessageProducer(HazelcastInstance hazelcastInstance) {
|
||||
Assert.notNull(hazelcastInstance, "'hazelcastInstance' must not be null");
|
||||
@@ -72,31 +75,31 @@ public class HazelcastClusterMonitorMessageProducer extends MessageProducerSuppo
|
||||
final HazelcastClusterMonitorListener clusterMonitorListener = new HazelcastClusterMonitorListener();
|
||||
|
||||
if (this.monitorTypes.contains(ClusterMonitorType.MEMBERSHIP.name())) {
|
||||
final String registrationId = this.hazelcastInstance.getCluster()
|
||||
final UUID registrationId = this.hazelcastInstance.getCluster()
|
||||
.addMembershipListener(clusterMonitorListener);
|
||||
this.hazelcastRegisteredListenerIdMap.put(ClusterMonitorType.MEMBERSHIP, registrationId);
|
||||
}
|
||||
|
||||
if (this.monitorTypes.contains(ClusterMonitorType.DISTRIBUTED_OBJECT.name())) {
|
||||
final String registrationId = this.hazelcastInstance
|
||||
final UUID registrationId = this.hazelcastInstance
|
||||
.addDistributedObjectListener(clusterMonitorListener);
|
||||
this.hazelcastRegisteredListenerIdMap.put(ClusterMonitorType.DISTRIBUTED_OBJECT, registrationId);
|
||||
}
|
||||
|
||||
if (this.monitorTypes.contains(ClusterMonitorType.MIGRATION.name())) {
|
||||
final String registrationId = this.hazelcastInstance.getPartitionService()
|
||||
final UUID registrationId = this.hazelcastInstance.getPartitionService()
|
||||
.addMigrationListener(clusterMonitorListener);
|
||||
this.hazelcastRegisteredListenerIdMap.put(ClusterMonitorType.MIGRATION, registrationId);
|
||||
}
|
||||
|
||||
if (this.monitorTypes.contains(ClusterMonitorType.LIFECYCLE.name())) {
|
||||
final String registrationId = this.hazelcastInstance.getLifecycleService()
|
||||
final UUID registrationId = this.hazelcastInstance.getLifecycleService()
|
||||
.addLifecycleListener(clusterMonitorListener);
|
||||
this.hazelcastRegisteredListenerIdMap.put(ClusterMonitorType.LIFECYCLE, registrationId);
|
||||
}
|
||||
|
||||
if (this.monitorTypes.contains(ClusterMonitorType.CLIENT.name())) {
|
||||
final String registrationId = this.hazelcastInstance.getClientService()
|
||||
final UUID registrationId = this.hazelcastInstance.getClientService()
|
||||
.addClientListener(clusterMonitorListener);
|
||||
this.hazelcastRegisteredListenerIdMap.put(ClusterMonitorType.CLIENT, registrationId);
|
||||
}
|
||||
@@ -105,7 +108,7 @@ public class HazelcastClusterMonitorMessageProducer extends MessageProducerSuppo
|
||||
@Override
|
||||
protected void doStop() {
|
||||
if (this.hazelcastInstance.getLifecycleService().isRunning()) {
|
||||
String id = this.hazelcastRegisteredListenerIdMap.remove(ClusterMonitorType.MEMBERSHIP);
|
||||
UUID id = this.hazelcastRegisteredListenerIdMap.remove(ClusterMonitorType.MEMBERSHIP);
|
||||
if (id != null) {
|
||||
this.hazelcastInstance.getCluster().removeMembershipListener(id);
|
||||
}
|
||||
@@ -160,11 +163,6 @@ public class HazelcastClusterMonitorMessageProducer extends MessageProducerSuppo
|
||||
processEvent(membershipEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void memberAttributeChanged(MemberAttributeEvent memberAttributeEvent) {
|
||||
processEvent(memberAttributeEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void distributedObjectCreated(DistributedObjectEvent event) {
|
||||
processEvent(event);
|
||||
@@ -176,18 +174,23 @@ public class HazelcastClusterMonitorMessageProducer extends MessageProducerSuppo
|
||||
}
|
||||
|
||||
@Override
|
||||
public void migrationStarted(MigrationEvent migrationEvent) {
|
||||
public void migrationStarted(MigrationState migrationEvent) {
|
||||
processEvent(migrationEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void migrationCompleted(MigrationEvent migrationEvent) {
|
||||
public void migrationFinished(MigrationState migrationEvent) {
|
||||
processEvent(migrationEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void migrationFailed(MigrationEvent migrationEvent) {
|
||||
processEvent(migrationEvent);
|
||||
public void replicaMigrationCompleted(ReplicaMigrationEvent event) {
|
||||
processEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void replicaMigrationFailed(ReplicaMigrationEvent event) {
|
||||
processEvent(event);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,9 +18,8 @@ package org.springframework.integration.hazelcast.inbound;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.map.listener.MapListener;
|
||||
import com.hazelcast.query.SqlPredicate;
|
||||
import com.hazelcast.map.IMap;
|
||||
import com.hazelcast.query.impl.predicates.SqlPredicate;
|
||||
|
||||
/**
|
||||
* Hazelcast Continuous Query Message Producer is a message producer which enables
|
||||
@@ -48,11 +47,11 @@ public class HazelcastContinuousQueryMessageProducer extends AbstractHazelcastMe
|
||||
this.includeValue = includeValue;
|
||||
}
|
||||
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@Override
|
||||
protected void doStart() {
|
||||
setHazelcastRegisteredEventListenerId(((IMap<?, ?>) this.distributedObject)
|
||||
.addEntryListener((MapListener) new HazelcastEntryListener(), new SqlPredicate(this.predicate),
|
||||
.addEntryListener(new HazelcastEntryListener(), new SqlPredicate(this.predicate),
|
||||
this.includeValue));
|
||||
}
|
||||
|
||||
|
||||
@@ -24,8 +24,8 @@ import org.springframework.integration.hazelcast.DistributedSQLIterationType;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.query.SqlPredicate;
|
||||
import com.hazelcast.map.IMap;
|
||||
import com.hazelcast.query.impl.predicates.SqlPredicate;
|
||||
|
||||
/**
|
||||
* Hazelcast Distributed SQL Message Source is a message source which runs defined
|
||||
@@ -61,6 +61,7 @@ public class HazelcastDistributedSQLMessageSource extends AbstractMessageSource
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Collection<?> doReceive() {
|
||||
switch (this.iterationType) {
|
||||
case ENTRY:
|
||||
|
||||
@@ -23,20 +23,20 @@ import org.springframework.integration.hazelcast.HazelcastHeaders;
|
||||
import org.springframework.integration.hazelcast.HazelcastIntegrationDefinitionValidator;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.hazelcast.collection.IList;
|
||||
import com.hazelcast.collection.IQueue;
|
||||
import com.hazelcast.collection.ISet;
|
||||
import com.hazelcast.collection.ItemEvent;
|
||||
import com.hazelcast.collection.ItemListener;
|
||||
import com.hazelcast.core.DistributedObject;
|
||||
import com.hazelcast.core.IList;
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.core.IQueue;
|
||||
import com.hazelcast.core.ISet;
|
||||
import com.hazelcast.core.ITopic;
|
||||
import com.hazelcast.core.ItemEvent;
|
||||
import com.hazelcast.core.ItemListener;
|
||||
import com.hazelcast.core.Message;
|
||||
import com.hazelcast.core.MessageListener;
|
||||
import com.hazelcast.core.MultiMap;
|
||||
import com.hazelcast.core.ReplicatedMap;
|
||||
import com.hazelcast.instance.EndpointQualifier;
|
||||
import com.hazelcast.map.IMap;
|
||||
import com.hazelcast.map.listener.MapListener;
|
||||
import com.hazelcast.multimap.MultiMap;
|
||||
import com.hazelcast.replicatedmap.ReplicatedMap;
|
||||
import com.hazelcast.topic.ITopic;
|
||||
import com.hazelcast.topic.Message;
|
||||
import com.hazelcast.topic.MessageListener;
|
||||
|
||||
/**
|
||||
* Hazelcast Event Driven Message Producer is a message producer which enables
|
||||
|
||||
@@ -22,12 +22,12 @@ import java.util.concurrent.locks.Lock;
|
||||
|
||||
import org.springframework.integration.hazelcast.HazelcastLocalInstanceRegistrar;
|
||||
|
||||
import com.hazelcast.cluster.MembershipAdapter;
|
||||
import com.hazelcast.cluster.MembershipEvent;
|
||||
import com.hazelcast.core.Hazelcast;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.hazelcast.core.MembershipAdapter;
|
||||
import com.hazelcast.core.MembershipEvent;
|
||||
import com.hazelcast.core.MultiMap;
|
||||
import com.hazelcast.instance.EndpointQualifier;
|
||||
import com.hazelcast.multimap.MultiMap;
|
||||
|
||||
/**
|
||||
* Hazelcast {@link MembershipAdapter} in order to listen for membership updates in the cluster.
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.springframework.util.Assert;
|
||||
|
||||
import com.hazelcast.core.EntryEvent;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.map.IMap;
|
||||
import com.hazelcast.map.listener.EntryAddedListener;
|
||||
import com.hazelcast.map.listener.EntryRemovedListener;
|
||||
import com.hazelcast.map.listener.EntryUpdatedListener;
|
||||
|
||||
@@ -28,8 +28,8 @@ import org.springframework.messaging.Message;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.hazelcast.core.DistributedObject;
|
||||
import com.hazelcast.core.ITopic;
|
||||
import com.hazelcast.core.MultiMap;
|
||||
import com.hazelcast.multimap.MultiMap;
|
||||
import com.hazelcast.topic.ITopic;
|
||||
|
||||
/**
|
||||
* MessageHandler implementation that writes {@link Message} or payload to defined
|
||||
|
||||
@@ -22,8 +22,9 @@ import org.springframework.integration.store.AbstractKeyValueMessageStore;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.query.SqlPredicate;
|
||||
import com.hazelcast.map.IMap;
|
||||
import com.hazelcast.query.Predicate;
|
||||
import com.hazelcast.query.impl.predicates.SqlPredicate;
|
||||
|
||||
/**
|
||||
* The Hazelcast {@link IMap}-based {@link AbstractKeyValueMessageStore} implementation.
|
||||
@@ -76,7 +77,8 @@ public class HazelcastMessageStore extends AbstractKeyValueMessageStore {
|
||||
protected Collection<?> doListKeys(String keyPattern) {
|
||||
Assert.hasText(keyPattern, "'keyPattern' must not be empty");
|
||||
keyPattern = keyPattern.replaceAll("\\*", "%");
|
||||
SqlPredicate sqlPredicate = new SqlPredicate("__key like " + keyPattern);
|
||||
@SuppressWarnings("unchecked")
|
||||
Predicate<Object, Object> sqlPredicate = new SqlPredicate("__key like " + keyPattern);
|
||||
return this.map.values(sqlPredicate);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@ import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.hazelcast.collection.IList;
|
||||
import com.hazelcast.core.DistributedObject;
|
||||
import com.hazelcast.core.IList;
|
||||
import com.hazelcast.instance.HazelcastInstanceFactory;
|
||||
import com.hazelcast.instance.impl.HazelcastInstanceFactory;
|
||||
|
||||
/**
|
||||
* Hazelcast Integration Definition Validator Test Class
|
||||
|
||||
@@ -38,8 +38,8 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.hazelcast.core.EntryEventType;
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.instance.HazelcastInstanceFactory;
|
||||
import com.hazelcast.instance.impl.HazelcastInstanceFactory;
|
||||
import com.hazelcast.map.IMap;
|
||||
|
||||
/**
|
||||
* Hazelcast Continuous Query Inbound Channel Adapter Unit Test Class
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.springframework.integration.hazelcast.inbound;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.AfterClass;
|
||||
@@ -34,17 +33,12 @@ import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.hazelcast.client.HazelcastClient;
|
||||
import com.hazelcast.client.config.ClientConfig;
|
||||
import com.hazelcast.config.GroupConfig;
|
||||
import com.hazelcast.core.Client;
|
||||
import com.hazelcast.core.ClientType;
|
||||
import com.hazelcast.client.Client;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.core.LifecycleEvent;
|
||||
import com.hazelcast.core.LifecycleEvent.LifecycleState;
|
||||
import com.hazelcast.core.MigrationEvent;
|
||||
import com.hazelcast.instance.HazelcastInstanceFactory;
|
||||
import com.hazelcast.instance.impl.HazelcastInstanceFactory;
|
||||
import com.hazelcast.internal.nio.ConnectionType;
|
||||
|
||||
/**
|
||||
* Hazelcast Cluster Monitor Inbound Channel Adapter Unit Test Class
|
||||
@@ -92,12 +86,6 @@ public class HazelcastClusterMonitorInboundChannelAdapterTests {
|
||||
HazelcastInstanceFactory.terminateAll();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMembershipEvent() {
|
||||
HazelcastInboundChannelAdapterTestUtils
|
||||
.testMembershipEvent(hazelcastInstance, cmChannel1, "testKey1", "testValue1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDistributedObjectEvent() {
|
||||
HazelcastInboundChannelAdapterTestUtils
|
||||
@@ -105,18 +93,6 @@ public class HazelcastClusterMonitorInboundChannelAdapterTests {
|
||||
hazelcastInstance, "Test_Distributed_Map4");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMigrationEvent() {
|
||||
final IMap<Integer, String> distributedMap =
|
||||
hazelcastInstance3.getMap("Test_Distributed_Map2");
|
||||
distributedMap.put(1, "TestValue1");
|
||||
distributedMap.put(2, "TestValue2");
|
||||
|
||||
hazelcastInstance3.getLifecycleService().terminate();
|
||||
final Message<?> msg = this.cmChannel3.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
|
||||
verifyMigrationEvent(msg);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testLifecycleEvent() {
|
||||
hazelcastInstance2.getLifecycleService().terminate();
|
||||
@@ -129,55 +105,6 @@ public class HazelcastClusterMonitorInboundChannelAdapterTests {
|
||||
verifyLifecycleEvent(msg, LifecycleState.SHUTDOWN);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testClientEvent() {
|
||||
testClientEventByChannelAndGroupName(cmChannel5, TEST_GROUP_NAME1);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleMonitorTypes() {
|
||||
HazelcastInboundChannelAdapterTestUtils
|
||||
.testDistributedObjectEventByChannelAndHazelcastInstance(cmChannel6,
|
||||
hazelcastInstance, "Test_Distributed_Map5");
|
||||
|
||||
HazelcastInboundChannelAdapterTestUtils
|
||||
.testMembershipEvent(hazelcastInstance, cmChannel6, "testKey2", "testValue2");
|
||||
}
|
||||
|
||||
private void testClientEventByChannelAndGroupName(final PollableChannel channel,
|
||||
final String groupName) {
|
||||
final HazelcastInstance client = getHazelcastClientByGroupName(groupName);
|
||||
|
||||
Message<?> msg = channel.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
|
||||
verifyClientEvent(msg);
|
||||
|
||||
client.getLifecycleService().terminate();
|
||||
|
||||
msg = channel.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
|
||||
verifyClientEvent(msg);
|
||||
}
|
||||
|
||||
private HazelcastInstance getHazelcastClientByGroupName(final String groupName) {
|
||||
final GroupConfig groupConfig = new GroupConfig();
|
||||
groupConfig.setName(groupName);
|
||||
final ClientConfig cfg = new ClientConfig();
|
||||
cfg.setGroupConfig(groupConfig);
|
||||
cfg.getNetworkConfig().addAddress("127.0.0.1:5701");
|
||||
|
||||
return HazelcastClient.newHazelcastClient(cfg);
|
||||
}
|
||||
|
||||
private void verifyMigrationEvent(final Message<?> msg) {
|
||||
assertNotNull(msg);
|
||||
assertNotNull(msg.getPayload());
|
||||
assertTrue(msg.getPayload() instanceof MigrationEvent);
|
||||
assertNotNull(((MigrationEvent) msg.getPayload()).getStatus());
|
||||
assertNotNull(((MigrationEvent) msg.getPayload()).getNewOwner());
|
||||
|
||||
// Newer Hazelcast versions doesn't populated 'oldOwner' if we drop member on the same host
|
||||
assertNull(((MigrationEvent) msg.getPayload()).getOldOwner());
|
||||
}
|
||||
|
||||
private void verifyLifecycleEvent(final Message<?> msg,
|
||||
final LifecycleState lifecycleState) {
|
||||
assertNotNull(msg);
|
||||
@@ -190,7 +117,7 @@ public class HazelcastClusterMonitorInboundChannelAdapterTests {
|
||||
assertNotNull(msg);
|
||||
assertNotNull(msg.getPayload());
|
||||
assertTrue(msg.getPayload() instanceof Client);
|
||||
assertEquals(ClientType.JAVA, ((Client) msg.getPayload()).getClientType());
|
||||
assertEquals(ConnectionType.JAVA_CLIENT, ((Client) msg.getPayload()).getClientType());
|
||||
assertNotNull(((Client) msg.getPayload()).getSocketAddress());
|
||||
}
|
||||
|
||||
|
||||
@@ -35,9 +35,9 @@ import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.hazelcast.collection.IList;
|
||||
import com.hazelcast.core.EntryEventType;
|
||||
import com.hazelcast.core.IList;
|
||||
import com.hazelcast.instance.HazelcastInstanceFactory;
|
||||
import com.hazelcast.instance.impl.HazelcastInstanceFactory;
|
||||
|
||||
/**
|
||||
* Hazelcast Distributed List Event Driven Inbound Channel Adapter Test Class
|
||||
|
||||
@@ -35,8 +35,8 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.hazelcast.core.EntryEventType;
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.instance.HazelcastInstanceFactory;
|
||||
import com.hazelcast.instance.impl.HazelcastInstanceFactory;
|
||||
import com.hazelcast.map.IMap;
|
||||
|
||||
/**
|
||||
* Hazelcast Distributed Map Event Driven Inbound Channel Adapter Test
|
||||
|
||||
@@ -33,9 +33,9 @@ import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.hazelcast.collection.IQueue;
|
||||
import com.hazelcast.core.EntryEventType;
|
||||
import com.hazelcast.core.IQueue;
|
||||
import com.hazelcast.instance.HazelcastInstanceFactory;
|
||||
import com.hazelcast.instance.impl.HazelcastInstanceFactory;
|
||||
|
||||
/**
|
||||
* Hazelcast Distributed Queue Event Driven Inbound Channel Adapter Test
|
||||
|
||||
@@ -30,8 +30,8 @@ import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.instance.HazelcastInstanceFactory;
|
||||
import com.hazelcast.instance.impl.HazelcastInstanceFactory;
|
||||
import com.hazelcast.map.IMap;
|
||||
|
||||
/**
|
||||
* Hazelcast Distributed SQL Inbound Channel Adapter Test
|
||||
|
||||
@@ -33,9 +33,9 @@ import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.hazelcast.collection.ISet;
|
||||
import com.hazelcast.core.EntryEventType;
|
||||
import com.hazelcast.core.ISet;
|
||||
import com.hazelcast.instance.HazelcastInstanceFactory;
|
||||
import com.hazelcast.instance.impl.HazelcastInstanceFactory;
|
||||
|
||||
/**
|
||||
* Hazelcast Distributed Set Event Driven Inbound Channel Adapter Test
|
||||
|
||||
@@ -30,8 +30,8 @@ import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.hazelcast.core.ITopic;
|
||||
import com.hazelcast.instance.HazelcastInstanceFactory;
|
||||
import com.hazelcast.instance.impl.HazelcastInstanceFactory;
|
||||
import com.hazelcast.topic.ITopic;
|
||||
|
||||
/**
|
||||
* Hazelcast Distributed Topic Event Driven Inbound Channel Adapter Test
|
||||
|
||||
@@ -35,8 +35,8 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.hazelcast.core.EntryEventType;
|
||||
import com.hazelcast.core.MultiMap;
|
||||
import com.hazelcast.instance.HazelcastInstanceFactory;
|
||||
import com.hazelcast.instance.impl.HazelcastInstanceFactory;
|
||||
import com.hazelcast.multimap.MultiMap;
|
||||
|
||||
/**
|
||||
* Hazelcast MultiMap Event Driven Inbound Channel Adapter Test
|
||||
|
||||
@@ -35,8 +35,8 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.hazelcast.core.EntryEventType;
|
||||
import com.hazelcast.core.ReplicatedMap;
|
||||
import com.hazelcast.instance.HazelcastInstanceFactory;
|
||||
import com.hazelcast.instance.impl.HazelcastInstanceFactory;
|
||||
import com.hazelcast.replicatedmap.ReplicatedMap;
|
||||
|
||||
/**
|
||||
* Hazelcast Replicated Map Event Driven Inbound Channel Adapter Test
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.support.AnnotationConfigContextLoader;
|
||||
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.map.IMap;
|
||||
|
||||
/**
|
||||
* Hazelcast Continuous Query Inbound Channel Adapter JavaConfig driven Unit Test Class
|
||||
|
||||
@@ -48,13 +48,6 @@ public class HazelcastClusterMonitorInboundChannelAdapterConfigTests {
|
||||
@Autowired
|
||||
private HazelcastInstance testHazelcastInstance;
|
||||
|
||||
@Test
|
||||
public void testConfigDrivenMembershipEvent() {
|
||||
HazelcastInboundChannelAdapterTestUtils
|
||||
.testMembershipEvent(testHazelcastInstance, cmonChannel, "testKey1",
|
||||
"testValue1");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testConfigDrivenDistributedObjectEvent() {
|
||||
HazelcastInboundChannelAdapterTestUtils
|
||||
|
||||
@@ -30,7 +30,7 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.support.AnnotationConfigContextLoader;
|
||||
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.map.IMap;
|
||||
|
||||
/**
|
||||
* Hazelcast Distributed SQL Inbound Channel Adapter JavaConfig driven Unit Test Class
|
||||
|
||||
@@ -30,13 +30,13 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.support.AnnotationConfigContextLoader;
|
||||
|
||||
import com.hazelcast.core.IList;
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.core.IQueue;
|
||||
import com.hazelcast.core.ISet;
|
||||
import com.hazelcast.core.ITopic;
|
||||
import com.hazelcast.core.MultiMap;
|
||||
import com.hazelcast.core.ReplicatedMap;
|
||||
import com.hazelcast.collection.IList;
|
||||
import com.hazelcast.collection.IQueue;
|
||||
import com.hazelcast.collection.ISet;
|
||||
import com.hazelcast.map.IMap;
|
||||
import com.hazelcast.multimap.MultiMap;
|
||||
import com.hazelcast.replicatedmap.ReplicatedMap;
|
||||
import com.hazelcast.topic.ITopic;
|
||||
|
||||
/**
|
||||
* Hazelcast Event Driven Inbound Channel Adapter JavaConfig driven Unit Test Class
|
||||
|
||||
@@ -33,17 +33,17 @@ import org.springframework.integration.hazelcast.inbound.HazelcastDistributedSQL
|
||||
import org.springframework.integration.hazelcast.inbound.HazelcastEventDrivenMessageProducer;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
|
||||
import com.hazelcast.collection.IList;
|
||||
import com.hazelcast.collection.IQueue;
|
||||
import com.hazelcast.collection.ISet;
|
||||
import com.hazelcast.config.Config;
|
||||
import com.hazelcast.core.Hazelcast;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.hazelcast.core.IList;
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.core.IQueue;
|
||||
import com.hazelcast.core.ISet;
|
||||
import com.hazelcast.core.ITopic;
|
||||
import com.hazelcast.core.MultiMap;
|
||||
import com.hazelcast.core.ReplicatedMap;
|
||||
import com.hazelcast.instance.HazelcastInstanceFactory;
|
||||
import com.hazelcast.instance.impl.HazelcastInstanceFactory;
|
||||
import com.hazelcast.map.IMap;
|
||||
import com.hazelcast.multimap.MultiMap;
|
||||
import com.hazelcast.replicatedmap.ReplicatedMap;
|
||||
import com.hazelcast.topic.ITopic;
|
||||
|
||||
/**
|
||||
* Configuration Class for Hazelcast Integration Inbound Test
|
||||
|
||||
@@ -35,17 +35,16 @@ import org.springframework.integration.hazelcast.message.EntryEventMessagePayloa
|
||||
import org.springframework.messaging.Message;
|
||||
import org.springframework.messaging.PollableChannel;
|
||||
|
||||
import com.hazelcast.cluster.MembershipEvent;
|
||||
import com.hazelcast.collection.ICollection;
|
||||
import com.hazelcast.core.DistributedObjectEvent;
|
||||
import com.hazelcast.core.EntryEventType;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.hazelcast.core.ICollection;
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.core.ITopic;
|
||||
import com.hazelcast.core.Member;
|
||||
import com.hazelcast.core.MembershipEvent;
|
||||
import com.hazelcast.core.MultiMap;
|
||||
import com.hazelcast.core.ReplicatedMap;
|
||||
import com.hazelcast.map.IMap;
|
||||
import com.hazelcast.multimap.MultiMap;
|
||||
import com.hazelcast.replicatedmap.ReplicatedMap;
|
||||
import com.hazelcast.spi.exception.DistributedObjectDestroyedException;
|
||||
import com.hazelcast.topic.ITopic;
|
||||
|
||||
/**
|
||||
* Util Class for Hazelcast Inbound Channel Adapters Test Support.
|
||||
@@ -348,15 +347,6 @@ public final class HazelcastInboundChannelAdapterTestUtils {
|
||||
.next())).getSurname());
|
||||
}
|
||||
|
||||
public static void testMembershipEvent(final HazelcastInstance instance,
|
||||
final PollableChannel channel, final String key, final String value) {
|
||||
Member member = instance.getCluster().getLocalMember();
|
||||
member.setStringAttribute(key, value);
|
||||
|
||||
Message<?> msg = channel.receive(TIMEOUT);
|
||||
verifyMembershipEvent(msg, MembershipEvent.MEMBER_ATTRIBUTE_CHANGED);
|
||||
}
|
||||
|
||||
public static void testDistributedObjectEventByChannelAndHazelcastInstance(
|
||||
final PollableChannel channel, final HazelcastInstance hazelcastInstance,
|
||||
final String distributedObjectName) {
|
||||
|
||||
@@ -16,9 +16,10 @@
|
||||
|
||||
package org.springframework.integration.hazelcast.leader;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.mockito.ArgumentMatchers.any;
|
||||
import static org.mockito.BDDMockito.willAnswer;
|
||||
import static org.mockito.Mockito.spy;
|
||||
@@ -48,7 +49,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import com.hazelcast.config.Config;
|
||||
import com.hazelcast.core.Hazelcast;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.hazelcast.instance.HazelcastInstanceFactory;
|
||||
import com.hazelcast.instance.impl.HazelcastInstanceFactory;
|
||||
|
||||
/**
|
||||
* Tests for hazelcast leader election.
|
||||
@@ -82,9 +83,9 @@ public class LeaderInitiatorTests {
|
||||
|
||||
@Test
|
||||
public void testLeaderElections() throws Exception {
|
||||
assertThat(this.candidate.onGrantedLatch.await(5, TimeUnit.SECONDS), is(true));
|
||||
assertThat(this.listener.onEventLatch.await(5, TimeUnit.SECONDS), is(true));
|
||||
assertThat(this.listener.events.size(), is(1));
|
||||
assertTrue(this.candidate.onGrantedLatch.await(5, TimeUnit.SECONDS));
|
||||
assertTrue(this.listener.onEventLatch.await(5, TimeUnit.SECONDS));
|
||||
assertEquals(1, this.listener.events.size());
|
||||
|
||||
this.initiator.destroy();
|
||||
|
||||
@@ -101,7 +102,7 @@ public class LeaderInitiatorTests {
|
||||
initiator.start();
|
||||
}
|
||||
|
||||
assertThat(granted.await(10, TimeUnit.SECONDS), is(true));
|
||||
assertTrue(granted.await(10, TimeUnit.SECONDS));
|
||||
|
||||
LeaderInitiator initiator1 = countingPublisher.initiator;
|
||||
|
||||
@@ -116,8 +117,8 @@ public class LeaderInitiatorTests {
|
||||
|
||||
assertNotNull(initiator2);
|
||||
|
||||
assertThat(initiator1.getContext().isLeader(), is(true));
|
||||
assertThat(initiator2.getContext().isLeader(), is(false));
|
||||
assertTrue(initiator1.getContext().isLeader());
|
||||
assertFalse(initiator2.getContext().isLeader());
|
||||
|
||||
final CountDownLatch granted1 = new CountDownLatch(1);
|
||||
final CountDownLatch granted2 = new CountDownLatch(1);
|
||||
@@ -129,7 +130,7 @@ public class LeaderInitiatorTests {
|
||||
public void publishOnRevoked(Object source, Context context, String role) {
|
||||
try {
|
||||
// It's difficult to see round-robin election, so block one initiator until the second is elected.
|
||||
assertThat(granted2.await(10, TimeUnit.SECONDS), is(true));
|
||||
assertTrue(granted2.await(10, TimeUnit.SECONDS));
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
// No op
|
||||
@@ -145,7 +146,7 @@ public class LeaderInitiatorTests {
|
||||
public void publishOnRevoked(Object source, Context context, String role) {
|
||||
try {
|
||||
// It's difficult to see round-robin election, so block one initiator until the second is elected.
|
||||
assertThat(granted1.await(10, TimeUnit.SECONDS), is(true));
|
||||
assertTrue(granted1.await(10, TimeUnit.SECONDS));
|
||||
}
|
||||
catch (InterruptedException e) {
|
||||
// No op
|
||||
@@ -157,17 +158,17 @@ public class LeaderInitiatorTests {
|
||||
|
||||
initiator1.getContext().yield();
|
||||
|
||||
assertThat(revoked1.await(10, TimeUnit.SECONDS), is(true));
|
||||
assertTrue(revoked1.await(10, TimeUnit.SECONDS));
|
||||
|
||||
assertThat(initiator2.getContext().isLeader(), is(true));
|
||||
assertThat(initiator1.getContext().isLeader(), is(false));
|
||||
assertTrue(initiator2.getContext().isLeader());
|
||||
assertFalse(initiator1.getContext().isLeader());
|
||||
|
||||
initiator2.getContext().yield();
|
||||
|
||||
assertThat(revoked2.await(10, TimeUnit.SECONDS), is(true));
|
||||
assertTrue(revoked2.await(10, TimeUnit.SECONDS));
|
||||
|
||||
assertThat(initiator1.getContext().isLeader(), is(true));
|
||||
assertThat(initiator2.getContext().isLeader(), is(false));
|
||||
assertTrue(initiator1.getContext().isLeader());
|
||||
assertFalse(initiator2.getContext().isLeader());
|
||||
|
||||
initiator2.destroy();
|
||||
|
||||
@@ -176,7 +177,7 @@ public class LeaderInitiatorTests {
|
||||
|
||||
initiator1.getContext().yield();
|
||||
|
||||
assertThat(revoked11.await(10, TimeUnit.SECONDS), is(true));
|
||||
assertTrue(revoked11.await(10, TimeUnit.SECONDS));
|
||||
|
||||
initiator1.destroy();
|
||||
|
||||
@@ -207,9 +208,9 @@ public class LeaderInitiatorTests {
|
||||
|
||||
initiator.start();
|
||||
|
||||
assertThat(onGranted.await(5, TimeUnit.SECONDS), is(true));
|
||||
assertTrue(onGranted.await(5, TimeUnit.SECONDS));
|
||||
|
||||
assertThat(initiator.getContext().isLeader(), is(true));
|
||||
assertTrue(initiator.getContext().isLeader());
|
||||
|
||||
initiator.destroy();
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ import com.hazelcast.config.Config;
|
||||
import com.hazelcast.core.Hazelcast;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.hazelcast.cp.lock.FencedLock;
|
||||
import com.hazelcast.instance.HazelcastInstanceFactory;
|
||||
import com.hazelcast.instance.impl.HazelcastInstanceFactory;
|
||||
|
||||
/**
|
||||
* @author Artem Bilan
|
||||
|
||||
@@ -32,7 +32,7 @@ import org.springframework.integration.metadata.MetadataStoreListener;
|
||||
|
||||
import com.hazelcast.core.Hazelcast;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.map.IMap;
|
||||
|
||||
/**
|
||||
* @author Vinicius Carvalho
|
||||
|
||||
@@ -56,10 +56,10 @@ import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
|
||||
import com.hazelcast.core.ITopic;
|
||||
import com.hazelcast.core.MultiMap;
|
||||
import com.hazelcast.core.ReplicatedMap;
|
||||
import com.hazelcast.instance.HazelcastInstanceFactory;
|
||||
import com.hazelcast.instance.impl.HazelcastInstanceFactory;
|
||||
import com.hazelcast.multimap.MultiMap;
|
||||
import com.hazelcast.replicatedmap.ReplicatedMap;
|
||||
import com.hazelcast.topic.ITopic;
|
||||
|
||||
/**
|
||||
* Hazelcast Outbound Channel Adapter Test Class.
|
||||
|
||||
@@ -39,11 +39,11 @@ import org.springframework.messaging.MessageChannel;
|
||||
import com.hazelcast.core.DistributedObject;
|
||||
import com.hazelcast.core.Hazelcast;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.core.ITopic;
|
||||
import com.hazelcast.core.MultiMap;
|
||||
import com.hazelcast.core.ReplicatedMap;
|
||||
import com.hazelcast.instance.HazelcastInstanceFactory;
|
||||
import com.hazelcast.instance.impl.HazelcastInstanceFactory;
|
||||
import com.hazelcast.map.IMap;
|
||||
import com.hazelcast.multimap.MultiMap;
|
||||
import com.hazelcast.replicatedmap.ReplicatedMap;
|
||||
import com.hazelcast.topic.ITopic;
|
||||
|
||||
/**
|
||||
* Configuration Class for Hazelcast Integration Outbound Test
|
||||
|
||||
@@ -37,11 +37,11 @@ import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.support.AnnotationConfigContextLoader;
|
||||
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.core.ITopic;
|
||||
import com.hazelcast.core.MultiMap;
|
||||
import com.hazelcast.core.ReplicatedMap;
|
||||
import com.hazelcast.instance.HazelcastInstanceFactory;
|
||||
import com.hazelcast.instance.impl.HazelcastInstanceFactory;
|
||||
import com.hazelcast.map.IMap;
|
||||
import com.hazelcast.multimap.MultiMap;
|
||||
import com.hazelcast.replicatedmap.ReplicatedMap;
|
||||
import com.hazelcast.topic.ITopic;
|
||||
|
||||
/**
|
||||
* Hazelcast Outbound Channel Adapter JavaConfig driven Unit Test Class
|
||||
|
||||
@@ -39,10 +39,10 @@ import org.springframework.integration.hazelcast.HazelcastTestRequestHandlerAdvi
|
||||
import org.springframework.messaging.MessageChannel;
|
||||
import org.springframework.messaging.support.GenericMessage;
|
||||
|
||||
import com.hazelcast.core.ITopic;
|
||||
import com.hazelcast.core.MessageListener;
|
||||
import com.hazelcast.core.MultiMap;
|
||||
import com.hazelcast.core.ReplicatedMap;
|
||||
import com.hazelcast.multimap.MultiMap;
|
||||
import com.hazelcast.replicatedmap.ReplicatedMap;
|
||||
import com.hazelcast.topic.ITopic;
|
||||
import com.hazelcast.topic.MessageListener;
|
||||
|
||||
/**
|
||||
* Util Class for Hazelcast Outbound Channel Adapter Test Support
|
||||
@@ -169,7 +169,7 @@ public final class HazelcastOutboundChannelAdapterTestUtils {
|
||||
private int index = 1;
|
||||
|
||||
@Override
|
||||
public void onMessage(com.hazelcast.core.Message message) {
|
||||
public void onMessage(com.hazelcast.topic.Message message) {
|
||||
HazelcastIntegrationTestUser user =
|
||||
(HazelcastIntegrationTestUser) message.getMessageObject();
|
||||
verifyHazelcastIntegrationTestUser(user, index);
|
||||
|
||||
@@ -40,7 +40,7 @@ import org.springframework.messaging.support.GenericMessage;
|
||||
|
||||
import com.hazelcast.core.Hazelcast;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.hazelcast.core.IMap;
|
||||
import com.hazelcast.map.IMap;
|
||||
|
||||
/**
|
||||
* @author Vinicius Carvalho
|
||||
|
||||
Reference in New Issue
Block a user