Search in sources :

Example 26 with Grouping

use of edu.hawaii.its.api.type.Grouping in project uhgroupings by uhawaii-system-its-ti-iam.

the class TestGroupingsRestController method assignAndRemoveOwnershipTest.

@Test
@WithMockUhUser(username = "iamtst01")
public void assignAndRemoveOwnershipTest() throws Exception {
    Grouping g = mapGrouping(GROUPING);
    assertFalse(g.getOwners().getUsernames().contains(tst[1]));
    mapGSR("/api/groupings/" + GROUPING + "/" + tst[1] + "/assignOwnership");
    g = mapGrouping(GROUPING);
    assertTrue(g.getOwners().getUsernames().contains(tst[1]));
    mapGSR("/api/groupings/" + GROUPING + "/" + tst[1] + "/removeOwnership");
    g = mapGrouping(GROUPING);
    assertFalse(g.getOwners().getUsernames().contains(tst[1]));
}
Also used : Grouping(edu.hawaii.its.api.type.Grouping) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) WithMockUhUser(edu.hawaii.its.groupings.controller.WithMockUhUser)

Example 27 with Grouping

use of edu.hawaii.its.api.type.Grouping in project uhgroupings by uhawaii-system-its-ti-iam.

the class TestGroupingsRestController method myGroupingsTest3.

@Test
@WithMockUhUser(username = "iamtst04")
public void myGroupingsTest3() throws Exception {
    boolean optedIn = false;
    GroupingAssignment tst4Groupings = mapGroupingAssignment();
    assertEquals(tst4Groupings.getGroupingsOptedInTo().size(), 0);
    mapGSRs("/api/groupings/" + GROUPING + "/optIn");
    tst4Groupings = mapGroupingAssignment();
    for (Grouping grouping : tst4Groupings.getGroupingsOptedInTo()) {
        if (grouping.getPath().contains(GROUPING)) {
            optedIn = true;
        }
    }
    // in basis
    assertFalse(optedIn);
}
Also used : Grouping(edu.hawaii.its.api.type.Grouping) GroupingAssignment(edu.hawaii.its.api.type.GroupingAssignment) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) WithMockUhUser(edu.hawaii.its.groupings.controller.WithMockUhUser)

Example 28 with Grouping

use of edu.hawaii.its.api.type.Grouping in project uhgroupings by uhawaii-system-its-ti-iam.

the class TestGroupingsRestController method myGroupingsTest2.

@Test
@WithMockUhUser(username = "iamtst04")
public void myGroupingsTest2() throws Exception {
    GroupingAssignment groupings = mapGroupingAssignment();
    boolean inGrouping = false;
    for (Grouping grouping : groupings.getGroupingsIn()) {
        if (grouping.getPath().contains(this.GROUPING)) {
            inGrouping = true;
            break;
        }
    }
    assertFalse(inGrouping);
    boolean ownsGrouping = false;
    for (Grouping grouping : groupings.getGroupingsOwned()) {
        if (grouping.getPath().contains(this.GROUPING)) {
            ownsGrouping = true;
            break;
        }
    }
    assertFalse(ownsGrouping);
}
Also used : Grouping(edu.hawaii.its.api.type.Grouping) GroupingAssignment(edu.hawaii.its.api.type.GroupingAssignment) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) WithMockUhUser(edu.hawaii.its.groupings.controller.WithMockUhUser)

Example 29 with Grouping

use of edu.hawaii.its.api.type.Grouping in project uhgroupings by uhawaii-system-its-ti-iam.

the class TestGroupingsRestController method groupingAssignmentTest.

@Test
@WithMockUhUser(username = "iamtst01")
public void groupingAssignmentTest() throws Exception {
    GroupingAssignment groupings = mapGroupingAssignment();
    boolean inGrouping = false;
    for (Grouping grouping : groupings.getGroupingsIn()) {
        if (grouping.getPath().contains(this.GROUPING)) {
            inGrouping = true;
            break;
        }
    }
    assertTrue(inGrouping);
    boolean canOptin = false;
    for (Grouping grouping : groupings.getGroupingsToOptInTo()) {
        if (grouping.getPath().contains(this.GROUPING)) {
            canOptin = true;
            break;
        }
    }
    assertFalse(canOptin);
    boolean canOptOut = false;
    for (Grouping grouping : groupings.getGroupingsToOptOutOf()) {
        if (grouping.getPath().contains(this.GROUPING)) {
            canOptOut = true;
            break;
        }
    }
    assertTrue(canOptOut);
    boolean ownsGrouping = false;
    for (Grouping grouping : groupings.getGroupingsOwned()) {
        if (grouping.getPath().contains(this.GROUPING)) {
            ownsGrouping = true;
            break;
        }
    }
    assertTrue(ownsGrouping);
}
Also used : Grouping(edu.hawaii.its.api.type.Grouping) GroupingAssignment(edu.hawaii.its.api.type.GroupingAssignment) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) WithMockUhUser(edu.hawaii.its.groupings.controller.WithMockUhUser)

Example 30 with Grouping

use of edu.hawaii.its.api.type.Grouping in project uhgroupings by uhawaii-system-its-ti-iam.

the class DatabaseSetup method makeGrouping.

private void makeGrouping(String path, Group basis, Group exclude, Group include, Group owners, boolean listserveOn, boolean optInOn, boolean optOutOn) {
    Grouping grouping = new Grouping(path);
    Group composite = buildComposite(include, exclude, basis, path);
    groupRepository.save(composite);
    grouping.setBasis(basis);
    grouping.setExclude(exclude);
    grouping.setInclude(include);
    grouping.setOwners(owners);
    grouping.setComposite(composite);
    grouping.setListservOn(listserveOn);
    grouping.setOptInOn(optInOn);
    grouping.setOptOutOn(optOutOn);
    groupings.add(grouping);
}
Also used : Group(edu.hawaii.its.api.type.Group) Grouping(edu.hawaii.its.api.type.Grouping)

Aggregations

Grouping (edu.hawaii.its.api.type.Grouping)45 Test (org.junit.Test)28 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)28 ArrayList (java.util.ArrayList)14 Group (edu.hawaii.its.api.type.Group)13 GroupingAssignment (edu.hawaii.its.api.type.GroupingAssignment)11 WsGroup (edu.internet2.middleware.grouperClient.ws.beans.WsGroup)11 WithMockUhUser (edu.hawaii.its.groupings.controller.WithMockUhUser)9 Person (edu.hawaii.its.api.type.Person)8 GroupingsServiceResult (edu.hawaii.its.api.type.GroupingsServiceResult)6 GroupingsServiceResultException (edu.hawaii.its.api.type.GroupingsServiceResultException)6 WsAttributeAssign (edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign)5 WsResultMeta (edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta)5 WsAssignAttributesResults (edu.internet2.middleware.grouperClient.ws.beans.WsAssignAttributesResults)3 WsGetAttributeAssignmentsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults)3 AdminListsHolder (edu.hawaii.its.api.type.AdminListsHolder)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 Membership (edu.hawaii.its.api.type.Membership)1 StemScope (edu.internet2.middleware.grouperClient.ws.StemScope)1 WsAddMemberResults (edu.internet2.middleware.grouperClient.ws.beans.WsAddMemberResults)1