@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("RANGER", service);
  Mockito.when(cluster.getServices()).thenReturn(services);
  Mockito.when(cluster.getClusterId()).thenReturn(1L);
  Mockito.when(clusters.getCluster("cluster")).thenReturn(cluster);
  final DesiredConfig desiredConfig = Mockito.mock(DesiredConfig.class);
  Mockito.when(desiredConfig.getTag()).thenReturn("tag");
  Map<String, DesiredConfig> configMap = new HashMap<String, DesiredConfig>();
  configMap.put("ranger-admin-site", desiredConfig);
  Mockito.when(cluster.getDesiredConfigs()).thenReturn(configMap);
  final Config config = Mockito.mock(Config.class);
  Mockito.when(cluster.getConfig(Mockito.anyString(), Mockito.anyString())).thenReturn(config);
  final Map<String, String> properties = new HashMap<String, String>();
  Mockito.when(config.getProperties()).thenReturn(properties);
  properties.put("ranger.service.http.enabled","true");
  properties.put("ranger.service.https.attrib.ssl.enabled","true");
  properties.put("ranger.https.attrib.keystore.file","/etc/ranger/security/ranger-admin-keystore.jks");
  PrerequisiteCheck check = new PrerequisiteCheck(null, null);
  rangerSSLConfigCheck.perform(check, new PrereqCheckRequest("cluster"));
  Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
  properties.put("ranger.service.http.enabled","true");
  properties.put("ranger.service.https.attrib.ssl.enabled","true");
  properties.put("ranger.https.attrib.keystore.file","/etc/ranger/security/ranger-admin-keystore.jks");
  check = new PrerequisiteCheck(null, null);
  rangerSSLConfigCheck.perform(check, new PrereqCheckRequest("cluster"));
  Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
  properties.put("ranger.service.http.enabled","true");
  properties.put("ranger.service.https.attrib.ssl.enabled","fasle");
  properties.put("ranger.https.attrib.keystore.file","/etc/ranger/security/ranger-admin-keystore.jks");
  check = new PrerequisiteCheck(null, null);
  rangerSSLConfigCheck.perform(check, new PrereqCheckRequest("cluster"));
  Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
  properties.put("ranger.service.http.enabled","false");
  properties.put("ranger.service.https.attrib.ssl.enabled","true");
  properties.put("ranger.https.attrib.keystore.file","/etc/ranger/admin/conf/ranger-admin-keystore.jks");
  check = new PrerequisiteCheck(null, null);
  rangerSSLConfigCheck.perform(check, new PrereqCheckRequest("cluster"));
  Assert.assertEquals(PrereqCheckStatus.WARNING, check.getStatus());
  properties.put("ranger.service.http.enabled","false");
  properties.put("ranger.service.https.attrib.ssl.enabled","true");
  properties.put("ranger.https.attrib.keystore.file","/etc/ranger/security/ranger-admin-keystore.jks");
  check = new PrerequisiteCheck(null, null);
  rangerSSLConfigCheck.perform(check, new PrereqCheckRequest("cluster"));
  Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
  properties.put("ranger.service.http.enabled","false");
  properties.put("ranger.service.https.attrib.ssl.enabled","false");
  properties.put("ranger.https.attrib.keystore.file","/etc/ranger/security/ranger-admin-keystore.jks");
  check = new PrerequisiteCheck(null, null);
  rangerSSLConfigCheck.perform(check, new PrereqCheckRequest("cluster"));
  Assert.assertEquals(PrereqCheckStatus.PASS, check.getStatus());
}