use of org.apache.ranger.plugin.model.RangerTagDef in project ranger by apache.
the class TestTagREST method test1createTagDef.
@Test
public void test1createTagDef() {
RangerTagDef oldTagDef = null;
RangerTagDef newTagDef = new RangerTagDef();
newTagDef.setId(id);
newTagDef.setName(name);
try {
Mockito.when(validator.preCreateTagDef(oldTagDef, false)).thenReturn(null);
} catch (Exception e) {
}
try {
Mockito.when(tagStore.createTagDef(oldTagDef)).thenReturn(newTagDef);
} catch (Exception e) {
}
RangerTagDef rangerTagDef = tagREST.createTagDef(oldTagDef, false);
Assert.assertEquals(rangerTagDef.getId(), newTagDef.getId());
Assert.assertNotNull(rangerTagDef);
Assert.assertEquals(rangerTagDef.getName(), newTagDef.getName());
try {
Mockito.verify(validator).preCreateTagDef(oldTagDef, false);
} catch (Exception e) {
}
try {
Mockito.verify(tagStore).createTagDef(oldTagDef);
} catch (Exception e) {
}
}
use of org.apache.ranger.plugin.model.RangerTagDef in project ranger by apache.
the class TestTagREST method test14getAllTagDefs.
@Test
public void test14getAllTagDefs() {
List<RangerTagDef> ret = new ArrayList<RangerTagDef>();
RangerTagDef rangerTagDef = new RangerTagDef();
rangerTagDef.setId(id);
rangerTagDef.setVersion(5L);
ret.add(rangerTagDef);
try {
Mockito.when(tagStore.getTagDefs((SearchFilter) Mockito.any())).thenReturn(ret);
} catch (Exception e) {
}
List<RangerTagDef> result = tagREST.getAllTagDefs();
Assert.assertNotNull(result);
Assert.assertEquals(result.get(0).getId(), ret.get(0).getId());
Assert.assertEquals(result.get(0).getVersion(), ret.get(0).getVersion());
try {
Mockito.verify(tagStore).getTagDefs((SearchFilter) Mockito.any());
} catch (Exception e) {
}
}
use of org.apache.ranger.plugin.model.RangerTagDef in project ranger by apache.
the class TestTagREST method test8getTagDef.
@Test
public void test8getTagDef() {
RangerTagDef oldTagDef = new RangerTagDef();
oldTagDef.setId(id);
oldTagDef.setName(name);
try {
Mockito.when(tagStore.getTagDef(id)).thenReturn(oldTagDef);
} catch (Exception e) {
}
RangerTagDef rangerTagDef = tagREST.getTagDef(id);
Assert.assertNotNull(rangerTagDef.getId());
Assert.assertEquals(rangerTagDef.getId(), oldTagDef.getId());
Assert.assertEquals(rangerTagDef.getName(), oldTagDef.getName());
try {
Mockito.verify(tagStore).getTagDef(id);
} catch (Exception e) {
}
}
use of org.apache.ranger.plugin.model.RangerTagDef in project ranger by apache.
the class RangerTagDefService method getTagDefByName.
public RangerTagDef getTagDefByName(String name) {
RangerTagDef ret = null;
XXTagDef xxTagDef = daoMgr.getXXTagDef().findByName(name);
if (xxTagDef != null) {
ret = populateViewBean(xxTagDef);
}
return ret;
}
use of org.apache.ranger.plugin.model.RangerTagDef in project ranger by apache.
the class RangerTagDefService method getTagDefByGuid.
public RangerTagDef getTagDefByGuid(String guid) {
RangerTagDef ret = null;
XXTagDef xxTagDef = daoMgr.getXXTagDef().findByGuid(guid);
if (xxTagDef != null) {
ret = populateViewBean(xxTagDef);
}
return ret;
}
Aggregations