Search in sources :

Example 1 with EmbeddedConnection

use of com.adaptris.core.http.jetty.EmbeddedConnection 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 EmbeddedConnection

use of com.adaptris.core.http.jetty.EmbeddedConnection 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)

Example 3 with EmbeddedConnection

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

the class SharedComponentListTest method retrieveObjectForSampleConfig.

@Override
protected Object retrieveObjectForSampleConfig() {
    Adapter adapter = null;
    try {
        adapter = createAdapter();
        for (ConnectionBuilder b : ConnectionBuilder.values()) {
            adapter.getSharedComponents().addConnection(b.build());
        }
        TransactionManager transactionManager = new DummyTransactionManager("myTransactionManager");
        adapter.getSharedComponents().setTransactionManager(transactionManager);
        Channel c = new Channel();
        c.setProduceConnection(new SharedConnection("goofy_edison"));
        c.setConsumeConnection(new EmbeddedConnection());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    return adapter;
}
Also used : DummyTransactionManager(com.adaptris.core.transaction.DummyTransactionManager) SharedTransactionManager(com.adaptris.core.transaction.SharedTransactionManager) TransactionManager(com.adaptris.core.transaction.TransactionManager) DummyTransactionManager(com.adaptris.core.transaction.DummyTransactionManager) EmbeddedConnection(com.adaptris.core.http.jetty.EmbeddedConnection) NamingException(javax.naming.NamingException) PasswordException(com.adaptris.security.exc.PasswordException)

Example 4 with EmbeddedConnection

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

the class RetryFromJettyTest method retrieveObjectForSampleConfig.

@Override
protected Object retrieveObjectForSampleConfig() {
    Adapter result = null;
    try {
        RetryFromJetty fmr = new RetryFromJetty();
        fmr.setConnection(new EmbeddedConnection());
        fmr.setRetryStore(new InMemoryRetryStore());
        result = new Adapter();
        result.setFailedMessageRetrier(fmr);
        result.setChannelList(new ChannelList());
        result.setEventHandler(new StubEventHandler());
        result.setUniqueId(UUID.randomUUID().toString());
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    return result;
}
Also used : StubEventHandler(com.adaptris.core.stubs.StubEventHandler) EmbeddedConnection(com.adaptris.core.http.jetty.EmbeddedConnection) Adapter(com.adaptris.core.Adapter) ChannelList(com.adaptris.core.ChannelList) InterlokException(com.adaptris.interlok.InterlokException) ConfiguredException(com.adaptris.core.services.exception.ConfiguredException)

Aggregations

EmbeddedConnection (com.adaptris.core.http.jetty.EmbeddedConnection)4 AdaptrisMessage (com.adaptris.core.AdaptrisMessage)2 Channel (com.adaptris.core.Channel)2 EmbeddedJettyHelper (com.adaptris.core.http.jetty.EmbeddedJettyHelper)2 MockMessageProducer (com.adaptris.core.stubs.MockMessageProducer)2 Test (org.junit.Test)2 Adapter (com.adaptris.core.Adapter)1 ChannelList (com.adaptris.core.ChannelList)1 ConfiguredException (com.adaptris.core.services.exception.ConfiguredException)1 StubEventHandler (com.adaptris.core.stubs.StubEventHandler)1 DummyTransactionManager (com.adaptris.core.transaction.DummyTransactionManager)1 SharedTransactionManager (com.adaptris.core.transaction.SharedTransactionManager)1 TransactionManager (com.adaptris.core.transaction.TransactionManager)1 InterlokException (com.adaptris.interlok.InterlokException)1 PasswordException (com.adaptris.security.exc.PasswordException)1 NamingException (javax.naming.NamingException)1