@Test public void testPerform() 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("KAFKA", service); Mockito.when(cluster.getServices()).thenReturn(services); Mockito.when(cluster.getClusterId()).thenReturn(1L); Mockito.when(cluster.getSecurityType()).thenReturn(SecurityType.KERBEROS); Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster); PrerequisiteCheck check = new PrerequisiteCheck(null, null); kafkaKerberosCheck.perform(check, new PrereqCheckRequest("cluster")); Assert.assertEquals(PrereqCheckStatus.WARNING, check.getStatus()); check = new PrerequisiteCheck(null, null); Mockito.when(cluster.getSecurityType()).thenReturn(SecurityType.NONE); kafkaKerberosCheck.perform(check, new PrereqCheckRequest("cluster")); Assert.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); if (cluster.getSecurityType() == SecurityType.KERBEROS){ prerequisiteCheck.getFailedOn().add(KAFKA_SERVICE); prerequisiteCheck.setStatus(PrereqCheckStatus.WARNING); prerequisiteCheck.setFailReason(getFailReason(prerequisiteCheck, request)); } }
KafkaKerberosCheck extends AbstractCheckDescriptor { @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { final String clusterName = request.getClusterName(); final Cluster cluster = clustersProvider.get().getCluster(clusterName); if (cluster.getSecurityType() == SecurityType.KERBEROS){ prerequisiteCheck.getFailedOn().add(KAFKA_SERVICE); prerequisiteCheck.setStatus(PrereqCheckStatus.WARNING); prerequisiteCheck.setFailReason(getFailReason(prerequisiteCheck, request)); } } }
KafkaKerberosCheck extends AbstractCheckDescriptor { @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { final String clusterName = request.getClusterName(); final Cluster cluster = clustersProvider.get().getCluster(clusterName); if (cluster.getSecurityType() == SecurityType.KERBEROS){ prerequisiteCheck.getFailedOn().add(KAFKA_SERVICE); prerequisiteCheck.setStatus(PrereqCheckStatus.WARNING); prerequisiteCheck.setFailReason(getFailReason(prerequisiteCheck, request)); } } KafkaKerberosCheck(); }
KafkaKerberosCheck extends AbstractCheckDescriptor { @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { final String clusterName = request.getClusterName(); final Cluster cluster = clustersProvider.get().getCluster(clusterName); if (cluster.getSecurityType() == SecurityType.KERBEROS){ prerequisiteCheck.getFailedOn().add(KAFKA_SERVICE); prerequisiteCheck.setStatus(PrereqCheckStatus.WARNING); prerequisiteCheck.setFailReason(getFailReason(prerequisiteCheck, request)); } } KafkaKerberosCheck(); @Override boolean isApplicable(PrereqCheckRequest request); @Override void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request); }
KafkaKerberosCheck extends AbstractCheckDescriptor { @Override public void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request) throws AmbariException { final String clusterName = request.getClusterName(); final Cluster cluster = clustersProvider.get().getCluster(clusterName); if (cluster.getSecurityType() == SecurityType.KERBEROS){ prerequisiteCheck.getFailedOn().add(KAFKA_SERVICE); prerequisiteCheck.setStatus(PrereqCheckStatus.WARNING); prerequisiteCheck.setFailReason(getFailReason(prerequisiteCheck, request)); } } KafkaKerberosCheck(); @Override boolean isApplicable(PrereqCheckRequest request); @Override void perform(PrerequisiteCheck prerequisiteCheck, PrereqCheckRequest request);  }