Search in sources :

Example 1 with WsMembership

use of edu.internet2.middleware.grouperClient.ws.beans.WsMembership in project uhgroupings by uhawaii-system-its-ti-iam.

the class HelperServiceTest method extractFirstMembershipID.

@Test
public void extractFirstMembershipID() {
    WsGetMembershipsResults mr = new WsGetMembershipsResults();
    WsMembership[] memberships = new WsMembership[3];
    for (int i = 0; i < 3; i++) {
        memberships[i] = new WsMembership();
        memberships[i].setMembershipId("membershipID_" + i);
    }
    mr.setWsMemberships(memberships);
    assertEquals("membershipID_0", helperService.extractFirstMembershipID(mr));
}
Also used : WsGetMembershipsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetMembershipsResults) WsMembership(edu.internet2.middleware.grouperClient.ws.beans.WsMembership) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 2 with WsMembership

use of edu.internet2.middleware.grouperClient.ws.beans.WsMembership in project uhgroupings by uhawaii-system-its-ti-iam.

the class HelperServiceTest method extractFirstMembershipIDTest.

@Test
public void extractFirstMembershipIDTest() {
    WsGetMembershipsResults membershipsResults = null;
    String firstMembershipId = helperService.extractFirstMembershipID(membershipsResults);
    assertEquals(firstMembershipId, "");
    membershipsResults = new WsGetMembershipsResults();
    firstMembershipId = helperService.extractFirstMembershipID(membershipsResults);
    assertEquals(firstMembershipId, "");
    WsMembership[] memberships = null;
    membershipsResults.setWsMemberships(memberships);
    firstMembershipId = helperService.extractFirstMembershipID(membershipsResults);
    assertEquals(firstMembershipId, "");
    memberships = new WsMembership[] { null };
    membershipsResults.setWsMemberships(memberships);
    firstMembershipId = helperService.extractFirstMembershipID(membershipsResults);
    assertEquals(firstMembershipId, "");
    WsMembership membership = new WsMembership();
    memberships = new WsMembership[] { membership };
    membershipsResults.setWsMemberships(memberships);
    firstMembershipId = helperService.extractFirstMembershipID(membershipsResults);
    assertEquals(firstMembershipId, "");
    membership.setMembershipId("1234");
    memberships = new WsMembership[] { membership };
    membershipsResults.setWsMemberships(memberships);
    firstMembershipId = helperService.extractFirstMembershipID(membershipsResults);
    assertEquals(firstMembershipId, "1234");
}
Also used : WsGetMembershipsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetMembershipsResults) WsMembership(edu.internet2.middleware.grouperClient.ws.beans.WsMembership) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 3 with WsMembership

use of edu.internet2.middleware.grouperClient.ws.beans.WsMembership in project uhgroupings by uhawaii-system-its-ti-iam.

the class GrouperFactoryServiceImplLocal method makeWsGetMembershipsResults.

@Override
public WsGetMembershipsResults makeWsGetMembershipsResults(String groupName, WsSubjectLookup lookup) {
    Person person = personRepository.findByUsername(lookup.getSubjectIdentifier());
    Group group = groupRepository.findByPath(groupName);
    Membership membership = membershipRepository.findByPersonAndGroup(person, group);
    WsGetMembershipsResults wsGetMembershipsResults = new WsGetMembershipsResults();
    WsResultMeta wsResultMeta = new WsResultMeta();
    wsResultMeta.setResultCode(FAILURE);
    WsMembership[] wsMemberships = new WsMembership[1];
    WsMembership wsMembership = new WsMembership();
    if (membership != null) {
        wsMembership.setMembershipId(membership.getId());
        wsResultMeta.setResultCode(SUCCESS);
    }
    wsMemberships[0] = wsMembership;
    wsGetMembershipsResults.setWsMemberships(wsMemberships);
    return wsGetMembershipsResults;
}
Also used : WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) Group(edu.hawaii.its.api.type.Group) WsGetMembershipsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetMembershipsResults) WsMembership(edu.internet2.middleware.grouperClient.ws.beans.WsMembership) Membership(edu.hawaii.its.api.type.Membership) WsMembership(edu.internet2.middleware.grouperClient.ws.beans.WsMembership) WsResultMeta(edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta) Person(edu.hawaii.its.api.type.Person)

Aggregations

WsGetMembershipsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetMembershipsResults)3 WsMembership (edu.internet2.middleware.grouperClient.ws.beans.WsMembership)3 Test (org.junit.Test)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 Group (edu.hawaii.its.api.type.Group)1 Membership (edu.hawaii.its.api.type.Membership)1 Person (edu.hawaii.its.api.type.Person)1 WsGroup (edu.internet2.middleware.grouperClient.ws.beans.WsGroup)1 WsResultMeta (edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta)1