Search in sources :

Example 26 with Group

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

the class GroupingFactoryServiceTest method setup.

@Before
public void setup() {
    new DatabaseSetup(personRepository, groupRepository, groupingRepository, membershipRepository);
    admins.add(ADMIN_PERSON);
    adminGroup = new Group(GROUPING_ADMINS, admins);
    personRepository.save(ADMIN_PERSON);
    groupRepository.save(adminGroup);
    admins.add(APP_PERSON);
    appGroup = new Group(GROUPING_APPS, apps);
    personRepository.save(APP_PERSON);
    groupRepository.save(appGroup);
    for (int i = 0; i < 100; i++) {
        String name = NAME + i;
        String uuid = UUID + i;
        String username = USERNAME + i;
        Person person = new Person(name, uuid, username);
        users.add(person);
        WsSubjectLookup lookup = new WsSubjectLookup(null, null, username);
        lookups.add(lookup);
    }
}
Also used : Group(edu.hawaii.its.api.type.Group) WsSubjectLookup(edu.internet2.middleware.grouperClient.ws.beans.WsSubjectLookup) Person(edu.hawaii.its.api.type.Person) Before(org.junit.Before)

Example 27 with Group

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

the class HelperServiceTest method setup.

@Before
public void setup() {
    new DatabaseSetup(personRepository, groupRepository, groupingRepository, membershipRepository);
    admins.add(ADMIN_PERSON);
    Group adminGroup = new Group(GROUPING_ADMINS, admins);
    personRepository.save(ADMIN_PERSON);
    groupRepository.save(adminGroup);
    admins.add(APP_PERSON);
    Group appGroup = new Group(GROUPING_APPS, apps);
    personRepository.save(APP_PERSON);
    groupRepository.save(appGroup);
    for (int i = 0; i < 100; i++) {
        String name = NAME + i;
        String uuid = UUID + i;
        String username = USERNAME + i;
        Person person = new Person(name, uuid, username);
        users.add(person);
        WsSubjectLookup lookup = new WsSubjectLookup(null, null, username);
        lookups.add(lookup);
    }
}
Also used : Group(edu.hawaii.its.api.type.Group) WsSubjectLookup(edu.internet2.middleware.grouperClient.ws.beans.WsSubjectLookup) Person(edu.hawaii.its.api.type.Person) Before(org.junit.Before)

Example 28 with Group

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

the class MemberAttributeServiceTest method setup.

@Before
public void setup() {
    new DatabaseSetup(personRepository, groupRepository, groupingRepository, membershipRepository);
    admins.add(ADMIN_PERSON);
    Group adminGroup = new Group(GROUPING_ADMINS, admins);
    personRepository.save(ADMIN_PERSON);
    groupRepository.save(adminGroup);
    admins.add(APP_PERSON);
    Group appGroup = new Group(GROUPING_APPS, apps);
    personRepository.save(APP_PERSON);
    groupRepository.save(appGroup);
    for (int i = 0; i < 100; i++) {
        String name = NAME + i;
        String uuid = UUID + i;
        String username = USERNAME + i;
        Person person = new Person(name, uuid, username);
        users.add(person);
        WsSubjectLookup lookup = new WsSubjectLookup(null, null, username);
        lookups.add(lookup);
    }
}
Also used : Group(edu.hawaii.its.api.type.Group) WsSubjectLookup(edu.internet2.middleware.grouperClient.ws.beans.WsSubjectLookup) Person(edu.hawaii.its.api.type.Person) Before(org.junit.Before)

Example 29 with Group

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

the class MembershipServiceTest method removeSelfOptedTest.

