@Test public void testPerform() throws Exception { PrerequisiteCheck check = new PrerequisiteCheck(null, null); PrereqCheckRequest request = new PrereqCheckRequest("c1"); m_check.perform(check, request); assertEquals(PrereqCheckStatus.PASS, check.getStatus()); m_configMap.put("dfs.allow.truncate", "true"); request.setSourceStackId(new StackId("HDP-2.2.4.2")); request.setTargetStackId(new StackId("HDP-2.2.8.4")); check = new PrerequisiteCheck(null, null); m_check.perform(check, request); assertEquals(PrereqCheckStatus.FAIL, check.getStatus()); m_configMap.put("dfs.allow.truncate", "false"); check = new PrerequisiteCheck(null, null); m_check.perform(check, request); assertEquals(PrereqCheckStatus.PASS, check.getStatus()); m_configMap.put("dfs.allow.truncate", "true"); request.setSourceStackId(new StackId("HDP-2.2.4.2")); request.setTargetStackId(new StackId("HDP-2.3.8.4")); check = new PrerequisiteCheck(null, null); m_check.perform(check, request); assertEquals(PrereqCheckStatus.FAIL, check.getStatus()); m_configMap.put("dfs.allow.truncate", "false"); check = new PrerequisiteCheck(null, null); m_check.perform(check, request); assertEquals(PrereqCheckStatus.PASS, check.getStatus()); }
@Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { final String clusterName = request.getClusterName(); final Cluster cluster = clustersProvider.get().getCluster(clusterName); Config config = cluster.getDesiredConfigByType("hdfs-site"); String truncateEnabled = config.getProperties().get("dfs.allow.truncate"); if (Boolean.valueOf(truncateEnabled)) { prerequisiteCheck.getFailedOn().add("HDFS"); PrereqCheckStatus checkStatus = PrereqCheckStatus.FAIL; prerequisiteCheck.setStatus(checkStatus); prerequisiteCheck.setFailReason(getFailReason(prerequisiteCheck, request)); } }
ServicesNamenodeTruncateCheck extends AbstractCheckDescriptor { @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { final String clusterName = request.getClusterName(); final Cluster cluster = clustersProvider.get().getCluster(clusterName); Config config = cluster.getDesiredConfigByType("hdfs-site"); String truncateEnabled = config.getProperties().get("dfs.allow.truncate"); if (Boolean.valueOf(truncateEnabled)) { prerequisiteCheck.getFailedOn().add("HDFS"); PrereqCheckStatus checkStatus = PrereqCheckStatus.FAIL; prerequisiteCheck.setStatus(checkStatus); prerequisiteCheck.setFailReason(getFailReason(prerequisiteCheck, request)); } } }
ServicesNamenodeTruncateCheck extends AbstractCheckDescriptor { @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { final String clusterName = request.getClusterName(); final Cluster cluster = clustersProvider.get().getCluster(clusterName); Config config = cluster.getDesiredConfigByType("hdfs-site"); String truncateEnabled = config.getProperties().get("dfs.allow.truncate"); if (Boolean.valueOf(truncateEnabled)) { prerequisiteCheck.getFailedOn().add("HDFS"); PrereqCheckStatus checkStatus = PrereqCheckStatus.FAIL; prerequisiteCheck.setStatus(checkStatus); prerequisiteCheck.setFailReason(getFailReason(prerequisiteCheck, request)); } } ServicesNamenodeTruncateCheck(); }
ServicesNamenodeTruncateCheck extends AbstractCheckDescriptor { @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { final String clusterName = request.getClusterName(); final Cluster cluster = clustersProvider.get().getCluster(clusterName); Config config = cluster.getDesiredConfigByType("hdfs-site"); String truncateEnabled = config.getProperties().get("dfs.allow.truncate"); if (Boolean.valueOf(truncateEnabled)) { prerequisiteCheck.getFailedOn().add("HDFS"); PrereqCheckStatus checkStatus = PrereqCheckStatus.FAIL; prerequisiteCheck.setStatus(checkStatus); prerequisiteCheck.setFailReason(getFailReason(prerequisiteCheck, request)); } } ServicesNamenodeTruncateCheck(); @Override boolean isApplicable(PrereqCheckRequest request); @Override void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request); }
ServicesNamenodeTruncateCheck extends AbstractCheckDescriptor { @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { final String clusterName = request.getClusterName(); final Cluster cluster = clustersProvider.get().getCluster(clusterName); Config config = cluster.getDesiredConfigByType("hdfs-site"); String truncateEnabled = config.getProperties().get("dfs.allow.truncate"); if (Boolean.valueOf(truncateEnabled)) { prerequisiteCheck.getFailedOn().add("HDFS"); PrereqCheckStatus checkStatus = PrereqCheckStatus.FAIL; prerequisiteCheck.setStatus(checkStatus); prerequisiteCheck.setFailReason(getFailReason(prerequisiteCheck, request)); } } ServicesNamenodeTruncateCheck(); @Override boolean isApplicable(PrereqCheckRequest request); @Override void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request);  }