Search in sources :

Example 6 with NullTaskImpl

use of com.evolveum.midpoint.task.api.test.NullTaskImpl in project midpoint by Evolveum.

the class MappingTestEvaluator method evaluateMapping.

public <T> PrismValueDeltaSetTriple<PrismPropertyValue<T>> evaluateMapping(String filename, String testName, ItemName defaultTargetPropertyName) throws SchemaException, IOException, ExpressionEvaluationException, ObjectNotFoundException, EncryptionException, SecurityViolationException, ConfigurationException, CommunicationException {
    MappingImpl<PrismPropertyValue<T>, PrismPropertyDefinition<T>> mapping = createMapping(filename, testName, defaultTargetPropertyName, null);
    OperationResult opResult = new OperationResult(testName);
    mapping.evaluate(new NullTaskImpl(), opResult);
    assertResult(opResult);
    PrismValueDeltaSetTriple<PrismPropertyValue<T>> outputTriple = mapping.getOutputTriple();
    if (outputTriple != null) {
        outputTriple.checkConsistence();
    }
    return outputTriple;
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) NullTaskImpl(com.evolveum.midpoint.task.api.test.NullTaskImpl)

Example 7 with NullTaskImpl

use of com.evolveum.midpoint.task.api.test.NullTaskImpl in project midpoint by Evolveum.

the class TestExpressionUtil method resolvePath.

private <T> T resolvePath(String path, VariablesMap variables, String exprShortDesc) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException, SecurityViolationException, ExpressionEvaluationException {
    OperationResult result = createOperationResult();
    ItemPath itemPath = toItemPath(path);
    // WHEN
    ObjectResolver objectResolver = new DirectoryFileObjectResolver(MidPointTestConstants.OBJECTS_DIR);
    Object resolved = ExpressionUtil.resolvePathGetValue(itemPath, variables, false, null, objectResolver, PrismTestUtil.getPrismContext(), exprShortDesc, new NullTaskImpl(), result);
    // THEN
    IntegrationTestTools.display("Resolved", resolved);
    // noinspection unchecked
    return (T) resolved;
}
Also used : DirectoryFileObjectResolver(com.evolveum.midpoint.repo.common.DirectoryFileObjectResolver) ObjectResolver(com.evolveum.midpoint.repo.common.ObjectResolver) DirectoryFileObjectResolver(com.evolveum.midpoint.repo.common.DirectoryFileObjectResolver) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ObjectDeltaObject(com.evolveum.midpoint.prism.util.ObjectDeltaObject) PrismObject(com.evolveum.midpoint.prism.PrismObject) UniformItemPath(com.evolveum.midpoint.prism.path.UniformItemPath) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) NullTaskImpl(com.evolveum.midpoint.task.api.test.NullTaskImpl)

Example 8 with NullTaskImpl

use of com.evolveum.midpoint.task.api.test.NullTaskImpl in project midpoint by Evolveum.

the class MappingTestEvaluator method evaluateMappingDynamicReplace.

public <T, I> PrismValueDeltaSetTriple<PrismPropertyValue<T>> evaluateMappingDynamicReplace(String filename, String testName, String defaultTargetPropertyName, ItemPath changedPropertyName, I... valuesToReplace) throws SchemaException, IOException, ExpressionEvaluationException, ObjectNotFoundException, EncryptionException, SecurityViolationException, ConfigurationException, CommunicationException {
    ObjectDelta<UserType> userDelta = prismContext.deltaFactory().object().createModificationReplaceProperty(UserType.class, USER_OLD_OID, changedPropertyName, valuesToReplace);
    MappingImpl<PrismPropertyValue<T>, PrismPropertyDefinition<T>> mapping = createMapping(filename, testName, defaultTargetPropertyName, userDelta);
    OperationResult opResult = new OperationResult(testName);
    mapping.evaluate(new NullTaskImpl(), opResult);
    assertResult(opResult);
    PrismValueDeltaSetTriple<PrismPropertyValue<T>> outputTriple = mapping.getOutputTriple();
    if (outputTriple != null) {
        outputTriple.checkConsistence();
    }
    return outputTriple;
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) NullTaskImpl(com.evolveum.midpoint.task.api.test.NullTaskImpl)

