use of com.evolveum.midpoint.prism.PrismPropertyDefinition in project midpoint by Evolveum.
the class TestMappingComplex method testModifyObjectUnrelated.
/**
* Change property that is not a source in this mapping
*/
@Test
public void testModifyObjectUnrelated() throws Exception {
final String TEST_NAME = "testModifyObjectUnrelated";
System.out.println("===[ " + TEST_NAME + "]===");
// GIVEN
ObjectDelta<UserType> delta = ObjectDelta.createModificationReplaceProperty(UserType.class, evaluator.USER_OLD_OID, evaluator.toPath("costCenter"), evaluator.getPrismContext(), "X606");
Mapping<PrismPropertyValue<PolyString>, PrismPropertyDefinition<PolyString>> mapping = evaluator.createMapping(MAPPING_COMPLEX_FILENAME, TEST_NAME, "title", delta);
OperationResult opResult = new OperationResult(TEST_NAME);
// WHEN
mapping.evaluate(null, opResult);
// THEN
PrismValueDeltaSetTriple<PrismPropertyValue<PolyString>> outputTriple = mapping.getOutputTriple();
outputTriple.checkConsistence();
PrismAsserts.assertTripleZero(outputTriple, PrismTestUtil.createPolyString("Pirate null (#null)"));
PrismAsserts.assertTripleNoPlus(outputTriple);
PrismAsserts.assertTripleNoMinus(outputTriple);
}
use of com.evolveum.midpoint.prism.PrismPropertyDefinition in project midpoint by Evolveum.
the class TestMappingComplex method testModifyObjectSetAdditionalNameFalse.
@Test
public void testModifyObjectSetAdditionalNameFalse() throws Exception {
final String TEST_NAME = "testModifyObjectSetAdditionalNameFalse";
System.out.println("===[ " + TEST_NAME + "]===");
// GIVEN
ObjectDelta<UserType> delta = ObjectDelta.createModificationReplaceProperty(UserType.class, evaluator.USER_OLD_OID, UserType.F_ADDITIONAL_NAME, evaluator.getPrismContext(), "Jackie");
delta.addModificationReplaceProperty(UserType.F_EMPLOYEE_NUMBER, "321");
PrismObject<UserType> userOld = evaluator.getUserOld();
userOld.asObjectable().getEmployeeType().clear();
userOld.asObjectable().getEmployeeType().add("WHATEVER");
Mapping<PrismPropertyValue<PolyString>, PrismPropertyDefinition<PolyString>> mapping = evaluator.createMapping(MAPPING_COMPLEX_FILENAME, TEST_NAME, "title", delta, userOld);
OperationResult opResult = new OperationResult(TEST_NAME);
// WHEN
mapping.evaluate(null, opResult);
// THEN
PrismValueDeltaSetTriple<PrismPropertyValue<PolyString>> outputTriple = mapping.getOutputTriple();
assertNull("Unexpected value in outputTriple: " + outputTriple, outputTriple);
}
use of com.evolveum.midpoint.prism.PrismPropertyDefinition in project midpoint by Evolveum.
the class TestMappingComplex method testAddObjectUnrelatedEmptyFalse.
@Test
public void testAddObjectUnrelatedEmptyFalse() throws Exception {
final String TEST_NAME = "testAddObjectUnrelatedEmptyFalse";
System.out.println("===[ " + TEST_NAME + "]===");
// GIVEN
PrismObject<UserType> user = evaluator.getUserOld();
user.asObjectable().getEmployeeType().clear();
ObjectDelta<UserType> delta = user.createAddDelta();
Mapping<PrismPropertyValue<PolyString>, PrismPropertyDefinition<PolyString>> mapping = evaluator.createMapping(MAPPING_COMPLEX_FILENAME, TEST_NAME, "title", delta);
OperationResult opResult = new OperationResult(TEST_NAME);
// WHEN
mapping.evaluate(null, opResult);
// THEN
PrismValueDeltaSetTriple<PrismPropertyValue<PolyString>> outputTriple = mapping.getOutputTriple();
assertNull("Unexpected value in outputTriple: " + outputTriple, outputTriple);
}
use of com.evolveum.midpoint.prism.PrismPropertyDefinition in project midpoint by Evolveum.
the class TestMappingComplex method testModifyObjectUnrelatedFalse.
@Test
public void testModifyObjectUnrelatedFalse() throws Exception {
final String TEST_NAME = "testModifyObjectUnrelatedFalse";
System.out.println("===[ " + TEST_NAME + "]===");
// GIVEN
ObjectDelta<UserType> delta = ObjectDelta.createModificationReplaceProperty(UserType.class, evaluator.USER_OLD_OID, evaluator.toPath("costCenter"), evaluator.getPrismContext(), "X606");
PrismObject<UserType> userOld = evaluator.getUserOld();
userOld.asObjectable().getEmployeeType().clear();
userOld.asObjectable().getEmployeeType().add("WHATEVER");
Mapping<PrismPropertyValue<PolyString>, PrismPropertyDefinition<PolyString>> mapping = evaluator.createMapping(MAPPING_COMPLEX_FILENAME, TEST_NAME, "title", delta, userOld);
OperationResult opResult = new OperationResult(TEST_NAME);
// WHEN
mapping.evaluate(null, opResult);
// THEN
PrismValueDeltaSetTriple<PrismPropertyValue<PolyString>> outputTriple = mapping.getOutputTriple();
assertNull("Unexpected value in outputTriple: " + outputTriple, outputTriple);
}
use of com.evolveum.midpoint.prism.PrismPropertyDefinition in project midpoint by Evolveum.
the class TestMappingDomain method testControlReplaceMultiValue.
/**
* Control. All goes well here. All values in the domain.
*/
@Test
public void testControlReplaceMultiValue() throws Exception {
final String TEST_NAME = "testControlReplaceMultiValue";
TestUtil.displayTestTile(this, TEST_NAME);
// GIVEN
PrismObject<UserType> userOld = evaluator.getUserOld();
List<String> employeeTypeOld = userOld.asObjectable().getEmployeeType();
employeeTypeOld.clear();
employeeTypeOld.add("001");
employeeTypeOld.add("002");
employeeTypeOld.add("003");
ObjectDelta<UserType> delta = ObjectDelta.createModificationReplaceProperty(UserType.class, evaluator.USER_OLD_OID, UserType.F_ADDITIONAL_NAME, evaluator.getPrismContext(), "Jackie");
delta.addModificationReplaceProperty(UserType.F_EMPLOYEE_TYPE, "991", "992");
Mapping<PrismPropertyValue<PolyString>, PrismPropertyDefinition<PolyString>> mapping = evaluator.createMapping(MAPPING_DOMAIN_FILENAME, TEST_NAME, "organization", delta, userOld);
OperationResult opResult = new OperationResult(TEST_NAME);
// WHEN
mapping.evaluate(null, opResult);
// THEN
PrismValueDeltaSetTriple<PrismPropertyValue<PolyString>> outputTriple = mapping.getOutputTriple();
outputTriple.checkConsistence();
PrismAsserts.assertTripleNoZero(outputTriple);
PrismAsserts.assertTriplePlus(outputTriple, PrismTestUtil.createPolyString("Pirate Jackie (991)"), PrismTestUtil.createPolyString("Pirate Jackie (992)"));
PrismAsserts.assertTripleMinus(outputTriple, PrismTestUtil.createPolyString("Pirate null (001)"), PrismTestUtil.createPolyString("Pirate null (002)"), PrismTestUtil.createPolyString("Pirate null (003)"));
}
Aggregations