Search in sources :

Example 36 with OperationProvisioningScriptsType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType in project midpoint by Evolveum.

the class TestDummy method test126ModifyObjectDeletePirate.

@Test
public void test126ModifyObjectDeletePirate() throws Exception {
    TestUtil.displayTestTile("test126ModifyObjectDeletePirate");
    Task syncTask = taskManager.createTaskInstance(TestDummy.class.getName() + ".test126ModifyObjectDeletePirate");
    OperationResult result = new OperationResult(TestOpenDj.class.getName() + ".test126ModifyObjectDeletePirate");
    syncServiceMock.reset();
    ObjectDelta<ShadowType> delta = ObjectDelta.createModificationDeleteProperty(ShadowType.class, ACCOUNT_WILL_OID, dummyResourceCtl.getAttributePath(DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME), prismContext, "Pirate");
    display("ObjectDelta", delta);
    delta.checkConsistence();
    // WHEN
    provisioningService.modifyObject(ShadowType.class, delta.getOid(), delta.getModifications(), new OperationProvisioningScriptsType(), null, syncTask, result);
    // THEN
    result.computeStatus();
    display("modifyObject result", result);
    TestUtil.assertSuccess(result);
    delta.checkConsistence();
    // check if attribute was changed
    assertDummyAccountAttributeValues(transformNameFromResource(ACCOUNT_WILL_USERNAME), willIcfUid, DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, "Captain");
    syncServiceMock.assertNotifySuccessOnly();
    assertSteadyResource();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationProvisioningScriptsType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test)

Example 37 with OperationProvisioningScriptsType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType in project midpoint by Evolveum.

the class TestDummy method test220EntitleAccountWillPirates.

@Test
public void test220EntitleAccountWillPirates() throws Exception {
    final String TEST_NAME = "test220EntitleAccountWillPirates";
    TestUtil.displayTestTile(TEST_NAME);
    Task task = taskManager.createTaskInstance(TestDummy.class.getName() + "." + TEST_NAME);
    OperationResult result = task.getResult();
    rememberDummyResourceGroupMembersReadCount(null);
    syncServiceMock.reset();
    ObjectDelta<ShadowType> delta = IntegrationTestTools.createEntitleDelta(ACCOUNT_WILL_OID, dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ENTITLEMENT_GROUP_NAME), GROUP_PIRATES_OID, prismContext);
    display("ObjectDelta", delta);
    delta.checkConsistence();
    // WHEN
    TestUtil.displayWhen(TEST_NAME);
    provisioningService.modifyObject(ShadowType.class, delta.getOid(), delta.getModifications(), new OperationProvisioningScriptsType(), null, task, result);
    // THEN
    TestUtil.displayThen(TEST_NAME);
    result.computeStatus();
    display("modifyObject result", result);
    TestUtil.assertSuccess(result);
    delta.checkConsistence();
    if (isAvoidDuplicateValues()) {
        assertDummyResourceGroupMembersReadCountIncrement(null, 1);
    } else {
        assertDummyResourceGroupMembersReadCountIncrement(null, 0);
    }
    DummyGroup group = getDummyGroupAssert(GROUP_PIRATES_NAME, piratesIcfUid);
    assertMember(group, transformNameToResource(ACCOUNT_WILL_USERNAME));
    syncServiceMock.assertNotifySuccessOnly();
    assertDummyResourceGroupMembersReadCountIncrement(null, 0);
    assertSteadyResource();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationProvisioningScriptsType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) DummyGroup(com.evolveum.icf.dummy.resource.DummyGroup) Test(org.testng.annotations.Test)

Example 38 with OperationProvisioningScriptsType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType in project midpoint by Evolveum.

the class TestDummy method test230DetitleAccountWillPirates.

