use of com.adaptris.core.stubs.MockRequestReplyProducer in project interlok by adaptris.
the class RequestReplyProducerTest method testRequest_AdaptrisMessage_IgnoreReply.
@Test
public void testRequest_AdaptrisMessage_IgnoreReply() throws Exception {
MockRequestReplyProducer mock = createAndStart();
mock.setIgnoreReplyMetadata(true);
try {
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage("dummy");
AdaptrisMessage reply = mock.request(msg);
assertSame(msg, reply);
assertFalse(msg.headersContainsKey(MockRequestReplyProducer.REPLY_METADATA_KEY));
} finally {
LifecycleHelper.stopAndClose(mock);
}
}
use of com.adaptris.core.stubs.MockRequestReplyProducer in project interlok by adaptris.
the class StandaloneRequestorTest method testSetTimeoutOverride.
@Test
public void testSetTimeoutOverride() throws Exception {
MockRequestReplyProducer m = new MockRequestReplyProducer();
StandaloneRequestor service = new StandaloneRequestor(m);
assertNull(service.getReplyTimeout());
assertEquals(-1, service.timeoutOverrideMs());
TimeInterval interval = new TimeInterval(10L, TimeUnit.SECONDS);
service.setReplyTimeout(interval);
assertEquals(interval, service.getReplyTimeout());
assertEquals(interval.toMilliseconds(), service.timeoutOverrideMs());
service.setReplyTimeout(null);
assertNull(service.getReplyTimeout());
assertEquals(-1, service.timeoutOverrideMs());
}
use of com.adaptris.core.stubs.MockRequestReplyProducer in project interlok by adaptris.
the class StandaloneRequestorTest method testCreateQualifier.
@Test
public void testCreateQualifier() throws Exception {
MockRequestReplyProducer mp = new MockRequestReplyProducer();
StandaloneRequestor service = new StandaloneRequestor(mp);
mp.setUniqueId("abc");
assertEquals("abc", service.createQualifier());
assertEquals(service.getProducer().createQualifier(), service.createQualifier());
}
use of com.adaptris.core.stubs.MockRequestReplyProducer in project interlok by adaptris.
the class StandaloneRequestorTest method testCreateName.
@Test
public void testCreateName() throws Exception {
MockRequestReplyProducer m = new MockRequestReplyProducer();
StandaloneRequestor service = new StandaloneRequestor(m);
assertEquals(MockRequestReplyProducer.class.getName(), service.createName());
assertEquals(service.getProducer().createName(), service.createName());
}
use of com.adaptris.core.stubs.MockRequestReplyProducer in project interlok by adaptris.
the class StandaloneRequestorTest method testDoServiceNoTimeout.
@Test
public void testDoServiceNoTimeout() throws Exception {
MockRequestReplyProducer m = new MockRequestReplyProducer();
StandaloneRequestor service = new StandaloneRequestor(m);
service.setReplyTimeout(null);
AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage("XYZ");
execute(service, msg);
assertTrue(msg.containsKey(MockRequestReplyProducer.REPLY_METADATA_KEY));
assertEquals(MockRequestReplyProducer.REPLY_METADATA_VALUE, msg.getMetadataValue(MockRequestReplyProducer.REPLY_METADATA_KEY));
assertEquals(1, m.getProducedMessages().size());
}
Aggregations