Search in sources :

Example 1 with WsGetMembersResult

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

the class GroupingAssignmentServiceTest method makeGroupTest.

@Test
public void makeGroupTest() {
    WsGetMembersResults getMembersResults = new WsGetMembersResults();
    WsGetMembersResult[] getMembersResult = new WsGetMembersResult[1];
    WsGetMembersResult getMembersResult1 = new WsGetMembersResult();
    WsSubject[] list = new WsSubject[3];
    for (int i = 0; i < 3; i++) {
        list[i] = new WsSubject();
        list[i].setName("testSubject_" + i);
        list[i].setId("testSubject_uuid_" + i);
        list[i].setAttributeValues(new String[] { "testSubject_username_" + i });
    }
    getMembersResult1.setWsSubjects(list);
    getMembersResult[0] = getMembersResult1;
    getMembersResults.setResults(getMembersResult);
    Group group = groupingAssignmentService.makeGroup(getMembersResults);
    for (int i = 0; i < group.getMembers().size(); i++) {
        assertTrue(group.getMembers().get(i).getName().equals("testSubject_" + i));
        assertTrue(group.getNames().contains("testSubject_" + i));
        assertTrue(group.getMembers().get(i).getUuid().equals("testSubject_uuid_" + i));
        assertTrue(group.getUuids().contains("testSubject_uuid_" + i));
        assertTrue(group.getMembers().get(i).getUsername().equals("testSubject_username_" + i));
        assertTrue(group.getUsernames().contains("testSubject_username_" + i));
    }
}
Also used : WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) Group(edu.hawaii.its.api.type.Group) WsGetMembersResult(edu.internet2.middleware.grouperClient.ws.beans.WsGetMembersResult) WsSubject(edu.internet2.middleware.grouperClient.ws.beans.WsSubject) WsGetMembersResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetMembersResults) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 2 with WsGetMembersResult

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

the class GroupingAssignmentServiceTest method makeGroup.

@Test
public void makeGroup() {
    WsGetMembersResults getMembersResults = new WsGetMembersResults();
    WsGetMembersResult[] getMembersResult = new WsGetMembersResult[1];
    WsGetMembersResult getMembersResult1 = new WsGetMembersResult();
    WsSubject[] subjects = new WsSubject[0];
    getMembersResult1.setWsSubjects(subjects);
    getMembersResult[0] = getMembersResult1;
    getMembersResults.setResults(getMembersResult);
    assertNotNull(groupingAssignmentService.makeGroup(getMembersResults));
    subjects = new WsSubject[1];
    getMembersResults.getResults()[0].setWsSubjects(subjects);
    assertNotNull(groupingAssignmentService.makeGroup(getMembersResults));
    subjects[0] = new WsSubject();
    getMembersResults.getResults()[0].setWsSubjects(subjects);
    assertNotNull(groupingAssignmentService.makeGroup(getMembersResults));
}
Also used : WsGetMembersResult(edu.internet2.middleware.grouperClient.ws.beans.WsGetMembersResult) WsSubject(edu.internet2.middleware.grouperClient.ws.beans.WsSubject) WsGetMembersResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetMembersResults) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 3 with WsGetMembersResult

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

the class GrouperFactoryServiceImplLocal method makeWsGetMembersResults.

@Override
public WsGetMembersResults makeWsGetMembersResults(String subjectAttributeName, WsSubjectLookup lookup, String groupName) {
    WsGetMembersResults wsGetMembersResults = new WsGetMembersResults();
    String[] attributeNames = new String[] { UID_KEY, UUID_KEY, LAST_NAME_KEY, COMPOSITE_NAME_KEY, FIRST_NAME_KEY };
    wsGetMembersResults.setSubjectAttributeNames(attributeNames);
    WsGetMembersResult wsGetMembersResult = new WsGetMembersResult();
    WsSubject[] subjects;
    Group group = groupRepository.findByPath(groupName);
    List<Person> members = group.getMembers();
    List<WsSubject> subjectList = new ArrayList<>();
    for (Person person : members) {
        WsSubject subject = new WsSubject();
        subject.setId(person.getUuid());
        subject.setName(person.getName());
        // has to be the same order as attributeNames array
        subject.setAttributeValues(new String[] { person.getUsername(), person.getUuid(), person.getLastName(), person.getName(), person.getFirstName() });
        subjectList.add(subject);
    }
    subjects = subjectList.toArray(new WsSubject[subjectList.size()]);
    wsGetMembersResult.setWsSubjects(subjects);
    wsGetMembersResults.setResults(new WsGetMembersResult[] { wsGetMembersResult });
    return wsGetMembersResults;
}
Also used : WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) Group(edu.hawaii.its.api.type.Group) WsGetMembersResult(edu.internet2.middleware.grouperClient.ws.beans.WsGetMembersResult) ArrayList(java.util.ArrayList) WsSubject(edu.internet2.middleware.grouperClient.ws.beans.WsSubject) WsGetMembersResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetMembersResults) Person(edu.hawaii.its.api.type.Person)

Aggregations

WsGetMembersResult (edu.internet2.middleware.grouperClient.ws.beans.WsGetMembersResult)3 WsGetMembersResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetMembersResults)3 WsSubject (edu.internet2.middleware.grouperClient.ws.beans.WsSubject)3 Group (edu.hawaii.its.api.type.Group)2 WsGroup (edu.internet2.middleware.grouperClient.ws.beans.WsGroup)2 Test (org.junit.Test)2 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)2 Person (edu.hawaii.its.api.type.Person)1 ArrayList (java.util.ArrayList)1