Search in sources :

Example 26 with PrismPropertyDefinition

use of com.evolveum.midpoint.prism.PrismPropertyDefinition in project midpoint by Evolveum.

the class MappingTestEvaluator method evaluateMapping.

public <T, I> PrismValueDeltaSetTriple<PrismPropertyValue<T>> evaluateMapping(String filename, String testName, String defaultTargetPropertyName) throws SchemaException, IOException, JAXBException, ExpressionEvaluationException, ObjectNotFoundException, EncryptionException {
    Mapping<PrismPropertyValue<T>, PrismPropertyDefinition<T>> mapping = createMapping(filename, testName, defaultTargetPropertyName, null);
    OperationResult opResult = new OperationResult(testName);
    mapping.evaluate(null, opResult);
    assertResult(opResult);
    PrismValueDeltaSetTriple<PrismPropertyValue<T>> outputTriple = mapping.getOutputTriple();
    if (outputTriple != null) {
        outputTriple.checkConsistence();
    }
    return outputTriple;
}
Also used : PrismPropertyDefinition(com.evolveum.midpoint.prism.PrismPropertyDefinition) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PrismPropertyValue(com.evolveum.midpoint.prism.PrismPropertyValue)

Example 27 with PrismPropertyDefinition

use of com.evolveum.midpoint.prism.PrismPropertyDefinition in project midpoint by Evolveum.

the class MappingTestEvaluator method evaluateMapping.

public <T, I> PrismValueDeltaSetTriple<PrismPropertyValue<T>> evaluateMapping(String filename, String testName, ItemPath defaultTargetPropertyPath) throws SchemaException, IOException, JAXBException, ExpressionEvaluationException, ObjectNotFoundException, EncryptionException {
    Mapping<PrismPropertyValue<T>, PrismPropertyDefinition<T>> mapping = createMapping(filename, testName, defaultTargetPropertyPath, null);
    OperationResult opResult = new OperationResult(testName);
    mapping.evaluate(null, opResult);
    assertResult(opResult);
    PrismValueDeltaSetTriple<PrismPropertyValue<T>> outputTriple = mapping.getOutputTriple();
    if (outputTriple != null) {
        outputTriple.checkConsistence();
    }
    return outputTriple;
}
Also used : PrismPropertyDefinition(com.evolveum.midpoint.prism.PrismPropertyDefinition) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PrismPropertyValue(com.evolveum.midpoint.prism.PrismPropertyValue)

Example 28 with PrismPropertyDefinition

use of com.evolveum.midpoint.prism.PrismPropertyDefinition in project midpoint by Evolveum.

the class MappingTestEvaluator method evaluateMapping.

public <T, I> PrismValueDeltaSetTriple<PrismPropertyValue<T>> evaluateMapping(String filename, String testName, QName defaultTargetPropertyName) throws SchemaException, IOException, JAXBException, ExpressionEvaluationException, ObjectNotFoundException, EncryptionException {
    Mapping<PrismPropertyValue<T>, PrismPropertyDefinition<T>> mapping = createMapping(filename, testName, defaultTargetPropertyName, null);
    OperationResult opResult = new OperationResult(testName);
    mapping.evaluate(null, opResult);
    assertResult(opResult);
    PrismValueDeltaSetTriple<PrismPropertyValue<T>> outputTriple = mapping.getOutputTriple();
    if (outputTriple != null) {
        outputTriple.checkConsistence();
    }
    return outputTriple;
}
Also used : PrismPropertyDefinition(com.evolveum.midpoint.prism.PrismPropertyDefinition) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PrismPropertyValue(com.evolveum.midpoint.prism.PrismPropertyValue)

Example 29 with PrismPropertyDefinition

use of com.evolveum.midpoint.prism.PrismPropertyDefinition in project midpoint by Evolveum.

the class TestMappingDynamicSimple method testScriptFullNameDeleteGivenNameFromNull.

