@Test public void monitoringStatus_contains_information_about_two_members_when_two_members_defined() { PDSMonitoring testData = PDSMonitoringTestDataUtil.createTestMonitoringWith2ClusterMembers(); List<PDSHeartBeat> heartBeatsForServerId = new ArrayList<>(); PDSHeartBeat heartbeat1 = new PDSHeartBeat(); heartbeat1.setClusterMemberData(testData.getMembers().get(0).toJSON()); heartBeatsForServerId.add(heartbeat1); PDSHeartBeat heartbeat2 = new PDSHeartBeat(); heartbeat2.setClusterMemberData(testData.getMembers().get(1).toJSON()); heartBeatsForServerId.add(heartbeat2); when(heartBeatRepository.findAllByServerId(SERVER_ID)).thenReturn(heartBeatsForServerId); PDSMonitoring monitoring = serviceToTest.getMonitoringStatus(); assertEquals(2, monitoring.getMembers().size()); assertEquals(testData.getMembers().get(0).getHeartBeatTimestamp(), monitoring.getMembers().get(0).getHeartBeatTimestamp()); assertEquals(testData.getMembers().get(1).getHeartBeatTimestamp(), monitoring.getMembers().get(1).getHeartBeatTimestamp()); }
@UseCaseAdminFetchesMonitoringStatus(@PDSStep(name="service call",description = "service fetches job state counts and gathers hearbeats of cluster members by serverId",number=4)) public PDSMonitoring getMonitoringStatus() { String serverId = serverConfiguratonService.getServerId(); PDSMonitoring monitoring = new PDSMonitoring(); addStateCounts(serverId, monitoring); addHeartBeatDataAsMember(serverId, monitoring); return monitoring; }
PDSMonitoringStatusService { @UseCaseAdminFetchesMonitoringStatus(@PDSStep(name="service call",description = "service fetches job state counts and gathers hearbeats of cluster members by serverId",number=4)) public PDSMonitoring getMonitoringStatus() { String serverId = serverConfiguratonService.getServerId(); PDSMonitoring monitoring = new PDSMonitoring(); addStateCounts(serverId, monitoring); addHeartBeatDataAsMember(serverId, monitoring); return monitoring; } }
PDSMonitoringStatusService { @UseCaseAdminFetchesMonitoringStatus(@PDSStep(name="service call",description = "service fetches job state counts and gathers hearbeats of cluster members by serverId",number=4)) public PDSMonitoring getMonitoringStatus() { String serverId = serverConfiguratonService.getServerId(); PDSMonitoring monitoring = new PDSMonitoring(); addStateCounts(serverId, monitoring); addHeartBeatDataAsMember(serverId, monitoring); return monitoring; }  }
PDSMonitoringStatusService { @UseCaseAdminFetchesMonitoringStatus(@PDSStep(name="service call",description = "service fetches job state counts and gathers hearbeats of cluster members by serverId",number=4)) public PDSMonitoring getMonitoringStatus() { String serverId = serverConfiguratonService.getServerId(); PDSMonitoring monitoring = new PDSMonitoring(); addStateCounts(serverId, monitoring); addHeartBeatDataAsMember(serverId, monitoring); return monitoring; }  @UseCaseAdminFetchesMonitoringStatus(@PDSStep(name="service call",description = "service fetches job state counts and gathers hearbeats of cluster members by serverId",number=4)) PDSMonitoring getMonitoringStatus(); }
PDSMonitoringStatusService { @UseCaseAdminFetchesMonitoringStatus(@PDSStep(name="service call",description = "service fetches job state counts and gathers hearbeats of cluster members by serverId",number=4)) public PDSMonitoring getMonitoringStatus() { String serverId = serverConfiguratonService.getServerId(); PDSMonitoring monitoring = new PDSMonitoring(); addStateCounts(serverId, monitoring); addHeartBeatDataAsMember(serverId, monitoring); return monitoring; }  @UseCaseAdminFetchesMonitoringStatus(@PDSStep(name="service call",description = "service fetches job state counts and gathers hearbeats of cluster members by serverId",number=4)) PDSMonitoring getMonitoringStatus();  }