Search in sources :

Example 16 with ProvisioningScriptSpec

use of com.evolveum.midpoint.test.ProvisioningScriptSpec in project midpoint by Evolveum.

the class TestDummy method test135ExecuteScript.

@Test
public void test135ExecuteScript() throws Exception {
    final String TEST_NAME = "test135ExecuteScript";
    TestUtil.displayTestTile(TEST_NAME);
    // GIVEN
    Task task = taskManager.createTaskInstance(TestDummy.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    syncServiceMock.reset();
    dummyResource.purgeScriptHistory();
    OperationProvisioningScriptsType scriptsType = unmarshallValueFromFile(SCRIPTS_FILE, OperationProvisioningScriptsType.class);
    display("Provisioning scripts", PrismTestUtil.serializeAnyDataWrapped(scriptsType));
    ProvisioningScriptType script = scriptsType.getScript().get(0);
    // WHEN
    provisioningService.executeScript(RESOURCE_DUMMY_OID, script, task, result);
    // THEN
    result.computeStatus();
    display("executeScript result", result);
    TestUtil.assertSuccess("executeScript has failed (result)", result);
    ProvisioningScriptSpec expectedScript = new ProvisioningScriptSpec("Where to go now?");
    expectedScript.addArgMulti("direction", "left", "right");
    IntegrationTestTools.assertScripts(dummyResource.getScriptHistory(), expectedScript);
    assertSteadyResource();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationProvisioningScriptsType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ProvisioningScriptSpec(com.evolveum.midpoint.test.ProvisioningScriptSpec) ProvisioningScriptType(com.evolveum.midpoint.xml.ns._public.common.common_3.ProvisioningScriptType) Test(org.testng.annotations.Test)

Aggregations

ProvisioningScriptSpec (com.evolveum.midpoint.test.ProvisioningScriptSpec)16 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)9 Task (com.evolveum.midpoint.task.api.Task)9 Test (org.testng.annotations.Test)9 DummyAccount (com.evolveum.icf.dummy.resource.DummyAccount)6 AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)5 PrismObject (com.evolveum.midpoint.prism.PrismObject)5 OperationResultType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationResultType)5 TaskType (com.evolveum.midpoint.xml.ns._public.common.common_3.TaskType)5 ArrayList (java.util.ArrayList)5 OperationProvisioningScriptsType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType)4 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)3 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)2 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)2 ProvisioningScriptType (com.evolveum.midpoint.xml.ns._public.common.common_3.ProvisioningScriptType)1