Search in sources :

Example 96 with PrismPropertyDefinition

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);
}
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 97 with PrismPropertyDefinition

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);
}
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 98 with PrismPropertyDefinition

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);
}
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 99 with PrismPropertyDefinition

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);
}
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 100 with PrismPropertyDefinition

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)"));
}
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)

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