diff --git a/spring-integration-hazelcast/src/main/resources/org/springframework/integration/hazelcast/config/xml/spring-integration-hazelcast-1.0.xsd b/spring-integration-hazelcast/src/main/resources/org/springframework/integration/hazelcast/config/xml/spring-integration-hazelcast-1.0.xsd
index efab23f..1864d20 100644
--- a/spring-integration-hazelcast/src/main/resources/org/springframework/integration/hazelcast/config/xml/spring-integration-hazelcast-1.0.xsd
+++ b/spring-integration-hazelcast/src/main/resources/org/springframework/integration/hazelcast/config/xml/spring-integration-hazelcast-1.0.xsd
@@ -7,7 +7,7 @@
targetNamespace="http://www.springframework.org/schema/integration/hazelcast"
elementFormDefault="qualified"
attributeFormDefault="unqualified">
-
+
@@ -15,16 +15,16 @@
schemaLocation="http://www.springframework.org/schema/integration/spring-integration.xsd"/>
-
+
Configures Hazelcast Event-Driven Inbound Channel Adapter
-
+
-
+
@@ -51,7 +51,7 @@
-
+
@@ -63,26 +63,27 @@
-
+
-
+
-
+
Configures Hazelcast Outbound Channel Adapter
-
+
-
+
-
-
+
+
+
-
+
@@ -95,7 +96,7 @@
-
+
-
+
-
+
-
+
Configures Hazelcast Continuous Query Inbound Channel Adapter
-
+
-
+
@@ -146,7 +147,7 @@
-
+
@@ -154,7 +155,7 @@
-
+
@@ -162,7 +163,7 @@
-
+
@@ -174,24 +175,24 @@
-
+
-
+
-
+
Configures Hazelcast Distributed SQL Inbound Channel Adapter
-
+
-
+
-
+
@@ -206,7 +207,7 @@
-
+
@@ -220,7 +221,7 @@
-
+
@@ -228,8 +229,8 @@
-
+
-
+
diff --git a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/outbound/HazelcastOutboundChannelAdapterTests-context.xml b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/outbound/HazelcastOutboundChannelAdapterTests-context.xml
index 200fed1..bf0702b 100644
--- a/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/outbound/HazelcastOutboundChannelAdapterTests-context.xml
+++ b/spring-integration-hazelcast/src/test/java/org/springframework/integration/hazelcast/outbound/HazelcastOutboundChannelAdapterTests-context.xml
@@ -11,14 +11,34 @@
http://www.springframework.org/schema/integration/hazelcast/spring-integration-hazelcast.xsd">
+
+
-
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
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 8f369bf..1b44984 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
@@ -16,6 +16,11 @@
package org.springframework.integration.hazelcast.outbound;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
@@ -25,7 +30,9 @@ import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Set;
+import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
import javax.annotation.Resource;
@@ -35,8 +42,12 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.integration.handler.advice.AbstractRequestHandlerAdvice;
+import org.springframework.messaging.Message;
import org.springframework.messaging.MessageChannel;
import org.springframework.messaging.MessageHandlingException;
+import org.springframework.messaging.PollableChannel;
+import org.springframework.messaging.support.ErrorMessage;
import org.springframework.messaging.support.GenericMessage;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.ContextConfiguration;
@@ -46,6 +57,7 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
* Hazelcast Outbound Channel Adapter Test Class
*
* @author Eren Avsarogullari
+ * @author Artem Bilan
* @since 1.0.0
*/
@RunWith(SpringJUnit4ClassRunner.class)
@@ -67,6 +79,9 @@ public class HazelcastOutboundChannelAdapterTests {
@Autowired
private MessageChannel queueChannel;
+ @Autowired
+ private PollableChannel errorChannel;
+
@Resource
private Map, ?> distributedMap;
@@ -79,6 +94,9 @@ public class HazelcastOutboundChannelAdapterTests {
@Resource
private Queue> distributedQueue;
+ @Autowired
+ private TestRequestHandlerAdvice testRequestHandlerAdvice;
+
@Before
public void setUp() {
distributedMap.clear();
@@ -109,11 +127,17 @@ public class HazelcastOutboundChannelAdapterTests {
}
@Test
- public void testWriteDistributedQueue() {
- Queue queue = (Queue) fillCollectionByEntryCount(
- new LinkedBlockingQueue(DATA_COUNT));
- queueChannel.send(new GenericMessage<>(queue));
- verifyDistributedQueue();
+ public void testWriteDistributedQueue() throws InterruptedException {
+ Collection queue = fillCollectionByEntryCount(new LinkedBlockingQueue(DATA_COUNT));
+ this.queueChannel.send(new GenericMessage<>(queue));
+
+ assertTrue(this.testRequestHandlerAdvice.executeLatch.await(10, TimeUnit.SECONDS));
+
+ Assert.assertEquals(true, this.distributedQueue.size() == DATA_COUNT);
+ int index = 0;
+ for (Object o : this.distributedQueue) {
+ Assert.assertEquals(index++, o);
+ }
}
@Test(expected = MessageHandlingException.class)
@@ -137,11 +161,15 @@ public class HazelcastOutboundChannelAdapterTests {
setChannel.send(new GenericMessage<>(list));
}
- @Test(expected = MessageHandlingException.class)
public void testQueueChannelWithIncorrectDataType() {
Set set = new HashSet<>();
set.add(1);
- queueChannel.send(new GenericMessage<>(set));
+ this.queueChannel.send(new GenericMessage<>(set));
+ Message> receive = this.errorChannel.receive(10000);
+ assertNotNull(receive);
+ assertThat(receive, instanceOf(ErrorMessage.class));
+ assertThat(receive.getPayload(), instanceOf(MessageHandlingException.class));
+
}
private Map createMapByEntryCount() {
@@ -192,12 +220,20 @@ public class HazelcastOutboundChannelAdapterTests {
}
}
- private void verifyDistributedQueue() {
- Assert.assertEquals(true, distributedQueue.size() == DATA_COUNT);
- int index = 0;
- for (Object o : distributedQueue) {
- Assert.assertEquals(index++, o);
+ public static class TestRequestHandlerAdvice extends AbstractRequestHandlerAdvice {
+
+ public final CountDownLatch executeLatch = new CountDownLatch(1);
+
+ @Override
+ protected Object doInvoke(ExecutionCallback callback, Object target, Message> message) throws Exception {
+ try {
+ return callback.execute();
+ }
+ finally {
+ this.executeLatch.countDown();
+ }
}
+
}
}