INT-2212 fixed NPE in AbstractKeyValueMessageStore

INT-2212 polished AbstractKeyValueMessageStore
eliminated possibility for NPE during the Message removal, added test

INT-2212 polishing

INT-2212 polishing
added remove(..) method to MessageGroupMetadata
This commit is contained in:
Oleg Zhurakousky
2011-10-31 16:55:28 -04:00
parent 61b7108f72
commit 2d504904db
5 changed files with 77 additions and 11 deletions

View File

@@ -296,6 +296,22 @@ public class GemfireGroupStoreTests {
inputA.send(m3);
assertNotNull(outputA.receive(1000));
}
@Test
public void testQueue() throws Exception{
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("gemfire-queue-config.xml", this.getClass());
QueueChannel gemfireQueue = context.getBean("gemfireQueue", QueueChannel.class);
QueueChannel outputQueue = context.getBean("outputQueue", QueueChannel.class);
for (int i = 0; i < 20; i++) {
gemfireQueue.send(new GenericMessage<String>("Hello"));
Thread.sleep(1);
}
for (int i = 0; i < 20; i++) {
assertNotNull(outputQueue.receive(1));
}
assertNull(outputQueue.receive(1));
}
@Before
public void init() throws Exception{

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:int="http://www.springframework.org/schema/integration"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/integration http://www.springframework.org/schema/integration/spring-integration-2.1.xsd">
<int:channel id="gemfireQueue">
<int:queue message-store="gemfireStore"/>
</int:channel>
<int:bridge input-channel="gemfireQueue" output-channel="outputQueue">
<int:poller fixed-rate="1000" max-messages-per-poll="200"/>
</int:bridge>
<int:channel id="outputQueue">
<int:queue/>
</int:channel>
<bean id="gemfireStore" class="org.springframework.integration.gemfire.store.GemfireMessageStore">
<constructor-arg ref="gemfireCache"/>
</bean>
<bean id="gemfireCache" class="org.springframework.data.gemfire.CacheFactoryBean"/>
</beans>