@Test
public void test230DetitleAccountWillPirates() throws Exception {
    final String TEST_NAME = "test230DetitleAccountWillPirates";
    TestUtil.displayTestTile(TEST_NAME);
    Task task = createTask(TEST_NAME);
    OperationResult result = task.getResult();
    rememberDummyResourceGroupMembersReadCount(null);
    syncServiceMock.reset();
    ObjectDelta<ShadowType> delta = IntegrationTestTools.createDetitleDelta(ACCOUNT_WILL_OID, dummyResourceCtl.getAttributeQName(DummyResourceContoller.DUMMY_ENTITLEMENT_GROUP_NAME), GROUP_PIRATES_OID, prismContext);
    display("ObjectDelta", delta);
    delta.checkConsistence();
    // WHEN
    provisioningService.modifyObject(ShadowType.class, delta.getOid(), delta.getModifications(), new OperationProvisioningScriptsType(), null, task, result);
    // THEN
    result.computeStatus();
    display("modifyObject result", result);
    TestUtil.assertSuccess(result);
    delta.checkConsistence();
    if (isAvoidDuplicateValues()) {
        assertDummyResourceGroupMembersReadCountIncrement(null, 1);
    } else {
        assertDummyResourceGroupMembersReadCountIncrement(null, 0);
    }
    DummyGroup group = getDummyGroupAssert(GROUP_PIRATES_NAME, piratesIcfUid);
    assertNoMember(group, getWillRepoIcfName());
    // Make sure that account is still there and it has the privilege
    DummyAccount dummyAccount = getDummyAccountAssert(transformNameFromResource(ACCOUNT_WILL_USERNAME), willIcfUid);
    assertNotNull("Account will is gone!", dummyAccount);
    Set<String> accountProvileges = dummyAccount.getAttributeValues(DummyAccount.ATTR_PRIVILEGES_NAME, String.class);
    PrismAsserts.assertSets("Wrong account privileges", accountProvileges, PRIVILEGE_PILLAGE_NAME, PRIVILEGE_BARGAIN_NAME, PRIVILEGE_NONSENSE_NAME);
    assertDummyResourceGroupMembersReadCountIncrement(null, 0);
    // Make sure that privilege object is still there
    DummyPrivilege priv = getDummyPrivilegeAssert(PRIVILEGE_PILLAGE_NAME, pillageIcfUid);
    assertNotNull("Privilege object is gone!", priv);
    DummyPrivilege priv2 = getDummyPrivilegeAssert(PRIVILEGE_BARGAIN_NAME, bargainIcfUid);
    assertNotNull("Privilege object (bargain) is gone!", priv2);
    assertDummyResourceGroupMembersReadCountIncrement(null, 0);
    syncServiceMock.assertNotifySuccessOnly();
    PrismObject<ShadowType> shadow = provisioningService.getObject(ShadowType.class, ACCOUNT_WILL_OID, null, task, result);
    display("Shadow after", shadow);
    assertEntitlementPriv(shadow, PRIVILEGE_PILLAGE_OID);
    assertEntitlementPriv(shadow, PRIVILEGE_BARGAIN_OID);
    assertSteadyResource();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationProvisioningScriptsType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) DummyPrivilege(com.evolveum.icf.dummy.resource.DummyPrivilege) DummyAccount(com.evolveum.icf.dummy.resource.DummyAccount) DummyGroup(com.evolveum.icf.dummy.resource.DummyGroup) Test(org.testng.annotations.Test)

Example 39 with OperationProvisioningScriptsType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType in project midpoint by Evolveum.

the class TestDummy method test300AccountRename.

@Test
public void test300AccountRename() throws Exception {
    final String TEST_NAME = "test300AccountRename";
    TestUtil.displayTestTile(TEST_NAME);
    Task task = createTask(TEST_NAME);
    OperationResult result = task.getResult();
    syncServiceMock.reset();
    ObjectDelta<ShadowType> delta = ObjectDelta.createModificationReplaceProperty(ShadowType.class, ACCOUNT_MORGAN_OID, SchemaTestConstants.ICFS_NAME_PATH, prismContext, "cptmorgan");
    provisioningService.applyDefinition(delta, task, result);
    display("ObjectDelta", delta);
    delta.checkConsistence();
    // WHEN
    provisioningService.modifyObject(ShadowType.class, delta.getOid(), delta.getModifications(), new OperationProvisioningScriptsType(), null, task, result);
    // THEN
    result.computeStatus();
    display("modifyObject result", result);
    TestUtil.assertSuccess(result);
    delta.checkConsistence();
    PrismObject<ShadowType> account = provisioningService.getObject(ShadowType.class, ACCOUNT_MORGAN_OID, null, task, result);
    Collection<ResourceAttribute<?>> identifiers = ShadowUtil.getPrimaryIdentifiers(account);
    assertNotNull("Identifiers must not be null", identifiers);
    assertEquals("Expected one identifier", 1, identifiers.size());
    ResourceAttribute<?> identifier = identifiers.iterator().next();
    String shadowUuid = "cptmorgan";
    assertDummyAccountAttributeValues(shadowUuid, morganIcfUid, DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, "Captain Morgan");
    PrismObject<ShadowType> repoShadow = repositoryService.getObject(ShadowType.class, ACCOUNT_MORGAN_OID, null, result);
    assertAccountShadowRepo(repoShadow, ACCOUNT_MORGAN_OID, "cptmorgan", resourceType);
    if (!isIcfNameUidSame()) {
        shadowUuid = (String) identifier.getRealValue();
    }
    PrismAsserts.assertPropertyValue(repoShadow, SchemaTestConstants.ICFS_UID_PATH, shadowUuid);
    syncServiceMock.assertNotifySuccessOnly();
    assertSteadyResource();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationProvisioningScriptsType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) ResourceAttribute(com.evolveum.midpoint.schema.processor.ResourceAttribute) Test(org.testng.annotations.Test)

