+ add a delay to improve test synchronization

This commit is contained in:
Costin Leau
2011-01-21 21:26:06 +02:00
parent f2d3c71216
commit b19a63d5c4

View File

@@ -66,7 +66,7 @@ public class PubSubTests<T> {
@Before
public void setUp() throws Exception {
adapter.setSerializer(template.getValueSerializer());
//adapter.setSerializer(template.getValueSerializer());
container = new RedisMessageListenerContainer();
container.setConnectionFactory(template.getConnectionFactory());
@@ -74,6 +74,7 @@ public class PubSubTests<T> {
container.addMessageListener(adapter, Arrays.asList(new ChannelTopic(CHANNEL)));
container.afterPropertiesSet();
Thread.sleep(500);
}
@After
@@ -118,6 +119,7 @@ public class PubSubTests<T> {
public void testContainerSubscribe() throws Exception {
String payload1 = "do";
String payload2 = "re mi";
template.convertAndSend(CHANNEL, payload1);
template.convertAndSend(CHANNEL, payload2);
@@ -125,7 +127,6 @@ public class PubSubTests<T> {
set.add(bag.poll(1, TimeUnit.SECONDS));
set.add(bag.poll(1, TimeUnit.SECONDS));
assertTrue(set.contains(payload1));
assertTrue(set.contains(payload2));
}