@Test public void shouldBeFalseWhenHostsReturnedHasOldHeartbeat() throws ApiException { InstanceMetaData instanceMetaData = validInstanceMetadata(); ApiHost apiHost = new ApiHost() .ipAddress(instanceMetaData.getPrivateIp()) .lastHeartbeat(Instant.now().minus(5, ChronoUnit.MINUTES).toString()); when(hostsResourceApi.readHosts(null, null, VIEWTYPE)).thenReturn(new ApiHostList().items(List.of(apiHost))); boolean result = underTest.doStatusCheck(getPollerObject(instanceMetaData), new CommandsResourceApi()); assertFalse(result); }
@Override protected boolean doStatusCheck(ClouderaManagerCommandPollerObject pollerObject, CommandsResourceApi commandsResourceApi) throws ApiException { List<String> hostIpsFromManager = fetchHeartbeatedHostIpsFromManager(pollerObject); List<InstanceMetaData> notKnownInstancesByManager = collectNotKnownInstancesByManager(pollerObject, hostIpsFromManager); if (!notKnownInstancesByManager.isEmpty()) { LOGGER.warn("there are missing nodes from cloudera manager, not known instances: {}", notKnownInstancesByManager); return false; } else { return true; } }
ClouderaManagerHostStatusChecker extends AbstractClouderaManagerCommandCheckerTask<ClouderaManagerCommandPollerObject> { @Override protected boolean doStatusCheck(ClouderaManagerCommandPollerObject pollerObject, CommandsResourceApi commandsResourceApi) throws ApiException { List<String> hostIpsFromManager = fetchHeartbeatedHostIpsFromManager(pollerObject); List<InstanceMetaData> notKnownInstancesByManager = collectNotKnownInstancesByManager(pollerObject, hostIpsFromManager); if (!notKnownInstancesByManager.isEmpty()) { LOGGER.warn("there are missing nodes from cloudera manager, not known instances: {}", notKnownInstancesByManager); return false; } else { return true; } } }
ClouderaManagerHostStatusChecker extends AbstractClouderaManagerCommandCheckerTask<ClouderaManagerCommandPollerObject> { @Override protected boolean doStatusCheck(ClouderaManagerCommandPollerObject pollerObject, CommandsResourceApi commandsResourceApi) throws ApiException { List<String> hostIpsFromManager = fetchHeartbeatedHostIpsFromManager(pollerObject); List<InstanceMetaData> notKnownInstancesByManager = collectNotKnownInstancesByManager(pollerObject, hostIpsFromManager); if (!notKnownInstancesByManager.isEmpty()) { LOGGER.warn("there are missing nodes from cloudera manager, not known instances: {}", notKnownInstancesByManager); return false; } else { return true; } } ClouderaManagerHostStatusChecker(ClouderaManagerApiPojoFactory clouderaManagerApiPojoFactory,
            CloudbreakEventService cloudbreakEventService); }
ClouderaManagerHostStatusChecker extends AbstractClouderaManagerCommandCheckerTask<ClouderaManagerCommandPollerObject> { @Override protected boolean doStatusCheck(ClouderaManagerCommandPollerObject pollerObject, CommandsResourceApi commandsResourceApi) throws ApiException { List<String> hostIpsFromManager = fetchHeartbeatedHostIpsFromManager(pollerObject); List<InstanceMetaData> notKnownInstancesByManager = collectNotKnownInstancesByManager(pollerObject, hostIpsFromManager); if (!notKnownInstancesByManager.isEmpty()) { LOGGER.warn("there are missing nodes from cloudera manager, not known instances: {}", notKnownInstancesByManager); return false; } else { return true; } } ClouderaManagerHostStatusChecker(ClouderaManagerApiPojoFactory clouderaManagerApiPojoFactory,
            CloudbreakEventService cloudbreakEventService); @Override void handleTimeout(ClouderaManagerCommandPollerObject pollerObject); @Override String successMessage(ClouderaManagerCommandPollerObject pollerObject); }
ClouderaManagerHostStatusChecker extends AbstractClouderaManagerCommandCheckerTask<ClouderaManagerCommandPollerObject> { @Override protected boolean doStatusCheck(ClouderaManagerCommandPollerObject pollerObject, CommandsResourceApi commandsResourceApi) throws ApiException { List<String> hostIpsFromManager = fetchHeartbeatedHostIpsFromManager(pollerObject); List<InstanceMetaData> notKnownInstancesByManager = collectNotKnownInstancesByManager(pollerObject, hostIpsFromManager); if (!notKnownInstancesByManager.isEmpty()) { LOGGER.warn("there are missing nodes from cloudera manager, not known instances: {}", notKnownInstancesByManager); return false; } else { return true; } } ClouderaManagerHostStatusChecker(ClouderaManagerApiPojoFactory clouderaManagerApiPojoFactory,
            CloudbreakEventService cloudbreakEventService); @Override void handleTimeout(ClouderaManagerCommandPollerObject pollerObject); @Override String successMessage(ClouderaManagerCommandPollerObject pollerObject);  }