Search in sources :

Example 11 with ApplicationsPageQuery

use of cz.metacentrum.perun.registrar.model.ApplicationsPageQuery 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());
}
Also used : RichApplication(cz.metacentrum.perun.registrar.model.RichApplication) Group(cz.metacentrum.perun.core.api.Group) ApplicationsPageQuery(cz.metacentrum.perun.registrar.model.ApplicationsPageQuery) User(cz.metacentrum.perun.core.api.User) Application(cz.metacentrum.perun.registrar.model.Application) RichApplication(cz.metacentrum.perun.registrar.model.RichApplication) Test(org.junit.Test)

Example 12 with ApplicationsPageQuery

use of cz.metacentrum.perun.registrar.model.ApplicationsPageQuery 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());
}
Also used : RichApplication(cz.metacentrum.perun.registrar.model.RichApplication) Group(cz.metacentrum.perun.core.api.Group) ApplicationsPageQuery(cz.metacentrum.perun.registrar.model.ApplicationsPageQuery) User(cz.metacentrum.perun.core.api.User) Application(cz.metacentrum.perun.registrar.model.Application) RichApplication(cz.metacentrum.perun.registrar.model.RichApplication) Test(org.junit.Test)

Example 13 with ApplicationsPageQuery

use of cz.metacentrum.perun.registrar.model.ApplicationsPageQuery 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());
}
Also used : RichApplication(cz.metacentrum.perun.registrar.model.RichApplication) Group(cz.metacentrum.perun.core.api.Group) ApplicationsPageQuery(cz.metacentrum.perun.registrar.model.ApplicationsPageQuery) User(cz.metacentrum.perun.core.api.User) Application(cz.metacentrum.perun.registrar.model.Application) RichApplication(cz.metacentrum.perun.registrar.model.RichApplication) Test(org.junit.Test)

Aggregations

Group (cz.metacentrum.perun.core.api.Group)13 User (cz.metacentrum.perun.core.api.User)13 ApplicationsPageQuery (cz.metacentrum.perun.registrar.model.ApplicationsPageQuery)13 RichApplication (cz.metacentrum.perun.registrar.model.RichApplication)13 Test (org.junit.Test)13 Application (cz.metacentrum.perun.registrar.model.Application)11 ApplicationForm (cz.metacentrum.perun.registrar.model.ApplicationForm)1 ApplicationFormItem (cz.metacentrum.perun.registrar.model.ApplicationFormItem)1 ApplicationFormItemData (cz.metacentrum.perun.registrar.model.ApplicationFormItemData)1