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