use of org.apache.ranger.plugin.model.RangerTagDef in project ranger by apache.
the class RangerTagDefService method postUpdate.
@Override
public RangerTagDef postUpdate(XXTagDef tagDef) {
RangerTagDef ret = super.postUpdate(tagDef);
daoMgr.getXXServiceVersionInfo().updateServiceVersionInfoForTagDefUpdate(tagDef.getId(), tagDef.getUpdateTime());
return ret;
}
use of org.apache.ranger.plugin.model.RangerTagDef in project ranger by apache.
the class TestTagREST method test3createTagDef.
@Test
public void test3createTagDef() {
RangerTagDef oldTagDef = new RangerTagDef();
RangerTagDef newTagDef = new RangerTagDef();
oldTagDef.setId(null);
newTagDef.setId(id);
newTagDef.setName(name);
try {
Mockito.when(validator.preCreateTagDef(oldTagDef, true)).thenReturn(oldTagDef);
} catch (Exception e) {
}
try {
Mockito.when(tagStore.updateTagDef(oldTagDef)).thenReturn(newTagDef);
} catch (Exception e) {
}
RangerTagDef rangerTagDef = tagREST.createTagDef(oldTagDef, true);
Assert.assertNotNull(rangerTagDef);
Assert.assertEquals(rangerTagDef.getId(), newTagDef.getId());
Assert.assertEquals(rangerTagDef.getName(), newTagDef.getName());
Assert.assertNotEquals(rangerTagDef.getName(), oldTagDef.getName());
try {
Mockito.verify(validator).preCreateTagDef(oldTagDef, true);
} catch (Exception e) {
}
try {
Mockito.verify(tagStore).updateTagDef(oldTagDef);
} catch (Exception e) {
}
}
use of org.apache.ranger.plugin.model.RangerTagDef in project ranger by apache.
the class TestTagREST method test6deleteTagDefByGuid.
@Test
public void test6deleteTagDefByGuid() {
RangerTagDef oldTagDef = new RangerTagDef();
oldTagDef.setId(id);
oldTagDef.setGuid(gId);
try {
Mockito.when(tagStore.getTagDefByGuid(oldTagDef.getGuid())).thenReturn(oldTagDef);
} catch (Exception e) {
}
try {
Mockito.doNothing().when(tagStore).deleteTagDef(oldTagDef.getId());
} catch (Exception e) {
}
tagREST.deleteTagDefByGuid(oldTagDef.getGuid());
Assert.assertNotNull(oldTagDef.getId());
Assert.assertNotNull(oldTagDef.getGuid());
try {
Mockito.verify(tagStore).getTagDefByGuid(oldTagDef.getGuid());
} catch (Exception e) {
}
try {
Mockito.verify(tagStore).deleteTagDef(oldTagDef.getId());
} catch (Exception e) {
}
}
use of org.apache.ranger.plugin.model.RangerTagDef in project ranger by apache.
the class TestTagREST method test10getTagDefByGuid.
@Test
public void test10getTagDefByGuid() {
RangerTagDef oldTagDef = new RangerTagDef();
oldTagDef.setId(id);
oldTagDef.setGuid(gId);
try {
Mockito.when(tagStore.getTagDefByGuid(gId)).thenReturn(oldTagDef);
} catch (Exception e) {
}
RangerTagDef rangerTagDef = tagREST.getTagDefByGuid(gId);
Assert.assertNotNull(oldTagDef.getGuid());
Assert.assertEquals(rangerTagDef.getGuid(), oldTagDef.getGuid());
Assert.assertEquals(rangerTagDef.getId(), oldTagDef.getId());
try {
Mockito.verify(tagStore).getTagDefByGuid(gId);
} catch (Exception e) {
}
}
use of org.apache.ranger.plugin.model.RangerTagDef in project ranger by apache.
the class TestTagREST method test12getTagDefByName.
@Test
public void test12getTagDefByName() {
RangerTagDef oldTagDef = new RangerTagDef();
oldTagDef.setId(id);
oldTagDef.setName(name);
try {
Mockito.when(tagStore.getTagDefByName(name)).thenReturn(oldTagDef);
} catch (Exception e) {
}
RangerTagDef rangerTagDef = tagREST.getTagDefByName(name);
Assert.assertNotNull(rangerTagDef.getName());
Assert.assertEquals(rangerTagDef.getName(), oldTagDef.getName());
Assert.assertEquals(rangerTagDef.getId(), oldTagDef.getId());
try {
Mockito.verify(tagStore).getTagDefByName(name);
} catch (Exception e) {
}
}
Aggregations