protected void notifyOnConnect(ServerInstance serverInstance) { notificationService.notify(new ServerInstanceUpdated(serverInstance)); notificationService.notify(new ServerInstanceConnected(serverInstance)); }
@Test public void testServerInstanceConnected() { handler.accept(new ServerInstanceConnected(new ServerInstance())); verify(eventHandler).onServerInstanceConnected(any()); verifyNoMoreInteractions(eventHandler); }
@Override public void afterResponseSent() { ServerTemplate serverTemplate = controller.getTemplateStorage().load(serverInfo.getServerId()); ServerInstanceKey serverInstanceKey = serverTemplate.getServerInstanceKeys().stream() .filter(server -> server.getUrl().equals(serverInfo.getLocation())) .findFirst() .get(); ServerInstance serverInstance = new ServerInstance(); serverInstance.setServerName(serverInstanceKey.getServerName()); serverInstance.setServerTemplateId(serverInstanceKey.getServerTemplateId()); serverInstance.setServerInstanceId(serverInstanceKey.getServerInstanceId()); serverInstance.setUrl(serverInstanceKey.getUrl()); controller.getNotificationService().notify(new ServerInstanceUpdated(serverInstance)); controller.getNotificationService().notify(new ServerInstanceConnected(serverInstance)); }
@Test public void testServerInstanceConnected() throws Exception { final ServerInstanceConnected event = new ServerInstanceConnected(new ServerInstance()); notificationService.notify(event); verify(endpoint, timeout(TIMEOUT)).sendObject(new KieServerControllerNotification(event)); }
@Parameterized.Parameters(name = "{index}: {0}") public static Collection<Object[]> data() { Collection<Object[]> parameterData = new ArrayList<Object[]>(Arrays.asList(new Object[][]{ {new ServerInstanceConnected(new ServerInstance())}, {new ServerInstanceDisconnected("serverId")}, {new ServerInstanceDeleted("serverId")}, {new ServerInstanceUpdated(new ServerInstance())}, {new ServerTemplateUpdated(new ServerTemplate())}, {new ServerTemplateDeleted("serverTemplateId")}, {new ContainerSpecUpdated(new ServerTemplate(), new ContainerSpec(), new ArrayList<>())} } )); return parameterData; }
when(specManagementService.getServerTemplate(serverTemplateId2)).thenReturn(serverTemplate2); kieServerIntegration.onServerInstanceConnected(new ServerInstanceConnected(serverInstance2)); assertNotNull(kieServerIntegration.getServerInstancesById().get(serverInstanceId2)); kieServerIntegration.onServerInstanceConnected(new ServerInstanceConnected(serverInstance1));
kieServerIntegration.onServerInstanceConnected(new ServerInstanceConnected(serverInstance2)); kieServerIntegration.onServerInstanceConnected(new ServerInstanceConnected(serverInstance1));
kieServerIntegration.onServerInstanceConnected(new ServerInstanceConnected(serverInstance2)); kieServerIntegration.onServerInstanceConnected(new ServerInstanceConnected(serverInstance1));
when(specManagementService.getServerTemplate(serverTemplateId2)).thenReturn(serverTemplate2); kieServerIntegration.onServerInstanceConnected(new ServerInstanceConnected(serverInstance2)); assertNotNull(kieServerIntegration.getServerInstancesById().get(serverInstanceId2)); kieServerIntegration.onServerInstanceConnected(new ServerInstanceConnected(serverInstance1));