Example 9 with NullTaskImpl

use of com.evolveum.midpoint.task.api.test.NullTaskImpl in project midpoint by Evolveum.

the class MappingTestEvaluator method evaluateMappingDynamicAdd.

public <T, I> PrismValueDeltaSetTriple<PrismPropertyValue<T>> evaluateMappingDynamicAdd(String filename, String testName, ItemPath defaultTargetPropertyPath, String changedPropertyName, I... valuesToAdd) throws SchemaException, IOException, ExpressionEvaluationException, ObjectNotFoundException, EncryptionException, SecurityViolationException, ConfigurationException, CommunicationException {
    ObjectDelta<UserType> userDelta = prismContext.deltaFactory().object().createModificationAddProperty(UserType.class, USER_OLD_OID, toPath(changedPropertyName), valuesToAdd);
    MappingImpl<PrismPropertyValue<T>, PrismPropertyDefinition<T>> mapping = createMapping(filename, testName, defaultTargetPropertyPath, userDelta);
    OperationResult opResult = new OperationResult(testName);
    mapping.evaluate(new NullTaskImpl(), opResult);
    assertResult(opResult);
    PrismValueDeltaSetTriple<PrismPropertyValue<T>> outputTriple = mapping.getOutputTriple();
    if (outputTriple != null) {
        outputTriple.checkConsistence();
    }
    return outputTriple;
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) NullTaskImpl(com.evolveum.midpoint.task.api.test.NullTaskImpl)

Example 10 with NullTaskImpl

use of com.evolveum.midpoint.task.api.test.NullTaskImpl in project midpoint by Evolveum.

the class MappingTestEvaluator method evaluateMappingDynamicDelete.

public <T, I> PrismValueDeltaSetTriple<PrismPropertyValue<T>> evaluateMappingDynamicDelete(String filename, String testName, String defaultTargetPropertyName, String changedPropertyName, I... valuesToAdd) throws SchemaException, IOException, ExpressionEvaluationException, ObjectNotFoundException, EncryptionException, SecurityViolationException, ConfigurationException, CommunicationException {
    ObjectDelta<UserType> userDelta = prismContext.deltaFactory().object().createModificationDeleteProperty(UserType.class, USER_OLD_OID, toPath(changedPropertyName), valuesToAdd);
    MappingImpl<PrismPropertyValue<T>, PrismPropertyDefinition<T>> mapping = createMapping(filename, testName, defaultTargetPropertyName, userDelta);
    OperationResult opResult = new OperationResult(testName);
    mapping.evaluate(new NullTaskImpl(), opResult);
    assertResult(opResult);
    PrismValueDeltaSetTriple<PrismPropertyValue<T>> outputTriple = mapping.getOutputTriple();
    if (outputTriple != null) {
        outputTriple.checkConsistence();
    }
    return outputTriple;
}
Also used : OperationResult(com.evolveum.midpoint.schema.result.OperationResult) NullTaskImpl(com.evolveum.midpoint.task.api.test.NullTaskImpl)

Aggregations

NullTaskImpl (com.evolveum.midpoint.task.api.test.NullTaskImpl)13 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)11 AuditEventRecord (com.evolveum.midpoint.audit.api.AuditEventRecord)5 MAuditEventRecord (com.evolveum.midpoint.repo.sql.audit.beans.MAuditEventRecord)4 QAuditEventRecord (com.evolveum.midpoint.repo.sql.audit.querymodel.QAuditEventRecord)3 Test (org.testng.annotations.Test)3 AuditReferenceValue (com.evolveum.midpoint.audit.api.AuditReferenceValue)1 PrismObject (com.evolveum.midpoint.prism.PrismObject)1 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)1 UniformItemPath (com.evolveum.midpoint.prism.path.UniformItemPath)1 ObjectDeltaObject (com.evolveum.midpoint.prism.util.ObjectDeltaObject)1 DirectoryFileObjectResolver (com.evolveum.midpoint.repo.common.DirectoryFileObjectResolver)1 ObjectResolver (com.evolveum.midpoint.repo.common.ObjectResolver)1 ObjectDeltaOperation (com.evolveum.midpoint.schema.ObjectDeltaOperation)1 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)1 Calendar (java.util.Calendar)1 Date (java.util.Date)1