Search in sources :

Example 1 with WsGetAttributeAssignmentsResults

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

the class TestGroupingAssignmentService method grouperTest.

@Test
public void grouperTest() {
    List<String> groupPaths = groupingAssignmentService.getGroupPaths(username[0]);
    List<String> groupings = new ArrayList<>();
    List<String> groupings2 = new ArrayList<>();
    if (groupPaths.size() > 0) {
        List<WsAttributeAssign> attributes = new ArrayList<>();
        for (String path : groupPaths) {
            WsGetAttributeAssignmentsResults trioGroups = new GcGetAttributeAssignments().addAttributeDefNameName(TRIO).assignAttributeAssignType(ASSIGN_TYPE_GROUP).addOwnerGroupName(path).execute();
            if (trioGroups.getWsAttributeAssigns() != null) {
                Collections.addAll(attributes, trioGroups.getWsAttributeAssigns());
            }
        }
        if (attributes.size() > 0) {
            groupings.addAll(attributes.stream().map(WsAttributeAssign::getOwnerGroupName).collect(Collectors.toList()));
        }
        assertNotNull(groupings);
        // ////////////////////////////////////////////////////////////////////////////////
        GcGetAttributeAssignments trioGroups2 = new GcGetAttributeAssignments().addAttributeDefNameName(TRIO).assignAttributeAssignType(ASSIGN_TYPE_GROUP);
        groupPaths.forEach(trioGroups2::addOwnerGroupName);
        WsGetAttributeAssignmentsResults attributeAssignmentsResults2 = trioGroups2.execute();
        assertNotNull(attributeAssignmentsResults2);
        WsAttributeAssign[] wsGroups2 = attributeAssignmentsResults2.getWsAttributeAssigns();
        if (wsGroups2 != null && wsGroups2.length > 0) {
            for (WsAttributeAssign grouping : wsGroups2) {
                groupings2.add(grouping.getOwnerGroupName());
            }
        }
    }
    assertNotNull(groupings2);
}
Also used : GcGetAttributeAssignments(edu.internet2.middleware.grouperClient.api.GcGetAttributeAssignments) ArrayList(java.util.ArrayList) WsGetAttributeAssignmentsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults) WsAttributeAssign(edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 2 with WsGetAttributeAssignmentsResults

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

the class TestGroupingAssignmentService method updateLastModifiedTest.

@Test
public void updateLastModifiedTest() {
    // Test is accurate to the minute, and if checks to see if the current
    // time gets added to the lastModified attribute of a group if the
    // minute happens to change in between getting the time and setting
    // the time, the test will fail.
    final String group = GROUPING_INCLUDE;
    GroupingsServiceResult gsr = membershipService.updateLastModified(group);
    String dateStr = gsr.getAction().split(" to time ")[1];
    WsGetAttributeAssignmentsResults assignments = groupAttributeService.attributeAssignmentsResults(ASSIGN_TYPE_GROUP, group, YYYYMMDDTHHMM);
    String assignedValue = assignments.getWsAttributeAssigns()[0].getWsAttributeAssignValues()[0].getValueSystem();
    assertEquals(dateStr, assignedValue);
}
Also used : GroupingsServiceResult(edu.hawaii.its.api.type.GroupingsServiceResult) WsGetAttributeAssignmentsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 3 with WsGetAttributeAssignmentsResults

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

the class TestMembershipService method updateLastModifiedTest.

@Test
public void updateLastModifiedTest() {
    // Test is accurate to the minute, and if checks to see if the current
    // time gets added to the lastModified attribute of a group if the
    // minute happens to change in between getting the time and setting
    // the time, the test will fail.
    final String group = GROUPING_INCLUDE;
    GroupingsServiceResult gsr = membershipService.updateLastModified(group);
    String dateStr = gsr.getAction().split(" to time ")[1];
    WsGetAttributeAssignmentsResults assignments = groupAttributeService.attributeAssignmentsResults(ASSIGN_TYPE_GROUP, group, YYYYMMDDTHHMM);
    String assignedValue = assignments.getWsAttributeAssigns()[0].getWsAttributeAssignValues()[0].getValueSystem();
    assertEquals(dateStr, assignedValue);
}
Also used : GroupingsServiceResult(edu.hawaii.its.api.type.GroupingsServiceResult) WsGetAttributeAssignmentsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 4 with WsGetAttributeAssignmentsResults

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

the class GrouperFactoryServiceImplLocal method makeWsGetAttributeAssignmentsResultsTrio.

@Override
public List<WsGetAttributeAssignmentsResults> makeWsGetAttributeAssignmentsResultsTrio(String assignType, String attributeDefNameName0, String attributeDefNameName1, List<String> ownerGroupNames) {
    List<WsGetAttributeAssignmentsResults> resultsList = new ArrayList<>();
    WsGetAttributeAssignmentsResults wsGetAttributeAssignmentsResults = makeWsGetAttributeAssignmentsResultsTrio(assignType, attributeDefNameName0, attributeDefNameName1);
    wsGetAttributeAssignmentsResults = removeGroupsNotInList(wsGetAttributeAssignmentsResults, ownerGroupNames);
    resultsList.add(wsGetAttributeAssignmentsResults);
    return resultsList;
}
Also used : ArrayList(java.util.ArrayList) WsGetAttributeAssignmentsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults)

