use of cz.metacentrum.perun.registrar.model.RichApplication in project perun by CESNET.
the class RegistrarBaseIntegrationTest method getApplicationsPageForGroup.
@Test
public void getApplicationsPageForGroup() throws Exception {
System.out.println("getApplicationsPageForGroup");
// create groups
Group group1 = setUpGroup("Group1", "Cool folks");
Group group2 = setUpGroup("Group2", "Cooler folks");
// create users
User user1 = setUpUser("Joe", "Doe");
User user2 = setUpUser("Barney", "Stinson");
Application application1 = setUpApplicationGroup(user1, group1);
Application application2 = setUpApplicationGroup(user2, group2);
ApplicationsPageQuery query = new ApplicationsPageQuery(4, 0, SortingOrder.DESCENDING, ApplicationsOrderColumn.STATE, List.of(Application.AppState.APPROVED, Application.AppState.VERIFIED), group1.getId());
Paginated<RichApplication> result = registrarManager.getApplicationsPage(session, vo, query);
List<Group> returnedGroups = result.getData().stream().map(Application::getGroup).toList();
List<Integer> returnedIds = returnedGroups.stream().map(Group::getId).toList();
assertThat(returnedIds).containsExactly(group1.getId());
}
use of cz.metacentrum.perun.registrar.model.RichApplication in project perun by CESNET.
the class RegistrarBaseIntegrationTest method getApplicationsPageForUserIsMember.
@Test
public void getApplicationsPageForUserIsMember() throws Exception {
System.out.println("getApplicationsPageForUserIsMember");
// create groups
Group group1 = setUpGroup("Group1", "Cool folks");
Group group2 = setUpGroup("Group2", "Cooler folks");
// create users
User user1 = setUpUser("Joe", "Doe");
User user2 = setUpUser("Barney", "Stinson");
Application application1 = setUpApplicationGroup(user1, group1);
Application application2 = setUpApplicationGroup(user2, group2);
ApplicationsPageQuery query = new ApplicationsPageQuery(4, 0, SortingOrder.DESCENDING, ApplicationsOrderColumn.STATE, List.of(Application.AppState.VERIFIED), user1.getId(), group1.getId());
Paginated<RichApplication> result = registrarManager.getApplicationsPage(session, vo, query);
assertEquals(1, result.getData().size());
}
use of cz.metacentrum.perun.registrar.model.RichApplication in project perun by CESNET.
the class RegistrarBaseIntegrationTest method getApplicationsPageFindByGroupUuid.
@Test
public void getApplicationsPageFindByGroupUuid() throws Exception {
System.out.println("getApplicationsPageFindByGroupUuid");
// create groups
Group group1 = setUpGroup("Group1", "Cool folks");
Group group2 = setUpGroup("Group2", "Cooler folks");
// create users
User user1 = setUpUser("Joe", "Doe");
User user2 = setUpUser("Barney", "Stinson");
setUpApplicationGroup(user1, group1);
setUpApplicationGroup(user2, group2);
ApplicationsPageQuery query = new ApplicationsPageQuery(4, 0, SortingOrder.DESCENDING, ApplicationsOrderColumn.ID, group2.getUuid().toString(), List.of(Application.AppState.APPROVED, Application.AppState.VERIFIED), true);
Paginated<RichApplication> result = registrarManager.getApplicationsPage(session, vo, query);
List<Group> returnedGroups = result.getData().stream().map(Application::getGroup).filter(Predicate.not(Objects::isNull)).toList();
List<UUID> returnedIds = returnedGroups.stream().map(Group::getUuid).toList();
assertThat(returnedIds).containsOnly(group2.getUuid());
}
Aggregations