use of cz.metacentrum.perun.registrar.model.RichApplication in project perun by CESNET.
the class RegistrarBaseIntegrationTest method getApplicationsPagePageSizeWorks.
@Test
public void getApplicationsPagePageSizeWorks() throws Exception {
System.out.println("getApplicationsPagePageSizeWorks");
// create groups
Group group1 = setUpGroup("Group1", "Cool folks");
// create users
User user1 = setUpUser("Joe", "Doe");
User user2 = setUpUser("Barney", "Stinson");
Application voApplication1 = setUpApplicationGroup(user1, group1);
Application voApplication2 = setUpApplicationGroup(user2, group1);
ApplicationsPageQuery query = new ApplicationsPageQuery(1, 0, SortingOrder.ASCENDING, ApplicationsOrderColumn.ID, List.of(Application.AppState.APPROVED), true);
Paginated<RichApplication> result = registrarManager.getApplicationsPage(session, vo, query);
assertThat(result.getData()).hasSize(1);
assertThat(result.getData().get(0).getId()).isEqualTo(voApplication1.getId());
}
use of cz.metacentrum.perun.registrar.model.RichApplication in project perun by CESNET.
the class RegistrarBaseIntegrationTest method getApplicationsPageFindByApplicationId.
@Test
public void getApplicationsPageFindByApplicationId() throws Exception {
System.out.println("getApplicationsPageFindByApplicationId");
// 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, Integer.toString(application1.getId()), List.of(Application.AppState.APPROVED, Application.AppState.VERIFIED), true);
Paginated<RichApplication> result = registrarManager.getApplicationsPage(session, vo, query);
List<Integer> returnedIds = result.getData().stream().map(Application::getId).toList();
assertThat(returnedIds).containsExactly(application1.getId());
}
use of cz.metacentrum.perun.registrar.model.RichApplication in project perun by CESNET.
the class RegistrarBaseIntegrationTest method getApplicationsPageFindByGroupName.
@Test
public void getApplicationsPageFindByGroupName() throws Exception {
System.out.println("getApplicationsPageFindByGroupName");
// 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", 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();
assertThat(returnedGroups).containsOnly(group2);
}
use of cz.metacentrum.perun.registrar.model.RichApplication in project perun by CESNET.
the class RegistrarBaseIntegrationTest method getApplicationsPageFindByGroupId.
@Test
public void getApplicationsPageFindByGroupId() throws Exception {
System.out.println("getApplicationsPageFindByGroupId");
// 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, Integer.toString(group2.getId()), 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<Integer> returnedIds = returnedGroups.stream().map(Group::getId).toList();
assertThat(returnedIds).containsOnly(group2.getId());
}
use of cz.metacentrum.perun.registrar.model.RichApplication in project perun by CESNET.
the class RegistrarBaseIntegrationTest method getApplicationsPageIdSortWorks.
@Test
public void getApplicationsPageIdSortWorks() throws Exception {
System.out.println("getApplicationsPageIdSortWorks");
// create groups
Group group1 = setUpGroup("Group1", "Cool folks");
// create users
User user1 = setUpUser("Joe", "Doe");
User user2 = setUpUser("Barney", "Stinson");
setUpApplicationGroup(user1, group1);
setUpApplicationGroup(user2, group1);
ApplicationsPageQuery query = new ApplicationsPageQuery(4, 0, SortingOrder.DESCENDING, ApplicationsOrderColumn.STATE, List.of(Application.AppState.APPROVED, Application.AppState.VERIFIED), true);
Paginated<RichApplication> result = registrarManager.getApplicationsPage(session, vo, query);
List<Application.AppState> returnedAppStates = result.getData().stream().map(Application::getState).toList();
assertThat(returnedAppStates).containsExactly(Application.AppState.VERIFIED, Application.AppState.VERIFIED, Application.AppState.APPROVED, Application.AppState.APPROVED);
}
Aggregations