ServicesNamenodeHighAvailabilityCheck extends AbstractCheckDescriptor { @Override public boolean isApplicable(PrereqCheckRequest request) throws AmbariException { return super.isApplicable(request, Arrays.asList("HDFS"), true); } ServicesNamenodeHighAvailabilityCheck(); @Override boolean isApplicable(PrereqCheckRequest request); @Override void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request);  }
@Test public void testIsApplicable() throws Exception { final Cluster cluster = Mockito.mock(Cluster.class); final Map<String, Service> services = new HashMap<>(); final Service service = Mockito.mock(Service.class); services.put("HDFS", service); Mockito.when(cluster.getServices()).thenReturn(services); Mockito.when(cluster.getClusterId()).thenReturn(1L); Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster); Assert.assertTrue(servicesNamenodeHighAvailabilityCheck.isApplicable(new PrereqCheckRequest("cluster"))); services.remove("HDFS"); Assert.assertFalse(servicesNamenodeHighAvailabilityCheck.isApplicable(new PrereqCheckRequest("cluster"))); }