Search in sources :

Example 6 with MockRequestReplyProducer

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);
    }
}
Also used : MockRequestReplyProducer(com.adaptris.core.stubs.MockRequestReplyProducer) Test(org.junit.Test)

Example 7 with MockRequestReplyProducer

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());
}
Also used : TimeInterval(com.adaptris.util.TimeInterval) MockRequestReplyProducer(com.adaptris.core.stubs.MockRequestReplyProducer) Test(org.junit.Test)

Example 8 with MockRequestReplyProducer

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());
}
Also used : MockRequestReplyProducer(com.adaptris.core.stubs.MockRequestReplyProducer) Test(org.junit.Test)

Example 9 with MockRequestReplyProducer

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());
}
Also used : MockRequestReplyProducer(com.adaptris.core.stubs.MockRequestReplyProducer) Test(org.junit.Test)

Example 10 with MockRequestReplyProducer

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());
}
Also used : MockRequestReplyProducer(com.adaptris.core.stubs.MockRequestReplyProducer) Test(org.junit.Test)

Aggregations

MockRequestReplyProducer (com.adaptris.core.stubs.MockRequestReplyProducer)19 Test (org.junit.Test)18 MockChannel (com.adaptris.core.stubs.MockChannel)7 MockMessageProducer (com.adaptris.core.stubs.MockMessageProducer)7 MockMessageConsumer (com.adaptris.core.stubs.MockMessageConsumer)2 MockSkipProducerService (com.adaptris.core.stubs.MockSkipProducerService)1 MockWorkflowInterceptor (com.adaptris.core.stubs.MockWorkflowInterceptor)1 TimeInterval (com.adaptris.util.TimeInterval)1