use of org.apache.ranger.plugin.model.RangerTagDef in project ranger by apache.
the class TestRangerTagDefService method test8getTagDefsByServiceId.
@Test
public void test8getTagDefsByServiceId() {
List<XXTagDef> xxTagDefs = new ArrayList<XXTagDef>();
XXTagDef xxTagDef = new XXTagDef();
xxTagDef.setId(id);
xxTagDef.setName(name);
xxTagDefs.add(xxTagDef);
XXTagDefDao xXTagDefDao = Mockito.mock(XXTagDefDao.class);
Mockito.when(daoMgr.getXXTagDef()).thenReturn(xXTagDefDao);
Mockito.when(xXTagDefDao.findByServiceId(serviceId)).thenReturn(xxTagDefs);
List<XXTagAttributeDef> tagAttrDefList = new ArrayList<XXTagAttributeDef>();
XXTagAttributeDef xxTagAttributeDef = new XXTagAttributeDef();
xxTagAttributeDef.setId(id);
xxTagAttributeDef.setName(name);
tagAttrDefList.add(xxTagAttributeDef);
List<RangerTagDef> result = rangerTagDefService.getTagDefsByServiceId(serviceId);
Assert.assertEquals(result.get(0).getId(), tagAttrDefList.get(0).getId());
Assert.assertEquals(result.get(0).getName(), tagAttrDefList.get(0).getName());
Mockito.verify(daoMgr).getXXTagDef();
Mockito.verify(xXTagDefDao).findByServiceId(serviceId);
}
use of org.apache.ranger.plugin.model.RangerTagDef in project ranger by apache.
the class TestRangerTagDefService method test9getTagDefsByServiceId.
@Test
public void test9getTagDefsByServiceId() {
List<XXTagDef> xxTagDefs = new ArrayList<XXTagDef>();
XXTagDefDao xXTagDefDao = Mockito.mock(XXTagDefDao.class);
Mockito.when(daoMgr.getXXTagDef()).thenReturn(xXTagDefDao);
Mockito.when(xXTagDefDao.findByServiceId(serviceId)).thenReturn(xxTagDefs);
List<RangerTagDef> result = rangerTagDefService.getTagDefsByServiceId(serviceId);
Assert.assertNotNull(result);
Mockito.verify(daoMgr).getXXTagDef();
Mockito.verify(xXTagDefDao).findByServiceId(serviceId);
}
use of org.apache.ranger.plugin.model.RangerTagDef in project ranger by apache.
the class TestRangerTagDefService method test7getTagDefByName.
@Test
public void test7getTagDefByName() {
XXTagDef xxTagDef = null;
XXTagDefDao xXTagDefDao = Mockito.mock(XXTagDefDao.class);
Mockito.when(daoMgr.getXXTagDef()).thenReturn(xXTagDefDao);
Mockito.when(xXTagDefDao.findByName(name)).thenReturn(xxTagDef);
RangerTagDef result = rangerTagDefService.getTagDefByName(name);
Assert.assertNull(result);
Mockito.verify(daoMgr).getXXTagDef();
Mockito.verify(xXTagDefDao).findByName(name);
}
use of org.apache.ranger.plugin.model.RangerTagDef in project ranger by apache.
the class TestRangerTagDefService method test1ValidateForCreate.
@Test
public void test1ValidateForCreate() {
RangerTagDef rangerServiceDef = new RangerTagDef();
rangerTagDefService.validateForCreate(rangerServiceDef);
Assert.assertNotNull(rangerServiceDef);
}
Aggregations