use of cz.metacentrum.perun.core.api.GroupsPageQuery in project perun by CESNET.
the class GroupsManagerEntryIntegrationTest method getGroupsPage_ParentGroup_OrderByDescriptionDSC.
@Test
public void getGroupsPage_ParentGroup_OrderByDescriptionDSC() throws Exception {
System.out.println(CLASS_NAME + "getGroupsPage_ParentGroup_OrderByDescriptionDSC");
vo = setUpVo();
perun.getGroupsManager().createGroup(sess, vo, group);
perun.getGroupsManager().createGroup(sess, group, group2);
perun.getGroupsManager().createGroup(sess, group2, group21);
Group groupA = new Group("A_group", "A_testovaci");
perun.getGroupsManager().createGroup(sess, group, groupA);
Group groupZ = new Group("Z_group", "Z_testovaci");
perun.getGroupsManager().createGroup(sess, group, groupZ);
GroupsPageQuery query = new GroupsPageQuery(10, 0, SortingOrder.DESCENDING, GroupsOrderColumn.DESCRIPTION);
Paginated<RichGroup> subgroups = groupsManager.getSubgroupsPage(sess, group, query, List.of());
assertNotNull(subgroups);
assertEquals(subgroups.getData().size(), 4);
assertEquals(subgroups.getData().get(0), groupsManagerBl.convertGroupToRichGroupWithAttributesByName(sess, groupZ, List.of()));
assertEquals(subgroups.getData().get(3), groupsManagerBl.convertGroupToRichGroupWithAttributesByName(sess, groupA, List.of()));
}
use of cz.metacentrum.perun.core.api.GroupsPageQuery in project perun by CESNET.
the class GroupsManagerEntryIntegrationTest method getGroupsPage_Vo_all.
@Test
public void getGroupsPage_Vo_all() throws Exception {
System.out.println(CLASS_NAME + "getGroupsPage_Vo_all");
vo = setUpVo();
perun.getGroupsManager().createGroup(sess, vo, group);
perun.getGroupsManager().createGroup(sess, vo, group2);
perun.getGroupsManager().createGroup(sess, group2, group21);
perun.getGroupsManager().createGroup(sess, group21, group3);
GroupsPageQuery query = new GroupsPageQuery(10, 0, SortingOrder.ASCENDING, GroupsOrderColumn.ID);
Paginated<RichGroup> groups = groupsManager.getGroupsPage(sess, vo, query, List.of());
assertNotNull(groups);
assertEquals(groups.getData().size(), 5);
assertTrue(groups.getData().containsAll(groupsManager.getAllRichGroupsWithAttributesByNames(sess, vo, List.of())));
}
use of cz.metacentrum.perun.core.api.GroupsPageQuery in project perun by CESNET.
the class GroupsManagerEntryIntegrationTest method getGroupsPage_Vo_OrderByDescriptionDSC.
@Test
public void getGroupsPage_Vo_OrderByDescriptionDSC() throws Exception {
System.out.println(CLASS_NAME + "getGroupsPage_Vo_OrderByDescriptionDSC");
vo = setUpVo();
perun.getGroupsManager().createGroup(sess, vo, group);
Group groupA = new Group("A_group", "A_testovaci");
perun.getGroupsManager().createGroup(sess, vo, groupA);
Group groupZ = new Group("Z_group", "Z_testovaci");
perun.getGroupsManager().createGroup(sess, vo, groupZ);
GroupsPageQuery query = new GroupsPageQuery(10, 0, SortingOrder.DESCENDING, GroupsOrderColumn.DESCRIPTION);
Paginated<RichGroup> groups = groupsManager.getGroupsPage(sess, vo, query, List.of());
assertNotNull(groups);
assertEquals(groups.getData().size(), 4);
assertEquals(groups.getData().get(0), groupsManagerBl.convertGroupToRichGroupWithAttributesByName(sess, groupZ, List.of()));
assertEquals(groups.getData().get(3), groupsManagerBl.convertGroupToRichGroupWithAttributesByName(sess, groupA, List.of()));
}
use of cz.metacentrum.perun.core.api.GroupsPageQuery in project perun by CESNET.
the class GroupsManagerEntryIntegrationTest method getGroupsPage_ParentGroup_searchStringName.
@Test
public void getGroupsPage_ParentGroup_searchStringName() throws Exception {
System.out.println(CLASS_NAME + "getGroupsPage_ParentGroup_searchStringName");
vo = setUpVo();
perun.getGroupsManager().createGroup(sess, vo, group);
perun.getGroupsManager().createGroup(sess, group, group2);
perun.getGroupsManager().createGroup(sess, group2, group21);
perun.getGroupsManager().createGroup(sess, group2, group3);
perun.getGroupsManager().createGroup(sess, group21, group4);
perun.getGroupsManager().createGroup(sess, group3, group5);
GroupsPageQuery query = new GroupsPageQuery(10, 0, SortingOrder.ASCENDING, GroupsOrderColumn.ID, "GroupsManagerTestGroup");
Paginated<RichGroup> subgroups = groupsManager.getSubgroupsPage(sess, group, query, List.of());
Paginated<RichGroup> subgroups2 = groupsManager.getSubgroupsPage(sess, group21, query, List.of());
assertNotNull(subgroups);
assertEquals(subgroups.getData().size(), 5);
assertNotNull(subgroups2);
assertEquals(subgroups2.getData().size(), 1);
}
use of cz.metacentrum.perun.core.api.GroupsPageQuery in project perun by CESNET.
the class GroupsManagerEntryIntegrationTest method getGroupsPage_filterByPolicyForGroupAdmin.
@Test
public void getGroupsPage_filterByPolicyForGroupAdmin() throws Exception {
System.out.println(CLASS_NAME + "getGroupsPage_checkPolicy");
vo = setUpVo();
perun.getGroupsManager().createGroup(sess, vo, group);
perun.getGroupsManager().createGroup(sess, vo, group2);
perun.getGroupsManager().createGroup(sess, group2, group21);
perun.getGroupsManager().createGroup(sess, group21, group3);
perun.getGroupsManager().createGroup(sess, group21, group4);
perun.getGroupsManager().createGroup(sess, group4, group5);
perun.getGroupsManager().createGroup(sess, group5, group6);
Member member1 = setUpMember(vo);
User user1 = perun.getUsersManagerBl().getUserByMember(sess, member1);
groupsManager.addAdmin(sess, group4, user1);
PerunSession sess2 = new PerunSessionImpl(perun, new PerunPrincipal("groupAdmin1", ExtSourcesManager.EXTSOURCE_NAME_INTERNAL, ExtSourcesManager.EXTSOURCE_INTERNAL), new PerunClient());
sess2.getPerunPrincipal().setUser(user1);
GroupsPageQuery query = new GroupsPageQuery(10, 0, SortingOrder.ASCENDING, GroupsOrderColumn.ID);
Paginated<RichGroup> groups = groupsManager.getGroupsPage(sess2, vo, query, List.of());
assertNotNull(groups);
assertEquals(groups.getData().size(), 3);
}
Aggregations