use of cz.metacentrum.perun.core.api.GroupsPageQuery in project perun by CESNET.
the class GroupsManagerEntryIntegrationTest method getGroupsPage_Vo_searchStringName.
@Test
public void getGroupsPage_Vo_searchStringName() throws Exception {
System.out.println(CLASS_NAME + "getGroupsPage_Vo_searchStringName");
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, "GroupsManagerTestGroup");
Paginated<RichGroup> groups = groupsManager.getGroupsPage(sess, vo, query, List.of());
assertNotNull(groups);
assertEquals(groups.getData().size(), 4);
}
use of cz.metacentrum.perun.core.api.GroupsPageQuery in project perun by CESNET.
the class GroupsManagerEntryIntegrationTest method getGroupsPage_Vo_ReturnsAttributes.
@Test
public void getGroupsPage_Vo_ReturnsAttributes() throws Exception {
System.out.println(CLASS_NAME + "getGroupsPage_Vo_ReturnsAttributes");
vo = setUpVo();
perun.getGroupsManager().createGroup(sess, vo, group);
// set membershipExpirationRules attribute
HashMap<String, String> extendMembershipRules = new LinkedHashMap<>();
extendMembershipRules.put(AbstractMembershipExpirationRulesModule.membershipPeriodKeyName, "+10d");
Attribute extendMembershipRulesAttribute = new Attribute(attributesManager.getAttributeDefinition(sess, AttributesManager.NS_GROUP_ATTR_DEF + ":groupMembershipExpirationRules"));
extendMembershipRulesAttribute.setValue(extendMembershipRules);
attributesManager.setAttribute(sess, group, extendMembershipRulesAttribute);
GroupsPageQuery query = new GroupsPageQuery(10, 0, SortingOrder.ASCENDING, GroupsOrderColumn.ID);
Paginated<RichGroup> groups = groupsManager.getGroupsPage(sess, vo, query, List.of(extendMembershipRulesAttribute.getName()));
assertNotNull(groups);
assertEquals(groups.getData().size(), 2);
assertEquals(groups.getData().get(1), groupsManagerBl.convertGroupToRichGroupWithAttributesByName(sess, group, List.of(extendMembershipRulesAttribute.getName())));
assertThat(groups.getData().get(1).getAttributes()).containsOnly(extendMembershipRulesAttribute);
}
Aggregations