Search in sources :

Example 1 with FilteredSharedComponentStart

use of com.adaptris.core.lifecycle.FilteredSharedComponentStart in project interlok by adaptris.

the class SharedComponentListTest method testInterlok_1096.

// FilteredStart was removing connections
// from the underlying list.
@Test
public void testInterlok_1096() throws Exception {
    SharedComponentList list = new SharedComponentList();
    List<AdaptrisConnection> good = Arrays.asList(new AdaptrisConnection[] { new MockConnection(getName()), new MockConnection(getName() + "_1") });
    list.setConnections(new ArrayList<>(good));
    FilteredSharedComponentStart starter = new FilteredSharedComponentStart();
    starter.addExclude(getName());
    starter.addExclude(getName() + "_1");
    list.setLifecycleStrategy(starter);
    try {
        LifecycleHelper.init(list);
        LifecycleHelper.start(list);
        assertEquals(2, list.getConnections().size());
        for (AdaptrisConnection c : good) {
            assertEquals(ClosedState.getInstance(), c.retrieveComponentState());
        }
    } finally {
        stop(list);
    }
}
Also used : FilteredSharedComponentStart(com.adaptris.core.lifecycle.FilteredSharedComponentStart) MockConnection(com.adaptris.core.stubs.MockConnection) Test(org.junit.Test)

Aggregations

FilteredSharedComponentStart (com.adaptris.core.lifecycle.FilteredSharedComponentStart)1 MockConnection (com.adaptris.core.stubs.MockConnection)1 Test (org.junit.Test)1