@Test public void testWarningWhenHostWithVersionMismatchExists() throws Exception { when(firstServiceComponentHosts.get(FIRST_SERVICE_COMPONENT_HOST_NAME).getUpgradeState()).thenReturn(VERSION_MISMATCH); PrerequisiteCheck check = new PrerequisiteCheck(null, CLUSTER_NAME); versionMismatchCheck.perform(check, new PrereqCheckRequest(CLUSTER_NAME)); Assert.assertEquals(PrereqCheckStatus.WARNING, check.getStatus()); }
@Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { final String clusterName = request.getClusterName(); final Cluster cluster = clustersProvider.get().getCluster(clusterName); Map<String, Service> services = cluster.getServices(); List<String> errorMessages = new ArrayList<String>(); for (Service service : services.values()) { validateService(service, prerequisiteCheck, errorMessages); } if (!prerequisiteCheck.getFailedOn().isEmpty()) { prerequisiteCheck.setStatus(PrereqCheckStatus.WARNING); String failReason = getFailReason(prerequisiteCheck, request); prerequisiteCheck.setFailReason(String.format(failReason, StringUtils.join(errorMessages, "\n"))); prerequisiteCheck.setFailReason(StringUtils.join(errorMessages, "\n")); } }
VersionMismatchCheck extends AbstractCheckDescriptor { @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { final String clusterName = request.getClusterName(); final Cluster cluster = clustersProvider.get().getCluster(clusterName); Map<String, Service> services = cluster.getServices(); List<String> errorMessages = new ArrayList<String>(); for (Service service : services.values()) { validateService(service, prerequisiteCheck, errorMessages); } if (!prerequisiteCheck.getFailedOn().isEmpty()) { prerequisiteCheck.setStatus(PrereqCheckStatus.WARNING); String failReason = getFailReason(prerequisiteCheck, request); prerequisiteCheck.setFailReason(String.format(failReason, StringUtils.join(errorMessages, "\n"))); prerequisiteCheck.setFailReason(StringUtils.join(errorMessages, "\n")); } } }
VersionMismatchCheck extends AbstractCheckDescriptor { @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { final String clusterName = request.getClusterName(); final Cluster cluster = clustersProvider.get().getCluster(clusterName); Map<String, Service> services = cluster.getServices(); List<String> errorMessages = new ArrayList<String>(); for (Service service : services.values()) { validateService(service, prerequisiteCheck, errorMessages); } if (!prerequisiteCheck.getFailedOn().isEmpty()) { prerequisiteCheck.setStatus(PrereqCheckStatus.WARNING); String failReason = getFailReason(prerequisiteCheck, request); prerequisiteCheck.setFailReason(String.format(failReason, StringUtils.join(errorMessages, "\n"))); prerequisiteCheck.setFailReason(StringUtils.join(errorMessages, "\n")); } } VersionMismatchCheck(); }
VersionMismatchCheck extends AbstractCheckDescriptor { @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { final String clusterName = request.getClusterName(); final Cluster cluster = clustersProvider.get().getCluster(clusterName); Map<String, Service> services = cluster.getServices(); List<String> errorMessages = new ArrayList<String>(); for (Service service : services.values()) { validateService(service, prerequisiteCheck, errorMessages); } if (!prerequisiteCheck.getFailedOn().isEmpty()) { prerequisiteCheck.setStatus(PrereqCheckStatus.WARNING); String failReason = getFailReason(prerequisiteCheck, request); prerequisiteCheck.setFailReason(String.format(failReason, StringUtils.join(errorMessages, "\n"))); prerequisiteCheck.setFailReason(StringUtils.join(errorMessages, "\n")); } } VersionMismatchCheck(); @Override void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request); }
VersionMismatchCheck extends AbstractCheckDescriptor { @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { final String clusterName = request.getClusterName(); final Cluster cluster = clustersProvider.get().getCluster(clusterName); Map<String, Service> services = cluster.getServices(); List<String> errorMessages = new ArrayList<String>(); for (Service service : services.values()) { validateService(service, prerequisiteCheck, errorMessages); } if (!prerequisiteCheck.getFailedOn().isEmpty()) { prerequisiteCheck.setStatus(PrereqCheckStatus.WARNING); String failReason = getFailReason(prerequisiteCheck, request); prerequisiteCheck.setFailReason(String.format(failReason, StringUtils.join(errorMessages, "\n"))); prerequisiteCheck.setFailReason(StringUtils.join(errorMessages, "\n")); } } VersionMismatchCheck(); @Override void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request);  }