Readjusted test case timings to reasonable values after server updates.

This commit is contained in:
Mark Fisher
2008-01-02 15:11:58 +00:00
parent a31d2a153d
commit 1cfef8def3
6 changed files with 13 additions and 20 deletions

View File

@@ -35,11 +35,6 @@ import org.springframework.integration.message.GenericMessage;
*/
public class FixedDelayConsumerTests {
@Test
public void temp() {
// stub method until others can be uncommented
}
@Test
public void testAllSentMessagesAreReceivedWithinTimeLimit() throws Exception {
int messagesToSend = 20;
@@ -70,7 +65,7 @@ public class FixedDelayConsumerTests {
for (int i = 0; i < messagesToSend; i++) {
channel.send(new GenericMessage<String>(1, "test " + (i+1)));
}
latch.await(5000, TimeUnit.MILLISECONDS);
latch.await(500, TimeUnit.MILLISECONDS);
assertEquals(messagesToSend, counter.get());
}
@@ -105,8 +100,9 @@ public class FixedDelayConsumerTests {
channel.send(new GenericMessage<String>(1, "test " + (i+1)));
}
latch.await(80, TimeUnit.MILLISECONDS);
assertTrue(counter.get() < 15);
assertTrue(counter.get() > 5);
System.out.println("count: " + counter.get());
assertTrue(counter.get() < 10);
assertTrue(counter.get() > 7);
}
}

View File

@@ -36,9 +36,6 @@ import org.springframework.integration.message.GenericMessage;
*/
public class FixedRateConsumerTests {
@Test
public void temp() {}
@Test
public void testAllSentMessagesAreReceivedWithinTimeLimit() throws Exception {
int messagesToSend = 20;
@@ -66,7 +63,7 @@ public class FixedRateConsumerTests {
for (int i = 0; i < messagesToSend; i++) {
channel.send(new GenericMessage<String>(1, "test " + (i+1)));
}
latch.await(250, TimeUnit.MILLISECONDS);
latch.await(210, TimeUnit.MILLISECONDS);
assertEquals(messagesToSend, counter.get());
}

View File

@@ -48,7 +48,7 @@ public class MessageBusTests {
endpoint.setDefaultOutputChannelName("targetChannel");
bus.registerEndpoint("endpoint", endpoint);
bus.start();
Message<?> result = targetChannel.receive(1000);
Message<?> result = targetChannel.receive(100);
assertEquals("test", result.getPayload());
bus.stop();
}
@@ -62,7 +62,7 @@ public class MessageBusTests {
bus.registerChannel("sourceChannel", sourceChannel);
bus.registerChannel("targetChannel", targetChannel);
bus.start();
Message<?> result = targetChannel.receive(500);
Message<?> result = targetChannel.receive(100);
assertNull(result);
bus.stop();
}
@@ -81,7 +81,7 @@ public class MessageBusTests {
subscription.setEndpoint("endpoint");
subscription.setPolicy(policy);
bus.activateSubscription(subscription);
Message<?> result = targetChannel.receive(500);
Message<?> result = targetChannel.receive(100);
assertEquals("test", result.getPayload());
}

View File

@@ -62,7 +62,7 @@ public class UnicastMessageDispatcherTests {
dispatcher.addExecutor(new MessageReceivingExecutor(endpoint1, 1, 1));
dispatcher.addExecutor(new MessageReceivingExecutor(endpoint2, 1, 1));
dispatcher.dispatch();
latch.await(500, TimeUnit.MILLISECONDS);
latch.await(100, TimeUnit.MILLISECONDS);
assertTrue("exactly one endpoint should have received message",
endpoint1Received.get() ^ endpoint2Received.get());
}

View File

@@ -193,7 +193,7 @@ public class PointToPointChannelTests {
assertTrue(sendInterrupted.get());
}
//@Test
@Test
public void testSelectorMatchesWithinTimeout() throws Exception {
final PointToPointChannel channel = new PointToPointChannel();
final CountDownLatch latch = new CountDownLatch(1);
@@ -204,7 +204,7 @@ public class PointToPointChannelTests {
public boolean accept(Message<?> message) {
return (((Integer)message.getId()).intValue() == 3);
}
}, 50);
}, 100);
messageRef.set(message);
latch.countDown();
}

View File

@@ -52,7 +52,7 @@ public class GenericMessageEndpointTests {
bus.start();
StringMessage testMessage = new StringMessage(1, "test");
channel.send(testMessage);
Message<String> reply = replyChannel.receive(10);
Message<String> reply = replyChannel.receive(50);
assertNotNull(reply);
assertEquals("hello test", reply.getPayload());
}
@@ -77,7 +77,7 @@ public class GenericMessageEndpointTests {
StringMessage testMessage = new StringMessage(1, "test");
testMessage.getHeader().setReplyChannelName("replyChannel");
channel.send(testMessage);
Message reply = replyChannel.receive(10);
Message reply = replyChannel.receive(50);
assertNotNull(reply);
assertEquals("hello test", reply.getPayload());
}