WorkflowSequenceService extends AbstractService implements
    ServiceParent, ServiceStateChangeListener { public Service getPreviousService() { return previousService; } WorkflowSequenceService(String name);  WorkflowSequenceService();  WorkflowSequenceService(String name, Service... children);  WorkflowSequenceService(String name, List<Service> children); Service getActiveService(); Service getPreviousService(); synchronized boolean startNextService(); @Override void stateChanged(Service service); @Override synchronized void addService(Service service); @Override //Parent synchronized List<Service> getServices(); @Override // Object synchronized String toString();  }
@Test public void testSequence() throws Throwable { MockService one = new MockService("one", false, 100); MockService two = new MockService("two", false, 100); ServiceParent parent = startService(one, two); waitForParentToStop(parent); assertStopped(one); assertStopped(two); assert ((WorkflowSequenceService) parent).getPreviousService().equals(two); }
@Test public void testFailingSequence() throws Throwable { MockService one = new MockService("one", true, 100); MockService two = new MockService("two", false, 100); WorkflowSequenceService parent = (WorkflowSequenceService) startService(one, two); waitForParentToStop(parent); assertStopped(one); assertInState(two, Service.STATE.NOTINITED); assertEquals(one, parent.getPreviousService()); }