Example 5 with WsGetAttributeAssignmentsResults

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

the class GroupingAssignmentServiceImpl method adminLists.

// returns an adminLists object containing the list of all admins and all groupings
@Override
public AdminListsHolder adminLists(String adminUsername) {
    AdminListsHolder info = new AdminListsHolder();
    List<Grouping> groupings;
    if (memberAttributeService.isSuperuser(adminUsername)) {
        WsGetAttributeAssignmentsResults attributeAssignmentsResults = grouperFS.makeWsGetAttributeAssignmentsResultsTrio(ASSIGN_TYPE_GROUP, TRIO);
        List<WsGroup> groups = new ArrayList<>(Arrays.asList(attributeAssignmentsResults.getWsGroups()));
        List<String> groupPaths = groups.stream().map(WsGroup::getName).collect(Collectors.toList());
        Group admin = getMembers(adminUsername, GROUPING_ADMINS);
        groupings = helperService.makeGroupings(groupPaths);
        info.setAdminGroup(admin);
        info.setAllGroupings(groupings);
    }
    return info;
}
Also used : AdminListsHolder(edu.hawaii.its.api.type.AdminListsHolder) WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup) Group(edu.hawaii.its.api.type.Group) ArrayList(java.util.ArrayList) WsGetAttributeAssignmentsResults(edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults) Grouping(edu.hawaii.its.api.type.Grouping) WsGroup(edu.internet2.middleware.grouperClient.ws.beans.WsGroup)

Aggregations

WsGetAttributeAssignmentsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults)13 ArrayList (java.util.ArrayList)10 WsAttributeAssign (edu.internet2.middleware.grouperClient.ws.beans.WsAttributeAssign)8 Grouping (edu.hawaii.its.api.type.Grouping)5 WsGroup (edu.internet2.middleware.grouperClient.ws.beans.WsGroup)5 WsAttributeDefName (edu.internet2.middleware.grouperClient.ws.beans.WsAttributeDefName)3 Test (org.junit.Test)3 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)3 AdminListsHolder (edu.hawaii.its.api.type.AdminListsHolder)2 Group (edu.hawaii.its.api.type.Group)2 GroupingsServiceResult (edu.hawaii.its.api.type.GroupingsServiceResult)2 GcGetAttributeAssignments (edu.internet2.middleware.grouperClient.api.GcGetAttributeAssignments)2 GroupingAssignment (edu.hawaii.its.api.type.GroupingAssignment)1 Membership (edu.hawaii.its.api.type.Membership)1 Person (edu.hawaii.its.api.type.Person)1 StemScope (edu.internet2.middleware.grouperClient.ws.StemScope)1 WsGetGroupsResult (edu.internet2.middleware.grouperClient.ws.beans.WsGetGroupsResult)1 WsGetGroupsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetGroupsResults)1 WsGetMembersResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetMembersResults)1 WsMembership (edu.internet2.middleware.grouperClient.ws.beans.WsMembership)1