Search in sources :

Example 6 with CorrelationResult

use of com.evolveum.midpoint.model.api.correlator.CorrelationResult in project midpoint by Evolveum.

the class TestExpressionCorrelator method test110OwnerX.

/**
 * The correlation code returns X.
 */
@Test
public void test110OwnerX() throws Exception {
    given();
    Task task = getTestTask();
    OperationResult result = task.getResult();
    String accountName = getTestNameShort();
    DummyAccount account = DUMMY_RESOURCE_SOURCE.controller.addAccount(accountName);
    account.addAttributeValue(ATTR_CORRELATION_CODE, ownersCode(USER_X));
    when();
    CorrelationResult correlationResult = correlateAccount(accountName, task, result);
    then();
    assertCorrelationResult(correlationResult, EXISTING_OWNER, USER_X.oid);
    assertNoCorrelationCase(accountName, task, result);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) CorrelationResult(com.evolveum.midpoint.model.api.correlator.CorrelationResult) DummyAccount(com.evolveum.icf.dummy.resource.DummyAccount) Test(org.testng.annotations.Test) AbstractInternalModelIntegrationTest(com.evolveum.midpoint.model.impl.AbstractInternalModelIntegrationTest)

Example 7 with CorrelationResult

use of com.evolveum.midpoint.model.api.correlator.CorrelationResult in project midpoint by Evolveum.

the class TestExpressionCorrelator method test140CustomPotentialMatches.

/**
 * The correlation code returns empty list but a custom potential matches.
 */
@Test
public void test140CustomPotentialMatches() throws Exception {
    given();
    Task task = getTestTask();
    OperationResult result = task.getResult();
    String customCode = "import com.evolveum.midpoint.xml.ns._public.common.common_3.*\n\n" + "correlationContext.requestManualCorrelation([\n" + "\tnew BuiltInCorrelationPotentialMatchType()\n" + "\t\t.candidateOwnerRef('f2cb9158-3e3f-40c5-84da-7859c2da5535', UserType.COMPLEX_TYPE),\n" + "\tnew BuiltInCorrelationPotentialMatchType()\n" + "\t\t.candidateOwnerRef('712c127f-1320-4fa9-95fb-f833feac5f58', UserType.COMPLEX_TYPE)])\n" + "[]";
    String accountName = getTestNameShort();
    DummyAccount account = DUMMY_RESOURCE_SOURCE.controller.addAccount(accountName);
    account.addAttributeValue(ATTR_CORRELATION_CODE, customCode);
    when();
    CorrelationResult correlationResult = correlateAccount(accountName, task, result);
    then();
    assertCorrelationResult(correlationResult, UNCERTAIN, null);
    var aCase = assertCorrelationCase(accountName, task, result);
    displayValue("case", prismContext.xmlSerializer().serialize(aCase.asPrismObject()));
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) CorrelationResult(com.evolveum.midpoint.model.api.correlator.CorrelationResult) DummyAccount(com.evolveum.icf.dummy.resource.DummyAccount) Test(org.testng.annotations.Test) AbstractInternalModelIntegrationTest(com.evolveum.midpoint.model.impl.AbstractInternalModelIntegrationTest)

Example 8 with CorrelationResult

use of com.evolveum.midpoint.model.api.correlator.CorrelationResult in project midpoint by Evolveum.

the class TestExpressionCorrelator method test130OwnersXYWithCase.

/**
 * The correlation code returns X and Y. Correlation case is requested to be created.
 */
@Test
public void test130OwnersXYWithCase() throws Exception {
    given();
    Task task = getTestTask();
    OperationResult result = task.getResult();
    String accountName = getTestNameShort();
    DummyAccount account = DUMMY_RESOURCE_SOURCE.controller.addAccount(accountName);
    account.addAttributeValue(ATTR_CORRELATION_CODE, requestCaseCode() + ownersCode(USER_X, USER_Y));
    when();
    CorrelationResult correlationResult = correlateAccount(accountName, task, result);
    then();
    assertCorrelationResult(correlationResult, UNCERTAIN, null);
    assertCorrelationCase(accountName, task, result);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) CorrelationResult(com.evolveum.midpoint.model.api.correlator.CorrelationResult) DummyAccount(com.evolveum.icf.dummy.resource.DummyAccount) Test(org.testng.annotations.Test) AbstractInternalModelIntegrationTest(com.evolveum.midpoint.model.impl.AbstractInternalModelIntegrationTest)

Example 9 with CorrelationResult

use of com.evolveum.midpoint.model.api.correlator.CorrelationResult in project midpoint by Evolveum.

the class TestExpressionCorrelator method test120OwnersXY.

/**
 * The correlation code returns X and Y. Because manual case is not created automatically, no case should be there.
 */
@Test
public void test120OwnersXY() throws Exception {
    given();
    Task task = getTestTask();
    OperationResult result = task.getResult();
    String accountName = getTestNameShort();
    DummyAccount account = DUMMY_RESOURCE_SOURCE.controller.addAccount(accountName);
    account.addAttributeValue(ATTR_CORRELATION_CODE, ownersCode(USER_X, USER_Y));
    when();
    CorrelationResult correlationResult = correlateAccount(accountName, task, result);
    then();
    assertCorrelationResult(correlationResult, UNCERTAIN, null);
    assertNoCorrelationCase(accountName, task, result);
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) CorrelationResult(com.evolveum.midpoint.model.api.correlator.CorrelationResult) DummyAccount(com.evolveum.icf.dummy.resource.DummyAccount) Test(org.testng.annotations.Test) AbstractInternalModelIntegrationTest(com.evolveum.midpoint.model.impl.AbstractInternalModelIntegrationTest)

Aggregations

CorrelationResult (com.evolveum.midpoint.model.api.correlator.CorrelationResult)9 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)7 DummyAccount (com.evolveum.icf.dummy.resource.DummyAccount)5 AbstractInternalModelIntegrationTest (com.evolveum.midpoint.model.impl.AbstractInternalModelIntegrationTest)5 Task (com.evolveum.midpoint.task.api.Task)5 Test (org.testng.annotations.Test)5 NotNull (org.jetbrains.annotations.NotNull)3