@Test
public void testScriptFullNameDeleteGivenNameFromNull() throws Exception {
    final String TEST_NAME = "testScriptFullNameDeleteGivenNameFromNull";
    TestUtil.displayTestTile(TEST_NAME);
    // GIVEN
    ObjectDelta<UserType> delta = ObjectDelta.createModificationDeleteProperty(UserType.class, evaluator.USER_OLD_OID, UserType.F_GIVEN_NAME, evaluator.getPrismContext(), PrismTestUtil.createPolyString("Jack"));
    PrismObject<UserType> userOld = evaluator.getUserOld();
    userOld.asObjectable().setGivenName(null);
    Mapping<PrismPropertyValue<PolyString>, PrismPropertyDefinition<PolyString>> mapping = evaluator.createMapping("mapping-script-fullname.xml", TEST_NAME, // target
    "fullName", 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("Sparrow"));
    PrismAsserts.assertTripleMinus(outputTriple, PrismTestUtil.createPolyString("Jack Sparrow"));
}
Also used : PrismPropertyDefinition(com.evolveum.midpoint.prism.PrismPropertyDefinition) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) PrismPropertyValue(com.evolveum.midpoint.prism.PrismPropertyValue) Test(org.testng.annotations.Test)

Example 30 with PrismPropertyDefinition

use of com.evolveum.midpoint.prism.PrismPropertyDefinition in project midpoint by Evolveum.

the class TestMappingDynamicSimple method testScriptRootNodeJaxb.

@Test
public void testScriptRootNodeJaxb() throws Exception {
    // GIVEN
    final String TEST_NAME = "testScriptRootNodeJaxb";
    TestUtil.displayTestTile(TEST_NAME);
    PrismObject<UserType> user = PrismTestUtil.parseObject(new File(MidPointTestConstants.OBJECTS_DIR, "c0c010c0-d34d-b33f-f00d-111111111111.xml"));
    Mapping<PrismPropertyValue<PolyString>, PrismPropertyDefinition<PolyString>> mapping = evaluator.<PolyString>createMappingBuilder("mapping-script-root-node.xml", TEST_NAME, "locality", null).rootNode(user.asObjectable()).build();
    OperationResult opResult = new OperationResult(TEST_NAME);
    // WHEN
    mapping.evaluate(null, opResult);
    // THEN
    PrismValueDeltaSetTriple<PrismPropertyValue<PolyString>> outputTriple = mapping.getOutputTriple();
    outputTriple.checkConsistence();
    PrismAsserts.assertTripleZero(outputTriple, new PolyString("Black Pearl", "black pearl"));
    PrismAsserts.assertTripleNoPlus(outputTriple);
    PrismAsserts.assertTripleNoMinus(outputTriple);
}
Also used : PrismPropertyDefinition(com.evolveum.midpoint.prism.PrismPropertyDefinition) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) PolyString(com.evolveum.midpoint.prism.polystring.PolyString) File(java.io.File) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType) PrismPropertyValue(com.evolveum.midpoint.prism.PrismPropertyValue) Test(org.testng.annotations.Test)

Aggregations

PrismPropertyDefinition (com.evolveum.midpoint.prism.PrismPropertyDefinition)134 PrismPropertyValue (com.evolveum.midpoint.prism.PrismPropertyValue)93 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)82 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)62 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)61 Test (org.testng.annotations.Test)60 PrismObject (com.evolveum.midpoint.prism.PrismObject)24 QName (javax.xml.namespace.QName)23 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)19 PrismPropertyDefinitionImpl (com.evolveum.midpoint.prism.PrismPropertyDefinitionImpl)18 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)15 Task (com.evolveum.midpoint.task.api.Task)12 ArrayList (java.util.ArrayList)12 ExpressionEvaluationContext (com.evolveum.midpoint.repo.common.expression.ExpressionEvaluationContext)11 ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)9 PrismContainerDefinition (com.evolveum.midpoint.prism.PrismContainerDefinition)8 PrismContext (com.evolveum.midpoint.prism.PrismContext)8 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)8 ItemDefinition (com.evolveum.midpoint.prism.ItemDefinition)7 File (java.io.File)7