Search in sources :

Example 36 with DummyGroup

use of com.evolveum.icf.dummy.resource.DummyGroup 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 37 with DummyGroup

use of com.evolveum.icf.dummy.resource.DummyGroup 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 38 with DummyGroup

use of com.evolveum.icf.dummy.resource.DummyGroup in project midpoint by Evolveum.

the class TestDummy method test224GetPillagingPirateWill.

/**
	 * Reads the will accounts, checks that both entitlements are there.
	 */
@Test
public void test224GetPillagingPirateWill() throws Exception {
    final String TEST_NAME = "test224GetPillagingPirateWill";
    TestUtil.displayTestTile(TEST_NAME);
    Task task = createTask(TEST_NAME);
    OperationResult result = task.getResult();
    rememberDummyResourceGroupMembersReadCount(null);
    syncServiceMock.reset();
    // WHEN
    PrismObject<ShadowType> account = provisioningService.getObject(ShadowType.class, ACCOUNT_WILL_OID, null, task, result);
    // THEN
    result.computeStatus();
    display("Account", account);
    display(result);
    TestUtil.assertSuccess(result);
    assertEntitlementGroup(account, GROUP_PIRATES_OID);
    assertEntitlementPriv(account, PRIVILEGE_PILLAGE_OID);
    assertEntitlementPriv(account, PRIVILEGE_BARGAIN_OID);
    assertDummyResourceGroupMembersReadCountIncrement(null, 0);
    // Just make sure nothing has changed
    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);
    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);
    DummyGroup group = getDummyGroupAssert(GROUP_PIRATES_NAME, piratesIcfUid);
    assertMember(group, transformNameToResource(ACCOUNT_WILL_USERNAME));
    assertDummyResourceGroupMembersReadCountIncrement(null, 0);
    assertSteadyResource();
}
Also used : Task(com.evolveum.midpoint.task.api.Task) 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)

Aggregations

DummyGroup (com.evolveum.icf.dummy.resource.DummyGroup)38 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)24 Task (com.evolveum.midpoint.task.api.Task)23 Test (org.testng.annotations.Test)23 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)20 DummyAccount (com.evolveum.icf.dummy.resource.DummyAccount)18 DummyPrivilege (com.evolveum.icf.dummy.resource.DummyPrivilege)16 OperationProvisioningScriptsType (com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType)11 SchemaViolationException (com.evolveum.icf.dummy.resource.SchemaViolationException)7 GuardedString (org.identityconnectors.common.security.GuardedString)7 ConflictException (com.evolveum.icf.dummy.resource.ConflictException)6 DummyOrg (com.evolveum.icf.dummy.resource.DummyOrg)6 ObjectAlreadyExistsException (com.evolveum.icf.dummy.resource.ObjectAlreadyExistsException)6 FileNotFoundException (java.io.FileNotFoundException)6 ConnectException (java.net.ConnectException)6 AlreadyExistsException (org.identityconnectors.framework.common.exceptions.AlreadyExistsException)6 ConnectionFailedException (org.identityconnectors.framework.common.exceptions.ConnectionFailedException)6 ConnectorIOException (org.identityconnectors.framework.common.exceptions.ConnectorIOException)6 InvalidAttributeValueException (org.identityconnectors.framework.common.exceptions.InvalidAttributeValueException)6 QName (javax.xml.namespace.QName)5