use of org.apache.syncope.common.lib.patch.AssociationPatch in project syncope by apache.
the class GroupITCase method provision.
@Test
public void provision() {
GroupTO groupTO = getSampleTO("provision");
groupTO.getResources().clear();
try {
groupTO = createGroup(groupTO).getEntity();
assertNotNull(groupTO);
try {
resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), groupTO.getKey());
fail("This should not happen");
} catch (Exception e) {
assertNotNull(e);
}
AssociationPatch associationPatch = new AssociationPatch.Builder().key(groupTO.getKey()).action(ResourceAssociationAction.PROVISION).resource(RESOURCE_NAME_LDAP).build();
assertNotNull(groupService.associate(associationPatch).readEntity(BulkActionResult.class));
groupTO = groupService.read(groupTO.getKey());
assertTrue(groupTO.getResources().isEmpty());
assertNotNull(resourceService.readConnObject(RESOURCE_NAME_LDAP, AnyTypeKind.GROUP.name(), groupTO.getKey()));
} finally {
if (groupTO.getKey() != null) {
groupService.delete(groupTO.getKey());
}
}
}
use of org.apache.syncope.common.lib.patch.AssociationPatch in project syncope by apache.
the class UserITCase method deprovisionUnlinked.
@Test
public void deprovisionUnlinked() {
UserTO userTO = getUniqueSampleTO("provision@syncope.apache.org");
userTO.getResources().clear();
userTO.getMemberships().clear();
userTO.getVirAttrs().clear();
userTO.getAuxClasses().add("csv");
UserTO actual = createUser(userTO).getEntity();
assertNotNull(actual);
assertTrue(actual.getResources().isEmpty());
try {
resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey());
fail("This should not happen");
} catch (Exception e) {
assertNotNull(e);
}
AssociationPatch associationPatch = new AssociationPatch.Builder().key(actual.getKey()).value("password").action(ResourceAssociationAction.PROVISION).resource(RESOURCE_NAME_CSV).build();
assertNotNull(userService.associate(associationPatch).readEntity(BulkActionResult.class));
actual = userService.read(actual.getKey());
assertNotNull(actual);
assertTrue(actual.getResources().isEmpty());
assertNotNull(resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey()));
DeassociationPatch deassociationPatch = new DeassociationPatch.Builder().key(actual.getKey()).action(ResourceDeassociationAction.DEPROVISION).resource(RESOURCE_NAME_CSV).build();
assertNotNull(userService.deassociate(deassociationPatch).readEntity(BulkActionResult.class));
actual = userService.read(actual.getKey());
assertNotNull(actual);
assertTrue(actual.getResources().isEmpty());
try {
resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey());
fail("This should not happen");
} catch (Exception e) {
assertNotNull(e);
}
}
use of org.apache.syncope.common.lib.patch.AssociationPatch in project syncope by apache.
the class UserITCase method assign.
@Test
public void assign() {
UserTO userTO = getUniqueSampleTO("assign@syncope.apache.org");
userTO.getResources().clear();
userTO.getMemberships().clear();
userTO.getVirAttrs().clear();
userTO.getAuxClasses().add("csv");
UserTO actual = createUser(userTO).getEntity();
assertNotNull(actual);
assertTrue(actual.getResources().isEmpty());
try {
resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey());
fail("This should not happen");
} catch (Exception e) {
assertNotNull(e);
}
AssociationPatch associationPatch = new AssociationPatch.Builder().key(actual.getKey()).value("password").action(ResourceAssociationAction.ASSIGN).resource(RESOURCE_NAME_CSV).build();
assertNotNull(userService.associate(associationPatch).readEntity(BulkActionResult.class));
actual = userService.read(actual.getKey());
assertNotNull(actual);
assertFalse(actual.getResources().isEmpty());
assertNotNull(resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey()));
}
use of org.apache.syncope.common.lib.patch.AssociationPatch in project syncope by apache.
the class UserITCase method link.
@Test
public void link() {
UserTO userTO = getUniqueSampleTO("link@syncope.apache.org");
userTO.getResources().clear();
userTO.getMemberships().clear();
userTO.getVirAttrs().clear();
userTO.getAuxClasses().add("csv");
UserTO actual = createUser(userTO).getEntity();
assertNotNull(actual);
assertTrue(actual.getResources().isEmpty());
try {
resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey());
fail("This should not happen");
} catch (Exception e) {
assertNotNull(e);
}
AssociationPatch associationPatch = new AssociationPatch.Builder().key(actual.getKey()).action(ResourceAssociationAction.LINK).resource(RESOURCE_NAME_CSV).build();
assertNotNull(userService.associate(associationPatch).readEntity(BulkActionResult.class));
actual = userService.read(actual.getKey());
assertNotNull(actual);
assertFalse(actual.getResources().isEmpty());
try {
resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey());
fail("This should not happen");
} catch (Exception e) {
assertNotNull(e);
}
}
use of org.apache.syncope.common.lib.patch.AssociationPatch in project syncope by apache.
the class UserITCase method provision.
@Test
public void provision() {
UserTO userTO = getUniqueSampleTO("provision@syncope.apache.org");
userTO.getResources().clear();
userTO.getMemberships().clear();
userTO.getVirAttrs().clear();
userTO.getAuxClasses().add("csv");
UserTO actual = createUser(userTO).getEntity();
assertNotNull(actual);
assertTrue(actual.getResources().isEmpty());
try {
resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey());
fail("This should not happen");
} catch (Exception e) {
assertNotNull(e);
}
AssociationPatch associationPatch = new AssociationPatch.Builder().key(actual.getKey()).value("password").action(ResourceAssociationAction.PROVISION).resource(RESOURCE_NAME_CSV).build();
assertNotNull(userService.associate(associationPatch).readEntity(BulkActionResult.class));
actual = userService.read(actual.getKey());
assertNotNull(actual);
assertTrue(actual.getResources().isEmpty());
assertNotNull(resourceService.readConnObject(RESOURCE_NAME_CSV, AnyTypeKind.USER.name(), actual.getKey()));
}
Aggregations