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));
}
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");
}
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;
}
Aggregations