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();
}
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();
}
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();
}
Aggregations