use of org.apache.ranger.plugin.model.RangerService in project ranger by apache.
the class TestPublicAPIsv2 method test13updateService.
@Test
public void test13updateService() throws Exception {
RangerService rangerService = rangerService();
HttpServletRequest request = null;
Mockito.when(serviceREST.updateService(rangerService, request)).thenReturn(rangerService);
RangerService dbRangerService = publicAPIsv2.updateService(rangerService, Id, request);
Assert.assertNotNull(dbRangerService);
Assert.assertEquals(dbRangerService, rangerService);
Assert.assertEquals(dbRangerService.getId(), rangerService.getId());
Assert.assertEquals(dbRangerService.getName(), rangerService.getName());
Mockito.verify(serviceREST).updateService(rangerService, request);
}
use of org.apache.ranger.plugin.model.RangerService in project ranger by apache.
the class TestPublicAPIsv2 method test16deleteServiceByName.
@Test
public void test16deleteServiceByName() throws Exception {
RangerService rangerService = rangerService();
String name = rangerService.getName();
Mockito.when(serviceREST.getServiceByName(name)).thenReturn(rangerService);
Mockito.doNothing().when(serviceREST).deleteService(rangerService.getId());
publicAPIsv2.deleteServiceByName(name);
Mockito.verify(serviceREST).deleteService(rangerService.getId());
Mockito.verify(serviceREST).getServiceByName(name);
}
use of org.apache.ranger.plugin.model.RangerService in project ranger by apache.
the class TestPublicAPIsv2 method rangerService.
private RangerService rangerService() {
Map<String, String> configs = new HashMap<String, String>();
configs.put("username", "servicemgr");
configs.put("password", "servicemgr");
configs.put("namenode", "servicemgr");
configs.put("hadoop.security.authorization", "No");
configs.put("hadoop.security.authentication", "Simple");
configs.put("hadoop.security.auth_to_local", "");
configs.put("dfs.datanode.kerberos.principal", "");
configs.put("dfs.namenode.kerberos.principal", "");
configs.put("dfs.secondary.namenode.kerberos.principal", "");
configs.put("hadoop.rpc.protection", "Privacy");
configs.put("commonNameForCertificate", "");
RangerService rangerService = new RangerService();
rangerService.setId(Id);
rangerService.setConfigs(configs);
rangerService.setCreateTime(new Date());
rangerService.setDescription("service policy");
rangerService.setGuid("1427365526516_835_0");
rangerService.setIsEnabled(true);
rangerService.setName("HDFS_1");
rangerService.setPolicyUpdateTime(new Date());
rangerService.setType("1");
rangerService.setUpdatedBy("Admin");
rangerService.setUpdateTime(new Date());
return rangerService;
}
use of org.apache.ranger.plugin.model.RangerService in project ranger by apache.
the class TestPublicAPIsv2 method test9getService.
@Test
public void test9getService() throws Exception {
RangerService rangerService = rangerService();
Mockito.when(serviceREST.getService(rangerService.getId())).thenReturn(rangerService);
RangerService dbRangerService = publicAPIsv2.getService(Id);
Assert.assertNotNull(dbRangerService);
Assert.assertEquals(dbRangerService, rangerService);
Assert.assertEquals(dbRangerService.getId(), rangerService.getId());
Assert.assertEquals(dbRangerService.getName(), rangerService.getName());
Mockito.verify(serviceREST).getService(Id);
}
use of org.apache.ranger.plugin.model.RangerService in project ranger by apache.
the class TestPublicAPIsv2 method test14updateServiceByName.
@Test
public void test14updateServiceByName() throws Exception {
RangerService rangerService = rangerService();
HttpServletRequest request = null;
String name = rangerService.getName();
Mockito.when(serviceREST.getServiceByName(name)).thenReturn(rangerService);
Mockito.when(serviceREST.updateService(rangerService, request)).thenReturn(rangerService);
RangerService dbRangerService = publicAPIsv2.updateServiceByName(rangerService, name, request);
Assert.assertNotNull(dbRangerService);
Assert.assertEquals(dbRangerService, rangerService);
Assert.assertEquals(dbRangerService.getId(), rangerService.getId());
Assert.assertEquals(dbRangerService.getName(), rangerService.getName());
Mockito.verify(serviceREST).updateService(rangerService, request);
Mockito.verify(serviceREST).getServiceByName(name);
}
Aggregations