use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class RRole method toJAXB.
@Override
public RoleType toJAXB(PrismContext prismContext, Collection<SelectorOptions<GetOperationOptions>> options) throws DtoTranslationException {
RoleType object = new RoleType();
RRole.copyToJAXB(this, object, prismContext, options);
RUtil.revive(object, prismContext);
return object;
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class AbstractLdapSynchronizationTest method test810SyncAddGroupMonkeys.
@Test
public void test810SyncAddGroupMonkeys() throws Exception {
final String TEST_NAME = "test810SyncAddGroupMonkeys";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(this.getClass().getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
long tsStart = System.currentTimeMillis();
// WHEN
TestUtil.displayWhen(TEST_NAME);
if (needsGroupFakeMemeberEntry()) {
addLdapGroup(GROUP_MONKEYS_CN, GROUP_MONKEYS_DESCRIPTION, "uid=fake," + getPeopleLdapSuffix());
} else {
addLdapGroup(GROUP_MONKEYS_CN, GROUP_MONKEYS_DESCRIPTION);
}
waitForTaskNextRunAssertSuccess(getSyncTaskOid(), true);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
long tsEnd = System.currentTimeMillis();
PrismObject<RoleType> role = findObjectByName(RoleType.class, GROUP_MONKEYS_CN);
display("Role", role);
assertNotNull("no role " + GROUP_MONKEYS_CN, role);
PrismAsserts.assertPropertyValue(role, RoleType.F_DESCRIPTION, GROUP_MONKEYS_DESCRIPTION);
assertNotNull("No role " + GROUP_MONKEYS_CN + " created", role);
assertStepSyncToken(getSyncTaskOid(), 3, tsStart, tsEnd);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class TestDeputy method test170AddRoleDrinker.
@Test
public void test170AddRoleDrinker() throws Exception {
final String TEST_NAME = "test170AssignJackRoleDrinker";
TestUtil.displayTestTile(this, TEST_NAME);
Task task = taskManager.createTaskInstance(TestDeputy.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
PrismObject<RoleType> role = PrismTestUtil.parseObject(ROLE_DRINKER_FILE);
display("Adding role", role);
// WHEN
TestUtil.displayWhen(TEST_NAME);
addObject(role, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
PrismObject<RoleType> roleAfter = getObject(RoleType.class, ROLE_DRINKER_OID);
display("Role after", roleAfter);
assertAssignedOrg(roleAfter, ORG_MINISTRY_OF_RUM_OID);
assertHasOrg(roleAfter, ORG_MINISTRY_OF_RUM_OID);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class ModifyTest method test100ModifyUserAddRole.
@Test
public void test100ModifyUserAddRole() throws Exception {
final String TEST_NAME = "test100ModifyUserAddRole";
TestUtil.displayTestTile(TEST_NAME);
OperationResult parentResult = new OperationResult("Modify user -> add roles");
String userToModifyOid = "f65963e3-9d47-4b18-aaf3-bfc98bdfa000";
PrismObject<ResourceType> csvResource = prismContext.parseObject(new File(TEST_DIR + "/resource-csv.xml"));
repositoryService.addObject(csvResource, null, parentResult);
PrismObject<ResourceType> openDjResource = prismContext.parseObject(new File(TEST_DIR + "/resource-opendj.xml"));
repositoryService.addObject(openDjResource, null, parentResult);
PrismObject<UserType> user = prismContext.parseObject(new File(TEST_DIR + "/user.xml"));
repositoryService.addObject(user, null, parentResult);
PrismObject<RoleType> roleCsv = prismContext.parseObject(new File(TEST_DIR + "/role-csv.xml"));
repositoryService.addObject(roleCsv, null, parentResult);
String ldapRoleOid = "12345678-d34d-b33f-f00d-987987987988";
PrismObject<RoleType> roleLdap = prismContext.parseObject(new File(TEST_DIR + "/role-ldap.xml"));
repositoryService.addObject(roleLdap, null, parentResult);
RoleType ldapRole = repositoryService.getObject(RoleType.class, ldapRoleOid, null, parentResult).asObjectable();
assertEquals("Expected that the role has one approver.", 1, ldapRole.getApproverRef().size());
assertEquals("Actual approved not equals to expected one.", userToModifyOid, ldapRole.getApproverRef().get(0).getOid());
ObjectModificationType modification = PrismTestUtil.parseAtomicValue(new File(TEST_DIR + "/modify-user-add-roles.xml"), ObjectModificationType.COMPLEX_TYPE);
ObjectDelta delta = DeltaConvertor.createObjectDelta(modification, UserType.class, prismContext);
repositoryService.modifyObject(UserType.class, userToModifyOid, delta.getModifications(), getModifyOptions(), parentResult);
UserType modifiedUser = repositoryService.getObject(UserType.class, userToModifyOid, null, parentResult).asObjectable();
assertEquals("wrong number of assignments", 3, modifiedUser.getAssignment().size());
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType in project midpoint by Evolveum.
the class ModifyTest method test150ModifyRoleAddInducements.
@Test
public void test150ModifyRoleAddInducements() throws Exception {
final String TEST_NAME = "test150ModifyRoleAddInducements";
TestUtil.displayTestTile(TEST_NAME);
OperationResult result = new OperationResult(TEST_NAME);
File roleFile = new File(TEST_DIR, "role-modify.xml");
//add first user
PrismObject<RoleType> role = prismContext.parseObject(roleFile);
String oid = repositoryService.addObject(role, null, result);
//modify second user name to "existingName"
ObjectModificationType modification = PrismTestUtil.parseAtomicValue(new File(TEST_DIR, "role-modify-change.xml"), ObjectModificationType.COMPLEX_TYPE);
modification.setOid(oid);
Collection<? extends ItemDelta> deltas = DeltaConvertor.toModifications(modification, RoleType.class, prismContext);
repositoryService.modifyObject(RoleType.class, oid, deltas, getModifyOptions(), result);
result.recomputeStatus();
AssertJUnit.assertTrue(result.isSuccess());
role = repositoryService.getObject(RoleType.class, oid, null, result);
result.recomputeStatus();
AssertJUnit.assertTrue(result.isSuccess());
PrismContainer container = role.findContainer(RoleType.F_INDUCEMENT);
assertEquals(2, container.size());
AssertJUnit.assertNotNull(container.getValue(2L));
AssertJUnit.assertNotNull(container.getValue(3L));
// modify role once more to check version progress
String version = role.getVersion();
repositoryService.modifyObject(RoleType.class, oid, new ArrayList<ItemDelta>(), getModifyOptions(), result);
result.recomputeStatus();
AssertJUnit.assertTrue(result.isSuccess());
role = repositoryService.getObject(RoleType.class, oid, null, result);
result.recomputeStatus();
AssertJUnit.assertTrue(result.isSuccess());
if (RepoModifyOptions.isExecuteIfNoChanges(getModifyOptions())) {
SqlRepoTestUtil.assertVersionProgress(version, role.getVersion());
} else {
assertEquals("Version has changed", version, role.getVersion());
}
}
Aggregations