ServicesNamenodeTruncateCheck extends AbstractCheckDescriptor { @Override public boolean isApplicable(PrereqCheckRequest request) throws AmbariException { if (!super.isApplicable(request, Arrays.asList("HDFS"), true)) { return false; } PrereqCheckStatus ha = request.getResult(CheckDescription.SERVICES_NAMENODE_HA); if (null != ha && ha == PrereqCheckStatus.FAIL) { return false; } return true; } ServicesNamenodeTruncateCheck(); @Override boolean isApplicable(PrereqCheckRequest request); @Override void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request);  }
@Test public void testIsApplicable() throws Exception { PrereqCheckRequest checkRequest = new PrereqCheckRequest("c1"); checkRequest.setRepositoryVersion("HDP-2.2.0.0"); checkRequest.setSourceStackId(new StackId("HDP", "2.2")); checkRequest.setTargetStackId(new StackId("HDP", "2.2")); Assert.assertTrue(m_check.isApplicable(checkRequest)); }