use of com.baidu.hugegraph.auth.HugeBelong in project incubator-hugegraph by apache.
the class AuthTest method testListAllBelong.
@Test
public void testListAllBelong() {
HugeGraph graph = graph();
AuthManager authManager = graph.authManager();
Id user = authManager.createUser(makeUser("tom", "pass1"));
Id group1 = authManager.createGroup(makeGroup("group1"));
Id group2 = authManager.createGroup(makeGroup("group2"));
authManager.createBelong(makeBelong(user, group1));
authManager.createBelong(makeBelong(user, group2));
List<HugeBelong> belongs = authManager.listAllBelong(-1);
Assert.assertEquals(2, belongs.size());
Assert.assertEquals(ImmutableSet.of(group1, group2), ImmutableSet.of(belongs.get(0).target(), belongs.get(1).target()));
Assert.assertEquals(0, authManager.listAllBelong(0).size());
Assert.assertEquals(1, authManager.listAllBelong(1).size());
Assert.assertEquals(2, authManager.listAllBelong(2).size());
Assert.assertEquals(2, authManager.listAllBelong(3).size());
}
Aggregations