use of edu.hawaii.its.api.type.Grouping in project uhgroupings by uhawaii-system-its-ti-iam.
the class TestGroupingsRestController method assignAndRemoveOwnershipTest.
@Test
@WithMockUhUser(username = "iamtst01")
public void assignAndRemoveOwnershipTest() throws Exception {
Grouping g = mapGrouping(GROUPING);
assertFalse(g.getOwners().getUsernames().contains(tst[1]));
mapGSR("/api/groupings/" + GROUPING + "/" + tst[1] + "/assignOwnership");
g = mapGrouping(GROUPING);
assertTrue(g.getOwners().getUsernames().contains(tst[1]));
mapGSR("/api/groupings/" + GROUPING + "/" + tst[1] + "/removeOwnership");
g = mapGrouping(GROUPING);
assertFalse(g.getOwners().getUsernames().contains(tst[1]));
}
use of edu.hawaii.its.api.type.Grouping in project uhgroupings by uhawaii-system-its-ti-iam.
the class TestGroupingsRestController method myGroupingsTest3.
@Test
@WithMockUhUser(username = "iamtst04")
public void myGroupingsTest3() throws Exception {
boolean optedIn = false;
GroupingAssignment tst4Groupings = mapGroupingAssignment();
assertEquals(tst4Groupings.getGroupingsOptedInTo().size(), 0);
mapGSRs("/api/groupings/" + GROUPING + "/optIn");
tst4Groupings = mapGroupingAssignment();
for (Grouping grouping : tst4Groupings.getGroupingsOptedInTo()) {
if (grouping.getPath().contains(GROUPING)) {
optedIn = true;
}
}
// in basis
assertFalse(optedIn);
}
use of edu.hawaii.its.api.type.Grouping in project uhgroupings by uhawaii-system-its-ti-iam.
the class TestGroupingsRestController method myGroupingsTest2.
@Test
@WithMockUhUser(username = "iamtst04")
public void myGroupingsTest2() throws Exception {
GroupingAssignment groupings = mapGroupingAssignment();
boolean inGrouping = false;
for (Grouping grouping : groupings.getGroupingsIn()) {
if (grouping.getPath().contains(this.GROUPING)) {
inGrouping = true;
break;
}
}
assertFalse(inGrouping);
boolean ownsGrouping = false;
for (Grouping grouping : groupings.getGroupingsOwned()) {
if (grouping.getPath().contains(this.GROUPING)) {
ownsGrouping = true;
break;
}
}
assertFalse(ownsGrouping);
}
use of edu.hawaii.its.api.type.Grouping in project uhgroupings by uhawaii-system-its-ti-iam.
the class TestGroupingsRestController method groupingAssignmentTest.
@Test
@WithMockUhUser(username = "iamtst01")
public void groupingAssignmentTest() throws Exception {
GroupingAssignment groupings = mapGroupingAssignment();
boolean inGrouping = false;
for (Grouping grouping : groupings.getGroupingsIn()) {
if (grouping.getPath().contains(this.GROUPING)) {
inGrouping = true;
break;
}
}
assertTrue(inGrouping);
boolean canOptin = false;
for (Grouping grouping : groupings.getGroupingsToOptInTo()) {
if (grouping.getPath().contains(this.GROUPING)) {
canOptin = true;
break;
}
}
assertFalse(canOptin);
boolean canOptOut = false;
for (Grouping grouping : groupings.getGroupingsToOptOutOf()) {
if (grouping.getPath().contains(this.GROUPING)) {
canOptOut = true;
break;
}
}
assertTrue(canOptOut);
boolean ownsGrouping = false;
for (Grouping grouping : groupings.getGroupingsOwned()) {
if (grouping.getPath().contains(this.GROUPING)) {
ownsGrouping = true;
break;
}
}
assertTrue(ownsGrouping);
}
use of edu.hawaii.its.api.type.Grouping in project uhgroupings by uhawaii-system-its-ti-iam.
the class DatabaseSetup method makeGrouping.
private void makeGrouping(String path, Group basis, Group exclude, Group include, Group owners, boolean listserveOn, boolean optInOn, boolean optOutOn) {
Grouping grouping = new Grouping(path);
Group composite = buildComposite(include, exclude, basis, path);
groupRepository.save(composite);
grouping.setBasis(basis);
grouping.setExclude(exclude);
grouping.setInclude(include);
grouping.setOwners(owners);
grouping.setComposite(composite);
grouping.setListservOn(listserveOn);
grouping.setOptInOn(optInOn);
grouping.setOptOutOn(optOutOn);
groupings.add(grouping);
}
Aggregations