Example 40 with OperationProvisioningScriptsType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType in project midpoint by Evolveum.

the class TestDummy method test124ModifyObjectAddPirate.

@Test
public void test124ModifyObjectAddPirate() throws Exception {
    TestUtil.displayTestTile("test124ModifyObjectAddPirate");
    Task syncTask = taskManager.createTaskInstance(TestDummy.class.getName() + ".test124ModifyObjectAddPirate");
    OperationResult result = new OperationResult(TestOpenDj.class.getName() + ".test124ModifyObjectAddPirate");
    syncServiceMock.reset();
    ObjectDelta<ShadowType> delta = ObjectDelta.createModificationAddProperty(ShadowType.class, ACCOUNT_WILL_OID, dummyResourceCtl.getAttributePath(DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME), prismContext, "Pirate");
    display("ObjectDelta", delta);
    delta.checkConsistence();
    // WHEN
    provisioningService.modifyObject(ShadowType.class, delta.getOid(), delta.getModifications(), new OperationProvisioningScriptsType(), null, syncTask, result);
    // THEN
    result.computeStatus();
    display("modifyObject result", result);
    TestUtil.assertSuccess(result);
    delta.checkConsistence();
    // check if attribute was changed
    assertDummyAccountAttributeValues(transformNameFromResource(ACCOUNT_WILL_USERNAME), willIcfUid, DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, "Pirate");
    syncServiceMock.assertNotifySuccessOnly();
    assertSteadyResource();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) OperationProvisioningScriptsType(com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType) ShadowType(com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Test(org.testng.annotations.Test)

Aggregations

OperationResult (com.evolveum.midpoint.schema.result.OperationResult)45 Task (com.evolveum.midpoint.task.api.Task)44 OperationProvisioningScriptsType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType)44 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)43 Test (org.testng.annotations.Test)42 DummyAccount (com.evolveum.icf.dummy.resource.DummyAccount)26 DummyGroup (com.evolveum.icf.dummy.resource.DummyGroup)11 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)8 DummyPrivilege (com.evolveum.icf.dummy.resource.DummyPrivilege)5 ProvisioningScriptSpec (com.evolveum.midpoint.test.ProvisioningScriptSpec)4 PropertyDelta (com.evolveum.midpoint.prism.delta.PropertyDelta)3 SecurityViolationException (com.evolveum.midpoint.util.exception.SecurityViolationException)2 Date (java.util.Date)2 PrismObjectDefinition (com.evolveum.midpoint.prism.PrismObjectDefinition)1 GenericFrameworkException (com.evolveum.midpoint.provisioning.ucf.api.GenericFrameworkException)1 ResourceAttribute (com.evolveum.midpoint.schema.processor.ResourceAttribute)1 CommunicationException (com.evolveum.midpoint.util.exception.CommunicationException)1 ConfigurationException (com.evolveum.midpoint.util.exception.ConfigurationException)1 ExpressionEvaluationException (com.evolveum.midpoint.util.exception.ExpressionEvaluationException)1 ObjectNotFoundException (com.evolveum.midpoint.util.exception.ObjectNotFoundException)1