Search in sources :

Example 1 with EmbeddedJettyHelper

use of com.adaptris.core.http.jetty.EmbeddedJettyHelper in project interlok by adaptris.

the class FileInputStreamDataInputParameterTest method testExtractFromRemote.

@Test
public void testExtractFromRemote() throws Exception {
    EmbeddedJettyHelper helper = new EmbeddedJettyHelper();
    helper.startServer();
    MockMessageProducer mockProducer = new MockMessageProducer();
    Channel channel = JettyHelper.createChannel(new EmbeddedConnection(), JettyHelper.createConsumer(URL_TO_POST_TO), mockProducer);
    try {
        LifecycleHelper.initAndStart(channel);
        FileInputStreamDataInputParameter p = new FileInputStreamDataInputParameter();
        p.setUrl(helper.createProduceDestination());
        AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
        assertNotNull(p.extract(msg));
    } finally {
        LifecycleHelper.stopAndClose(channel);
        helper.stopServer();
    }
}
Also used : MockMessageProducer(com.adaptris.core.stubs.MockMessageProducer) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Channel(com.adaptris.core.Channel) EmbeddedConnection(com.adaptris.core.http.jetty.EmbeddedConnection) EmbeddedJettyHelper(com.adaptris.core.http.jetty.EmbeddedJettyHelper) Test(org.junit.Test)

Example 2 with EmbeddedJettyHelper

use of com.adaptris.core.http.jetty.EmbeddedJettyHelper in project interlok by adaptris.

the class FileDataInputParameterTest method testExtractFromRemote.

@Test
public void testExtractFromRemote() throws Exception {
    EmbeddedJettyHelper helper = new EmbeddedJettyHelper();
    helper.startServer();
    MockMessageProducer mockProducer = new MockMessageProducer();
    Channel channel = JettyHelper.createChannel(new EmbeddedConnection(), JettyHelper.createConsumer(URL_TO_POST_TO), mockProducer);
    try {
        LifecycleHelper.initAndStart(channel);
        FileDataInputParameter p = new FileDataInputParameter();
        p.setUrl(helper.createProduceDestination());
        AdaptrisMessage msg = AdaptrisMessageFactory.getDefaultInstance().newMessage();
        assertNotNull(p.extract(msg));
    } finally {
        LifecycleHelper.stopAndClose(channel);
        helper.stopServer();
    }
}
Also used : MockMessageProducer(com.adaptris.core.stubs.MockMessageProducer) AdaptrisMessage(com.adaptris.core.AdaptrisMessage) Channel(com.adaptris.core.Channel) EmbeddedConnection(com.adaptris.core.http.jetty.EmbeddedConnection) EmbeddedJettyHelper(com.adaptris.core.http.jetty.EmbeddedJettyHelper) Test(org.junit.Test)

Aggregations

AdaptrisMessage (com.adaptris.core.AdaptrisMessage)2 Channel (com.adaptris.core.Channel)2 EmbeddedConnection (com.adaptris.core.http.jetty.EmbeddedConnection)2 EmbeddedJettyHelper (com.adaptris.core.http.jetty.EmbeddedJettyHelper)2 MockMessageProducer (com.adaptris.core.stubs.MockMessageProducer)2 Test (org.junit.Test)2