Search in sources :

Example 36 with MockConnection

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

the class StartedStateTest method testRestart.

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

Example 37 with MockConnection

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

the class StartedStateTest method testStarted_To_Stopped.

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

Example 38 with MockConnection

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

the class StoppedStateTest method testStopped_To_Initialised.

@Test
public void testStopped_To_Initialised() throws Exception {
    MockConnection component = new MockConnection();
    component.requestStart();
    component.requestStop();
    StoppedState state = StoppedState.getInstance();
    state.requestInit(component);
    // redmineID #4453 - Stopped won't let you goto Initialised.
    assertEquals(StoppedState.getInstance(), component.retrieveComponentState());
    assertEquals(1, component.getInitCount());
    assertEquals(1, component.getStartCount());
    assertEquals(1, component.getStopCount());
    assertEquals(0, component.getCloseCount());
}
Also used : MockConnection(com.adaptris.core.stubs.MockConnection) Test(org.junit.Test)

Example 39 with MockConnection

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

the class StoppedStateTest method testStopped_To_Stopped.

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

Example 40 with MockConnection

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

the class StoppedStateTest method testStopped_To_Closed.

@Test
public void testStopped_To_Closed() throws Exception {
    MockConnection component = new MockConnection();
    component.requestStart();
    component.requestStop();
    StoppedState state = StoppedState.getInstance();
    state.requestClose(component);
    assertEquals(ClosedState.getInstance(), component.retrieveComponentState());
    assertEquals(1, component.getInitCount());
    assertEquals(1, component.getStartCount());
    assertEquals(1, component.getStopCount());
    assertEquals(1, component.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