### Question:
ServerStateControllerImpl implements IActivationListener, ServerStateController { @Override public void activateServers(Node node) throws InterruptedException { activateServersInternal(node); } ServerStateControllerImpl(Toolbox toolbox, ServerSourceControllerManager serverManager); @Override void activateServers(Node node); @Override void activateServers(StateType state); @Override void activatingServers(List<IDataSource> servers); @Override void activationComplete(ServerConfigEvent event);  }### Answer:
@Test public void testActivateEmptyListOfServers() throws ParserConfigurationException, XPathExpressionException, InterruptedException { Node stateNode = StateNodeUtils.createStateNode(); ServerSourceProvider provider = ServerActivatorUtils.createSourceProvider(stateNode); ServerSourceController serverController = ServerActivatorUtils.createServerController(provider, null, null); ServerSourceControllerManager manager = ServerActivatorUtils.createControllerManager(serverController); EventManager eventManager = createEventManager(); Toolbox toolbox = createToolbox(eventManager, null); EasyMock.replay(provider, serverController, manager, eventManager, toolbox); long currentTime = System.currentTimeMillis(); final ServerStateControllerImpl controller = new ServerStateControllerImpl(toolbox, manager); controller.activateServers(stateNode); assertTrue(System.currentTimeMillis() - currentTime < 60000); EasyMock.verify(provider, serverController, manager, eventManager, toolbox); }
@Test public void testActivateServers() throws XPathExpressionException, ParserConfigurationException, JAXBException, InterruptedException { Node stateNode = StateNodeUtils.createWfsNodeWithData(ourWfsUrl); ServerSourceFilterer filterer = ServerActivatorUtils.createSourceFilterer(); ServerSourceProvider provider = ServerActivatorUtils.createSourceProvider(stateNode); ServerSourceController serverController = ServerActivatorUtils.createServerController(provider, filterer, null); ServerSourceControllerManager manager = ServerActivatorUtils.createControllerManager(serverController); EventManager eventManager = createEventManager(); Preferences prefs = createPrefs(); PreferencesRegistry prefsRegistry = createPrefsRegistry(prefs); Toolbox toolbox = createToolbox(eventManager, prefsRegistry); final ServerConnectionParams someHost = createParams("somehost"); final ServerConnectionParams wfsHost = createParams("wfsHost"); EasyMock.replay(filterer, provider, serverController, manager, eventManager, toolbox, someHost, wfsHost, prefsRegistry, prefs); final ServerStateControllerImpl controller = new ServerStateControllerImpl(toolbox, manager); ThreadUtilities.runBackground(new Runnable() { @Override public void run() { try { Thread.sleep(2000); } catch (InterruptedException e) { } controller.activationComplete(new ServerConfigEvent(toString(), someHost, ServerEventAction.LOADCOMPLETE)); try { Thread.sleep(2000); } catch (InterruptedException e) { } controller.activationComplete(new ServerConfigEvent(toString(), wfsHost, ServerEventAction.LOADCOMPLETE)); } }); long currentTime = System.currentTimeMillis(); controller.activateServers(stateNode); assertTrue(System.currentTimeMillis() - currentTime < 7000); EasyMock.verify(filterer, provider, serverController, manager, eventManager, toolbox, someHost, wfsHost, prefsRegistry, prefs); }