@Test
public void removeSelfOptedTest() {
    Group group = groupRepository.findByPath(GROUPING_4_EXCLUDE_PATH);
    GroupingsServiceResult gsr;
    try {
        // member is not in group
        gsr = membershipService.removeSelfOpted(GROUPING_4_EXCLUDE_PATH, users.get(5).getUsername());
    } catch (GroupingsServiceResultException gsre) {
        gsr = gsre.getGsr();
    }
    assertTrue(gsr.getResultCode().startsWith(FAILURE));
    // member is not self-opted
    gsr = membershipService.removeSelfOpted(GROUPING_4_EXCLUDE_PATH, users.get(4).getUsername());
    assertTrue(gsr.getResultCode().startsWith(SUCCESS));
    // make member self-opted
    Membership membership = membershipRepository.findByPersonAndGroup(users.get(4), group);
    membership.setSelfOpted(true);
    membershipRepository.save(membership);
    // member is self-opted
    gsr = membershipService.removeSelfOpted(GROUPING_4_EXCLUDE_PATH, users.get(4).getUsername());
    assertTrue(gsr.getResultCode().startsWith(SUCCESS));
}
Also used : Group(edu.hawaii.its.api.type.Group) GroupingsServiceResultException(edu.hawaii.its.api.type.GroupingsServiceResultException) GroupingsServiceResult(edu.hawaii.its.api.type.GroupingsServiceResult) Membership(edu.hawaii.its.api.type.Membership) Test(org.junit.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest)

Example 30 with Group

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

the class MembershipServiceTest method setup.

@Before
public void setup() {
    new DatabaseSetup(personRepository, groupRepository, groupingRepository, membershipRepository);
    admins.add(ADMIN_PERSON);
    adminGroup = new Group(GROUPING_ADMINS, admins);
    personRepository.save(ADMIN_PERSON);
    groupRepository.save(adminGroup);
    admins.add(APP_PERSON);
    appGroup = new Group(GROUPING_APPS, apps);
    personRepository.save(APP_PERSON);
    groupRepository.save(appGroup);
    for (int i = 0; i < 100; i++) {
        String name = NAME + i;
        String uuid = UUID + i;
        String username = USERNAME + i;
        Person person = new Person(name, uuid, username);
        users.add(person);
        WsSubjectLookup lookup = new WsSubjectLookup(null, null, username);
        lookups.add(lookup);
    }
}
Also used : Group(edu.hawaii.its.api.type.Group) WsSubjectLookup(edu.internet2.middleware.grouperClient.ws.beans.WsSubjectLookup) Person(edu.hawaii.its.api.type.Person) Before(org.junit.Before)

Aggregations

Group (edu.hawaii.its.api.type.Group)40 WsGroup (edu.internet2.middleware.grouperClient.ws.beans.WsGroup)23 Person (edu.hawaii.its.api.type.Person)21 Grouping (edu.hawaii.its.api.type.Grouping)13 ArrayList (java.util.ArrayList)10 Test (org.junit.Test)10 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)10 WsSubjectLookup (edu.internet2.middleware.grouperClient.ws.beans.WsSubjectLookup)9 Before (org.junit.Before)8 WsResultMeta (edu.internet2.middleware.grouperClient.ws.beans.WsResultMeta)7 Membership (edu.hawaii.its.api.type.Membership)6 WsGetMembersResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetMembersResults)4 WsSubject (edu.internet2.middleware.grouperClient.ws.beans.WsSubject)4 WsMembership (edu.internet2.middleware.grouperClient.ws.beans.WsMembership)3 AdminListsHolder (edu.hawaii.its.api.type.AdminListsHolder)2 WsGetAttributeAssignmentsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetAttributeAssignmentsResults)2 WsGetGroupsResult (edu.internet2.middleware.grouperClient.ws.beans.WsGetGroupsResult)2 WsGetGroupsResults (edu.internet2.middleware.grouperClient.ws.beans.WsGetGroupsResults)2 WsGetMembersResult (edu.internet2.middleware.grouperClient.ws.beans.WsGetMembersResult)2 GroupingAssignment (edu.hawaii.its.api.type.GroupingAssignment)1