This commit is contained in:
Josh Long
2011-08-18 06:36:49 -07:00
parent 8116b8ba5e
commit 6a2a368c3e
2 changed files with 18 additions and 3 deletions

3
.gitignore vendored
View File

@@ -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

View File

@@ -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}.
*
* <p/>
* 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<String> 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<Collection<Object>> 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<Object> collection : batches) {
Assert.assertTrue(letters.size() == collection.size());
for (String c : this.letters) {