use of com.adaptris.core.stubs.MockConnection in project interlok by adaptris.
the class ClosedStateTest method testRestart.
@Test
public void testRestart() throws Exception {
MockConnection channel = new MockConnection();
ClosedState state = ClosedState.getInstance();
state.requestRestart(channel);
assertEquals(StartedState.getInstance(), channel.retrieveComponentState());
assertEquals(1, channel.getInitCount());
assertEquals(1, channel.getStartCount());
assertEquals(0, channel.getStopCount());
assertEquals(0, channel.getCloseCount());
}
use of com.adaptris.core.stubs.MockConnection in project interlok by adaptris.
the class StoppedStateTest method testStopped_To_Started.
@Test
public void testStopped_To_Started() throws Exception {
MockConnection component = new MockConnection();
component.requestStart();
component.requestStop();
StoppedState state = StoppedState.getInstance();
state.requestStart(component);
assertEquals(StartedState.getInstance(), component.retrieveComponentState());
assertEquals(1, component.getInitCount());
assertEquals(2, component.getStartCount());
assertEquals(1, component.getStopCount());
assertEquals(0, component.getCloseCount());
}
use of com.adaptris.core.stubs.MockConnection in project interlok by adaptris.
the class StoppedStateTest method testRestart.
@Test
public void testRestart() throws Exception {
MockConnection component = new MockConnection();
component.requestStart();
component.requestStop();
StoppedState state = StoppedState.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());
}
use of com.adaptris.core.stubs.MockConnection in project interlok by adaptris.
the class StartedStateTest method testStarted_To_Initialised.
@Test
public void testStarted_To_Initialised() throws Exception {
MockConnection component = new MockConnection();
component.requestStart();
StartedState state = StartedState.getInstance();
state.requestInit(component);
// redmineID #4453 - Started won't let you goto Initialised.
assertEquals(StartedState.getInstance(), component.retrieveComponentState());
assertEquals(1, component.getInitCount());
assertEquals(1, component.getStartCount());
assertEquals(0, component.getStopCount());
assertEquals(0, component.getCloseCount());
}
use of com.adaptris.core.stubs.MockConnection in project interlok by adaptris.
the class SharedComponentListTest method testAddConnection.
@Test
public void testAddConnection() throws Exception {
SharedComponentList list = new SharedComponentList();
try {
list.addConnection(new MockConnection());
fail();
} catch (IllegalArgumentException expected) {
}
assertEquals(0, list.getConnections().size());
try {
list.addConnection(null);
fail();
} catch (IllegalArgumentException expected) {
}
assertEquals(0, list.getConnections().size());
// Should have no effect as you're just adding to a clone.
list.getConnections().add(new MockConnection());
assertEquals(0, list.getConnections().size());
list.addConnection(new MockConnection(getName()));
assertFalse(list.addConnection(new MockConnection(getName())));
assertEquals(1, list.getConnections().size());
}
Aggregations