From 6a2a368c3ed0d48343ce92fa20bdcf13ff031b27 Mon Sep 17 00:00:00 2001 From: Josh Long Date: Thu, 18 Aug 2011 06:36:49 -0700 Subject: [PATCH] INT-2062 --- .gitignore | 3 +++ .../GemfireMessageGroupStoreTest.java | 18 +++++++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 94eb6643c5..f3c2f8abb6 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,6 @@ spring-integration-samples/loanshark/application.log* target build.log .DS_Store +vf.gf.dmn-events.cfg +vf.gf.dmn-license.cfg +out \ No newline at end of file diff --git a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/store/messagegroupstore/GemfireMessageGroupStoreTest.java b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/store/messagegroupstore/GemfireMessageGroupStoreTest.java index 4b85af5e77..5d436c7400 100644 --- a/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/store/messagegroupstore/GemfireMessageGroupStoreTest.java +++ b/spring-integration-gemfire/src/test/java/org/springframework/integration/gemfire/store/messagegroupstore/GemfireMessageGroupStoreTest.java @@ -7,6 +7,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.support.AnnotationConfigContextLoader; + import java.util.Collection; import java.util.List; import java.util.Set; @@ -14,10 +15,11 @@ import java.util.Set; /** * Tests the Gemfire {@link org.springframework.integration.store.MessageGroupStore} implementation, * {@link org.springframework.integration.gemfire.store.GemfireMessageGroupStore}. - * + *

* It tests the {@link org.springframework.integration.store.MessageGroupStore} by sending 10 batches of letters (all of the same width), * and then counting on the other end that indeed all 10 batches arrived and that all letters expected are there. - * * + * * + * * @author Josh Long */ @RunWith(SpringJUnit4ClassRunner.class) @@ -27,11 +29,21 @@ public class GemfireMessageGroupStoreTest { @Autowired private GemfireMessageGroupStoreTestConfiguration.FakeMessageConsumer consumer; private List letters = GemfireMessageGroupStoreTestConfiguration.LIST_OF_STRINGS; + private int maxSize = 10; + private long totalTimeSleeping = 10 * 1000; // give it 10s to send the messages @Test public void testGemfireMessageGroupStore() throws Throwable { + long counter = 0; + int delay = 1000; Set> batches = consumer.getBatches(); - Assert.assertTrue(batches.size() == 10); + + while (batches.size() < maxSize && counter < totalTimeSleeping) { + counter += delay; + Thread.sleep(delay); + } + + Assert.assertTrue(batches.size() == maxSize); for (Collection collection : batches) { Assert.assertTrue(letters.size() == collection.size()); for (String c : this.letters) {