use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectModificationType in project midpoint by Evolveum.
the class ModifyTest method test020ModifyNotExistingUser.
@Test(expectedExceptions = ObjectNotFoundException.class, enabled = false)
public void test020ModifyNotExistingUser() throws Exception {
final String TEST_NAME = "test020ModifyNotExistingUser";
TestUtil.displayTestTile(TEST_NAME);
ObjectModificationType modification = PrismTestUtil.parseAtomicValue(new File(TEST_DIR, "change-add.xml"), ObjectModificationType.COMPLEX_TYPE);
Collection<? extends ItemDelta> deltas = DeltaConvertor.toModifications(modification, UserType.class, prismContext);
OperationResult result = new OperationResult("MODIFY");
repositoryService.modifyObject(UserType.class, "1234", deltas, getModifyOptions(), result);
}
use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectModificationType in project midpoint by Evolveum.
the class ModifyTest method test030ModifyUserOnNonExistingAccountTest.
// MID-3483
@Test(enabled = false)
public void test030ModifyUserOnNonExistingAccountTest() throws Exception {
final String TEST_NAME = "test030ModifyUserOnNonExistingAccountTest";
TestUtil.displayTestTile(TEST_NAME);
OperationResult result = new OperationResult("MODIFY");
//add user
File userFile = new File(TEST_DIR, "modify-user.xml");
PrismObject<UserType> user = prismContext.parseObject(userFile);
user.setOid(null);
user.asObjectable().setName(new PolyStringType("non-existing-account-user"));
String oid = repositoryService.addObject(user, null, result);
PrismObject<UserType> userOld = repositoryService.getObject(UserType.class, oid, null, result);
ObjectModificationType modification = PrismTestUtil.parseAtomicValue(new File(TEST_DIR, "change-add-non-existing.xml"), ObjectModificationType.COMPLEX_TYPE);
Collection<? extends ItemDelta> deltas = DeltaConvertor.toModifications(modification, UserType.class, prismContext);
repositoryService.modifyObject(UserType.class, oid, deltas, getModifyOptions(), result);
PropertyDelta.applyTo(deltas, userOld);
PrismObject<UserType> userNew = repositoryService.getObject(UserType.class, oid, null, result);
ObjectDelta<UserType> delta = userOld.diff(userNew);
LOGGER.debug("Modify diff \n{}", delta.debugDump(3));
AssertJUnit.assertTrue("Modify was unsuccessful, diff size: " + delta.getModifications().size(), delta.isEmpty());
AssertJUnit.assertTrue("User is not equivalent.", userOld.equivalent(userNew));
}
use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectModificationType in project midpoint by Evolveum.
the class ModifyUser method test020ModifyUser.
@Test
public void test020ModifyUser() throws Exception {
final String TEST_NAME = "test020ModifyUser";
TestUtil.displayTestTile(TEST_NAME);
OperationResult result = new OperationResult(TEST_NAME);
ObjectModificationType modification = PrismTestUtil.parseAtomicValue(new File(FOLDER_BASIC, "t002.xml"), ObjectModificationType.COMPLEX_TYPE);
ObjectDelta delta = DeltaConvertor.createObjectDelta(modification, UserType.class, prismContext);
delta.setOid(userOid);
// WHEN
TestUtil.displayWhen(TEST_NAME);
repositoryService.modifyObject(UserType.class, userOid, delta.getModifications(), result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
PrismObject<UserType> userAfter = repositoryService.getObject(UserType.class, userOid, null, result);
PrismAsserts.assertPropertyValue(userAfter, UserType.F_FULL_NAME, PrismTestUtil.createPolyString(USER_FULLNAME));
PrismAsserts.assertPropertyValue(userAfter, UserType.F_EMPLOYEE_NUMBER, "en1234");
}
use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectModificationType in project midpoint by Evolveum.
the class ModifyUser method test070ModifyBigUser.
/**
* This test fails with java.lang.IllegalStateException: An entity copy was already assigned to a different entity.
* It's ok to fail, but it should fail somehow differently.
*
* todo improve later [lazyman]
*/
@Test(enabled = false)
public void test070ModifyBigUser() throws Exception {
ObjectModificationType modification = PrismTestUtil.parseAtomicValue(new File(FOLDER_BASIC, "t004.xml"), ObjectModificationType.COMPLEX_TYPE);
ObjectDelta delta = DeltaConvertor.createObjectDelta(modification, UserType.class, prismContext);
repositoryService.modifyObject(UserType.class, userBigOid, delta.getModifications(), new OperationResult("asdf"));
}
use of com.evolveum.midpoint.xml.ns._public.common.api_types_3.ObjectModificationType in project midpoint by Evolveum.
the class ModifyUser method test022ModifyUserEmptyEmpNum.
@Test
public void test022ModifyUserEmptyEmpNum() throws Exception {
final String TEST_NAME = "test022ModifyUserEmptyEmpNum";
TestUtil.displayTestTile(TEST_NAME);
OperationResult result = new OperationResult(TEST_NAME);
ObjectModificationType modification = PrismTestUtil.parseAtomicValue(new File(FOLDER_BASIC, "t002b.xml"), ObjectModificationType.COMPLEX_TYPE);
ObjectDelta delta = DeltaConvertor.createObjectDelta(modification, UserType.class, prismContext);
delta.setOid(userOid);
// WHEN
TestUtil.displayWhen(TEST_NAME);
repositoryService.modifyObject(UserType.class, userOid, delta.getModifications(), result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
PrismObject<UserType> userAfter = repositoryService.getObject(UserType.class, userOid, null, result);
PrismAsserts.assertPropertyValue(userAfter, UserType.F_FULL_NAME, PrismTestUtil.createPolyString(USER_FULLNAME));
PrismAsserts.assertPropertyValue(userAfter, UserType.F_EMPLOYEE_NUMBER, "");
}
Aggregations