Hazelcast: Compatibility with IO-2.0

* Add IO plugin
* Upgrade to Gradle 2.4
* Upgrade dependencies
* Upgrade to Hazelcast-3.5 and therefore make compatible with IO-2.0
* All these changes and tests make this module compatible with SI-4.2
This commit is contained in:
Artem Bilan
2015-06-23 22:10:17 -04:00
parent 416cc39da4
commit 8f45e1caec
12 changed files with 48 additions and 26 deletions

View File

@@ -7,17 +7,37 @@ apply plugin: 'idea'
group = 'org.springframework.integration'
buildscript {
repositories {
maven { url 'http://repo.spring.io/plugins-release' }
}
dependencies {
classpath 'org.springframework.build.gradle:spring-io-plugin:0.0.3.RELEASE'
}
}
repositories {
if (version.endsWith('BUILD-SNAPSHOT') || project.hasProperty('platformVersion')) {
maven { url 'http://repo.spring.io/libs-snapshot' }
}
maven { url 'http://repo.spring.io/libs-milestone' }
}
if (project.hasProperty('platformVersion')) {
apply plugin: 'spring-io'
dependencies {
springIoVersions "io.spring.platform:platform-bom:${platformVersion}@properties"
}
}
sourceCompatibility = targetCompatibility = 1.7
ext {
hazelcastVersion = '3.4.2'
jacocoVersion = '0.7.2.201409121644'
slf4jVersion = '1.7.11'
springIntegrationVersion = '4.1.3.RELEASE'
hazelcastVersion = '3.5'
jacocoVersion = '0.7.5.201505241946'
slf4jVersion = '1.7.12'
springIntegrationVersion = '4.1.5.RELEASE'
idPrefix = 'hazelcast'
@@ -221,6 +241,6 @@ task dist(dependsOn: assemble) {
task wrapper(type: Wrapper) {
description = 'Generates gradlew[.bat] scripts'
gradleVersion = '2.3'
gradleVersion = '2.4'
distributionUrl = "http://services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
}

View File

@@ -1,6 +1,6 @@
#Thu Mar 19 00:10:16 GMT 2015
#Tue Jun 23 21:21:28 EDT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-2.3-all.zip
distributionUrl=http\://services.gradle.org/distributions/gradle-2.4-all.zip

View File

@@ -20,8 +20,8 @@ import java.util.Arrays;
import java.util.List;
import java.util.Set;
import reactor.util.CollectionUtils;
import reactor.util.StringUtils;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import com.hazelcast.core.DistributedObject;
import com.hazelcast.core.IList;

View File

@@ -26,8 +26,7 @@ import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
import org.springframework.integration.hazelcast.inbound.HazelcastContinuousQueryMessageProducer;
import reactor.util.StringUtils;
import org.springframework.util.StringUtils;
/**
* Hazelcast Continuous Query Inbound Channel Adapter Parser parses

View File

@@ -24,8 +24,7 @@ import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.config.xml.AbstractPollingInboundChannelAdapterParser;
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
import org.springframework.integration.hazelcast.inbound.HazelcastDistributedSQLMessageSource;
import reactor.util.StringUtils;
import org.springframework.util.StringUtils;
/**
* Hazelcast Distributed SQL Inbound Channel Adapter Parser parses

View File

@@ -26,8 +26,7 @@ import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
import org.springframework.beans.factory.xml.ParserContext;
import org.springframework.integration.config.xml.IntegrationNamespaceUtils;
import org.springframework.integration.hazelcast.inbound.HazelcastEventDrivenMessageProducer;
import reactor.util.StringUtils;
import org.springframework.util.StringUtils;
/**
* Hazelcast Event Driven Inbound Channel Adapter Parser parses

View File

@@ -33,6 +33,7 @@ import org.springframework.integration.hazelcast.HazelcastLocalInstanceRegistrar
import org.springframework.integration.hazelcast.message.EntryEventMessagePayload;
import org.springframework.messaging.Message;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
import com.hazelcast.core.AbstractIMapEvent;
import com.hazelcast.core.DistributedObject;
@@ -43,8 +44,6 @@ import com.hazelcast.core.HazelcastInstance;
import com.hazelcast.core.MapEvent;
import com.hazelcast.core.MultiMap;
import reactor.util.StringUtils;
/**
* Hazelcast Base Event-Driven Message Producer.
*

View File

@@ -19,6 +19,7 @@ package org.springframework.integration.hazelcast.inbound;
import org.springframework.util.Assert;
import com.hazelcast.core.IMap;
import com.hazelcast.map.listener.MapListener;
import com.hazelcast.query.SqlPredicate;
/**
@@ -51,7 +52,8 @@ public class HazelcastContinuousQueryMessageProducer extends AbstractHazelcastMe
@Override
protected void doStart() {
setHazelcastRegisteredEventListenerId(((IMap<?, ?>) this.distributedObject)
.addEntryListener(new HazelcastEntryListener(), new SqlPredicate(this.predicate), this.includeValue));
.addEntryListener((MapListener) new HazelcastEntryListener(), new SqlPredicate(this.predicate),
this.includeValue));
}
@Override

View File

@@ -35,6 +35,7 @@ import com.hazelcast.core.Message;
import com.hazelcast.core.MessageListener;
import com.hazelcast.core.MultiMap;
import com.hazelcast.core.ReplicatedMap;
import com.hazelcast.map.listener.MapListener;
/**
* Hazelcast Event Driven Message Producer is a message producer which enables
@@ -64,7 +65,7 @@ public class HazelcastEventDrivenMessageProducer extends AbstractHazelcastMessag
protected void doStart() {
if (this.distributedObject instanceof IMap) {
setHazelcastRegisteredEventListenerId(((IMap<?, ?>) this.distributedObject)
.addEntryListener(new HazelcastEntryListener(), true));
.addEntryListener((MapListener) new HazelcastEntryListener(), true));
}
else if (this.distributedObject instanceof MultiMap) {
setHazelcastRegisteredEventListenerId(((MultiMap<?, ?>) this.distributedObject)

View File

@@ -21,6 +21,7 @@ import java.util.Map;
import org.springframework.expression.EvaluationContext;
import org.springframework.expression.Expression;
import org.springframework.integration.expression.ExpressionUtils;
import org.springframework.integration.expression.IntegrationEvaluationContextAware;
import org.springframework.integration.handler.AbstractMessageHandler;
import org.springframework.integration.hazelcast.HazelcastHeaders;
@@ -39,8 +40,7 @@ import com.hazelcast.core.MultiMap;
* @author Artem Bilan
* @since 1.0.0
*/
public class HazelcastCacheWritingMessageHandler extends AbstractMessageHandler
implements IntegrationEvaluationContextAware {
public class HazelcastCacheWritingMessageHandler extends AbstractMessageHandler {
private DistributedObject distributedObject;
@@ -72,8 +72,9 @@ public class HazelcastCacheWritingMessageHandler extends AbstractMessageHandler
}
@Override
public void setIntegrationEvaluationContext(EvaluationContext evaluationContext) {
this.evaluationContext = evaluationContext;
protected void onInit() throws Exception {
super.onInit();
this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(getBeanFactory());
}
@Override

View File

@@ -40,6 +40,7 @@ import com.hazelcast.core.MultiMap;
* Hazelcast MultiMap Event Driven Inbound Channel Adapter Test
*
* @author Eren Avsarogullari
* @author Artem Bilan
* @since 1.0.0
*/
@RunWith(SpringJUnit4ClassRunner.class)
@@ -107,15 +108,16 @@ public class HazelcastMultiMapEventDrivenInboundChannelAdapterTests extends Abst
Assert.assertEquals(Integer.valueOf(2),
((EntryEventMessagePayload<Integer, HazelcastIntegrationTestUser>) msg
.getPayload()).key);
Assert.assertNull(((EntryEventMessagePayload<?, ?>) msg.getPayload()).value);
Assert.assertEquals(2,
(((EntryEventMessagePayload<Integer, HazelcastIntegrationTestUser>) msg
.getPayload()).value).getId());
.getPayload()).oldValue).getId());
Assert.assertEquals("TestName2",
(((EntryEventMessagePayload<Integer, HazelcastIntegrationTestUser>) msg
.getPayload()).value).getName());
.getPayload()).oldValue).getName());
Assert.assertEquals("TestSurname2",
(((EntryEventMessagePayload<Integer, HazelcastIntegrationTestUser>) msg
.getPayload()).value).getSurname());
.getPayload()).oldValue).getSurname());
}
@Test