@Test(timeout = 1000) public void testAddStartedChildBeforeInit() throws Throwable { CompositeService parent = new CompositeService("parent"); BreakableService child = new BreakableService(); child.init(new Configuration()); child.start(); AddSiblingService.addChildToService(parent, child); try { parent.init(new Configuration()); fail("Expected an exception, got " + parent); } catch (ServiceStateException e) { //expected } parent.stop(); }
@Test(timeout = 1000) public void testAddStartedChildBeforeInit() throws Throwable { CompositeService parent = new CompositeService("parent"); BreakableService child = new BreakableService(); child.init(new Configuration()); child.start(); AddSiblingService.addChildToService(parent, child); try { parent.init(new Configuration()); fail("Expected an exception, got " + parent); } catch (ServiceStateException e) { //expected } parent.stop(); }
@Test(timeout = 1000) public void testAddStoppedChildBeforeInit() throws Throwable { CompositeService parent = new CompositeService("parent"); BreakableService child = new BreakableService(); child.init(new Configuration()); child.start(); child.stop(); AddSiblingService.addChildToService(parent, child); try { parent.init(new Configuration()); fail("Expected an exception, got " + parent); } catch (ServiceStateException e) { //expected } parent.stop(); }
@Test(timeout = 1000) public void testAddStoppedChildBeforeInit() throws Throwable { CompositeService parent = new CompositeService("parent"); BreakableService child = new BreakableService(); child.init(new Configuration()); child.start(); child.stop(); AddSiblingService.addChildToService(parent, child); try { parent.init(new Configuration()); fail("Expected an exception, got " + parent); } catch (ServiceStateException e) { //expected } parent.stop(); }