diff --git a/spring-integration-hazelcast/build.gradle b/spring-integration-hazelcast/build.gradle
index acd0d58..de389d3 100644
--- a/spring-integration-hazelcast/build.gradle
+++ b/spring-integration-hazelcast/build.gradle
@@ -1,27 +1,28 @@
buildscript {
repositories {
- maven { url 'http://repo.spring.io/plugins-release' }
+ maven { url 'https://repo.spring.io/plugins-release' }
}
dependencies {
- classpath 'io.spring.gradle:spring-io-plugin:0.0.5.RELEASE'
+ classpath 'io.spring.gradle:dependency-management-plugin:1.0.0.RC2'
+ classpath 'io.spring.gradle:spring-io-plugin:0.0.6.RELEASE'
}
}
plugins {
- id "org.sonarqube" version "1.2"
+ id 'java'
+ id 'eclipse'
+ id 'idea'
+ id 'jacoco'
+ id 'checkstyle'
+ id 'org.sonarqube' version '2.1'
}
description = 'Spring Integration Hazelcast Support'
-apply plugin: 'java'
apply from: "${rootProject.projectDir}/publish-maven.gradle"
-apply plugin: 'eclipse'
-apply plugin: 'jacoco'
-apply plugin: 'idea'
group = 'org.springframework.integration'
-
repositories {
if (version.endsWith('BUILD-SNAPSHOT') || project.hasProperty('platformVersion')) {
maven { url 'http://repo.spring.io/libs-snapshot' }
@@ -41,12 +42,20 @@ if (project.hasProperty('platformVersion')) {
}
}
-sourceCompatibility = targetCompatibility = 1.7
+compileJava {
+ sourceCompatibility = 1.7
+ targetCompatibility = 1.7
+}
+
+compileTestJava {
+ sourceCompatibility = 1.8
+ targetCompatibility = 1.8
+}
ext {
- hazelcastVersion = '3.6.4'
- slf4jVersion = '1.7.21'
- springIntegrationVersion = '4.3.1.BUILD-SNAPSHOT'
+ hazelcastVersion = '3.7.4'
+ slf4jVersion = '1.7.22'
+ springIntegrationVersion = '4.3.6.RELEASE'
idPrefix = 'hazelcast'
@@ -69,7 +78,12 @@ sourceSets {
}
jacoco {
- toolVersion = "0.7.6.201602180812"
+ toolVersion = "0.7.8"
+}
+
+checkstyle {
+ configFile = file("$rootDir/src/checkstyle/checkstyle.xml")
+ toolVersion = "6.16.1"
}
// enable all compiler warnings; individual projects may customize further
@@ -86,9 +100,6 @@ dependencies {
testRuntime "org.slf4j:slf4j-log4j12:$slf4jVersion"
}
-// enable all compiler warnings; individual projects may customize further
-[compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:all,-options']
-
test {
// suppress all console output during testing unless running `gradle -i`
logging.captureStandardOutput(LogLevel.INFO)
diff --git a/spring-integration-hazelcast/gradle/wrapper/gradle-wrapper.jar b/spring-integration-hazelcast/gradle/wrapper/gradle-wrapper.jar
index d3b8398..c607543 100644
Binary files a/spring-integration-hazelcast/gradle/wrapper/gradle-wrapper.jar and b/spring-integration-hazelcast/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/spring-integration-hazelcast/gradle/wrapper/gradle-wrapper.properties b/spring-integration-hazelcast/gradle/wrapper/gradle-wrapper.properties
index f81b1a7..7125644 100644
--- a/spring-integration-hazelcast/gradle/wrapper/gradle-wrapper.properties
+++ b/spring-integration-hazelcast/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Wed Jul 06 16:58:06 EDT 2016
+#Mon Jan 23 13:52:31 EST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-bin.zip
diff --git a/spring-integration-hazelcast/gradlew b/spring-integration-hazelcast/gradlew
index 27309d9..4453cce 100755
--- a/spring-integration-hazelcast/gradlew
+++ b/spring-integration-hazelcast/gradlew
@@ -1,4 +1,4 @@
-#!/usr/bin/env bash
+#!/usr/bin/env sh
##############################################################################
##
@@ -154,11 +154,19 @@ if $cygwin ; then
esac
fi
-# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
-function splitJvmOpts() {
- JVM_OPTS=("$@")
+# Escape application args
+save ( ) {
+ for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
+ echo " "
}
-eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
-JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
+APP_ARGS=$(save "$@")
-exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
+# 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" "$@"
diff --git a/spring-integration-hazelcast/gradlew.bat b/spring-integration-hazelcast/gradlew.bat
index f6d5974..e95643d 100644
--- a/spring-integration-hazelcast/gradlew.bat
+++ b/spring-integration-hazelcast/gradlew.bat
@@ -49,7 +49,6 @@ goto fail
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
-if "%@eval[2+2]" == "4" goto 4NT_args
:win9xME_args
@rem Slurp the command line arguments.
@@ -60,11 +59,6 @@ set _SKIP=2
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
-goto execute
-
-:4NT_args
-@rem Get arguments from the 4NT Shell from JP Software
-set CMD_LINE_ARGS=%$
:execute
@rem Setup the command line
diff --git a/spring-integration-hazelcast/src/checkstyle/checkstyle-header.txt b/spring-integration-hazelcast/src/checkstyle/checkstyle-header.txt
new file mode 100644
index 0000000..f470e97
--- /dev/null
+++ b/spring-integration-hazelcast/src/checkstyle/checkstyle-header.txt
@@ -0,0 +1,17 @@
+^\Q/*\E$
+^\Q * Copyright \E20\d\d(\-20\d\d)?\Q the original author or authors.\E$
+^\Q *\E$
+^\Q * Licensed under the Apache License, Version 2.0 (the "License");\E$
+^\Q * you may not use this file except in compliance with the License.\E$
+^\Q * You may obtain a copy of the License at\E$
+^\Q *\E$
+^\Q * http://www.apache.org/licenses/LICENSE-2.0\E$
+^\Q *\E$
+^\Q * Unless required by applicable law or agreed to in writing, software\E$
+^\Q * distributed under the License is distributed on an "AS IS" BASIS,\E$
+^\Q * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\E$
+^\Q * See the License for the specific language governing permissions and\E$
+^\Q * limitations under the License.\E$
+^\Q */\E$
+^$
+^.*$
diff --git a/spring-integration-hazelcast/src/checkstyle/checkstyle-suppressions.xml b/spring-integration-hazelcast/src/checkstyle/checkstyle-suppressions.xml
new file mode 100644
index 0000000..be24a0f
--- /dev/null
+++ b/spring-integration-hazelcast/src/checkstyle/checkstyle-suppressions.xml
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-integration-hazelcast/src/checkstyle/checkstyle.xml b/spring-integration-hazelcast/src/checkstyle/checkstyle.xml
new file mode 100644
index 0000000..920a484
--- /dev/null
+++ b/spring-integration-hazelcast/src/checkstyle/checkstyle.xml
@@ -0,0 +1,183 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/CacheEventType.java b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/CacheEventType.java
index 976d32e..73b5f0c 100644
--- a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/CacheEventType.java
+++ b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/CacheEventType.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2017 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,14 +17,45 @@
package org.springframework.integration.hazelcast;
/**
- * Enumeration of Cache Event Types
+ * Enumeration of Cache Event Types.
*
* @author Eren Avsarogullari
+ * @author Artem Bilan
+ *
* @since 1.0.0
+ *
* @see org.springframework.integration.hazelcast.inbound.AbstractHazelcastMessageProducer
*/
public enum CacheEventType {
- ADDED, REMOVED, UPDATED, EVICTED, EVICT_ALL, CLEAR_ALL;
+ /**
+ * The Hazelcast ADDED event.
+ */
+ ADDED,
+
+ /**
+ * The Hazelcast REMOVED event.
+ */
+ REMOVED,
+
+ /**
+ * The Hazelcast UPDATED event.
+ */
+ UPDATED,
+
+ /**
+ * The Hazelcast EVICTED event.
+ */
+ EVICTED,
+
+ /**
+ * The Hazelcast EVICT_ALL event.
+ */
+ EVICT_ALL,
+
+ /**
+ * The Hazelcast CLEAR_ALL event.
+ */
+ CLEAR_ALL
}
diff --git a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/CacheListeningPolicyType.java b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/CacheListeningPolicyType.java
index 22ac779..7454b41 100644
--- a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/CacheListeningPolicyType.java
+++ b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/CacheListeningPolicyType.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2017 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,14 +17,25 @@
package org.springframework.integration.hazelcast;
/**
- * Enumeration of Cache Listening Policy Type
+ * Enumeration of Cache Listening Policy Type.
*
* @author Eren Avsarogullari
+ * @author Artem Bilan
+ *
* @since 1.0.0
+ *
* @see org.springframework.integration.hazelcast.inbound.AbstractHazelcastMessageProducer
*/
public enum CacheListeningPolicyType {
- SINGLE, ALL;
+ /**
+ * Only the local Hazelcast node can accept event.
+ */
+ SINGLE,
+
+ /**
+ * All subscribed members can accept event.
+ */
+ ALL
}
diff --git a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/ClusterMonitorType.java b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/ClusterMonitorType.java
index 43090df..33f46ee 100644
--- a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/ClusterMonitorType.java
+++ b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/ClusterMonitorType.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2017 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,10 +17,13 @@
package org.springframework.integration.hazelcast;
/**
- * Enumeration of Hazelcast Cluster Monitor Types
+ * Enumeration of Hazelcast Cluster Monitor Types.
*
* @author Eren Avsarogullari
+ * @author Artem Bilan
+ *
* @since 1.0.0
+ *
* @see org.springframework.integration.hazelcast.inbound.HazelcastClusterMonitorMessageProducer
* @see com.hazelcast.core.MembershipListener
* @see com.hazelcast.core.DistributedObjectListener
@@ -30,6 +33,29 @@ package org.springframework.integration.hazelcast;
*/
public enum ClusterMonitorType {
- MEMBERSHIP, DISTRIBUTED_OBJECT, MIGRATION, LIFECYCLE, CLIENT;
+ /**
+ * The membership listener mode.
+ */
+ MEMBERSHIP,
+
+ /**
+ * The distributed object listener mode.
+ */
+ DISTRIBUTED_OBJECT,
+
+ /**
+ * The migration listener mode.
+ */
+ MIGRATION,
+
+ /**
+ * The listener listener mode.
+ */
+ LIFECYCLE,
+
+ /**
+ * The client listener mode.
+ */
+ CLIENT
}
diff --git a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/DistributedSQLIterationType.java b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/DistributedSQLIterationType.java
index e2b9393..6dcafca 100644
--- a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/DistributedSQLIterationType.java
+++ b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/DistributedSQLIterationType.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2017 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,14 +17,36 @@
package org.springframework.integration.hazelcast;
/**
- * Enumeration of Distributed SQL Iteration Type
+ * Enumeration of Distributed SQL Iteration Type.
*
* @author Eren Avsarogullari
+ * @author Artem Bilan
+ *
* @since 1.0.0
+ *
* @see org.springframework.integration.hazelcast.inbound.HazelcastDistributedSQLMessageSource
+ * @see com.hazelcast.core.IMap
*/
public enum DistributedSQLIterationType {
- ENTRY, KEY, LOCAL_KEY, VALUE
+ /**
+ * The {@link com.hazelcast.core.IMap#entrySet()} to iterate.
+ */
+ ENTRY,
+
+ /**
+ * The {@link com.hazelcast.core.IMap#keySet()} to iterate.
+ */
+ KEY,
+
+ /**
+ * The {@link com.hazelcast.core.IMap#localKeySet()} to iterate.
+ */
+ LOCAL_KEY,
+
+ /**
+ * The {@link com.hazelcast.core.IMap#values()} to iterate.
+ */
+ VALUE
}
diff --git a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/HazelcastHeaders.java b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/HazelcastHeaders.java
index 255427d..0812afb 100644
--- a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/HazelcastHeaders.java
+++ b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/HazelcastHeaders.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2017 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,21 +17,35 @@
package org.springframework.integration.hazelcast;
/**
- * Hazelcast Message Headers
+ * Hazelcast Message Headers.
*
* @author Eren Avsarogullari
+ * @author Artem Bilan
+ *
* @since 1.0.0
*/
public abstract class HazelcastHeaders {
private static final String PREFIX = "hazelcast_";
+ /**
+ * The event type header name.
+ */
public static final String EVENT_TYPE = PREFIX + "eventType";
+ /**
+ * The member header name.
+ */
public static final String MEMBER = PREFIX + "member";
+ /**
+ * The cache name header name.
+ */
public static final String CACHE_NAME = PREFIX + "cacheName";
+ /**
+ * The publishing time header name.
+ */
public static final String PUBLISHING_TIME = PREFIX + "publishingTime";
}
diff --git a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/HazelcastIntegrationDefinitionValidator.java b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/HazelcastIntegrationDefinitionValidator.java
index befcdd5..be7390b 100644
--- a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/HazelcastIntegrationDefinitionValidator.java
+++ b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/HazelcastIntegrationDefinitionValidator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2016 the original author or authors.
+ * Copyright 2015-2017 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.
@@ -36,9 +36,11 @@ import com.hazelcast.core.ReplicatedMap;
* Common Validator for Hazelcast Integration. It validates cache types and events.
*
* @author Eren Avsarogullari
+ * @author Artem Bilan
+ *
* @since 1.0.0
*/
-public class HazelcastIntegrationDefinitionValidator {
+public final class HazelcastIntegrationDefinitionValidator {
public static > Set validateEnumType(final Class enumType, final String types) {
Set typeSet = StringUtils.commaDelimitedListToSet(StringUtils.trimAllWhitespace(types));
@@ -100,4 +102,7 @@ public class HazelcastIntegrationDefinitionValidator {
}
}
+ private HazelcastIntegrationDefinitionValidator() {
+ }
+
}
diff --git a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/HazelcastLocalInstanceRegistrar.java b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/HazelcastLocalInstanceRegistrar.java
index 3bab913..cbb64ed 100644
--- a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/HazelcastLocalInstanceRegistrar.java
+++ b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/HazelcastLocalInstanceRegistrar.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2017 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.
@@ -37,9 +37,15 @@ import com.hazelcast.core.MultiMap;
*/
public class HazelcastLocalInstanceRegistrar implements SmartInitializingSingleton {
+ /**
+ * The name for the Hazelcast MultiMap used for membership registration.
+ */
public static final String SPRING_INTEGRATION_INTERNAL_CLUSTER_MULTIMAP =
"SPRING_INTEGRATION_INTERNAL_CLUSTER_MULTIMAP";
+ /**
+ * The name for the Hazelcast Lock used for membership registration.
+ */
public static final String SPRING_INTEGRATION_INTERNAL_CLUSTER_LOCK = "SPRING_INTEGRATION_INTERNAL_CLUSTER_LOCK";
@Override
diff --git a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/inbound/AbstractHazelcastMessageProducer.java b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/inbound/AbstractHazelcastMessageProducer.java
index 722348e..b77ac9c 100644
--- a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/inbound/AbstractHazelcastMessageProducer.java
+++ b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/inbound/AbstractHazelcastMessageProducer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2017 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.
@@ -66,7 +66,7 @@ public abstract class AbstractHazelcastMessageProducer extends MessageProducerSu
}
protected Set getCacheEvents() {
- return cacheEvents;
+ return this.cacheEvents;
}
public void setCacheEventTypes(String cacheEventTypes) {
@@ -79,7 +79,7 @@ public abstract class AbstractHazelcastMessageProducer extends MessageProducerSu
}
protected CacheListeningPolicyType getCacheListeningPolicy() {
- return cacheListeningPolicy;
+ return this.cacheListeningPolicy;
}
public void setCacheListeningPolicy(CacheListeningPolicyType cacheListeningPolicy) {
@@ -88,13 +88,18 @@ public abstract class AbstractHazelcastMessageProducer extends MessageProducerSu
}
protected String getHazelcastRegisteredEventListenerId() {
- return hazelcastRegisteredEventListenerId;
+ return this.hazelcastRegisteredEventListenerId;
}
protected void setHazelcastRegisteredEventListenerId(String hazelcastRegisteredEventListenerId) {
this.hazelcastRegisteredEventListenerId = hazelcastRegisteredEventListenerId;
}
+ /**
+ * A base event listener abstraction.
+ *
+ * @param the event type
+ */
protected abstract class AbstractHazelcastEventListener {
protected abstract void processEvent(E event);
@@ -102,7 +107,7 @@ public abstract class AbstractHazelcastMessageProducer extends MessageProducerSu
protected abstract Message> toMessage(E event);
protected void sendMessage(E event, InetSocketAddress socketAddress,
- CacheListeningPolicyType cacheListeningPolicyType) {
+ CacheListeningPolicyType cacheListeningPolicyType) {
if (CacheListeningPolicyType.ALL == cacheListeningPolicyType || isEventAcceptable(socketAddress)) {
AbstractHazelcastMessageProducer.this.sendMessage(toMessage(event));
}
@@ -141,6 +146,12 @@ public abstract class AbstractHazelcastMessageProducer extends MessageProducerSu
}
+ /**
+ * The {@link AbstractHazelcastEventListener} implementation for the {@link AbstractIMapEvent}s.
+ *
+ * @param the entry key type
+ * @param the entry value type
+ */
protected final class HazelcastEntryListener extends
AbstractHazelcastEventListener implements EntryListener {
@@ -177,8 +188,8 @@ public abstract class AbstractHazelcastMessageProducer extends MessageProducerSu
@Override
protected void processEvent(AbstractIMapEvent event) {
if (getCacheEvents().contains(event.getEventType().toString())) {
- if (logger.isDebugEnabled()) {
- logger.debug("Received Event : " + event);
+ if (AbstractHazelcastMessageProducer.this.logger.isDebugEnabled()) {
+ AbstractHazelcastMessageProducer.this.logger.debug("Received Event : " + event);
}
sendMessage(event, event.getMember().getSocketAddress(), getCacheListeningPolicy());
}
diff --git a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/leader/LeaderInitiator.java b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/leader/LeaderInitiator.java
index d01c2a5..97dee71 100644
--- a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/leader/LeaderInitiator.java
+++ b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/leader/LeaderInitiator.java
@@ -1,11 +1,11 @@
/*
- * Copyright 2014-2015 the original author or authors.
+ * Copyright 2015-2017 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
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://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,
@@ -97,25 +97,14 @@ public class LeaderInitiator implements SmartLifecycle, DisposableBean, Applicat
private boolean customPublisher = false;
- /**
- * @see SmartLifecycle
- */
private volatile boolean autoStartup = true;
- /**
- * @see SmartLifecycle which is an extension of org.springframework.context.Phased
- */
private volatile int phase;
- /**
- * Flag that indicates whether the leadership election for
- * this {@link #candidate} is running.
- */
private volatile boolean running;
/**
* Construct a {@link LeaderInitiator} with a default candidate.
- *
* @param client Hazelcast client
*/
public LeaderInitiator(HazelcastInstance client) {
@@ -124,7 +113,6 @@ public class LeaderInitiator implements SmartLifecycle, DisposableBean, Applicat
/**
* Construct a {@link LeaderInitiator}.
- *
* @param client Hazelcast client
* @param candidate leadership election candidate
*/
@@ -146,6 +134,7 @@ public class LeaderInitiator implements SmartLifecycle, DisposableBean, Applicat
}
/**
+ * The context of the initiator or null if not running.
* @return the context (or null if not running)
*/
public Context getContext() {
@@ -214,6 +203,7 @@ public class LeaderInitiator implements SmartLifecycle, DisposableBean, Applicat
}
/**
+ * {@code true} if leadership election for this {@link #candidate} is running.
* @return true if leadership election for this {@link #candidate} is running
*/
@Override
@@ -248,7 +238,7 @@ public class LeaderInitiator implements SmartLifecycle, DisposableBean, Applicat
if (this.locked) {
LeaderInitiator.this.leaderEventPublisher.publishOnGranted(LeaderInitiator.this,
this.context, this.role);
- LeaderInitiator.this.candidate.onGranted(context);
+ LeaderInitiator.this.candidate.onGranted(this.context);
Thread.sleep(Long.MAX_VALUE);
}
}
diff --git a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/message/EntryEventMessagePayload.java b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/message/EntryEventMessagePayload.java
index fa02d38..cd55425 100644
--- a/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/message/EntryEventMessagePayload.java
+++ b/spring-integration-hazelcast/src/main/java/org/springframework/integration/hazelcast/message/EntryEventMessagePayload.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2017 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.
@@ -13,22 +13,37 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package org.springframework.integration.hazelcast.message;
import org.springframework.util.Assert;
/**
- * Hazelcast Message Payload for Entry Events
+ * Hazelcast Message Payload for Entry Events.
+ *
+ * @param the entry key type
+ * @param the entry value type
*
* @author Eren Avsarogullari
+ * @author Artem Bilan
+ *
* @since 1.0.0
*/
public class EntryEventMessagePayload {
+ /**
+ * The entry key.
+ */
public final K key;
+ /**
+ * The entry value.
+ */
public final V value;
+ /**
+ * The entry old value if any.
+ */
public final V oldValue;
public EntryEventMessagePayload(final K key, final V value, final V oldValue) {
@@ -40,27 +55,31 @@ public class EntryEventMessagePayload {
@Override
public String toString() {
- return "EntryEventMessagePayload [key=" + key + ", value=" + value + ", oldValue=" + oldValue + "]";
+ return "EntryEventMessagePayload [key=" + this.key + ", value=" + this.value + ", oldValue=" + this.oldValue + "]";
}
@Override
public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
EntryEventMessagePayload, ?> that = (EntryEventMessagePayload, ?>) o;
- return key.equals(that.key) && !(value != null ? !value.equals(that.value)
- : that.value != null) && !(oldValue != null
- ? !oldValue.equals(that.oldValue) : that.oldValue != null);
+ return this.key.equals(that.key) && !(this.value != null ? !this.value.equals(that.value)
+ : that.value != null) && !(this.oldValue != null
+ ? !this.oldValue.equals(that.oldValue) : that.oldValue != null);
}
@Override
public int hashCode() {
- int result = key.hashCode();
- result = 31 * result + (value != null ? value.hashCode() : 0);
- result = 31 * result + (oldValue != null ? oldValue.hashCode() : 0);
+ int result = this.key.hashCode();
+ result = 31 * result + (this.value != null ? this.value.hashCode() : 0);
+ result = 31 * result + (this.oldValue != null ? this.oldValue.hashCode() : 0);
return result;
}
diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/HazelcastIntegrationTestUser.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/HazelcastIntegrationTestUser.java
index b619096..00fe7c5 100644
--- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/HazelcastIntegrationTestUser.java
+++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/HazelcastIntegrationTestUser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2017 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,6 +17,7 @@
package org.springframework.integration.hazelcast;
import java.io.Serializable;
+import java.util.Objects;
/**
* User Bean for Hazelcast Integration Unit Tests
@@ -87,48 +88,29 @@ public class HazelcastIntegrationTestUser implements Comparable user.getId()) ? 1 : 0;
+ return (this.id < user.getId()) ? -1 : (this.id > user.getId()) ? 1 : 0;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) {
+ return true;
+ }
+ if (o == null || getClass() != o.getClass()) {
+ return false;
+ }
+ HazelcastIntegrationTestUser that = (HazelcastIntegrationTestUser) o;
+ return id == that.id &&
+ age == that.age &&
+ Objects.equals(name, that.name) &&
+ Objects.equals(surname, that.surname);
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(id, name, surname, age);
}
}
diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/HazelcastTestRequestHandlerAdvice.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/HazelcastTestRequestHandlerAdvice.java
index 820a8dc..1bfc189 100644
--- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/HazelcastTestRequestHandlerAdvice.java
+++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/HazelcastTestRequestHandlerAdvice.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2017 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,12 +22,12 @@ import org.springframework.integration.handler.advice.AbstractRequestHandlerAdvi
import org.springframework.messaging.Message;
/**
- * {@link MessageHandler} advice class for Hazelcast Integration Unit Tests.
+ * {@link AbstractRequestHandlerAdvice} advice class for Hazelcast Integration Unit Tests.
*
* @author Eren Avsarogullari
* @since 1.0.0
*/
-public class HazelcastTestRequestHandlerAdvice extends AbstractRequestHandlerAdvice {
+public class HazelcastTestRequestHandlerAdvice extends AbstractRequestHandlerAdvice {
public CountDownLatch executeLatch = null;
diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastCQDistributedMapInboundChannelAdapterTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastCQDistributedMapInboundChannelAdapterTests.java
index 95cc4a6..f83f6c3 100644
--- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastCQDistributedMapInboundChannelAdapterTests.java
+++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastCQDistributedMapInboundChannelAdapterTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2016 the original author or authors.
+ * Copyright 2015-2017 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.
@@ -16,9 +16,9 @@
package org.springframework.integration.hazelcast.inbound;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.assertEquals;
import javax.annotation.Resource;
@@ -51,127 +51,127 @@ import com.hazelcast.core.IMap;
@SuppressWarnings("unchecked")
public class HazelcastCQDistributedMapInboundChannelAdapterTests {
- @Autowired
- private PollableChannel cqMapChannel1;
+ @Autowired
+ private PollableChannel cqMapChannel1;
- @Autowired
- private PollableChannel cqMapChannel2;
+ @Autowired
+ private PollableChannel cqMapChannel2;
- @Autowired
- private PollableChannel cqMapChannel3;
+ @Autowired
+ private PollableChannel cqMapChannel3;
- @Autowired
- private PollableChannel cqMapChannel4;
+ @Autowired
+ private PollableChannel cqMapChannel4;
- @Autowired
- private PollableChannel cqMapChannel5;
+ @Autowired
+ private PollableChannel cqMapChannel5;
- @Resource
- private IMap cqDistributedMap1;
+ @Resource
+ private IMap cqDistributedMap1;
- @Resource
- private IMap cqDistributedMap2;
+ @Resource
+ private IMap cqDistributedMap2;
- @Resource
- private IMap cqDistributedMap3;
+ @Resource
+ private IMap cqDistributedMap3;
- @Resource
- private IMap cqDistributedMap4;
+ @Resource
+ private IMap cqDistributedMap4;
- @Resource
- private IMap cqDistributedMap5;
+ @Resource
+ private IMap cqDistributedMap5;
- @Test
- public void testContinuousQueryForOnlyADDEDEntryEvent() {
- HazelcastInboundChannelAdapterTestUtils
- .testEventDrivenForADDEDDistributedMapEntryEvent(cqDistributedMap1,
- cqMapChannel1, "cqDistributedMap1");
- }
+ @Test
+ public void testContinuousQueryForOnlyADDEDEntryEvent() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testEventDrivenForADDEDDistributedMapEntryEvent(cqDistributedMap1,
+ cqMapChannel1, "cqDistributedMap1");
+ }
- @Test
- public void testContinuousQueryForOnlyREMOVEDEntryEvent() {
- cqDistributedMap2
- .put(1, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
- cqDistributedMap2
- .put(2, new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2"));
- cqDistributedMap2.remove(2);
- Message> msg =
- cqMapChannel2.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
- assertNotNull(msg);
- assertNotNull(msg.getPayload());
- assertTrue(msg.getPayload() instanceof EntryEventMessagePayload);
- assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
- assertEquals(EntryEventType.REMOVED.name(),
- msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE));
- assertEquals("cqDistributedMap2",
- msg.getHeaders().get(HazelcastHeaders.CACHE_NAME));
+ @Test
+ public void testContinuousQueryForOnlyREMOVEDEntryEvent() {
+ cqDistributedMap2
+ .put(1, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
+ cqDistributedMap2
+ .put(2, new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2"));
+ cqDistributedMap2.remove(2);
+ Message> msg =
+ cqMapChannel2.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
+ assertNotNull(msg);
+ assertNotNull(msg.getPayload());
+ assertTrue(msg.getPayload() instanceof EntryEventMessagePayload);
+ assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
+ assertEquals(EntryEventType.REMOVED.name(),
+ msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE));
+ assertEquals("cqDistributedMap2",
+ msg.getHeaders().get(HazelcastHeaders.CACHE_NAME));
- assertEquals(Integer.valueOf(2),
- ((EntryEventMessagePayload) msg
- .getPayload()).key);
- assertEquals(2,
- (((EntryEventMessagePayload) msg
- .getPayload()).oldValue).getId());
- assertEquals("TestName2",
- (((EntryEventMessagePayload) msg
- .getPayload()).oldValue).getName());
- assertEquals("TestSurname2",
- (((EntryEventMessagePayload) msg
- .getPayload()).oldValue).getSurname());
- }
+ assertEquals(Integer.valueOf(2),
+ ((EntryEventMessagePayload) msg
+ .getPayload()).key);
+ assertEquals(2,
+ (((EntryEventMessagePayload) msg
+ .getPayload()).oldValue).getId());
+ assertEquals("TestName2",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).oldValue).getName());
+ assertEquals("TestSurname2",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).oldValue).getSurname());
+ }
- @Test
- public void testContinuousQueryForALLEntryEvent() {
- HazelcastInboundChannelAdapterTestUtils
- .testEventDrivenForDistributedMapEntryEvents(cqDistributedMap3,
- cqMapChannel3, "cqDistributedMap3");
- }
+ @Test
+ public void testContinuousQueryForALLEntryEvent() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testEventDrivenForDistributedMapEntryEvents(cqDistributedMap3,
+ cqMapChannel3, "cqDistributedMap3");
+ }
- @Test
- public void testContinuousQueryForOnlyUPDATEDEntryEvent() {
- cqDistributedMap4
- .put(1, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
- cqDistributedMap4
- .put(1, new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2"));
- Message> msg =
- cqMapChannel4.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
- assertNotNull(msg);
- assertNotNull(msg.getPayload());
- assertTrue(msg.getPayload() instanceof EntryEventMessagePayload);
- assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
- assertEquals(EntryEventType.UPDATED.name(),
- msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE));
- assertEquals("cqDistributedMap4",
- msg.getHeaders().get(HazelcastHeaders.CACHE_NAME));
+ @Test
+ public void testContinuousQueryForOnlyUPDATEDEntryEvent() {
+ cqDistributedMap4
+ .put(1, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
+ cqDistributedMap4
+ .put(1, new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2"));
+ Message> msg =
+ cqMapChannel4.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
+ assertNotNull(msg);
+ assertNotNull(msg.getPayload());
+ assertTrue(msg.getPayload() instanceof EntryEventMessagePayload);
+ assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
+ assertEquals(EntryEventType.UPDATED.name(),
+ msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE));
+ assertEquals("cqDistributedMap4",
+ msg.getHeaders().get(HazelcastHeaders.CACHE_NAME));
- assertEquals(Integer.valueOf(1),
- ((EntryEventMessagePayload) msg
- .getPayload()).key);
- assertEquals(1,
- (((EntryEventMessagePayload) msg
- .getPayload()).oldValue).getId());
- assertEquals("TestName1",
- (((EntryEventMessagePayload) msg
- .getPayload()).oldValue).getName());
- assertEquals("TestSurname1",
- (((EntryEventMessagePayload) msg
- .getPayload()).oldValue).getSurname());
- assertEquals(2,
- (((EntryEventMessagePayload) msg
- .getPayload()).value).getId());
- assertEquals("TestName2",
- (((EntryEventMessagePayload) msg
- .getPayload()).value).getName());
- assertEquals("TestSurname2",
- (((EntryEventMessagePayload) msg
- .getPayload()).value).getSurname());
- }
+ assertEquals(Integer.valueOf(1),
+ ((EntryEventMessagePayload) msg
+ .getPayload()).key);
+ assertEquals(1,
+ (((EntryEventMessagePayload) msg
+ .getPayload()).oldValue).getId());
+ assertEquals("TestName1",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).oldValue).getName());
+ assertEquals("TestSurname1",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).oldValue).getSurname());
+ assertEquals(2,
+ (((EntryEventMessagePayload) msg
+ .getPayload()).value).getId());
+ assertEquals("TestName2",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).value).getName());
+ assertEquals("TestSurname2",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).value).getSurname());
+ }
- @Test
- public void testContinuousQueryForOnlyUPDATEDEntryEventWhenIncludeValueIsFalse() {
- HazelcastInboundChannelAdapterTestUtils
- .testContinuousQueryForUPDATEDEntryEventWhenIncludeValueIsFalse(
- cqDistributedMap5, cqMapChannel5, "cqDistributedMap5");
- }
+ @Test
+ public void testContinuousQueryForOnlyUPDATEDEntryEventWhenIncludeValueIsFalse() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testContinuousQueryForUPDATEDEntryEventWhenIncludeValueIsFalse(
+ cqDistributedMap5, cqMapChannel5, "cqDistributedMap5");
+ }
}
diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastClusterMonitorInboundChannelAdapterTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastClusterMonitorInboundChannelAdapterTests.java
index bb4d455..48e22f0 100644
--- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastClusterMonitorInboundChannelAdapterTests.java
+++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastClusterMonitorInboundChannelAdapterTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2016 the original author or authors.
+ * Copyright 2015-2017 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.
@@ -16,9 +16,10 @@
package org.springframework.integration.hazelcast.inbound;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
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.Test;
import org.junit.runner.RunWith;
@@ -53,135 +54,136 @@ import com.hazelcast.core.MigrationEvent;
@DirtiesContext
public class HazelcastClusterMonitorInboundChannelAdapterTests {
- private static final String TEST_GROUP_NAME1 = "Test_Group_Name1";
+ private static final String TEST_GROUP_NAME1 = "Test_Group_Name1";
- @Autowired
- private PollableChannel cmChannel1;
+ @Autowired
+ private PollableChannel cmChannel1;
- @Autowired
- private PollableChannel cmChannel2;
+ @Autowired
+ private PollableChannel cmChannel2;
- @Autowired
- private PollableChannel cmChannel3;
+ @Autowired
+ private PollableChannel cmChannel3;
- @Autowired
- private PollableChannel cmChannel4;
+ @Autowired
+ private PollableChannel cmChannel4;
- @Autowired
- private PollableChannel cmChannel5;
+ @Autowired
+ private PollableChannel cmChannel5;
- @Autowired
- private PollableChannel cmChannel6;
+ @Autowired
+ private PollableChannel cmChannel6;
- @Autowired
- private HazelcastInstance hazelcastInstance;
+ @Autowired
+ private HazelcastInstance hazelcastInstance;
- @Autowired
- private HazelcastInstance hazelcastInstance2;
+ @Autowired
+ private HazelcastInstance hazelcastInstance2;
- @Autowired
- private HazelcastInstance hazelcastInstance3;
+ @Autowired
+ private HazelcastInstance hazelcastInstance3;
- @Test
- public void testMembershipEvent() {
- HazelcastInboundChannelAdapterTestUtils
- .testMembershipEvent(hazelcastInstance, cmChannel1, "testKey1", "testValue1");
- }
+ @Test
+ public void testMembershipEvent() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testMembershipEvent(hazelcastInstance, cmChannel1, "testKey1", "testValue1");
+ }
- @Test
- public void testDistributedObjectEvent() {
- HazelcastInboundChannelAdapterTestUtils
- .testDistributedObjectEventByChannelAndHazelcastInstance(cmChannel2,
- hazelcastInstance, "Test_Distributed_Map4");
- }
+ @Test
+ public void testDistributedObjectEvent() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testDistributedObjectEventByChannelAndHazelcastInstance(cmChannel2,
+ hazelcastInstance, "Test_Distributed_Map4");
+ }
- @Test
- public void testMigrationEvent() {
- final IMap distributedMap =
- hazelcastInstance3.getMap("Test_Distributed_Map2");
- distributedMap.put(1, "TestValue1");
- distributedMap.put(2, "TestValue2");
+ @Test
+ public void testMigrationEvent() {
+ final IMap distributedMap =
+ hazelcastInstance3.getMap("Test_Distributed_Map2");
+ distributedMap.put(1, "TestValue1");
+ distributedMap.put(2, "TestValue2");
- hazelcastInstance3.getLifecycleService().terminate();
- final Message> msg =
- cmChannel3.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
- verifyMigrationEvent(msg);
- }
+ hazelcastInstance3.getLifecycleService().terminate();
+ final Message> msg = this.cmChannel3.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
+ verifyMigrationEvent(msg);
+ }
- @Test
- public void testLifecycleEvent() throws InterruptedException {
- hazelcastInstance2.getLifecycleService().terminate();
+ @Test
+ public void testLifecycleEvent() {
+ hazelcastInstance2.getLifecycleService().terminate();
- Message> msg =
- cmChannel4.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
- verifyLifecycleEvent(msg, LifecycleState.SHUTTING_DOWN);
+ Message> msg =
+ cmChannel4.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
+ verifyLifecycleEvent(msg, LifecycleState.SHUTTING_DOWN);
- msg = cmChannel4.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
- verifyLifecycleEvent(msg, LifecycleState.SHUTDOWN);
- }
+ msg = cmChannel4.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
+ verifyLifecycleEvent(msg, LifecycleState.SHUTDOWN);
+ }
- @Test
- public void testClientEvent() {
- testClientEventByChannelAndGroupName(cmChannel5, TEST_GROUP_NAME1);
- }
+ @Test
+ public void testClientEvent() {
+ testClientEventByChannelAndGroupName(cmChannel5, TEST_GROUP_NAME1);
+ }
- @Test
- public void testMultipleMonitorTypes() {
- HazelcastInboundChannelAdapterTestUtils
- .testDistributedObjectEventByChannelAndHazelcastInstance(cmChannel6,
- hazelcastInstance, "Test_Distributed_Map5");
+ @Test
+ public void testMultipleMonitorTypes() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testDistributedObjectEventByChannelAndHazelcastInstance(cmChannel6,
+ hazelcastInstance, "Test_Distributed_Map5");
- HazelcastInboundChannelAdapterTestUtils
- .testMembershipEvent(hazelcastInstance, cmChannel6, "testKey2", "testValue2");
- }
+ HazelcastInboundChannelAdapterTestUtils
+ .testMembershipEvent(hazelcastInstance, cmChannel6, "testKey2", "testValue2");
+ }
- private void testClientEventByChannelAndGroupName(final PollableChannel channel,
- final String groupName) {
- final HazelcastInstance client = getHazelcastClientByGroupName(groupName);
+ private void testClientEventByChannelAndGroupName(final PollableChannel channel,
+ final String groupName) {
+ final HazelcastInstance client = getHazelcastClientByGroupName(groupName);
- Message> msg = channel.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
- verifyClientEvent(msg);
+ Message> msg = channel.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
+ verifyClientEvent(msg);
- client.getLifecycleService().terminate();
+ client.getLifecycleService().terminate();
- msg = channel.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
- verifyClientEvent(msg);
- }
+ msg = channel.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
+ verifyClientEvent(msg);
+ }
- private HazelcastInstance getHazelcastClientByGroupName(final String groupName) {
- final GroupConfig groupConfig = new GroupConfig();
- groupConfig.setName(groupName);
- groupConfig.setPassword("dev-pass");
- final ClientConfig cfg = new ClientConfig();
- cfg.setGroupConfig(groupConfig);
- cfg.getNetworkConfig().addAddress("127.0.0.1:5701");
+ private HazelcastInstance getHazelcastClientByGroupName(final String groupName) {
+ final GroupConfig groupConfig = new GroupConfig();
+ groupConfig.setName(groupName);
+ groupConfig.setPassword("dev-pass");
+ final ClientConfig cfg = new ClientConfig();
+ cfg.setGroupConfig(groupConfig);
+ cfg.getNetworkConfig().addAddress("127.0.0.1:5701");
- return HazelcastClient.newHazelcastClient(cfg);
- }
+ 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());
- assertNotNull(((MigrationEvent) msg.getPayload()).getOldOwner());
- }
+ 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());
- private void verifyLifecycleEvent(final Message> msg,
- final LifecycleState lifecycleState) {
- assertNotNull(msg);
- assertNotNull(msg.getPayload());
- assertTrue(msg.getPayload() instanceof LifecycleEvent);
- assertEquals(lifecycleState, ((LifecycleEvent) msg.getPayload()).getState());
- }
+ // Newer Hazelcast versions doesn't populated 'oldOwner' if we drop member on the same host
+ assertNull(((MigrationEvent) msg.getPayload()).getOldOwner());
+ }
- private void verifyClientEvent(final Message> msg) {
- assertNotNull(msg);
- assertNotNull(msg.getPayload());
- assertTrue(msg.getPayload() instanceof Client);
- assertEquals(ClientType.JAVA, ((Client) msg.getPayload()).getClientType());
- assertNotNull(((Client) msg.getPayload()).getSocketAddress());
- }
+ private void verifyLifecycleEvent(final Message> msg,
+ final LifecycleState lifecycleState) {
+ assertNotNull(msg);
+ assertNotNull(msg.getPayload());
+ assertTrue(msg.getPayload() instanceof LifecycleEvent);
+ assertEquals(lifecycleState, ((LifecycleEvent) msg.getPayload()).getState());
+ }
+
+ private void verifyClientEvent(final Message> msg) {
+ assertNotNull(msg);
+ assertNotNull(msg.getPayload());
+ assertTrue(msg.getPayload() instanceof Client);
+ assertEquals(ClientType.JAVA, ((Client) msg.getPayload()).getClientType());
+ assertNotNull(((Client) msg.getPayload()).getSocketAddress());
+ }
}
diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedListEventDrivenInboundChannelAdapterTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedListEventDrivenInboundChannelAdapterTests.java
index 55cc315..0a2c4d7 100644
--- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedListEventDrivenInboundChannelAdapterTests.java
+++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedListEventDrivenInboundChannelAdapterTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2016 the original author or authors.
+ * Copyright 2015-2017 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.
@@ -48,56 +48,56 @@ import com.hazelcast.core.IList;
@DirtiesContext
public class HazelcastDistributedListEventDrivenInboundChannelAdapterTests {
- @Autowired
- private PollableChannel edListChannel1;
+ @Autowired
+ private PollableChannel edListChannel1;
- @Autowired
- private PollableChannel edListChannel2;
+ @Autowired
+ private PollableChannel edListChannel2;
- @Autowired
- private PollableChannel edListChannel3;
+ @Autowired
+ private PollableChannel edListChannel3;
- @Resource
- private IList edDistributedList1;
+ @Resource
+ private IList edDistributedList1;
- @Resource
- private IList edDistributedList2;
+ @Resource
+ private IList edDistributedList2;
- @Resource
- private IList edDistributedList3;
+ @Resource
+ private IList edDistributedList3;
- @Test
- public void testEventDrivenForOnlyADDEDEntryEvent() {
- edDistributedList1.add(new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
- Message> msg = edListChannel1.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
- assertNotNull(msg);
- assertNotNull(msg.getPayload());
- assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
- assertEquals(EntryEventType.ADDED.toString(), msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString());
- assertEquals(1, ((HazelcastIntegrationTestUser) msg.getPayload()).getId());
- assertEquals("TestName1", ((HazelcastIntegrationTestUser) msg.getPayload()).getName());
- assertEquals("TestSurname1", ((HazelcastIntegrationTestUser) msg.getPayload()).getSurname());
- }
+ @Test
+ public void testEventDrivenForOnlyADDEDEntryEvent() {
+ edDistributedList1.add(new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
+ Message> msg = edListChannel1.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
+ assertNotNull(msg);
+ assertNotNull(msg.getPayload());
+ assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
+ assertEquals(EntryEventType.ADDED.toString(), msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString());
+ assertEquals(1, ((HazelcastIntegrationTestUser) msg.getPayload()).getId());
+ assertEquals("TestName1", ((HazelcastIntegrationTestUser) msg.getPayload()).getName());
+ assertEquals("TestSurname1", ((HazelcastIntegrationTestUser) msg.getPayload()).getSurname());
+ }
- @Test
- public void testEventDrivenForOnlyREMOVEDEntryEvent() {
- HazelcastIntegrationTestUser user = new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2");
- edDistributedList2.add(user);
- edDistributedList2.remove(user);
- Message> msg = edListChannel2.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
- assertNotNull(msg);
- assertNotNull(msg.getPayload());
- assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
- assertEquals(EntryEventType.REMOVED.toString(), msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString());
- assertEquals(2, ((HazelcastIntegrationTestUser) msg.getPayload()).getId());
- assertEquals("TestName2", ((HazelcastIntegrationTestUser) msg.getPayload()).getName());
- assertEquals("TestSurname2", ((HazelcastIntegrationTestUser) msg.getPayload()).getSurname());
- }
+ @Test
+ public void testEventDrivenForOnlyREMOVEDEntryEvent() {
+ HazelcastIntegrationTestUser user = new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2");
+ edDistributedList2.add(user);
+ edDistributedList2.remove(user);
+ Message> msg = edListChannel2.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
+ assertNotNull(msg);
+ assertNotNull(msg.getPayload());
+ assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
+ assertEquals(EntryEventType.REMOVED.toString(), msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString());
+ assertEquals(2, ((HazelcastIntegrationTestUser) msg.getPayload()).getId());
+ assertEquals("TestName2", ((HazelcastIntegrationTestUser) msg.getPayload()).getName());
+ assertEquals("TestSurname2", ((HazelcastIntegrationTestUser) msg.getPayload()).getSurname());
+ }
- @Test
- public void testEventDrivenForALLEntryEvent() {
- HazelcastInboundChannelAdapterTestUtils
- .testEventDrivenForDistributedCollectionItemEvents(edDistributedList3, edListChannel3);
- }
+ @Test
+ public void testEventDrivenForALLEntryEvent() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testEventDrivenForDistributedCollectionItemEvents(edDistributedList3, edListChannel3);
+ }
}
diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedMapEventDrivenInboundChannelAdapterTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedMapEventDrivenInboundChannelAdapterTests.java
index 4dd5b60..a47f753 100644
--- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedMapEventDrivenInboundChannelAdapterTests.java
+++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedMapEventDrivenInboundChannelAdapterTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2016 the original author or authors.
+ * Copyright 2015-2017 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.
@@ -48,114 +48,114 @@ import com.hazelcast.core.IMap;
@SuppressWarnings("unchecked")
public class HazelcastDistributedMapEventDrivenInboundChannelAdapterTests {
- @Autowired
- private PollableChannel edMapChannel1;
+ @Autowired
+ private PollableChannel edMapChannel1;
- @Autowired
- private PollableChannel edMapChannel2;
+ @Autowired
+ private PollableChannel edMapChannel2;
- @Autowired
- private PollableChannel edMapChannel3;
+ @Autowired
+ private PollableChannel edMapChannel3;
- @Autowired
- private PollableChannel edMapChannel4;
+ @Autowired
+ private PollableChannel edMapChannel4;
- @Resource
- private IMap edDistributedMap1;
+ @Resource
+ private IMap edDistributedMap1;
- @Resource
- private IMap edDistributedMap2;
+ @Resource
+ private IMap edDistributedMap2;
- @Resource
- private IMap edDistributedMap3;
+ @Resource
+ private IMap edDistributedMap3;
- @Resource
- private IMap edDistributedMap4;
+ @Resource
+ private IMap edDistributedMap4;
- @Test
- public void testEventDrivenForOnlyADDEDEntryEvent() {
- HazelcastInboundChannelAdapterTestUtils
- .testEventDrivenForADDEDDistributedMapEntryEvent(edDistributedMap1,
- edMapChannel1, "edDistributedMap1");
- }
+ @Test
+ public void testEventDrivenForOnlyADDEDEntryEvent() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testEventDrivenForADDEDDistributedMapEntryEvent(edDistributedMap1,
+ edMapChannel1, "edDistributedMap1");
+ }
- @Test
- public void testEventDrivenForOnlyUPDATEDEntryEvent() {
- edDistributedMap2
- .put(2, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
- edDistributedMap2
- .put(2, new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2"));
- Message> msg =
- edMapChannel2.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
- Assert.assertNotNull(msg);
- Assert.assertNotNull(msg.getPayload());
- Assert.assertTrue(msg.getPayload() instanceof EntryEventMessagePayload);
- Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
- Assert.assertEquals(EntryEventType.UPDATED.name(),
- msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE));
- Assert.assertEquals("edDistributedMap2",
- msg.getHeaders().get(HazelcastHeaders.CACHE_NAME));
+ @Test
+ public void testEventDrivenForOnlyUPDATEDEntryEvent() {
+ edDistributedMap2
+ .put(2, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
+ edDistributedMap2
+ .put(2, new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2"));
+ Message> msg =
+ edMapChannel2.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
+ Assert.assertNotNull(msg);
+ Assert.assertNotNull(msg.getPayload());
+ Assert.assertTrue(msg.getPayload() instanceof EntryEventMessagePayload);
+ Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
+ Assert.assertEquals(EntryEventType.UPDATED.name(),
+ msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE));
+ Assert.assertEquals("edDistributedMap2",
+ msg.getHeaders().get(HazelcastHeaders.CACHE_NAME));
- Assert.assertEquals(Integer.valueOf(2),
- ((EntryEventMessagePayload) msg
- .getPayload()).key);
- Assert.assertEquals(1,
- (((EntryEventMessagePayload) msg
- .getPayload()).oldValue).getId());
- Assert.assertEquals("TestName1",
- (((EntryEventMessagePayload) msg
- .getPayload()).oldValue).getName());
- Assert.assertEquals("TestSurname1",
- (((EntryEventMessagePayload) msg
- .getPayload()).oldValue).getSurname());
- Assert.assertEquals(2,
- (((EntryEventMessagePayload) msg
- .getPayload()).value).getId());
- Assert.assertEquals("TestName2",
- (((EntryEventMessagePayload) msg
- .getPayload()).value).getName());
- Assert.assertEquals("TestSurname2",
- (((EntryEventMessagePayload) msg
- .getPayload()).value).getSurname());
- }
+ Assert.assertEquals(Integer.valueOf(2),
+ ((EntryEventMessagePayload) msg
+ .getPayload()).key);
+ Assert.assertEquals(1,
+ (((EntryEventMessagePayload) msg
+ .getPayload()).oldValue).getId());
+ Assert.assertEquals("TestName1",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).oldValue).getName());
+ Assert.assertEquals("TestSurname1",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).oldValue).getSurname());
+ Assert.assertEquals(2,
+ (((EntryEventMessagePayload) msg
+ .getPayload()).value).getId());
+ Assert.assertEquals("TestName2",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).value).getName());
+ Assert.assertEquals("TestSurname2",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).value).getSurname());
+ }
- @Test
- public void testEventDrivenForOnlyREMOVEDEntryEvent() {
- edDistributedMap3
- .put(1, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
- edDistributedMap3
- .put(2, new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2"));
- edDistributedMap3.remove(2);
- Message> msg =
- edMapChannel3.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
- Assert.assertNotNull(msg);
- Assert.assertNotNull(msg.getPayload());
- Assert.assertTrue(msg.getPayload() instanceof EntryEventMessagePayload);
- Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
- Assert.assertEquals(EntryEventType.REMOVED.name(),
- msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE));
- Assert.assertEquals("edDistributedMap3",
- msg.getHeaders().get(HazelcastHeaders.CACHE_NAME));
+ @Test
+ public void testEventDrivenForOnlyREMOVEDEntryEvent() {
+ edDistributedMap3
+ .put(1, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
+ edDistributedMap3
+ .put(2, new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2"));
+ edDistributedMap3.remove(2);
+ Message> msg =
+ edMapChannel3.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
+ Assert.assertNotNull(msg);
+ Assert.assertNotNull(msg.getPayload());
+ Assert.assertTrue(msg.getPayload() instanceof EntryEventMessagePayload);
+ Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
+ Assert.assertEquals(EntryEventType.REMOVED.name(),
+ msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE));
+ Assert.assertEquals("edDistributedMap3",
+ msg.getHeaders().get(HazelcastHeaders.CACHE_NAME));
- Assert.assertEquals(Integer.valueOf(2),
- ((EntryEventMessagePayload) msg
- .getPayload()).key);
- Assert.assertEquals(2,
- (((EntryEventMessagePayload) msg
- .getPayload()).oldValue).getId());
- Assert.assertEquals("TestName2",
- (((EntryEventMessagePayload) msg
- .getPayload()).oldValue).getName());
- Assert.assertEquals("TestSurname2",
- (((EntryEventMessagePayload) msg
- .getPayload()).oldValue).getSurname());
- }
+ Assert.assertEquals(Integer.valueOf(2),
+ ((EntryEventMessagePayload) msg
+ .getPayload()).key);
+ Assert.assertEquals(2,
+ (((EntryEventMessagePayload) msg
+ .getPayload()).oldValue).getId());
+ Assert.assertEquals("TestName2",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).oldValue).getName());
+ Assert.assertEquals("TestSurname2",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).oldValue).getSurname());
+ }
- @Test
- public void testEventDrivenForALLEntryEvent() {
- HazelcastInboundChannelAdapterTestUtils
- .testEventDrivenForDistributedMapEntryEvents(edDistributedMap4, edMapChannel4,
- "edDistributedMap4");
- }
+ @Test
+ public void testEventDrivenForALLEntryEvent() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testEventDrivenForDistributedMapEntryEvents(edDistributedMap4, edMapChannel4,
+ "edDistributedMap4");
+ }
}
diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedQueueEventDrivenInboundChannelAdapterTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedQueueEventDrivenInboundChannelAdapterTests.java
index a8cc9d4..3932f73 100644
--- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedQueueEventDrivenInboundChannelAdapterTests.java
+++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedQueueEventDrivenInboundChannelAdapterTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2016 the original author or authors.
+ * Copyright 2015-2017 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.
@@ -46,69 +46,69 @@ import com.hazelcast.core.IQueue;
@DirtiesContext
public class HazelcastDistributedQueueEventDrivenInboundChannelAdapterTests {
- @Autowired
- private PollableChannel edQueueChannel1;
+ @Autowired
+ private PollableChannel edQueueChannel1;
- @Autowired
- private PollableChannel edQueueChannel2;
+ @Autowired
+ private PollableChannel edQueueChannel2;
- @Autowired
- private PollableChannel edQueueChannel3;
+ @Autowired
+ private PollableChannel edQueueChannel3;
- @Resource
- private IQueue edDistributedQueue1;
+ @Resource
+ private IQueue edDistributedQueue1;
- @Resource
- private IQueue edDistributedQueue2;
+ @Resource
+ private IQueue edDistributedQueue2;
- @Resource
- private IQueue edDistributedQueue3;
+ @Resource
+ private IQueue edDistributedQueue3;
- @Test
- public void testEventDrivenForOnlyADDEDEntryEvent() {
- edDistributedQueue1
- .add(new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
- Message> msg =
- edQueueChannel1.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
- Assert.assertNotNull(msg);
- Assert.assertNotNull(msg.getPayload());
- Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
- Assert.assertEquals(EntryEventType.ADDED.toString(),
- msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString());
- Assert
- .assertEquals(1, (((HazelcastIntegrationTestUser) msg.getPayload()).getId()));
- Assert.assertEquals("TestName1",
- (((HazelcastIntegrationTestUser) msg.getPayload()).getName()));
- Assert.assertEquals("TestSurname1",
- (((HazelcastIntegrationTestUser) msg.getPayload()).getSurname()));
- }
+ @Test
+ public void testEventDrivenForOnlyADDEDEntryEvent() {
+ edDistributedQueue1
+ .add(new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
+ Message> msg =
+ edQueueChannel1.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
+ Assert.assertNotNull(msg);
+ Assert.assertNotNull(msg.getPayload());
+ Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
+ Assert.assertEquals(EntryEventType.ADDED.toString(),
+ msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString());
+ Assert
+ .assertEquals(1, (((HazelcastIntegrationTestUser) msg.getPayload()).getId()));
+ Assert.assertEquals("TestName1",
+ (((HazelcastIntegrationTestUser) msg.getPayload()).getName()));
+ Assert.assertEquals("TestSurname1",
+ (((HazelcastIntegrationTestUser) msg.getPayload()).getSurname()));
+ }
- @Test
- public void testEventDrivenForOnlyREMOVEDEntryEvent() {
- HazelcastIntegrationTestUser user =
- new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2");
- edDistributedQueue2.add(user);
- edDistributedQueue2.remove(user);
- Message> msg =
- edQueueChannel2.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
- Assert.assertNotNull(msg);
- Assert.assertNotNull(msg.getPayload());
- Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
- Assert.assertEquals(EntryEventType.REMOVED.toString(),
- msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString());
- Assert
- .assertEquals(2, (((HazelcastIntegrationTestUser) msg.getPayload()).getId()));
- Assert.assertEquals("TestName2",
- (((HazelcastIntegrationTestUser) msg.getPayload()).getName()));
- Assert.assertEquals("TestSurname2",
- (((HazelcastIntegrationTestUser) msg.getPayload()).getSurname()));
- }
+ @Test
+ public void testEventDrivenForOnlyREMOVEDEntryEvent() {
+ HazelcastIntegrationTestUser user =
+ new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2");
+ edDistributedQueue2.add(user);
+ edDistributedQueue2.remove(user);
+ Message> msg =
+ edQueueChannel2.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
+ Assert.assertNotNull(msg);
+ Assert.assertNotNull(msg.getPayload());
+ Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
+ Assert.assertEquals(EntryEventType.REMOVED.toString(),
+ msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString());
+ Assert
+ .assertEquals(2, (((HazelcastIntegrationTestUser) msg.getPayload()).getId()));
+ Assert.assertEquals("TestName2",
+ (((HazelcastIntegrationTestUser) msg.getPayload()).getName()));
+ Assert.assertEquals("TestSurname2",
+ (((HazelcastIntegrationTestUser) msg.getPayload()).getSurname()));
+ }
- @Test
- public void testEventDrivenForALLEntryEvent() {
- HazelcastInboundChannelAdapterTestUtils
- .testEventDrivenForDistributedCollectionItemEvents(edDistributedQueue3,
- edQueueChannel3);
- }
+ @Test
+ public void testEventDrivenForALLEntryEvent() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testEventDrivenForDistributedCollectionItemEvents(edDistributedQueue3,
+ edQueueChannel3);
+ }
}
diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedSQLInboundChannelAdapterTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedSQLInboundChannelAdapterTests.java
index fa4f405..16f60a6 100644
--- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedSQLInboundChannelAdapterTests.java
+++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedSQLInboundChannelAdapterTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2016 the original author or authors.
+ * Copyright 2015-2017 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.
@@ -42,52 +42,52 @@ import com.hazelcast.core.IMap;
@DirtiesContext
public class HazelcastDistributedSQLInboundChannelAdapterTests {
- @Autowired
- private PollableChannel dsMapChannel1;
+ @Autowired
+ private PollableChannel dsMapChannel1;
- @Autowired
- private PollableChannel dsMapChannel2;
+ @Autowired
+ private PollableChannel dsMapChannel2;
- @Autowired
- private PollableChannel dsMapChannel3;
+ @Autowired
+ private PollableChannel dsMapChannel3;
- @Autowired
- private PollableChannel dsMapChannel4;
+ @Autowired
+ private PollableChannel dsMapChannel4;
- @Resource
- private IMap dsDistributedMap1;
+ @Resource
+ private IMap dsDistributedMap1;
- @Resource
- private IMap dsDistributedMap2;
+ @Resource
+ private IMap dsDistributedMap2;
- @Resource
- private IMap dsDistributedMap3;
+ @Resource
+ private IMap dsDistributedMap3;
- @Resource
- private IMap dsDistributedMap4;
+ @Resource
+ private IMap dsDistributedMap4;
- @Test
- public void testDistributedSQLForOnlyENTRYIterationType() {
- HazelcastInboundChannelAdapterTestUtils
- .testDistributedSQLForENTRYIterationType(dsDistributedMap1, dsMapChannel1);
- }
+ @Test
+ public void testDistributedSQLForOnlyENTRYIterationType() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testDistributedSQLForENTRYIterationType(dsDistributedMap1, dsMapChannel1);
+ }
- @Test
- public void testDistributedSQLForOnlyKEYIterationType() {
- HazelcastInboundChannelAdapterTestUtils
- .testDistributedSQLForKEYIterationType(dsDistributedMap2, dsMapChannel2);
- }
+ @Test
+ public void testDistributedSQLForOnlyKEYIterationType() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testDistributedSQLForKEYIterationType(dsDistributedMap2, dsMapChannel2);
+ }
- @Test
- public void testDistributedSQLForOnlyLOCAL_KEYIterationType() {
- HazelcastInboundChannelAdapterTestUtils
- .testDistributedSQLForLOCAL_KEYIterationType(dsDistributedMap3, dsMapChannel3);
- }
+ @Test
+ public void testDistributedSQLForOnlyLOCAL_KEYIterationType() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testDistributedSQLForLOCAL_KEYIterationType(dsDistributedMap3, dsMapChannel3);
+ }
- @Test
- public void testDistributedSQLForOnlyVALUEIterationType() {
- HazelcastInboundChannelAdapterTestUtils
- .testDistributedSQLForVALUEIterationType(dsDistributedMap4, dsMapChannel4);
- }
+ @Test
+ public void testDistributedSQLForOnlyVALUEIterationType() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testDistributedSQLForVALUEIterationType(dsDistributedMap4, dsMapChannel4);
+ }
}
diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedSetEventDrivenInboundChannelAdapterTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedSetEventDrivenInboundChannelAdapterTests.java
index ad9860d..abe2946 100644
--- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedSetEventDrivenInboundChannelAdapterTests.java
+++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedSetEventDrivenInboundChannelAdapterTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2016 the original author or authors.
+ * Copyright 2015-2017 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.
@@ -46,69 +46,69 @@ import com.hazelcast.core.ISet;
@DirtiesContext
public class HazelcastDistributedSetEventDrivenInboundChannelAdapterTests {
- @Autowired
- private PollableChannel edSetChannel1;
+ @Autowired
+ private PollableChannel edSetChannel1;
- @Autowired
- private PollableChannel edSetChannel2;
+ @Autowired
+ private PollableChannel edSetChannel2;
- @Autowired
- private PollableChannel edSetChannel3;
+ @Autowired
+ private PollableChannel edSetChannel3;
- @Resource
- private ISet edDistributedSet1;
+ @Resource
+ private ISet edDistributedSet1;
- @Resource
- private ISet edDistributedSet2;
+ @Resource
+ private ISet edDistributedSet2;
- @Resource
- private ISet edDistributedSet3;
+ @Resource
+ private ISet edDistributedSet3;
- @Test
- public void testEventDrivenForOnlyADDEDEntryEvent() {
- edDistributedSet1
- .add(new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
- Message> msg =
- edSetChannel1.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
- Assert.assertNotNull(msg);
- Assert.assertNotNull(msg.getPayload());
- Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
- Assert.assertEquals(EntryEventType.ADDED.toString(),
- msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString());
- Assert
- .assertEquals(1, (((HazelcastIntegrationTestUser) msg.getPayload()).getId()));
- Assert.assertEquals("TestName1",
- (((HazelcastIntegrationTestUser) msg.getPayload()).getName()));
- Assert.assertEquals("TestSurname1",
- (((HazelcastIntegrationTestUser) msg.getPayload()).getSurname()));
- }
+ @Test
+ public void testEventDrivenForOnlyADDEDEntryEvent() {
+ edDistributedSet1
+ .add(new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
+ Message> msg =
+ edSetChannel1.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
+ Assert.assertNotNull(msg);
+ Assert.assertNotNull(msg.getPayload());
+ Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
+ Assert.assertEquals(EntryEventType.ADDED.toString(),
+ msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString());
+ Assert
+ .assertEquals(1, (((HazelcastIntegrationTestUser) msg.getPayload()).getId()));
+ Assert.assertEquals("TestName1",
+ (((HazelcastIntegrationTestUser) msg.getPayload()).getName()));
+ Assert.assertEquals("TestSurname1",
+ (((HazelcastIntegrationTestUser) msg.getPayload()).getSurname()));
+ }
- @Test
- public void testEventDrivenForOnlyREMOVEDEntryEvent() {
- HazelcastIntegrationTestUser user =
- new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2");
- edDistributedSet2.add(user);
- edDistributedSet2.remove(user);
- Message> msg =
- edSetChannel2.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
- Assert.assertNotNull(msg);
- Assert.assertNotNull(msg.getPayload());
- Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
- Assert.assertEquals(EntryEventType.REMOVED.toString(),
- msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString());
- Assert
- .assertEquals(2, (((HazelcastIntegrationTestUser) msg.getPayload()).getId()));
- Assert.assertEquals("TestName2",
- (((HazelcastIntegrationTestUser) msg.getPayload()).getName()));
- Assert.assertEquals("TestSurname2",
- (((HazelcastIntegrationTestUser) msg.getPayload()).getSurname()));
- }
+ @Test
+ public void testEventDrivenForOnlyREMOVEDEntryEvent() {
+ HazelcastIntegrationTestUser user =
+ new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2");
+ edDistributedSet2.add(user);
+ edDistributedSet2.remove(user);
+ Message> msg =
+ edSetChannel2.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
+ Assert.assertNotNull(msg);
+ Assert.assertNotNull(msg.getPayload());
+ Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
+ Assert.assertEquals(EntryEventType.REMOVED.toString(),
+ msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE).toString());
+ Assert
+ .assertEquals(2, (((HazelcastIntegrationTestUser) msg.getPayload()).getId()));
+ Assert.assertEquals("TestName2",
+ (((HazelcastIntegrationTestUser) msg.getPayload()).getName()));
+ Assert.assertEquals("TestSurname2",
+ (((HazelcastIntegrationTestUser) msg.getPayload()).getSurname()));
+ }
- @Test
- public void testEventDrivenForALLEntryEvent() {
- HazelcastInboundChannelAdapterTestUtils
- .testEventDrivenForDistributedCollectionItemEvents(edDistributedSet3,
- edSetChannel3);
- }
+ @Test
+ public void testEventDrivenForALLEntryEvent() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testEventDrivenForDistributedCollectionItemEvents(edDistributedSet3,
+ edSetChannel3);
+ }
}
diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedTopicEventDrivenInboundChannelAdapterTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedTopicEventDrivenInboundChannelAdapterTests.java
index 67a24c0..bd5dc2b 100644
--- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedTopicEventDrivenInboundChannelAdapterTests.java
+++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastDistributedTopicEventDrivenInboundChannelAdapterTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2016 the original author or authors.
+ * Copyright 2015-2017 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.
@@ -42,16 +42,16 @@ import com.hazelcast.core.ITopic;
@DirtiesContext
public class HazelcastDistributedTopicEventDrivenInboundChannelAdapterTests {
- @Autowired
- private PollableChannel edTopicChannel1;
+ @Autowired
+ private PollableChannel edTopicChannel1;
- @Resource
- private ITopic edDistributedTopic1;
+ @Resource
+ private ITopic edDistributedTopic1;
- @Test
- public void testEventDrivenForOnlyADDEDEntryEvent() {
- HazelcastInboundChannelAdapterTestUtils
- .testEventDrivenForTopicMessageEvent(edDistributedTopic1, edTopicChannel1);
- }
+ @Test
+ public void testEventDrivenForOnlyADDEDEntryEvent() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testEventDrivenForTopicMessageEvent(edDistributedTopic1, edTopicChannel1);
+ }
}
diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastMultiMapEventDrivenInboundChannelAdapterTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastMultiMapEventDrivenInboundChannelAdapterTests.java
index f4da8f1..d17ccf2 100644
--- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastMultiMapEventDrivenInboundChannelAdapterTests.java
+++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastMultiMapEventDrivenInboundChannelAdapterTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2016 the original author or authors.
+ * Copyright 2015-2017 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.
@@ -49,91 +49,91 @@ import com.hazelcast.core.MultiMap;
@SuppressWarnings("unchecked")
public class HazelcastMultiMapEventDrivenInboundChannelAdapterTests {
- @Autowired
- private PollableChannel edMultiMapChannel1;
+ @Autowired
+ private PollableChannel edMultiMapChannel1;
- @Autowired
- private PollableChannel edMultiMapChannel2;
+ @Autowired
+ private PollableChannel edMultiMapChannel2;
- @Autowired
- private PollableChannel edMultiMapChannel3;
+ @Autowired
+ private PollableChannel edMultiMapChannel3;
- @Resource
- private MultiMap edMultiMap1;
+ @Resource
+ private MultiMap edMultiMap1;
- @Resource
- private MultiMap edMultiMap2;
+ @Resource
+ private MultiMap edMultiMap2;
- @Resource
- private MultiMap edMultiMap3;
+ @Resource
+ private MultiMap edMultiMap3;
- @Test
- public void testEventDrivenForOnlyADDEDEntryEvent() {
- edMultiMap1
- .put(1, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
- Message> msg =
- edMultiMapChannel1.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
- Assert.assertNotNull(msg);
- Assert.assertNotNull(msg.getPayload());
- Assert.assertTrue(msg.getPayload() instanceof EntryEventMessagePayload);
- Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
- Assert.assertEquals(EntryEventType.ADDED.name(),
- msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE));
- Assert.assertEquals("edMultiMap1",
- msg.getHeaders().get(HazelcastHeaders.CACHE_NAME));
+ @Test
+ public void testEventDrivenForOnlyADDEDEntryEvent() {
+ edMultiMap1
+ .put(1, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
+ Message> msg =
+ edMultiMapChannel1.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
+ Assert.assertNotNull(msg);
+ Assert.assertNotNull(msg.getPayload());
+ Assert.assertTrue(msg.getPayload() instanceof EntryEventMessagePayload);
+ Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
+ Assert.assertEquals(EntryEventType.ADDED.name(),
+ msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE));
+ Assert.assertEquals("edMultiMap1",
+ msg.getHeaders().get(HazelcastHeaders.CACHE_NAME));
- Assert.assertEquals(Integer.valueOf(1),
- ((EntryEventMessagePayload) msg
- .getPayload()).key);
- Assert.assertEquals(1,
- (((EntryEventMessagePayload) msg
- .getPayload()).value).getId());
- Assert.assertEquals("TestName1",
- (((EntryEventMessagePayload) msg
- .getPayload()).value).getName());
- Assert.assertEquals("TestSurname1",
- (((EntryEventMessagePayload) msg
- .getPayload()).value).getSurname());
- }
+ Assert.assertEquals(Integer.valueOf(1),
+ ((EntryEventMessagePayload) msg
+ .getPayload()).key);
+ Assert.assertEquals(1,
+ (((EntryEventMessagePayload) msg
+ .getPayload()).value).getId());
+ Assert.assertEquals("TestName1",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).value).getName());
+ Assert.assertEquals("TestSurname1",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).value).getSurname());
+ }
- @Test
- public void testEventDrivenForOnlyREMOVEDEntryEvent() {
- edMultiMap2
- .put(1, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
- edMultiMap2
- .put(2, new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2"));
- edMultiMap2.remove(2);
- Message> msg =
- edMultiMapChannel2.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
- Assert.assertNotNull(msg);
- Assert.assertNotNull(msg.getPayload());
- Assert.assertTrue(msg.getPayload() instanceof EntryEventMessagePayload);
- Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
- Assert.assertEquals(EntryEventType.REMOVED.name(),
- msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE));
- Assert.assertEquals("edMultiMap2",
- msg.getHeaders().get(HazelcastHeaders.CACHE_NAME));
+ @Test
+ public void testEventDrivenForOnlyREMOVEDEntryEvent() {
+ edMultiMap2
+ .put(1, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
+ edMultiMap2
+ .put(2, new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2"));
+ edMultiMap2.remove(2);
+ Message> msg =
+ edMultiMapChannel2.receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
+ Assert.assertNotNull(msg);
+ Assert.assertNotNull(msg.getPayload());
+ Assert.assertTrue(msg.getPayload() instanceof EntryEventMessagePayload);
+ Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
+ Assert.assertEquals(EntryEventType.REMOVED.name(),
+ msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE));
+ Assert.assertEquals("edMultiMap2",
+ msg.getHeaders().get(HazelcastHeaders.CACHE_NAME));
- Assert.assertEquals(Integer.valueOf(2),
- ((EntryEventMessagePayload) msg
- .getPayload()).key);
- Assert.assertNull(((EntryEventMessagePayload, ?>) msg.getPayload()).value);
- Assert.assertEquals(2,
- (((EntryEventMessagePayload) msg
- .getPayload()).oldValue).getId());
- Assert.assertEquals("TestName2",
- (((EntryEventMessagePayload) msg
- .getPayload()).oldValue).getName());
- Assert.assertEquals("TestSurname2",
- (((EntryEventMessagePayload) msg
- .getPayload()).oldValue).getSurname());
- }
+ Assert.assertEquals(Integer.valueOf(2),
+ ((EntryEventMessagePayload) msg
+ .getPayload()).key);
+ Assert.assertNull(((EntryEventMessagePayload, ?>) msg.getPayload()).value);
+ Assert.assertEquals(2,
+ (((EntryEventMessagePayload) msg
+ .getPayload()).oldValue).getId());
+ Assert.assertEquals("TestName2",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).oldValue).getName());
+ Assert.assertEquals("TestSurname2",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).oldValue).getSurname());
+ }
- @Test
- public void testEventDrivenForALLEntryEvent() {
- HazelcastInboundChannelAdapterTestUtils
- .testEventDrivenForMultiMapEntryEvents(edMultiMap3, edMultiMapChannel3,
- "edMultiMap3");
- }
+ @Test
+ public void testEventDrivenForALLEntryEvent() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testEventDrivenForMultiMapEntryEvents(edMultiMap3, edMultiMapChannel3,
+ "edMultiMap3");
+ }
}
diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastReplicatedMapEventDrivenInboundChannelAdapterTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastReplicatedMapEventDrivenInboundChannelAdapterTests.java
index 8b4cb7d..4602eb1 100644
--- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastReplicatedMapEventDrivenInboundChannelAdapterTests.java
+++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/HazelcastReplicatedMapEventDrivenInboundChannelAdapterTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2016 the original author or authors.
+ * Copyright 2015-2017 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.
@@ -48,137 +48,137 @@ import com.hazelcast.core.ReplicatedMap;
@SuppressWarnings("unchecked")
public class HazelcastReplicatedMapEventDrivenInboundChannelAdapterTests {
- @Autowired
- private PollableChannel edReplicatedMapChannel1;
+ @Autowired
+ private PollableChannel edReplicatedMapChannel1;
- @Autowired
- private PollableChannel edReplicatedMapChannel2;
+ @Autowired
+ private PollableChannel edReplicatedMapChannel2;
- @Autowired
- private PollableChannel edReplicatedMapChannel3;
+ @Autowired
+ private PollableChannel edReplicatedMapChannel3;
- @Autowired
- private PollableChannel edReplicatedMapChannel4;
+ @Autowired
+ private PollableChannel edReplicatedMapChannel4;
- @Resource
- private ReplicatedMap edReplicatedMap1;
+ @Resource
+ private ReplicatedMap edReplicatedMap1;
- @Resource
- private ReplicatedMap edReplicatedMap2;
+ @Resource
+ private ReplicatedMap edReplicatedMap2;
- @Resource
- private ReplicatedMap edReplicatedMap3;
+ @Resource
+ private ReplicatedMap edReplicatedMap3;
- @Resource
- private ReplicatedMap edReplicatedMap4;
+ @Resource
+ private ReplicatedMap edReplicatedMap4;
- @Test
- public void testEventDrivenForOnlyADDEDEntryEvent() {
- edReplicatedMap1
- .put(1, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
- Message> msg = edReplicatedMapChannel1
- .receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
- Assert.assertNotNull(msg);
- Assert.assertNotNull(msg.getPayload());
- Assert.assertTrue(msg.getPayload() instanceof EntryEventMessagePayload);
- Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
- Assert.assertEquals(EntryEventType.ADDED.name(),
- msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE));
- Assert.assertEquals("edReplicatedMap1",
- msg.getHeaders().get(HazelcastHeaders.CACHE_NAME));
+ @Test
+ public void testEventDrivenForOnlyADDEDEntryEvent() {
+ edReplicatedMap1
+ .put(1, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
+ Message> msg = edReplicatedMapChannel1
+ .receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
+ Assert.assertNotNull(msg);
+ Assert.assertNotNull(msg.getPayload());
+ Assert.assertTrue(msg.getPayload() instanceof EntryEventMessagePayload);
+ Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
+ Assert.assertEquals(EntryEventType.ADDED.name(),
+ msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE));
+ Assert.assertEquals("edReplicatedMap1",
+ msg.getHeaders().get(HazelcastHeaders.CACHE_NAME));
- Assert.assertEquals(Integer.valueOf(1),
- ((EntryEventMessagePayload) msg
- .getPayload()).key);
- Assert.assertEquals(1,
- (((EntryEventMessagePayload) msg
- .getPayload()).value).getId());
- Assert.assertEquals("TestName1",
- (((EntryEventMessagePayload) msg
- .getPayload()).value).getName());
- Assert.assertEquals("TestSurname1",
- (((EntryEventMessagePayload) msg
- .getPayload()).value).getSurname());
- }
+ Assert.assertEquals(Integer.valueOf(1),
+ ((EntryEventMessagePayload) msg
+ .getPayload()).key);
+ Assert.assertEquals(1,
+ (((EntryEventMessagePayload) msg
+ .getPayload()).value).getId());
+ Assert.assertEquals("TestName1",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).value).getName());
+ Assert.assertEquals("TestSurname1",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).value).getSurname());
+ }
- @Test
- public void testEventDrivenForOnlyUPDATEDEntryEvent() {
- edReplicatedMap2
- .put(2, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
- edReplicatedMap2
- .put(2, new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2"));
- Message> msg = edReplicatedMapChannel2
- .receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
- Assert.assertNotNull(msg);
- Assert.assertNotNull(msg.getPayload());
+ @Test
+ public void testEventDrivenForOnlyUPDATEDEntryEvent() {
+ edReplicatedMap2
+ .put(2, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
+ edReplicatedMap2
+ .put(2, new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2"));
+ Message> msg = edReplicatedMapChannel2
+ .receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
+ Assert.assertNotNull(msg);
+ Assert.assertNotNull(msg.getPayload());
- Assert.assertTrue(msg.getPayload() instanceof EntryEventMessagePayload);
- Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
- Assert.assertEquals(EntryEventType.UPDATED.name(),
- msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE));
- Assert.assertEquals("edReplicatedMap2",
- msg.getHeaders().get(HazelcastHeaders.CACHE_NAME));
+ Assert.assertTrue(msg.getPayload() instanceof EntryEventMessagePayload);
+ Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
+ Assert.assertEquals(EntryEventType.UPDATED.name(),
+ msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE));
+ Assert.assertEquals("edReplicatedMap2",
+ msg.getHeaders().get(HazelcastHeaders.CACHE_NAME));
- Assert.assertEquals(Integer.valueOf(2),
- ((EntryEventMessagePayload) msg
- .getPayload()).key);
- Assert.assertEquals(1,
- (((EntryEventMessagePayload) msg
- .getPayload()).oldValue).getId());
- Assert.assertEquals("TestName1",
- (((EntryEventMessagePayload) msg
- .getPayload()).oldValue).getName());
- Assert.assertEquals("TestSurname1",
- (((EntryEventMessagePayload) msg
- .getPayload()).oldValue).getSurname());
- Assert.assertEquals(2,
- (((EntryEventMessagePayload) msg
- .getPayload()).value).getId());
- Assert.assertEquals("TestName2",
- (((EntryEventMessagePayload) msg
- .getPayload()).value).getName());
- Assert.assertEquals("TestSurname2",
- (((EntryEventMessagePayload) msg
- .getPayload()).value).getSurname());
- }
+ Assert.assertEquals(Integer.valueOf(2),
+ ((EntryEventMessagePayload) msg
+ .getPayload()).key);
+ Assert.assertEquals(1,
+ (((EntryEventMessagePayload) msg
+ .getPayload()).oldValue).getId());
+ Assert.assertEquals("TestName1",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).oldValue).getName());
+ Assert.assertEquals("TestSurname1",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).oldValue).getSurname());
+ Assert.assertEquals(2,
+ (((EntryEventMessagePayload) msg
+ .getPayload()).value).getId());
+ Assert.assertEquals("TestName2",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).value).getName());
+ Assert.assertEquals("TestSurname2",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).value).getSurname());
+ }
- @Test
- public void testEventDrivenForOnlyREMOVEDEntryEvent() {
- edReplicatedMap3
- .put(1, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
- edReplicatedMap3
- .put(2, new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2"));
- edReplicatedMap3.remove(2);
- Message> msg = edReplicatedMapChannel3
- .receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
- Assert.assertNotNull(msg);
- Assert.assertNotNull(msg.getPayload());
- Assert.assertTrue(msg.getPayload() instanceof EntryEventMessagePayload);
- Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
- Assert.assertEquals(EntryEventType.REMOVED.name(),
- msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE));
- Assert.assertEquals("edReplicatedMap3",
- msg.getHeaders().get(HazelcastHeaders.CACHE_NAME));
+ @Test
+ public void testEventDrivenForOnlyREMOVEDEntryEvent() {
+ edReplicatedMap3
+ .put(1, new HazelcastIntegrationTestUser(1, "TestName1", "TestSurname1"));
+ edReplicatedMap3
+ .put(2, new HazelcastIntegrationTestUser(2, "TestName2", "TestSurname2"));
+ edReplicatedMap3.remove(2);
+ Message> msg = edReplicatedMapChannel3
+ .receive(HazelcastInboundChannelAdapterTestUtils.TIMEOUT);
+ Assert.assertNotNull(msg);
+ Assert.assertNotNull(msg.getPayload());
+ Assert.assertTrue(msg.getPayload() instanceof EntryEventMessagePayload);
+ Assert.assertNotNull(msg.getHeaders().get(HazelcastHeaders.MEMBER));
+ Assert.assertEquals(EntryEventType.REMOVED.name(),
+ msg.getHeaders().get(HazelcastHeaders.EVENT_TYPE));
+ Assert.assertEquals("edReplicatedMap3",
+ msg.getHeaders().get(HazelcastHeaders.CACHE_NAME));
- Assert.assertEquals(Integer.valueOf(2),
- ((EntryEventMessagePayload) msg
- .getPayload()).key);
- Assert.assertEquals(2,
- (((EntryEventMessagePayload) msg
- .getPayload()).oldValue).getId());
- Assert.assertEquals("TestName2",
- (((EntryEventMessagePayload) msg
- .getPayload()).oldValue).getName());
- Assert.assertEquals("TestSurname2",
- (((EntryEventMessagePayload) msg
- .getPayload()).oldValue).getSurname());
- }
+ Assert.assertEquals(Integer.valueOf(2),
+ ((EntryEventMessagePayload) msg
+ .getPayload()).key);
+ Assert.assertEquals(2,
+ (((EntryEventMessagePayload) msg
+ .getPayload()).oldValue).getId());
+ Assert.assertEquals("TestName2",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).oldValue).getName());
+ Assert.assertEquals("TestSurname2",
+ (((EntryEventMessagePayload) msg
+ .getPayload()).oldValue).getSurname());
+ }
- @Test
- public void testEventDrivenForALLEntryEvent() {
- HazelcastInboundChannelAdapterTestUtils
- .testEventDrivenForReplicatedMapEntryEvents(edReplicatedMap4,
- edReplicatedMapChannel4, "edReplicatedMap4");
- }
+ @Test
+ public void testEventDrivenForALLEntryEvent() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testEventDrivenForReplicatedMapEntryEvents(edReplicatedMap4,
+ edReplicatedMapChannel4, "edReplicatedMap4");
+ }
}
diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastCQDistributedMapInboundChannelAdapterConfigTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastCQDistributedMapInboundChannelAdapterConfigTests.java
index 418bffc..cb98e9c 100644
--- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastCQDistributedMapInboundChannelAdapterConfigTests.java
+++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastCQDistributedMapInboundChannelAdapterConfigTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2016 the original author or authors.
+ * Copyright 2015-2017 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.
@@ -40,48 +40,48 @@ import com.hazelcast.core.IMap;
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = HazelcastIntegrationInboundTestConfiguration.class,
- loader = AnnotationConfigContextLoader.class)
+ loader = AnnotationConfigContextLoader.class)
@DirtiesContext
public class HazelcastCQDistributedMapInboundChannelAdapterConfigTests {
- @Autowired
- private PollableChannel cqDistributedMapChannel1;
+ @Autowired
+ private PollableChannel cqDistributedMapChannel1;
- @Autowired
- private PollableChannel cqDistributedMapChannel2;
+ @Autowired
+ private PollableChannel cqDistributedMapChannel2;
- @Autowired
- private PollableChannel cqDistributedMapChannel3;
+ @Autowired
+ private PollableChannel cqDistributedMapChannel3;
- @Resource
- private IMap testCQDistributedMap1;
+ @Resource
+ private IMap testCQDistributedMap1;
- @Resource
- private IMap testCQDistributedMap2;
+ @Resource
+ private IMap testCQDistributedMap2;
- @Resource
- private IMap testCQDistributedMap3;
+ @Resource
+ private IMap testCQDistributedMap3;
- @Test
- public void testContinuousQueryForADDEDEntryEvent() {
- HazelcastInboundChannelAdapterTestUtils
- .testEventDrivenForADDEDDistributedMapEntryEvent(testCQDistributedMap1,
- cqDistributedMapChannel1, "Test_CQ_Distributed_Map1");
- }
+ @Test
+ public void testContinuousQueryForADDEDEntryEvent() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testEventDrivenForADDEDDistributedMapEntryEvent(testCQDistributedMap1,
+ cqDistributedMapChannel1, "Test_CQ_Distributed_Map1");
+ }
- @Test
- public void testContinuousQueryForALLEntryEvent() {
- HazelcastInboundChannelAdapterTestUtils
- .testEventDrivenForDistributedMapEntryEvents(testCQDistributedMap2,
- cqDistributedMapChannel2, "Test_CQ_Distributed_Map2");
- }
+ @Test
+ public void testContinuousQueryForALLEntryEvent() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testEventDrivenForDistributedMapEntryEvents(testCQDistributedMap2,
+ cqDistributedMapChannel2, "Test_CQ_Distributed_Map2");
+ }
- @Test
- public void testContinuousQueryForUPDATEDEntryEventWhenIncludeValueIsFalse() {
- HazelcastInboundChannelAdapterTestUtils
- .testContinuousQueryForUPDATEDEntryEventWhenIncludeValueIsFalse(
- testCQDistributedMap3, cqDistributedMapChannel3,
- "Test_CQ_Distributed_Map3");
- }
+ @Test
+ public void testContinuousQueryForUPDATEDEntryEventWhenIncludeValueIsFalse() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testContinuousQueryForUPDATEDEntryEventWhenIncludeValueIsFalse(
+ testCQDistributedMap3, cqDistributedMapChannel3,
+ "Test_CQ_Distributed_Map3");
+ }
}
diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastClusterMonitorInboundChannelAdapterConfigTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastClusterMonitorInboundChannelAdapterConfigTests.java
index 9c1a441..f148326 100644
--- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastClusterMonitorInboundChannelAdapterConfigTests.java
+++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastClusterMonitorInboundChannelAdapterConfigTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2016 the original author or authors.
+ * Copyright 2015-2017 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.
@@ -39,27 +39,27 @@ import com.hazelcast.core.HazelcastInstance;
@DirtiesContext
public class HazelcastClusterMonitorInboundChannelAdapterConfigTests {
- @Autowired
- private PollableChannel cmonChannel;
+ @Autowired
+ private PollableChannel cmonChannel;
- @Autowired
- private PollableChannel cmonChannel2;
+ @Autowired
+ private PollableChannel cmonChannel2;
- @Autowired
- private HazelcastInstance testHazelcastInstance;
+ @Autowired
+ private HazelcastInstance testHazelcastInstance;
- @Test
- public void testConfigDrivenMembershipEvent() {
- HazelcastInboundChannelAdapterTestUtils
- .testMembershipEvent(testHazelcastInstance, cmonChannel, "testKey1",
- "testValue1");
- }
+ @Test
+ public void testConfigDrivenMembershipEvent() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testMembershipEvent(testHazelcastInstance, cmonChannel, "testKey1",
+ "testValue1");
+ }
- @Test
- public void testConfigDrivenDistributedObjectEvent() {
- HazelcastInboundChannelAdapterTestUtils
- .testDistributedObjectEventByChannelAndHazelcastInstance(cmonChannel2,
- testHazelcastInstance, "Test_Distributed_Map3");
- }
+ @Test
+ public void testConfigDrivenDistributedObjectEvent() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testDistributedObjectEventByChannelAndHazelcastInstance(cmonChannel2,
+ testHazelcastInstance, "Test_Distributed_Map3");
+ }
}
diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastDistributedSQLInboundChannelAdapterConfigTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastDistributedSQLInboundChannelAdapterConfigTests.java
index cf07e40..b71617f 100644
--- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastDistributedSQLInboundChannelAdapterConfigTests.java
+++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastDistributedSQLInboundChannelAdapterConfigTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2016 the original author or authors.
+ * Copyright 2015-2017 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.
@@ -40,60 +40,60 @@ import com.hazelcast.core.IMap;
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = HazelcastIntegrationInboundTestConfiguration.class,
- loader = AnnotationConfigContextLoader.class)
+ loader = AnnotationConfigContextLoader.class)
@DirtiesContext
public class HazelcastDistributedSQLInboundChannelAdapterConfigTests {
- @Autowired
- private PollableChannel dsDistributedMapChannel;
+ @Autowired
+ private PollableChannel dsDistributedMapChannel;
- @Autowired
- private PollableChannel dsDistributedMapChannel2;
+ @Autowired
+ private PollableChannel dsDistributedMapChannel2;
- @Autowired
- private PollableChannel dsDistributedMapChannel3;
+ @Autowired
+ private PollableChannel dsDistributedMapChannel3;
- @Autowired
- private PollableChannel dsDistributedMapChannel4;
+ @Autowired
+ private PollableChannel dsDistributedMapChannel4;
- @Resource
- private IMap testDSDistributedMap;
+ @Resource
+ private IMap testDSDistributedMap;
- @Resource
- private IMap testDSDistributedMap2;
+ @Resource
+ private IMap testDSDistributedMap2;
- @Resource
- private IMap testDSDistributedMap3;
+ @Resource
+ private IMap testDSDistributedMap3;
- @Resource
- private IMap testDSDistributedMap4;
+ @Resource
+ private IMap testDSDistributedMap4;
- @Test
- public void testDistributedSQLForENTRYIterationType() {
- HazelcastInboundChannelAdapterTestUtils
- .testDistributedSQLForENTRYIterationType(testDSDistributedMap,
- dsDistributedMapChannel);
- }
+ @Test
+ public void testDistributedSQLForENTRYIterationType() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testDistributedSQLForENTRYIterationType(testDSDistributedMap,
+ dsDistributedMapChannel);
+ }
- @Test
- public void testDistributedSQLForKEYIterationType() {
- HazelcastInboundChannelAdapterTestUtils
- .testDistributedSQLForKEYIterationType(testDSDistributedMap2,
- dsDistributedMapChannel2);
- }
+ @Test
+ public void testDistributedSQLForKEYIterationType() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testDistributedSQLForKEYIterationType(testDSDistributedMap2,
+ dsDistributedMapChannel2);
+ }
- @Test
- public void testDistributedSQLForLOCAL_KEYIterationType() {
- HazelcastInboundChannelAdapterTestUtils
- .testDistributedSQLForLOCAL_KEYIterationType(testDSDistributedMap3,
- dsDistributedMapChannel3);
- }
+ @Test
+ public void testDistributedSQLForLOCAL_KEYIterationType() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testDistributedSQLForLOCAL_KEYIterationType(testDSDistributedMap3,
+ dsDistributedMapChannel3);
+ }
- @Test
- public void testDistributedSQLForVALUEIterationType() {
- HazelcastInboundChannelAdapterTestUtils
- .testDistributedSQLForVALUEIterationType(testDSDistributedMap4,
- dsDistributedMapChannel4);
- }
+ @Test
+ public void testDistributedSQLForVALUEIterationType() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testDistributedSQLForVALUEIterationType(testDSDistributedMap4,
+ dsDistributedMapChannel4);
+ }
}
diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastEventDrivenInboundChannelAdapterConfigTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastEventDrivenInboundChannelAdapterConfigTests.java
index 0c3ed1d..24f712b 100644
--- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastEventDrivenInboundChannelAdapterConfigTests.java
+++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastEventDrivenInboundChannelAdapterConfigTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2016 the original author or authors.
+ * Copyright 2015-2017 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.
@@ -46,111 +46,111 @@ import com.hazelcast.core.ReplicatedMap;
*/
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = HazelcastIntegrationInboundTestConfiguration.class,
- loader = AnnotationConfigContextLoader.class)
+ loader = AnnotationConfigContextLoader.class)
@DirtiesContext
public class HazelcastEventDrivenInboundChannelAdapterConfigTests {
- @Autowired
- private PollableChannel distributedMapChannel;
+ @Autowired
+ private PollableChannel distributedMapChannel;
- @Autowired
- private PollableChannel distributedMapChannel2;
+ @Autowired
+ private PollableChannel distributedMapChannel2;
- @Autowired
- private PollableChannel distributedListChannel;
+ @Autowired
+ private PollableChannel distributedListChannel;
- @Autowired
- private PollableChannel distributedSetChannel;
+ @Autowired
+ private PollableChannel distributedSetChannel;
- @Autowired
- private PollableChannel distributedQueueChannel;
+ @Autowired
+ private PollableChannel distributedQueueChannel;
- @Autowired
- private PollableChannel topicChannel;
+ @Autowired
+ private PollableChannel topicChannel;
- @Autowired
- private PollableChannel replicatedMapChannel;
+ @Autowired
+ private PollableChannel replicatedMapChannel;
- @Autowired
- private PollableChannel multiMapChannel;
+ @Autowired
+ private PollableChannel multiMapChannel;
- @Resource
- private IMap testDistributedMap;
+ @Resource
+ private IMap testDistributedMap;
- @Resource
- private IMap testDistributedMap2;
+ @Resource
+ private IMap testDistributedMap2;
- @Resource
- private IList testDistributedList;
+ @Resource
+ private IList testDistributedList;
- @Resource
- private ISet testDistributedSet;
+ @Resource
+ private ISet testDistributedSet;
- @Resource
- private IQueue testDistributedQueue;
+ @Resource
+ private IQueue testDistributedQueue;
- @Resource
- private ITopic testTopic;
+ @Resource
+ private ITopic testTopic;
- @Resource
- private ReplicatedMap testReplicatedMap;
+ @Resource
+ private ReplicatedMap testReplicatedMap;
- @Resource
- private MultiMap testMultiMap;
+ @Resource
+ private MultiMap testMultiMap;
- @Test
- public void testEventDrivenForADDEDEntryEvent() {
- HazelcastInboundChannelAdapterTestUtils
- .testEventDrivenForADDEDDistributedMapEntryEvent(testDistributedMap,
- distributedMapChannel, "Test_Distributed_Map");
- }
+ @Test
+ public void testEventDrivenForADDEDEntryEvent() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testEventDrivenForADDEDDistributedMapEntryEvent(testDistributedMap,
+ distributedMapChannel, "Test_Distributed_Map");
+ }
- @Test
- public void testEventDrivenForEntryEvents() {
- HazelcastInboundChannelAdapterTestUtils
- .testEventDrivenForDistributedMapEntryEvents(testDistributedMap2,
- distributedMapChannel2, "Test_Distributed_Map2");
- }
+ @Test
+ public void testEventDrivenForEntryEvents() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testEventDrivenForDistributedMapEntryEvents(testDistributedMap2,
+ distributedMapChannel2, "Test_Distributed_Map2");
+ }
- @Test
- public void testEventDrivenForDistributedListItemEvents() {
- HazelcastInboundChannelAdapterTestUtils
- .testEventDrivenForDistributedCollectionItemEvents(testDistributedList,
- distributedListChannel);
- }
+ @Test
+ public void testEventDrivenForDistributedListItemEvents() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testEventDrivenForDistributedCollectionItemEvents(testDistributedList,
+ distributedListChannel);
+ }
- @Test
- public void testEventDrivenForDistributedSetItemEvents() {
- HazelcastInboundChannelAdapterTestUtils
- .testEventDrivenForDistributedCollectionItemEvents(testDistributedSet,
- distributedSetChannel);
- }
+ @Test
+ public void testEventDrivenForDistributedSetItemEvents() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testEventDrivenForDistributedCollectionItemEvents(testDistributedSet,
+ distributedSetChannel);
+ }
- @Test
- public void testEventDrivenForDistributedQueueItemEvents() {
- HazelcastInboundChannelAdapterTestUtils
- .testEventDrivenForDistributedCollectionItemEvents(testDistributedQueue,
- distributedQueueChannel);
- }
+ @Test
+ public void testEventDrivenForDistributedQueueItemEvents() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testEventDrivenForDistributedCollectionItemEvents(testDistributedQueue,
+ distributedQueueChannel);
+ }
- @Test
- public void testEventDrivenForADDEDMessageEvent() {
- HazelcastInboundChannelAdapterTestUtils
- .testEventDrivenForTopicMessageEvent(testTopic, topicChannel);
- }
+ @Test
+ public void testEventDrivenForADDEDMessageEvent() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testEventDrivenForTopicMessageEvent(testTopic, topicChannel);
+ }
- @Test
- public void testEventDrivenForReplicatedMapEntryEvents() {
- HazelcastInboundChannelAdapterTestUtils
- .testEventDrivenForReplicatedMapEntryEvents(testReplicatedMap,
- replicatedMapChannel, "Test_Replicated_Map");
- }
+ @Test
+ public void testEventDrivenForReplicatedMapEntryEvents() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testEventDrivenForReplicatedMapEntryEvents(testReplicatedMap,
+ replicatedMapChannel, "Test_Replicated_Map");
+ }
- @Test
- public void testEventDrivenForMultiMapEntryEvents() {
- HazelcastInboundChannelAdapterTestUtils
- .testEventDrivenForMultiMapEntryEvents(testMultiMap, multiMapChannel,
- "Test_Multi_Map");
- }
+ @Test
+ public void testEventDrivenForMultiMapEntryEvents() {
+ HazelcastInboundChannelAdapterTestUtils
+ .testEventDrivenForMultiMapEntryEvents(testMultiMap, multiMapChannel,
+ "Test_Multi_Map");
+ }
}
diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastIntegrationInboundTestConfiguration.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastIntegrationInboundTestConfiguration.java
index 6f0b214..5f5de3f 100644
--- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastIntegrationInboundTestConfiguration.java
+++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/config/HazelcastIntegrationInboundTestConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2016 the original author or authors.
+ * Copyright 2015-2017 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.
@@ -50,330 +50,330 @@ import com.hazelcast.core.ReplicatedMap;
@EnableIntegration
public class HazelcastIntegrationInboundTestConfiguration {
- @Bean
- public PollableChannel distributedMapChannel() {
- return new QueueChannel();
- }
+ @Bean
+ public PollableChannel distributedMapChannel() {
+ return new QueueChannel();
+ }
- @Bean
- public PollableChannel distributedMapChannel2() {
- return new QueueChannel();
- }
+ @Bean
+ public PollableChannel distributedMapChannel2() {
+ return new QueueChannel();
+ }
- @Bean
- public PollableChannel distributedListChannel() {
- return new QueueChannel();
- }
+ @Bean
+ public PollableChannel distributedListChannel() {
+ return new QueueChannel();
+ }
- @Bean
- public PollableChannel distributedSetChannel() {
- return new QueueChannel();
- }
+ @Bean
+ public PollableChannel distributedSetChannel() {
+ return new QueueChannel();
+ }
- @Bean
- public PollableChannel distributedQueueChannel() {
- return new QueueChannel();
- }
+ @Bean
+ public PollableChannel distributedQueueChannel() {
+ return new QueueChannel();
+ }
- @Bean
- public PollableChannel topicChannel() {
- return new QueueChannel();
- }
+ @Bean
+ public PollableChannel topicChannel() {
+ return new QueueChannel();
+ }
- @Bean
- public PollableChannel multiMapChannel() {
- return new QueueChannel();
- }
+ @Bean
+ public PollableChannel multiMapChannel() {
+ return new QueueChannel();
+ }
- @Bean
- public PollableChannel replicatedMapChannel() {
- return new QueueChannel();
- }
+ @Bean
+ public PollableChannel replicatedMapChannel() {
+ return new QueueChannel();
+ }
- @Bean
- public PollableChannel cqDistributedMapChannel1() {
- return new QueueChannel();
- }
+ @Bean
+ public PollableChannel cqDistributedMapChannel1() {
+ return new QueueChannel();
+ }
- @Bean
- public PollableChannel cqDistributedMapChannel2() {
- return new QueueChannel();
- }
+ @Bean
+ public PollableChannel cqDistributedMapChannel2() {
+ return new QueueChannel();
+ }
- @Bean
- public PollableChannel cqDistributedMapChannel3() {
- return new QueueChannel();
- }
+ @Bean
+ public PollableChannel cqDistributedMapChannel3() {
+ return new QueueChannel();
+ }
- @Bean
- public PollableChannel dsDistributedMapChannel() {
- return new QueueChannel();
- }
+ @Bean
+ public PollableChannel dsDistributedMapChannel() {
+ return new QueueChannel();
+ }
- @Bean
- public PollableChannel dsDistributedMapChannel2() {
- return new QueueChannel();
- }
+ @Bean
+ public PollableChannel dsDistributedMapChannel2() {
+ return new QueueChannel();
+ }
- @Bean
- public PollableChannel dsDistributedMapChannel3() {
- return new QueueChannel();
- }
+ @Bean
+ public PollableChannel dsDistributedMapChannel3() {
+ return new QueueChannel();
+ }
- @Bean
- public PollableChannel dsDistributedMapChannel4() {
- return new QueueChannel();
- }
+ @Bean
+ public PollableChannel dsDistributedMapChannel4() {
+ return new QueueChannel();
+ }
- @Bean
- public PollableChannel cmonChannel() {
- return new QueueChannel();
- }
+ @Bean
+ public PollableChannel cmonChannel() {
+ return new QueueChannel();
+ }
- @Bean
- public PollableChannel cmonChannel2() {
- return new QueueChannel();
- }
+ @Bean
+ public PollableChannel cmonChannel2() {
+ return new QueueChannel();
+ }
- @Bean
- public IMap testDistributedMap() {
- return testHazelcastInstance().getMap("Test_Distributed_Map");
- }
+ @Bean
+ public IMap testDistributedMap() {
+ return testHazelcastInstance().getMap("Test_Distributed_Map");
+ }
- @Bean
- public IMap testDistributedMap2() {
- return testHazelcastInstance().getMap("Test_Distributed_Map2");
- }
+ @Bean
+ public IMap testDistributedMap2() {
+ return testHazelcastInstance().getMap("Test_Distributed_Map2");
+ }
- @Bean
- public IList testDistributedList() {
- return testHazelcastInstance().getList("Test_Distributed_List");
- }
+ @Bean
+ public IList testDistributedList() {
+ return testHazelcastInstance().getList("Test_Distributed_List");
+ }
- @Bean
- public ISet testDistributedSet() {
- return testHazelcastInstance().getSet("Test_Distributed_Set");
- }
+ @Bean
+ public ISet testDistributedSet() {
+ return testHazelcastInstance().getSet("Test_Distributed_Set");
+ }
- @Bean
- public IQueue testDistributedQueue() {
- return testHazelcastInstance().getQueue("Test_Distributed_Queue");
- }
+ @Bean
+ public IQueue testDistributedQueue() {
+ return testHazelcastInstance().getQueue("Test_Distributed_Queue");
+ }
- @Bean
- public ITopic testTopic() {
- return testHazelcastInstance().getTopic("Test_Topic");
- }
+ @Bean
+ public ITopic testTopic() {
+ return testHazelcastInstance().getTopic("Test_Topic");
+ }
- @Bean
- public MultiMap testMultiMap() {
- return testHazelcastInstance().getMultiMap("Test_Multi_Map");
- }
+ @Bean
+ public MultiMap testMultiMap() {
+ return testHazelcastInstance().getMultiMap("Test_Multi_Map");
+ }
- @Bean
- public ReplicatedMap testReplicatedMap() {
- return testHazelcastInstance().getReplicatedMap("Test_Replicated_Map");
- }
+ @Bean
+ public ReplicatedMap testReplicatedMap() {
+ return testHazelcastInstance().getReplicatedMap("Test_Replicated_Map");
+ }
- @Bean
- public IMap testCQDistributedMap1() {
- return testHazelcastInstance().getMap("Test_CQ_Distributed_Map1");
- }
+ @Bean
+ public IMap testCQDistributedMap1() {
+ return testHazelcastInstance().getMap("Test_CQ_Distributed_Map1");
+ }
- @Bean
- public IMap testCQDistributedMap2() {
- return testHazelcastInstance().getMap("Test_CQ_Distributed_Map2");
- }
+ @Bean
+ public IMap testCQDistributedMap2() {
+ return testHazelcastInstance().getMap("Test_CQ_Distributed_Map2");
+ }
- @Bean
- public IMap testCQDistributedMap3() {
- return testHazelcastInstance().getMap("Test_CQ_Distributed_Map3");
- }
+ @Bean
+ public IMap testCQDistributedMap3() {
+ return testHazelcastInstance().getMap("Test_CQ_Distributed_Map3");
+ }
- @Bean
- public IMap testDSDistributedMap() {
- return testHazelcastInstance().getMap("Test_DS_Distributed_Map");
- }
+ @Bean
+ public IMap testDSDistributedMap() {
+ return testHazelcastInstance().getMap("Test_DS_Distributed_Map");
+ }
- @Bean
- public IMap testDSDistributedMap2() {
- return testHazelcastInstance().getMap("Test_DS_Distributed_Map2");
- }
+ @Bean
+ public IMap testDSDistributedMap2() {
+ return testHazelcastInstance().getMap("Test_DS_Distributed_Map2");
+ }
- @Bean
- public IMap testDSDistributedMap3() {
- return testHazelcastInstance().getMap("Test_DS_Distributed_Map3");
- }
+ @Bean
+ public IMap testDSDistributedMap3() {
+ return testHazelcastInstance().getMap("Test_DS_Distributed_Map3");
+ }
- @Bean
- public IMap testDSDistributedMap4() {
- return testHazelcastInstance().getMap("Test_DS_Distributed_Map4");
- }
+ @Bean
+ public IMap testDSDistributedMap4() {
+ return testHazelcastInstance().getMap("Test_DS_Distributed_Map4");
+ }
- @Bean
- public HazelcastInstance testHazelcastInstance() {
- return Hazelcast.newHazelcastInstance();
- }
+ @Bean
+ public HazelcastInstance testHazelcastInstance() {
+ return Hazelcast.newHazelcastInstance();
+ }
- @Bean
- public HazelcastEventDrivenMessageProducer hazelcastEventDrivenMessageProducer() {
- final HazelcastEventDrivenMessageProducer producer =
- new HazelcastEventDrivenMessageProducer(testDistributedMap());
- producer.setOutputChannel(distributedMapChannel());
- return producer;
- }
+ @Bean
+ public HazelcastEventDrivenMessageProducer hazelcastEventDrivenMessageProducer() {
+ final HazelcastEventDrivenMessageProducer producer =
+ new HazelcastEventDrivenMessageProducer(testDistributedMap());
+ producer.setOutputChannel(distributedMapChannel());
+ return producer;
+ }
- @Bean
- public HazelcastEventDrivenMessageProducer hazelcastEventDrivenMessageProducer2() {
- final HazelcastEventDrivenMessageProducer producer =
- new HazelcastEventDrivenMessageProducer(testDistributedMap2());
- producer.setOutputChannel(distributedMapChannel2());
- producer.setCacheEventTypes("ADDED,REMOVED,UPDATED,CLEAR_ALL");
- return producer;
- }
+ @Bean
+ public HazelcastEventDrivenMessageProducer hazelcastEventDrivenMessageProducer2() {
+ final HazelcastEventDrivenMessageProducer producer =
+ new HazelcastEventDrivenMessageProducer(testDistributedMap2());
+ producer.setOutputChannel(distributedMapChannel2());
+ producer.setCacheEventTypes("ADDED,REMOVED,UPDATED,CLEAR_ALL");
+ return producer;
+ }
- @Bean
- public HazelcastEventDrivenMessageProducer hazelcastEventDrivenMessageProducer3() {
- final HazelcastEventDrivenMessageProducer producer =
- new HazelcastEventDrivenMessageProducer(testDistributedList());
- producer.setOutputChannel(distributedListChannel());
- producer.setCacheEventTypes("ADDED,REMOVED");
- return producer;
- }
+ @Bean
+ public HazelcastEventDrivenMessageProducer hazelcastEventDrivenMessageProducer3() {
+ final HazelcastEventDrivenMessageProducer producer =
+ new HazelcastEventDrivenMessageProducer(testDistributedList());
+ producer.setOutputChannel(distributedListChannel());
+ producer.setCacheEventTypes("ADDED,REMOVED");
+ return producer;
+ }
- @Bean
- public HazelcastEventDrivenMessageProducer hazelcastEventDrivenMessageProducer4() {
- final HazelcastEventDrivenMessageProducer producer =
- new HazelcastEventDrivenMessageProducer(testDistributedSet());
- producer.setOutputChannel(distributedSetChannel());
- producer.setCacheEventTypes("ADDED,REMOVED");
- return producer;
- }
+ @Bean
+ public HazelcastEventDrivenMessageProducer hazelcastEventDrivenMessageProducer4() {
+ final HazelcastEventDrivenMessageProducer producer =
+ new HazelcastEventDrivenMessageProducer(testDistributedSet());
+ producer.setOutputChannel(distributedSetChannel());
+ producer.setCacheEventTypes("ADDED,REMOVED");
+ return producer;
+ }
- @Bean
- public HazelcastEventDrivenMessageProducer hazelcastEventDrivenMessageProducer5() {
- final HazelcastEventDrivenMessageProducer producer =
- new HazelcastEventDrivenMessageProducer(testDistributedQueue());
- producer.setOutputChannel(distributedQueueChannel());
- producer.setCacheEventTypes("ADDED,REMOVED");
- return producer;
- }
+ @Bean
+ public HazelcastEventDrivenMessageProducer hazelcastEventDrivenMessageProducer5() {
+ final HazelcastEventDrivenMessageProducer producer =
+ new HazelcastEventDrivenMessageProducer(testDistributedQueue());
+ producer.setOutputChannel(distributedQueueChannel());
+ producer.setCacheEventTypes("ADDED,REMOVED");
+ return producer;
+ }
- @Bean
- public HazelcastEventDrivenMessageProducer hazelcastEventDrivenMessageProducer6() {
- final HazelcastEventDrivenMessageProducer producer =
- new HazelcastEventDrivenMessageProducer(testTopic());
- producer.setOutputChannel(topicChannel());
- return producer;
- }
+ @Bean
+ public HazelcastEventDrivenMessageProducer hazelcastEventDrivenMessageProducer6() {
+ final HazelcastEventDrivenMessageProducer producer =
+ new HazelcastEventDrivenMessageProducer(testTopic());
+ producer.setOutputChannel(topicChannel());
+ return producer;
+ }
- @Bean
- public HazelcastEventDrivenMessageProducer hazelcastEventDrivenMessageProducer7() {
- final HazelcastEventDrivenMessageProducer producer =
- new HazelcastEventDrivenMessageProducer(testReplicatedMap());
- producer.setOutputChannel(replicatedMapChannel());
- producer.setCacheEventTypes("ADDED,REMOVED,UPDATED");
- return producer;
- }
+ @Bean
+ public HazelcastEventDrivenMessageProducer hazelcastEventDrivenMessageProducer7() {
+ final HazelcastEventDrivenMessageProducer producer =
+ new HazelcastEventDrivenMessageProducer(testReplicatedMap());
+ producer.setOutputChannel(replicatedMapChannel());
+ producer.setCacheEventTypes("ADDED,REMOVED,UPDATED");
+ return producer;
+ }
- @Bean
- public HazelcastEventDrivenMessageProducer hazelcastEventDrivenMessageProducer8() {
- final HazelcastEventDrivenMessageProducer producer =
- new HazelcastEventDrivenMessageProducer(testMultiMap());
- producer.setOutputChannel(multiMapChannel());
- producer.setCacheEventTypes("ADDED,REMOVED,CLEAR_ALL");
- return producer;
- }
+ @Bean
+ public HazelcastEventDrivenMessageProducer hazelcastEventDrivenMessageProducer8() {
+ final HazelcastEventDrivenMessageProducer producer =
+ new HazelcastEventDrivenMessageProducer(testMultiMap());
+ producer.setOutputChannel(multiMapChannel());
+ producer.setCacheEventTypes("ADDED,REMOVED,CLEAR_ALL");
+ return producer;
+ }
- @Bean
- public HazelcastContinuousQueryMessageProducer hazelcastContinuousQueryMessageProducer() {
- final HazelcastContinuousQueryMessageProducer producer =
- new HazelcastContinuousQueryMessageProducer(testCQDistributedMap1(),
- "name=TestName1");
- producer.setOutputChannel(cqDistributedMapChannel1());
- return producer;
- }
+ @Bean
+ public HazelcastContinuousQueryMessageProducer hazelcastContinuousQueryMessageProducer() {
+ final HazelcastContinuousQueryMessageProducer producer =
+ new HazelcastContinuousQueryMessageProducer(testCQDistributedMap1(),
+ "name=TestName1");
+ producer.setOutputChannel(cqDistributedMapChannel1());
+ return producer;
+ }
- @Bean
- public HazelcastContinuousQueryMessageProducer hazelcastContinuousQueryMessageProducer2() {
- final HazelcastContinuousQueryMessageProducer producer =
- new HazelcastContinuousQueryMessageProducer(testCQDistributedMap2(),
- "name=TestName1 OR name=TestName2");
- producer.setOutputChannel(cqDistributedMapChannel2());
- producer.setCacheEventTypes("ADDED,REMOVED,UPDATED,CLEAR_ALL");
- return producer;
- }
+ @Bean
+ public HazelcastContinuousQueryMessageProducer hazelcastContinuousQueryMessageProducer2() {
+ final HazelcastContinuousQueryMessageProducer producer =
+ new HazelcastContinuousQueryMessageProducer(testCQDistributedMap2(),
+ "name=TestName1 OR name=TestName2");
+ producer.setOutputChannel(cqDistributedMapChannel2());
+ producer.setCacheEventTypes("ADDED,REMOVED,UPDATED,CLEAR_ALL");
+ return producer;
+ }
- @Bean
- public HazelcastContinuousQueryMessageProducer hazelcastContinuousQueryMessageProducer3() {
- final HazelcastContinuousQueryMessageProducer producer =
- new HazelcastContinuousQueryMessageProducer(testCQDistributedMap3(),
- "surname=TestSurname2");
- producer.setOutputChannel(cqDistributedMapChannel3());
- producer.setCacheEventTypes("UPDATED");
- producer.setIncludeValue(false);
- return producer;
- }
+ @Bean
+ public HazelcastContinuousQueryMessageProducer hazelcastContinuousQueryMessageProducer3() {
+ final HazelcastContinuousQueryMessageProducer producer =
+ new HazelcastContinuousQueryMessageProducer(testCQDistributedMap3(),
+ "surname=TestSurname2");
+ producer.setOutputChannel(cqDistributedMapChannel3());
+ producer.setCacheEventTypes("UPDATED");
+ producer.setIncludeValue(false);
+ return producer;
+ }
- @Bean
- public HazelcastClusterMonitorMessageProducer hazelcastClusterMonitorMessageProducer() {
- final HazelcastClusterMonitorMessageProducer producer =
- new HazelcastClusterMonitorMessageProducer(testHazelcastInstance());
- producer.setOutputChannel(cmonChannel());
- return producer;
- }
+ @Bean
+ public HazelcastClusterMonitorMessageProducer hazelcastClusterMonitorMessageProducer() {
+ final HazelcastClusterMonitorMessageProducer producer =
+ new HazelcastClusterMonitorMessageProducer(testHazelcastInstance());
+ producer.setOutputChannel(cmonChannel());
+ return producer;
+ }
- @Bean
- public HazelcastClusterMonitorMessageProducer hazelcastClusterMonitorMessageProducer2() {
- final HazelcastClusterMonitorMessageProducer producer =
- new HazelcastClusterMonitorMessageProducer(testHazelcastInstance());
- producer.setOutputChannel(cmonChannel2());
- producer.setMonitorEventTypes("DISTRIBUTED_OBJECT");
- return producer;
- }
+ @Bean
+ public HazelcastClusterMonitorMessageProducer hazelcastClusterMonitorMessageProducer2() {
+ final HazelcastClusterMonitorMessageProducer producer =
+ new HazelcastClusterMonitorMessageProducer(testHazelcastInstance());
+ producer.setOutputChannel(cmonChannel2());
+ producer.setMonitorEventTypes("DISTRIBUTED_OBJECT");
+ return producer;
+ }
- @Bean
- @InboundChannelAdapter(value = "dsDistributedMapChannel",
- poller = @Poller(maxMessagesPerPoll = "1"))
- public HazelcastDistributedSQLMessageSource hazelcastDistributedSQLMessageSource() {
- final HazelcastDistributedSQLMessageSource messageSource =
- new HazelcastDistributedSQLMessageSource(testDSDistributedMap(),
- "name='TestName4' AND surname='TestSurname4'");
- messageSource.setIterationType(DistributedSQLIterationType.ENTRY);
- return messageSource;
- }
+ @Bean
+ @InboundChannelAdapter(value = "dsDistributedMapChannel",
+ poller = @Poller(maxMessagesPerPoll = "1"))
+ public HazelcastDistributedSQLMessageSource hazelcastDistributedSQLMessageSource() {
+ final HazelcastDistributedSQLMessageSource messageSource =
+ new HazelcastDistributedSQLMessageSource(testDSDistributedMap(),
+ "name='TestName4' AND surname='TestSurname4'");
+ messageSource.setIterationType(DistributedSQLIterationType.ENTRY);
+ return messageSource;
+ }
- @Bean
- @InboundChannelAdapter(value = "dsDistributedMapChannel2",
- poller = @Poller(maxMessagesPerPoll = "1"))
- public HazelcastDistributedSQLMessageSource hazelcastDistributedSQLMessageSource2() {
- final HazelcastDistributedSQLMessageSource messageSource =
- new HazelcastDistributedSQLMessageSource(testDSDistributedMap2(),
- "name='TestName1' AND surname='TestSurname1'");
- messageSource.setIterationType(DistributedSQLIterationType.KEY);
- return messageSource;
- }
+ @Bean
+ @InboundChannelAdapter(value = "dsDistributedMapChannel2",
+ poller = @Poller(maxMessagesPerPoll = "1"))
+ public HazelcastDistributedSQLMessageSource hazelcastDistributedSQLMessageSource2() {
+ final HazelcastDistributedSQLMessageSource messageSource =
+ new HazelcastDistributedSQLMessageSource(testDSDistributedMap2(),
+ "name='TestName1' AND surname='TestSurname1'");
+ messageSource.setIterationType(DistributedSQLIterationType.KEY);
+ return messageSource;
+ }
- @Bean
- @InboundChannelAdapter(value = "dsDistributedMapChannel3",
- poller = @Poller(maxMessagesPerPoll = "1"))
- public HazelcastDistributedSQLMessageSource hazelcastDistributedSQLMessageSource3() {
- final HazelcastDistributedSQLMessageSource messageSource =
- new HazelcastDistributedSQLMessageSource(testDSDistributedMap3(),
- "age > 5");
- messageSource.setIterationType(DistributedSQLIterationType.LOCAL_KEY);
- return messageSource;
- }
+ @Bean
+ @InboundChannelAdapter(value = "dsDistributedMapChannel3",
+ poller = @Poller(maxMessagesPerPoll = "1"))
+ public HazelcastDistributedSQLMessageSource hazelcastDistributedSQLMessageSource3() {
+ final HazelcastDistributedSQLMessageSource messageSource =
+ new HazelcastDistributedSQLMessageSource(testDSDistributedMap3(),
+ "age > 5");
+ messageSource.setIterationType(DistributedSQLIterationType.LOCAL_KEY);
+ return messageSource;
+ }
- @Bean
- @InboundChannelAdapter(value = "dsDistributedMapChannel4",
- poller = @Poller(maxMessagesPerPoll = "1"))
- public HazelcastDistributedSQLMessageSource hazelcastDistributedSQLMessageSource4() {
- final HazelcastDistributedSQLMessageSource messageSource =
- new HazelcastDistributedSQLMessageSource(testDSDistributedMap4(),
- "name='TestName3' AND surname='TestSurname3'");
- messageSource.setIterationType(DistributedSQLIterationType.VALUE);
- return messageSource;
- }
+ @Bean
+ @InboundChannelAdapter(value = "dsDistributedMapChannel4",
+ poller = @Poller(maxMessagesPerPoll = "1"))
+ public HazelcastDistributedSQLMessageSource hazelcastDistributedSQLMessageSource4() {
+ final HazelcastDistributedSQLMessageSource messageSource =
+ new HazelcastDistributedSQLMessageSource(testDSDistributedMap4(),
+ "name='TestName3' AND surname='TestSurname3'");
+ messageSource.setIterationType(DistributedSQLIterationType.VALUE);
+ return messageSource;
+ }
}
diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/util/HazelcastInboundChannelAdapterTestUtils.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/util/HazelcastInboundChannelAdapterTestUtils.java
index 5f5fb90..817c0bf 100644
--- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/util/HazelcastInboundChannelAdapterTestUtils.java
+++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/inbound/util/HazelcastInboundChannelAdapterTestUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2016 the original author or authors.
+ * Copyright 2015-2017 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.
@@ -48,17 +48,18 @@ import com.hazelcast.core.ReplicatedMap;
import com.hazelcast.spi.exception.DistributedObjectDestroyedException;
/**
- * Util Class for Hazelcast Inbound Channel Adapters Test Support
+ * Util Class for Hazelcast Inbound Channel Adapters Test Support.
+ *
* @author Eren Avsarogullari
* @since 1.0.0
*/
@SuppressWarnings("unchecked")
-public class HazelcastInboundChannelAdapterTestUtils {
+public final class HazelcastInboundChannelAdapterTestUtils {
public static final int TIMEOUT = 20_000;
public static void verifyEntryEvent(Message> msg, String cacheName,
- EntryEventType event) {
+ EntryEventType event) {
Assert.assertNotNull(msg);
Assert.assertNotNull(msg.getPayload());
if (event == EntryEventType.CLEAR_ALL || event == EntryEventType.EVICT_ALL) {
@@ -348,7 +349,7 @@ public class HazelcastInboundChannelAdapterTestUtils {
}
public static void testMembershipEvent(final HazelcastInstance instance,
- final PollableChannel channel, final String key, final String value) {
+ final PollableChannel channel, final String key, final String value) {
Member member = instance.getCluster().getMembers().iterator().next();
member.setStringAttribute(key, value);
@@ -380,7 +381,7 @@ public class HazelcastInboundChannelAdapterTestUtils {
}
private static void verifyMembershipEvent(final Message> msg,
- final int membershipEvent) {
+ final int membershipEvent) {
assertNotNull(msg);
assertNotNull(msg.getPayload());
assertTrue(msg.getPayload() instanceof MembershipEvent);
@@ -390,8 +391,8 @@ public class HazelcastInboundChannelAdapterTestUtils {
}
private static void verifyDistributedObjectEvent(final Message> msg,
- final DistributedObjectEvent.EventType eventType,
- final String distributedObjectName) {
+ final DistributedObjectEvent.EventType eventType,
+ final String distributedObjectName) {
assertNotNull(msg);
assertNotNull(msg.getPayload());
assertTrue(msg.getPayload() instanceof DistributedObjectEvent);
@@ -401,4 +402,7 @@ public class HazelcastInboundChannelAdapterTestUtils {
.getName(), distributedObjectName);
}
+ private HazelcastInboundChannelAdapterTestUtils() {
+ }
+
}
diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/leader/LeaderInitiatorTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/leader/LeaderInitiatorTests.java
index d58c33c..e3f4311 100644
--- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/leader/LeaderInitiatorTests.java
+++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/leader/LeaderInitiatorTests.java
@@ -1,11 +1,11 @@
/*
- * Copyright 2015 the original author or authors.
+ * Copyright 2015-2017 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
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://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,
@@ -13,6 +13,8 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+
package org.springframework.integration.hazelcast.leader;
import static org.hamcrest.CoreMatchers.is;
diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/outbound/HazelcastOutboundChannelAdapterTests.java b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/outbound/HazelcastOutboundChannelAdapterTests.java
index 8709c6a..dcd18a6 100644
--- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/outbound/HazelcastOutboundChannelAdapterTests.java
+++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/outbound/HazelcastOutboundChannelAdapterTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2016 the original author or authors.
+ * Copyright 2015-2017 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.
@@ -60,7 +60,7 @@ import com.hazelcast.core.MultiMap;
import com.hazelcast.core.ReplicatedMap;
/**
- * Hazelcast Outbound Channel Adapter Test Class
+ * Hazelcast Outbound Channel Adapter Test Class.
*
* @author Eren Avsarogullari
* @author Artem Bilan
@@ -69,405 +69,405 @@ import com.hazelcast.core.ReplicatedMap;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration
@DirtiesContext
-@SuppressWarnings({"rawtypes", "unchecked"})
+@SuppressWarnings({ "rawtypes", "unchecked" })
public class HazelcastOutboundChannelAdapterTests {
- private static final String DISTRIBUTED_MAP = "distributedMap";
+ private static final String DISTRIBUTED_MAP = "distributedMap";
- private static final String CACHE_HEADER = "CACHE_HEADER";
+ private static final String CACHE_HEADER = "CACHE_HEADER";
- private final MessageBuilderFactory messageBuilderFactory =
- new DefaultMessageBuilderFactory();
+ private final MessageBuilderFactory messageBuilderFactory =
+ new DefaultMessageBuilderFactory();
- @Autowired
- @Qualifier("firstMapChannel")
- private MessageChannel firstMapChannel;
+ @Autowired
+ @Qualifier("firstMapChannel")
+ private MessageChannel firstMapChannel;
- @Autowired
- @Qualifier("secondMapChannel")
- private MessageChannel secondMapChannel;
+ @Autowired
+ @Qualifier("secondMapChannel")
+ private MessageChannel secondMapChannel;
- @Autowired
- @Qualifier("thirdMapChannel")
- private MessageChannel thirdMapChannel;
+ @Autowired
+ @Qualifier("thirdMapChannel")
+ private MessageChannel thirdMapChannel;
- @Autowired
- @Qualifier("fourthMapChannel")
- private MessageChannel fourthMapChannel;
+ @Autowired
+ @Qualifier("fourthMapChannel")
+ private MessageChannel fourthMapChannel;
- @Autowired
- @Qualifier("fifthMapChannel")
- private MessageChannel fifthMapChannel;
+ @Autowired
+ @Qualifier("fifthMapChannel")
+ private MessageChannel fifthMapChannel;
- @Autowired
- @Qualifier("sixthMapChannel")
- private MessageChannel sixthMapChannel;
+ @Autowired
+ @Qualifier("sixthMapChannel")
+ private MessageChannel sixthMapChannel;
- @Autowired
- @Qualifier("bulkMapChannel")
- private MessageChannel bulkMapChannel;
+ @Autowired
+ @Qualifier("bulkMapChannel")
+ private MessageChannel bulkMapChannel;
- @Autowired
- @Qualifier("multiMapChannel")
- private MessageChannel multiMapChannel;
+ @Autowired
+ @Qualifier("multiMapChannel")
+ private MessageChannel multiMapChannel;
- @Autowired
- @Qualifier("replicatedMapChannel")
- private MessageChannel replicatedMapChannel;
+ @Autowired
+ @Qualifier("replicatedMapChannel")
+ private MessageChannel replicatedMapChannel;
- @Autowired
- @Qualifier("bulkReplicatedMapChannel")
- private MessageChannel bulkReplicatedMapChannel;
+ @Autowired
+ @Qualifier("bulkReplicatedMapChannel")
+ private MessageChannel bulkReplicatedMapChannel;
- @Autowired
- @Qualifier("listChannel")
- private MessageChannel listChannel;
+ @Autowired
+ @Qualifier("listChannel")
+ private MessageChannel listChannel;
- @Autowired
- @Qualifier("bulkListChannel")
- private MessageChannel bulkListChannel;
+ @Autowired
+ @Qualifier("bulkListChannel")
+ private MessageChannel bulkListChannel;
- @Autowired
- @Qualifier("setChannel")
- private MessageChannel setChannel;
+ @Autowired
+ @Qualifier("setChannel")
+ private MessageChannel setChannel;
- @Autowired
- @Qualifier("bulkSetChannel")
- private MessageChannel bulkSetChannel;
+ @Autowired
+ @Qualifier("bulkSetChannel")
+ private MessageChannel bulkSetChannel;
- @Autowired
- @Qualifier("queueChannel")
- private MessageChannel queueChannel;
+ @Autowired
+ @Qualifier("queueChannel")
+ private MessageChannel queueChannel;
- @Autowired
- @Qualifier("bulkQueueChannel")
- private MessageChannel bulkQueueChannel;
+ @Autowired
+ @Qualifier("bulkQueueChannel")
+ private MessageChannel bulkQueueChannel;
- @Autowired
- @Qualifier("topicChannel")
- private MessageChannel topicChannel;
+ @Autowired
+ @Qualifier("topicChannel")
+ private MessageChannel topicChannel;
- @Autowired
- @Qualifier("lockChannel")
- private MessageChannel lockChannel;
+ @Autowired
+ @Qualifier("lockChannel")
+ private MessageChannel lockChannel;
- @Resource
- private Map, ?> distributedMap;
+ @Resource
+ private Map, ?> distributedMap;
- @Resource
- private Map, ?> distributedBulkMap;
+ @Resource
+ private Map, ?> distributedBulkMap;
- @Resource
- private MultiMap multiMap;
+ @Resource
+ private MultiMap multiMap;
- @Resource
- private ReplicatedMap replicatedMap;
+ @Resource
+ private ReplicatedMap replicatedMap;
- @Resource
- private ReplicatedMap bulkReplicatedMap;
+ @Resource
+ private ReplicatedMap bulkReplicatedMap;
- @Resource
- private List distributedList;
+ @Resource
+ private List distributedList;
- @Resource
- private List distributedBulkList;
+ @Resource
+ private List distributedBulkList;
- @Resource
- private Set distributedSet;
-
- @Resource
- private Set distributedBulkSet;
-
- @Resource
- private Queue distributedQueue;
-
- @Resource
- private Queue distributedBulkQueue;
-
- @Resource
- private ITopic topic;
-
- @Autowired
- @Qualifier("testFirstMapRequestHandlerAdvice")
- private HazelcastTestRequestHandlerAdvice testFirstMapRequestHandlerAdvice;
-
- @Autowired
- @Qualifier("testSecondMapRequestHandlerAdvice")
- private HazelcastTestRequestHandlerAdvice testSecondMapRequestHandlerAdvice;
-
- @Autowired
- @Qualifier("testThirdMapRequestHandlerAdvice")
- private HazelcastTestRequestHandlerAdvice testThirdMapRequestHandlerAdvice;
-
- @Autowired
- @Qualifier("testFourthMapRequestHandlerAdvice")
- private HazelcastTestRequestHandlerAdvice testFourthMapRequestHandlerAdvice;
-
- @Autowired
- @Qualifier("testBulkMapRequestHandlerAdvice")
- private HazelcastTestRequestHandlerAdvice testBulkMapRequestHandlerAdvice;
-
- @Autowired
- @Qualifier("testMultiMapRequestHandlerAdvice")
- private HazelcastTestRequestHandlerAdvice testMultiMapRequestHandlerAdvice;
-
- @Autowired
- @Qualifier("testReplicatedMapRequestHandlerAdvice")
- private HazelcastTestRequestHandlerAdvice testReplicatedMapRequestHandlerAdvice;
-
- @Autowired
- @Qualifier("testBulkReplicatedMapRequestHandlerAdvice")
- private HazelcastTestRequestHandlerAdvice testBulkReplicatedMapRequestHandlerAdvice;
-
- @Autowired
- @Qualifier("testListRequestHandlerAdvice")
- private HazelcastTestRequestHandlerAdvice testListRequestHandlerAdvice;
-
- @Autowired
- @Qualifier("testBulkListRequestHandlerAdvice")
- private HazelcastTestRequestHandlerAdvice testBulkListRequestHandlerAdvice;
-
- @Autowired
- @Qualifier("testSetRequestHandlerAdvice")
- private HazelcastTestRequestHandlerAdvice testSetRequestHandlerAdvice;
-
- @Autowired
- @Qualifier("testBulkSetRequestHandlerAdvice")
- private HazelcastTestRequestHandlerAdvice testBulkSetRequestHandlerAdvice;
-
- @Autowired
- @Qualifier("testQueueRequestHandlerAdvice")
- private HazelcastTestRequestHandlerAdvice testQueueRequestHandlerAdvice;
-
- @Autowired
- @Qualifier("testBulkQueueRequestHandlerAdvice")
- private HazelcastTestRequestHandlerAdvice testBulkQueueRequestHandlerAdvice;
-
- @Autowired
- @Qualifier("testTopicRequestHandlerAdvice")
- private HazelcastTestRequestHandlerAdvice testTopicRequestHandlerAdvice;
-
- @Before
- public void setUp() {
- this.distributedMap.clear();
- this.distributedBulkMap.clear();
- this.distributedList.clear();
- this.distributedBulkList.clear();
- this.distributedSet.clear();
- this.distributedBulkSet.clear();
- this.distributedQueue.clear();
- this.distributedBulkQueue.clear();
- this.multiMap.clear();
- this.replicatedMap.clear();
- this.bulkReplicatedMap.clear();
- }
-
- @Test
- public void testWriteToDistributedMap() throws InterruptedException {
- HazelcastOutboundChannelAdapterTestUtils
- .testWriteToDistributedMap(this.firstMapChannel, this.distributedMap,
- this.testFirstMapRequestHandlerAdvice);
- }
-
- @Test
- public void testBulkWriteToDistributedMap() {
- HazelcastOutboundChannelAdapterTestUtils
- .testBulkWriteToDistributedMap(this.bulkMapChannel, this.distributedBulkMap,
- this.testBulkMapRequestHandlerAdvice);
- }
-
- @Test
- public void testWriteToDistributedMapWhenCacheExpressionIsSet()
- throws InterruptedException {
- sendMessageWithCacheHeaderToChannel(this.secondMapChannel, CACHE_HEADER,
- DISTRIBUTED_MAP);
- assertTrue(this.testSecondMapRequestHandlerAdvice.executeLatch
- .await(10, TimeUnit.SECONDS));
- HazelcastOutboundChannelAdapterTestUtils
- .verifyMapForPayload(new TreeMap(this.distributedMap));
- }
-
- @Test
- public void testWriteToDistributedMapWhenHazelcastHeaderIsSet()
- throws InterruptedException {
- sendMessageWithCacheHeaderToChannel(this.thirdMapChannel,
- HazelcastHeaders.CACHE_NAME, DISTRIBUTED_MAP);
- assertTrue(this.testThirdMapRequestHandlerAdvice.executeLatch
- .await(10, TimeUnit.SECONDS));
- HazelcastOutboundChannelAdapterTestUtils
- .verifyMapForPayload(new TreeMap(this.distributedMap));
- }
-
- @Test
- public void testWriteToDistributedMapWhenExtractPayloadIsFalse()
- throws InterruptedException {
- sendMessageWithCacheHeaderToChannel(this.fourthMapChannel,
- HazelcastHeaders.CACHE_NAME, DISTRIBUTED_MAP);
- assertTrue(this.testFourthMapRequestHandlerAdvice.executeLatch
- .await(10, TimeUnit.SECONDS));
- verifyMapForMessage(new TreeMap(this.distributedMap));
- }
-
- @Test
- public void testWriteToMultiMap() {
- HazelcastOutboundChannelAdapterTestUtils
- .testWriteToMultiMap(this.multiMapChannel, this.multiMap,
- this.testMultiMapRequestHandlerAdvice);
- }
-
- @Test
- public void testWriteToReplicatedMap() {
- HazelcastOutboundChannelAdapterTestUtils
- .testWriteToReplicatedMap(this.replicatedMapChannel, this.replicatedMap,
- this.testReplicatedMapRequestHandlerAdvice);
- }
-
- @Test
- public void testBulkWriteToReplicatedMap() throws InterruptedException {
- Map userMap =
- new HashMap<>(HazelcastOutboundChannelAdapterTestUtils.DATA_COUNT);
- for (int index = 1;
- index <= HazelcastOutboundChannelAdapterTestUtils.DATA_COUNT; index++) {
- userMap
- .put(index, HazelcastOutboundChannelAdapterTestUtils.getTestUser(index));
- }
-
- this.bulkReplicatedMapChannel.send(new GenericMessage<>(userMap));
-
- assertTrue(this.testBulkReplicatedMapRequestHandlerAdvice.executeLatch
- .await(10, TimeUnit.SECONDS));
- HazelcastOutboundChannelAdapterTestUtils
- .verifyMapForPayload(new TreeMap(this.bulkReplicatedMap));
- }
-
-
- @Test
- public void testWriteToDistributedList() {
- HazelcastOutboundChannelAdapterTestUtils
- .testWriteToDistributedList(this.listChannel, this.distributedList,
- this.testListRequestHandlerAdvice);
- }
-
- @Test
- public void testBulkWriteToDistributedList() throws InterruptedException {
- List userList =
- new ArrayList<>(HazelcastOutboundChannelAdapterTestUtils.DATA_COUNT);
- for (int index = 1;
- index <= HazelcastOutboundChannelAdapterTestUtils.DATA_COUNT; index++) {
- userList.add(HazelcastOutboundChannelAdapterTestUtils.getTestUser(index));
- }
-
- this.bulkListChannel.send(new GenericMessage<>(userList));
-
- assertTrue(this.testBulkListRequestHandlerAdvice.executeLatch
- .await(10, TimeUnit.SECONDS));
- HazelcastOutboundChannelAdapterTestUtils
- .verifyCollection(this.distributedBulkList,
- HazelcastOutboundChannelAdapterTestUtils.DATA_COUNT);
- }
-
- @Test
- public void testWriteToDistributedSet() {
- HazelcastOutboundChannelAdapterTestUtils
- .testWriteToDistributedSet(this.setChannel, this.distributedSet,
- this.testSetRequestHandlerAdvice);
- }
-
- @Test
- public void testBulkWriteToDistributedSet() throws InterruptedException {
- Set userSet =
- new HashSet<>(HazelcastOutboundChannelAdapterTestUtils.DATA_COUNT);
- for (int index = 1;
- index <= HazelcastOutboundChannelAdapterTestUtils.DATA_COUNT; index++) {
- userSet.add(HazelcastOutboundChannelAdapterTestUtils.getTestUser(index));
- }
-
- this.bulkSetChannel.send(new GenericMessage<>(userSet));
-
- assertTrue(this.testBulkSetRequestHandlerAdvice.executeLatch
- .await(10, TimeUnit.SECONDS));
- final List list =
- new ArrayList(this.distributedBulkSet);
- Collections.sort(list);
- HazelcastOutboundChannelAdapterTestUtils
- .verifyCollection(list, HazelcastOutboundChannelAdapterTestUtils.DATA_COUNT);
- }
-
- @Test
- public void testWriteToDistributedQueue() {
- HazelcastOutboundChannelAdapterTestUtils
- .testWriteToDistributedQueue(this.queueChannel, this.distributedQueue,
- this.testQueueRequestHandlerAdvice);
- }
-
- @Test
- public void testBulkWriteToDistributedQueue() throws InterruptedException {
- Queue userQueue =
- new ArrayBlockingQueue(HazelcastOutboundChannelAdapterTestUtils.DATA_COUNT);
- for (int index = 1;
- index <= HazelcastOutboundChannelAdapterTestUtils.DATA_COUNT; index++) {
- userQueue.add(HazelcastOutboundChannelAdapterTestUtils.getTestUser(index));
- }
-
- this.bulkQueueChannel.send(new GenericMessage<>(userQueue));
-
- assertTrue(this.testBulkQueueRequestHandlerAdvice.executeLatch
- .await(10, TimeUnit.SECONDS));
- HazelcastOutboundChannelAdapterTestUtils
- .verifyCollection(this.distributedBulkQueue,
- HazelcastOutboundChannelAdapterTestUtils.DATA_COUNT);
- }
-
- @Test
- public void testWriteToTopic() {
- HazelcastOutboundChannelAdapterTestUtils
- .testWriteToTopic(this.topicChannel, this.topic,
- this.testTopicRequestHandlerAdvice);
- }
-
- @Test(expected = MessageHandlingException.class)
- public void testWriteToDistributedMapWhenCacheIsNotSet() {
- this.fifthMapChannel.send(new GenericMessage<>(
- HazelcastOutboundChannelAdapterTestUtils.getTestUser(1)));
- }
-
- @Test(expected = MessageHandlingException.class)
- public void testWriteToDistributedMapWhenKeyExpressionIsNotSet() {
- Message message = this.messageBuilderFactory
- .withPayload(HazelcastOutboundChannelAdapterTestUtils.getTestUser(1))
- .setHeader(HazelcastHeaders.CACHE_NAME, DISTRIBUTED_MAP).build();
- this.sixthMapChannel.send(message);
- }
-
- @Test(expected = MessageHandlingException.class)
- public void testWriteToLock() {
- this.lockChannel.send(new GenericMessage<>("foo"));
- }
-
- private void sendMessageWithCacheHeaderToChannel(final MessageChannel channel,
- final String headerName, final String distributedObjectName) {
- for (int index = 1;
- index <= HazelcastOutboundChannelAdapterTestUtils.DATA_COUNT; index++) {
- Message message = this.messageBuilderFactory
- .withPayload(HazelcastOutboundChannelAdapterTestUtils.getTestUser(index))
- .setHeader(headerName, distributedObjectName).build();
- channel.send(message);
- }
- }
-
- private void verifyMapForMessage(
- final Map> map) {
- int index = 1;
- assertNotNull(map);
- assertEquals(true, map.size() == HazelcastOutboundChannelAdapterTestUtils.DATA_COUNT);
- for (Entry> entry : map.entrySet()) {
- assertNotNull(entry);
- assertEquals(index, entry.getKey().intValue());
- assertTrue(entry.getValue().getHeaders().size() > 0);
- HazelcastOutboundChannelAdapterTestUtils
- .verifyHazelcastIntegrationTestUser(entry.getValue().getPayload(), index);
- index++;
- }
- }
+ @Resource
+ private Set distributedSet;
+
+ @Resource
+ private Set