Search in sources :

Example 1 with MockJmsConnection

use of com.adaptris.interlok.junit.scaffolding.jms.MockJmsConnection in project interlok by adaptris.

the class ChannelTest method testConnectionEqualityCheck2ConnectionsToSameBroker.

@Test
public void testConnectionEqualityCheck2ConnectionsToSameBroker() throws Exception {
    Channel channel = new Channel();
    MockJmsConnection produceConnection = createMockJmsConnection(null, "broker1");
    MockJmsConnection consumeConnection = createMockJmsConnection(null, "broker1");
    channel.setConsumeConnection(consumeConnection);
    channel.setProduceConnection(produceConnection);
    try {
        channel.init();
        fail("Should fail, 2 identical connections with error handlers");
    } catch (CoreException ex) {
        assertEquals(DUP_CEH_MESSAGE, ex.getMessage());
    }
}
Also used : MockJmsConnection(com.adaptris.interlok.junit.scaffolding.jms.MockJmsConnection) Test(org.junit.Test)

Example 2 with MockJmsConnection

use of com.adaptris.interlok.junit.scaffolding.jms.MockJmsConnection in project interlok by adaptris.

the class ChannelTest method createMockJmsConnection.

private MockJmsConnection createMockJmsConnection(String uid, String brokerUrl) {
    MockJmsConnection connection = new MockJmsConnection();
    if (uid != null)
        connection.setUniqueId(uid);
    UrlVendorImplementation vendorImp = new UrlVendorImplementation() {

        @Override
        public ConnectionFactory createConnectionFactory() throws JMSException {
            return null;
        }
    };
    vendorImp.setBrokerUrl(brokerUrl);
    connection.setVendorImplementation(vendorImp);
    connection.setConnectionErrorHandler(new MockNoOpConnectionErrorHandler());
    return connection;
}
Also used : UrlVendorImplementation(com.adaptris.core.jms.UrlVendorImplementation) MockNoOpConnectionErrorHandler(com.adaptris.core.jms.MockNoOpConnectionErrorHandler) MockJmsConnection(com.adaptris.interlok.junit.scaffolding.jms.MockJmsConnection)

Example 3 with MockJmsConnection

use of com.adaptris.interlok.junit.scaffolding.jms.MockJmsConnection in project interlok by adaptris.

the class ChannelTest method testConnectionEqualityCheck2DifferentConnections.

@Test
public void testConnectionEqualityCheck2DifferentConnections() throws Exception {
    Channel channel = new Channel();
    MockJmsConnection produceConnection = createMockJmsConnection(null, "broker1");
    MockJmsConnection consumeConnection = createMockJmsConnection(null, "broker2");
    channel.setConsumeConnection(consumeConnection);
    channel.setProduceConnection(produceConnection);
    consumeConnection.init();
    produceConnection.init();
    channel.init();
}
Also used : MockJmsConnection(com.adaptris.interlok.junit.scaffolding.jms.MockJmsConnection) Test(org.junit.Test)

Example 4 with MockJmsConnection

use of com.adaptris.interlok.junit.scaffolding.jms.MockJmsConnection in project interlok by adaptris.

the class ChannelTest method testConnectionEqualityCheckSameConnectionInstances.

@Test
public void testConnectionEqualityCheckSameConnectionInstances() throws Exception {
    Channel channel = new Channel();
    MockJmsConnection connection = createMockJmsConnection(null, "broker1");
    channel.setConsumeConnection(connection);
    channel.setProduceConnection(connection);
    channel.init();
}
Also used : MockJmsConnection(com.adaptris.interlok.junit.scaffolding.jms.MockJmsConnection) Test(org.junit.Test)

Aggregations

MockJmsConnection (com.adaptris.interlok.junit.scaffolding.jms.MockJmsConnection)4 Test (org.junit.Test)3 MockNoOpConnectionErrorHandler (com.adaptris.core.jms.MockNoOpConnectionErrorHandler)1 UrlVendorImplementation (com.adaptris.core.jms.UrlVendorImplementation)1