@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)); }
@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()); }
@Test public void testContainerSpecUpdated() { handler.accept(new ContainerSpecUpdated(new ServerTemplate(), new ContainerSpec(), new ArrayList<>())); verify(eventHandler).onContainerSpecUpdated(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()); }
@Test public void testContainerSpecUpdated() throws Exception { final ServerTemplate serverTemplate = new ServerTemplate(); final ContainerSpec containerSpec = new ContainerSpec(); final ArrayList<Container> containers = new ArrayList<>(); final ContainerSpecUpdated event = new ContainerSpecUpdated(serverTemplate, containerSpec, containers); notificationService.notify(serverTemplate, containerSpec, containers); verify(endpoint, timeout(TIMEOUT)).sendObject(new KieServerControllerNotification(event)); } }
@Override public int hashCode() { int result = getServerTemplate().hashCode(); result = 31 * result + getContainerSpec().hashCode(); result = 31 * result + getContainers().hashCode(); return result; }
@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; }
@Override public int hashCode() { int result = getServerTemplate().hashCode(); result = 31 * result + getContainerSpec().hashCode(); result = 31 * result + getContainers().hashCode(); return result; }