protected void notifyOnConnect(ServerInstance serverInstance) { notificationService.notify(new ServerInstanceUpdated(serverInstance)); notificationService.notify(new ServerInstanceConnected(serverInstance)); }
public void onServerInstanceDeleted( @Observes final ServerInstanceDeleted serverInstanceDeleted ) { if ( serverInstanceDeleted != null && serverInstanceDeleted.getServerInstanceId() != null ) { serverInstances.remove( serverInstanceDeleted.getServerInstanceId() ); } else { logger.warn( "Illegal event argument." ); } }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof ContainerSpecUpdated)) { return false; } ContainerSpecUpdated that = (ContainerSpecUpdated) o; if (!getServerTemplate().equals(that.getServerTemplate())) { return false; } if (!getContainerSpec().equals(that.getContainerSpec())) { return false; } return getContainers().equals(that.getContainers()); }
@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; }
protected void notifyOnDisconnect(ServerInstanceKey serverInstanceKey, ServerTemplate serverTemplate) { notificationService.notify(new ServerInstanceDeleted(serverInstanceKey.getServerInstanceId())); notificationService.notify(new ServerTemplateUpdated(serverTemplate)); notificationService.notify(new ServerInstanceDisconnected(serverInstanceKey.getServerInstanceId())); }
public void onServerTemplateUpdated(@Observes ServerTemplateUpdated serverTemplateUpdated) { buildClientsForServer(serverTemplateUpdated.getServerTemplate()); }
@Override public synchronized void deleteServerTemplate(String serverTemplateId) { if (!templateStorage.exists(serverTemplateId)) { throw new KieServerControllerIllegalArgumentException("No server template found for id " + serverTemplateId); } templateStorage.delete(serverTemplateId); notificationService.notify(new ServerTemplateDeleted(serverTemplateId)); }
@Test public void testServerInstanceConnected() { handler.accept(new ServerInstanceConnected(new ServerInstance())); verify(eventHandler).onServerInstanceConnected(any()); verifyNoMoreInteractions(eventHandler); }
@Test public void testServerInstanceDeleted() { handler.accept(new ServerInstanceDeleted("serverId")); verify(eventHandler).onServerInstanceDeleted(any()); verifyNoMoreInteractions(eventHandler); }
@Test public void testServerInstanceDisconnected() { handler.accept(new ServerInstanceDisconnected("serverId")); verify(eventHandler).onServerInstanceDisconnected(any()); verifyNoMoreInteractions(eventHandler); }
@Override public void notify(final ServerTemplate serverTemplate, final ContainerSpec containerSpec, final List<Container> containers) { LOGGER.info("WebSocket notification about change requested on server {} with container spec {} with following result {}", serverTemplate, containerSpec, containers); notifySessions(new ContainerSpecUpdated(serverTemplate, containerSpec, containers)); }
public void onServerTemplateDeleted(@Observes ServerTemplateDeleted serverTemplateDeleted) { // remove all clients for this server template and its containers final Map<String, KieServicesClient> clients = serverTemplatesClients.remove(serverTemplateDeleted.getServerTemplateId()); if (clients != null) { logger.debug("KieServerClient removed and closed for server template {}", serverTemplateDeleted.getServerTemplateId()); } // remove admin client adminClients.remove(serverTemplateDeleted.getServerTemplateId()); removeServerInstancesFromIndex(serverTemplateDeleted.getServerTemplateId()); }
public void onRuleConfigUpdate(@Observes final RuleConfigUpdated configUpdate) { if (configUpdate != null && configUpdate.getRuleConfig() != null && configUpdate.getReleasedId() != null) { setRuleConfig(configUpdate.getRuleConfig(), configUpdate.getReleasedId().getVersion()); } else { logger.warn("Illegal event argument."); } }
public void onConfigUpdate(@Observes final RuleConfigUpdated configUpdated) { if (configUpdated != null && configUpdated.getContainerSpecKey() != null && configUpdated.getContainerSpecKey().equals(containerSpec)) { setup(containerSpec, configUpdated.getRuleConfig()); } else { logger.warn("Illegal event argument."); } }
public void onServerTemplateDeleted(@Observes ServerTemplateUpdated serverTemplateUpdated) { buildClientsForServer(serverTemplateUpdated.getServerTemplate()); }
@Test public void testServerTemplateDeleted() { handler.accept(new ServerTemplateDeleted("serverTemplateId")); verify(eventHandler).onServerTemplateDeleted(any()); verifyNoMoreInteractions(eventHandler); }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof ContainerSpecUpdated)) { return false; } ContainerSpecUpdated that = (ContainerSpecUpdated) o; if (!getServerTemplate().equals(that.getServerTemplate())) { return false; } if (!getContainerSpec().equals(that.getContainerSpec())) { return false; } return getContainers().equals(that.getContainers()); }
public void onServerTemplateUpdated(@Observes final ServerTemplateUpdated serverTemplateUpdated) { if (serverTemplateUpdated.getServerTemplate().getServerInstanceKeys().isEmpty()) { loadServerTemplates(); } }
@Override public int hashCode() { int result = getServerTemplate().hashCode(); result = 31 * result + getContainerSpec().hashCode(); result = 31 * result + getContainers().hashCode(); return result; }
@Override public int hashCode() { int result = getServerTemplate().hashCode(); result = 31 * result + getContainerSpec().hashCode(); result = 31 * result + getContainers().hashCode(); return result; }