use of com.evolveum.midpoint.prism.polystring.PolyString in project midpoint by Evolveum.
the class TestEditSchema method test263EditShadowSchemaEmpty.
@Test
public void test263EditShadowSchemaEmpty() throws Exception {
final String TEST_NAME = "test263EditShadowSchemaEmpty";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestEditSchema.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ResourceShadowDiscriminator discr = new ResourceShadowDiscriminator(null, null);
IntegrationTestTools.display("Discr", discr);
// WHEN
TestUtil.displayWhen(TEST_NAME);
PrismObjectDefinition<ShadowType> editDef = modelInteractionService.getEditShadowDefinition(discr, AuthorizationPhaseType.REQUEST, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
PrismPropertyDefinition<PolyString> nameDef = editDef.findPropertyDefinition(ShadowType.F_NAME);
assertNotNull("No definition for name in shadow", nameDef);
assertEquals("Wrong shadow name displayName", "ObjectType.name", nameDef.getDisplayName());
assertTrue("additionalName not readable", nameDef.canRead());
PrismPropertyDefinition<Object> attrFullNameDef = editDef.findPropertyDefinition(dummyResourceCtl.getAttributeFullnamePath());
assertNull("Unexpected definition for fullname attribute in shadow", attrFullNameDef);
assertSteadyResources();
}
use of com.evolveum.midpoint.prism.polystring.PolyString in project midpoint by Evolveum.
the class TestEditSchema method test261EditShadowSchemaObjectclass.
@Test
public void test261EditShadowSchemaObjectclass() throws Exception {
final String TEST_NAME = "test261EditShadowSchemaObjectclass";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestEditSchema.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ResourceShadowDiscriminator discr = new ResourceShadowDiscriminator(RESOURCE_DUMMY_OID, dummyResourceCtl.getAccountObjectClassQName());
IntegrationTestTools.display("Discr", discr);
// WHEN
TestUtil.displayWhen(TEST_NAME);
PrismObjectDefinition<ShadowType> editDef = modelInteractionService.getEditShadowDefinition(discr, AuthorizationPhaseType.REQUEST, task, result);
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
TestUtil.assertSuccess(result);
PrismPropertyDefinition<PolyString> nameDef = editDef.findPropertyDefinition(ShadowType.F_NAME);
assertNotNull("No definition for name in shadow", nameDef);
assertEquals("Wrong shadow name displayName", "ObjectType.name", nameDef.getDisplayName());
assertTrue("additionalName not readable", nameDef.canRead());
PrismPropertyDefinition<Object> attrFullNameDef = editDef.findPropertyDefinition(dummyResourceCtl.getAttributeFullnamePath());
assertNotNull("No definition for fullname attribute in shadow", attrFullNameDef);
assertEquals("Wrong shadow fullname attribute displayName", "Full Name", attrFullNameDef.getDisplayName());
assertTrue("additionalName not readable", attrFullNameDef.canRead());
assertSteadyResources();
}
use of com.evolveum.midpoint.prism.polystring.PolyString in project midpoint by Evolveum.
the class TestUserTemplate method test100ModifyUserGivenName.
@Test
public void test100ModifyUserGivenName() throws Exception {
final String TEST_NAME = "test100ModifyUserGivenName";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestUserTemplate.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
Collection<ObjectDelta<? extends ObjectType>> deltas = new ArrayList<ObjectDelta<? extends ObjectType>>();
ObjectDelta<UserType> userDelta = ObjectDelta.createModificationReplaceProperty(UserType.class, USER_JACK_OID, UserType.F_GIVEN_NAME, prismContext, new PolyString("Jackie"));
deltas.add(userDelta);
// WHEN
modelService.executeChanges(deltas, null, task, result);
// THEN
result.computeStatus();
TestUtil.assertSuccess(result);
PrismObject<UserType> userJack = modelService.getObject(UserType.class, USER_JACK_OID, null, task, result);
assertUserJack(userJack, "Jackie Sparrow", "Jackie", "Sparrow");
PrismAsserts.assertPropertyValue(userJack, UserType.F_DESCRIPTION, "Where's the rum?");
assertAssignedAccount(userJack, RESOURCE_DUMMY_BLUE_OID);
assertAssignedNoRole(userJack);
assertAssignments(userJack, 1);
result.computeStatus();
TestUtil.assertSuccess(result);
UserType userJackType = userJack.asObjectable();
assertEquals("Unexpected number of accountRefs", 1, userJackType.getLinkRef().size());
PrismAsserts.assertPropertyValue(userJack, UserType.F_ADDITIONAL_NAME, PrismTestUtil.createPolyString("Jackie"));
XMLGregorianCalendar now = clock.currentTimeXMLGregorianCalendar();
XMLGregorianCalendar monthLater = XmlTypeConverter.addDuration(now, XmlTypeConverter.createDuration("P1M"));
assertTrigger(userJack, RecomputeTriggerHandler.HANDLER_URI, monthLater, 100000L);
// original value of 0 should be gone now, because the corresponding item in user template is marked as non-tolerant
PrismAsserts.assertPropertyValue(userJack.findContainer(UserType.F_EXTENSION), PIRACY_BAD_LUCK, 123L, 456L);
// timezone mapping is normal-strength. The source (locality) has not changed.
// The mapping should not be activated (MID-3040)
PrismAsserts.assertNoItem(userJack, UserType.F_TIMEZONE);
}
use of com.evolveum.midpoint.prism.polystring.PolyString in project midpoint by Evolveum.
the class TestUserTemplateWithRanges method test210RemoveUnit1.
/**
* OrganizationalUnit U1 disappearing + recompute. Computed value of 'OU: U1 ...' should be removed.
* Note that condition is true -> true.
*/
@Test
public void test210RemoveUnit1() throws Exception {
final String TEST_NAME = "test210RemoveUnit1";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestUserTemplateWithRanges.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
// WHEN
executeChanges((ObjectDelta) DeltaBuilder.deltaFor(UserType.class, prismContext).item(UserType.F_ORGANIZATIONAL_UNIT).delete(PolyString.fromOrig("U1")).asObjectDelta(USER_JACK_OID), ModelExecuteOptions.createRaw(), task, result);
recomputeUser(USER_JACK_OID, task, result);
// THEN
result.computeStatus();
TestUtil.assertSuccess(result);
PrismObject<UserType> userJack = getUser(USER_JACK_OID);
display("jack", userJack);
PrismAsserts.assertPropertyValue(userJack, UserType.F_ORGANIZATIONAL_UNIT, new PolyString("U2", "u2"), new PolyString("U3", "u3"), new PolyString("U4", "u4"));
PrismAsserts.assertPropertyValue(userJack, UserType.F_ORGANIZATION, new PolyString("O1", "o1"), new PolyString("OU: U2 emp1234", "ou u2 emp1234"), new PolyString("OU: U3 emp1234", "ou u3 emp1234"), new PolyString("OU: U4 emp1234", "ou u4 emp1234"));
}
use of com.evolveum.midpoint.prism.polystring.PolyString in project midpoint by Evolveum.
the class TestUserTemplate method test165ModifyUserGivenNameAgainAgain.
@Test
public void test165ModifyUserGivenNameAgainAgain() throws Exception {
final String TEST_NAME = "test165ModifyUserGivenNameAgainAgain";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestUserTemplate.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
PrismObject<UserType> userBefore = modelService.getObject(UserType.class, USER_JACK_OID, null, task, result);
display("User before", userBefore);
Collection<ObjectDelta<? extends ObjectType>> deltas = new ArrayList<ObjectDelta<? extends ObjectType>>();
ObjectDelta<UserType> userDelta = ObjectDelta.createModificationReplaceProperty(UserType.class, USER_JACK_OID, UserType.F_GIVEN_NAME, prismContext, new PolyString("jackie"));
deltas.add(userDelta);
// WHEN
modelService.executeChanges(deltas, null, task, result);
// THEN
PrismObject<UserType> userJack = modelService.getObject(UserType.class, USER_JACK_OID, null, task, result);
display("User after", userJack);
result.computeStatus();
TestUtil.assertSuccess(result);
// all the values should be gone now, because the corresponding item in user template is marked as non-tolerant
PrismAsserts.assertNoItem(userJack, new ItemPath(UserType.F_EXTENSION, PIRACY_BAD_LUCK));
}
Aggregations