Search in sources :

Example 6 with ApplicationsPageQuery

use of cz.metacentrum.perun.registrar.model.ApplicationsPageQuery 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());
}
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 7 with ApplicationsPageQuery

use of cz.metacentrum.perun.registrar.model.ApplicationsPageQuery 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());
}
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 8 with ApplicationsPageQuery

use of cz.metacentrum.perun.registrar.model.ApplicationsPageQuery 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);
}
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 9 with ApplicationsPageQuery

use of cz.metacentrum.perun.registrar.model.ApplicationsPageQuery 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());
}
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 10 with ApplicationsPageQuery

use of cz.metacentrum.perun.registrar.model.ApplicationsPageQuery 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);
}
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) 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