Search in sources :

Example 11 with MockConnection

use of com.adaptris.core.stubs.MockConnection in project interlok by adaptris.

the class InitialisedStateTest method testInitialised_To_Started.

@Test
public void testInitialised_To_Started() throws Exception {
    MockConnection component = new MockConnection();
    component.requestInit();
    InitialisedState state = InitialisedState.getInstance();
    state.requestStart(component);
    assertEquals(StartedState.getInstance(), component.retrieveComponentState());
    assertEquals(1, component.getInitCount());
    assertEquals(1, component.getStartCount());
}
Also used : MockConnection(com.adaptris.core.stubs.MockConnection) Test(org.junit.Test)

Example 12 with MockConnection

use of com.adaptris.core.stubs.MockConnection in project interlok by adaptris.

the class AdaptrisConnectionTest method testCloneForTesting.

@Test
public void testCloneForTesting() throws Exception {
    MockConnection mc = new MockConnection();
    assertEquals(MockConnection.class, mc.cloneForTesting().getClass());
}
Also used : MockConnection(com.adaptris.core.stubs.MockConnection) Test(org.junit.Test)

Example 13 with MockConnection

use of com.adaptris.core.stubs.MockConnection in project interlok by adaptris.

the class ClosedStateTest method testClosed_To_Stopped.

@Test
public void testClosed_To_Stopped() throws Exception {
    MockConnection channel = new MockConnection();
    ClosedState state = ClosedState.getInstance();
    state.requestStop(channel);
    // This actually should do nothing.
    assertEquals(ClosedState.getInstance(), channel.retrieveComponentState());
    assertEquals(0, channel.getInitCount());
    assertEquals(0, channel.getStartCount());
    assertEquals(0, channel.getStopCount());
    assertEquals(0, channel.getCloseCount());
}
Also used : MockConnection(com.adaptris.core.stubs.MockConnection) Test(org.junit.Test)

Example 14 with MockConnection

use of com.adaptris.core.stubs.MockConnection in project interlok by adaptris.

the class ClosedStateTest method testClosed_To_Initialised.

@Test
public void testClosed_To_Initialised() throws Exception {
    MockConnection channel = new MockConnection();
    ClosedState state = ClosedState.getInstance();
    state.requestInit(channel);
    assertEquals(InitialisedState.getInstance(), channel.retrieveComponentState());
    assertEquals(1, channel.getInitCount());
    assertEquals(0, channel.getStartCount());
    assertEquals(0, channel.getStopCount());
    assertEquals(0, channel.getCloseCount());
}
Also used : MockConnection(com.adaptris.core.stubs.MockConnection) Test(org.junit.Test)

Example 15 with MockConnection

use of com.adaptris.core.stubs.MockConnection in project interlok by adaptris.

the class ClosedStateTest method testClosed_To_Started.

@Test
public void testClosed_To_Started() throws Exception {
    MockConnection channel = new MockConnection();
    ClosedState state = ClosedState.getInstance();
    state.requestStart(channel);
    assertEquals(StartedState.getInstance(), channel.retrieveComponentState());
    assertEquals(1, channel.getInitCount());
    assertEquals(1, channel.getStartCount());
    assertEquals(0, channel.getStopCount());
    assertEquals(0, channel.getCloseCount());
}
Also used : MockConnection(com.adaptris.core.stubs.MockConnection) Test(org.junit.Test)

Aggregations

MockConnection (com.adaptris.core.stubs.MockConnection)49 Test (org.junit.Test)49 Adapter (com.adaptris.core.Adapter)7 MockMessageProducer (com.adaptris.core.stubs.MockMessageProducer)5 TimeInterval (com.adaptris.util.TimeInterval)5 TimeoutException (java.util.concurrent.TimeoutException)5 ObjectName (javax.management.ObjectName)5 MockMessageConsumer (com.adaptris.core.stubs.MockMessageConsumer)3 FilteredSharedComponentStart (com.adaptris.core.lifecycle.FilteredSharedComponentStart)1 ChannelRestartConnectionErrorHandler (com.adaptris.core.stubs.ChannelRestartConnectionErrorHandler)1 FailFirstMockMessageProducer (com.adaptris.core.stubs.FailFirstMockMessageProducer)1 MockChannel (com.adaptris.core.stubs.MockChannel)1 SimpleIdGenerator (com.adaptris.util.SimpleIdGenerator)1