getGroupInfo(getGroupsAdaptor());
assertEquals(3, groups.size());
Set<GroupPrincipal> groupSet = groups.keySet();
GroupPrincipal expectedGroup1 =
new GroupPrincipal("group1", LOCAL_NAMESPACE);
GroupPrincipal expectedGroup2 =
new GroupPrincipal("group2", LOCAL_NAMESPACE);
GroupPrincipal expectedGroup3 =
new GroupPrincipal("group3", GLOBAL_NAMESPACE);
Set<GroupPrincipal> expectedGroupSet =
ImmutableSet.of(expectedGroup1, expectedGroup2, expectedGroup3);
assertEquals(expectedGroupSet, groupSet);
Set<UserPrincipal> expectedUserSet1 =
ImmutableSet.of(
new UserPrincipal("user1", LOCAL_NAMESPACE),
new UserPrincipal("user2", LOCAL_NAMESPACE));
Collection<Principal> users1 = groups.get(expectedGroup1);
Set<Principal> userSet1 = new HashSet<Principal>(users1);
assertEquals(expectedUserSet1, userSet1);
Set<Principal> expectedUserSet2 = ImmutableSet.of(
new UserPrincipal("user1", LOCAL_NAMESPACE),
new UserPrincipal("user3", LOCAL_NAMESPACE),
new GroupPrincipal("group1", LOCAL_NAMESPACE),
new GroupPrincipal("group3", GLOBAL_NAMESPACE));
Collection<Principal> users2 = groups.get(expectedGroup2);
Set<Principal> userSet2 = new HashSet<Principal>(users2);
assertEquals(expectedUserSet2, userSet2);
Collection<Principal> users3 = groups.get(expectedGroup3);