use of com.baidu.hugegraph.auth.HugeGroup in project incubator-hugegraph by apache.
the class AuthTest method clearAll.
@After
public void clearAll() {
HugeGraph graph = graph();
AuthManager authManager = graph.authManager();
for (HugeUser user : authManager.listAllUsers(-1)) {
authManager.deleteUser(user.id());
}
for (HugeGroup group : authManager.listAllGroups(-1)) {
authManager.deleteGroup(group.id());
}
for (HugeTarget target : authManager.listAllTargets(-1)) {
authManager.deleteTarget(target.id());
}
for (HugeProject project : authManager.listAllProject(-1)) {
if (!CollectionUtils.isEmpty(project.graphs())) {
authManager.projectRemoveGraphs(project.id(), project.graphs());
}
authManager.deleteProject(project.id());
}
Assert.assertEquals(0, authManager.listAllAccess(-1).size());
Assert.assertEquals(0, authManager.listAllBelong(-1).size());
}
use of com.baidu.hugegraph.auth.HugeGroup in project incubator-hugegraph by apache.
the class AuthTest method testUpdateGroup.
@Test
public void testUpdateGroup() throws InterruptedException {
HugeGraph graph = graph();
AuthManager authManager = graph.authManager();
HugeGroup group = makeGroup("group1");
group.description("description1");
Id id = authManager.createGroup(group);
group = authManager.getGroup(id);
Assert.assertEquals("group1", group.name());
Assert.assertEquals("description1", group.description());
Assert.assertEquals(group.create(), group.update());
Date oldUpdateTime = group.update();
Thread.sleep(1L);
group.description("description2");
authManager.updateGroup(group);
HugeGroup group2 = authManager.getGroup(id);
Assert.assertEquals("group1", group2.name());
Assert.assertEquals("description2", group2.description());
Assert.assertEquals(oldUpdateTime, group2.create());
Assert.assertNotEquals(oldUpdateTime, group2.update());
}
Aggregations