use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType in project midpoint by Evolveum.
the class TestDummy method test158DeleteValidToValidFrom.
@Test
public void test158DeleteValidToValidFrom() throws Exception {
final String TEST_NAME = "test158DeleteValidToValidFrom";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestDummy.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ShadowType accountType = provisioningService.getObject(ShadowType.class, ACCOUNT_WILL_OID, null, task, result).asObjectable();
assertNotNull(accountType);
display("Retrieved account shadow", accountType);
DummyAccount dummyAccount = getDummyAccountAssert(transformNameFromResource(ACCOUNT_WILL_USERNAME), willIcfUid);
assertTrue(dummyAccount.isEnabled());
syncServiceMock.reset();
// long millis = VALID_TO_MILLIS;
ObjectDelta<ShadowType> delta = ObjectDelta.createModificationDeleteProperty(ShadowType.class, ACCOUNT_WILL_OID, SchemaConstants.PATH_ACTIVATION_VALID_TO, prismContext, XmlTypeConverter.createXMLGregorianCalendar(VALID_TO_MILLIS));
PrismObjectDefinition<ShadowType> def = accountType.asPrismObject().getDefinition();
PropertyDelta<XMLGregorianCalendar> validFromDelta = PropertyDelta.createModificationDeleteProperty(SchemaConstants.PATH_ACTIVATION_VALID_FROM, def.findPropertyDefinition(SchemaConstants.PATH_ACTIVATION_VALID_FROM), XmlTypeConverter.createXMLGregorianCalendar(VALID_FROM_MILLIS));
delta.addModification(validFromDelta);
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();
// check if activation was changed
dummyAccount = getDummyAccountAssert(transformNameFromResource(ACCOUNT_WILL_USERNAME), willIcfUid);
assertNull("Unexpected account validTo in account " + transformNameFromResource(ACCOUNT_WILL_USERNAME) + ": " + dummyAccount.getValidTo(), dummyAccount.getValidTo());
assertNull("Unexpected account validFrom in account " + transformNameFromResource(ACCOUNT_WILL_USERNAME) + ": " + dummyAccount.getValidFrom(), dummyAccount.getValidFrom());
assertTrue("Dummy account " + transformNameFromResource(ACCOUNT_WILL_USERNAME) + " is disabled, expected enabled", dummyAccount.isEnabled());
syncServiceMock.assertNotifySuccessOnly();
assertSteadyResource();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType in project midpoint by Evolveum.
the class TestDummy method test152ActivationStatusUndefinedAccount.
@Test
public void test152ActivationStatusUndefinedAccount() throws Exception {
final String TEST_NAME = "test152ActivationStatusUndefinedAccount";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestDummy.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ShadowType accountType = provisioningService.getObject(ShadowType.class, ACCOUNT_WILL_OID, null, task, result).asObjectable();
assertNotNull(accountType);
display("Retrieved account shadow", accountType);
DummyAccount dummyAccount = getDummyAccountAssert(transformNameFromResource(ACCOUNT_WILL_USERNAME), willIcfUid);
assertFalse("Account is not disabled", dummyAccount.isEnabled());
syncServiceMock.reset();
ObjectDelta<ShadowType> delta = ObjectDelta.createModificationDeleteProperty(ShadowType.class, ACCOUNT_WILL_OID, SchemaConstants.PATH_ACTIVATION_ADMINISTRATIVE_STATUS, prismContext, ActivationStatusType.DISABLED);
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();
// check if activation was changed
dummyAccount = getDummyAccountAssert(transformNameFromResource(ACCOUNT_WILL_USERNAME), willIcfUid);
assertEquals("Wrong dummy account " + transformNameFromResource(ACCOUNT_WILL_USERNAME) + " enabled flag", null, dummyAccount.isEnabled());
syncServiceMock.assertNotifySuccessOnly();
assertSteadyResource();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType in project midpoint by Evolveum.
the class TestDummy method test134DeleteScript.
@Test
public void test134DeleteScript() throws Exception {
final String TEST_NAME = "test134DeleteScript";
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));
// WHEN
provisioningService.deleteObject(ShadowType.class, ACCOUNT_NEW_SCRIPT_OID, null, scriptsType, task, result);
// THEN
result.computeStatus();
display("modifyObject result", result);
TestUtil.assertSuccess("modifyObject has failed (result)", result);
syncServiceMock.assertNotifySuccessOnly();
// Check if the account was modified in the dummy resource
DummyAccount dummyAccount = getDummyAccount("william", williamIcfUid);
assertNull("Dummy account not gone", dummyAccount);
ProvisioningScriptSpec beforeScript = new ProvisioningScriptSpec("Goodbye World");
beforeScript.addArgMulti("what", "cruel");
ProvisioningScriptSpec afterScript = new ProvisioningScriptSpec("R.I.P.");
IntegrationTestTools.assertScripts(dummyResource.getScriptHistory(), beforeScript, afterScript);
assertSteadyResource();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType in project midpoint by Evolveum.
the class TestDummy method test157SetValidTo.
@Test
public void test157SetValidTo() throws Exception {
final String TEST_NAME = "test157SetValidTo";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestDummy.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
ShadowType accountType = provisioningService.getObject(ShadowType.class, ACCOUNT_WILL_OID, null, task, result).asObjectable();
assertNotNull(accountType);
display("Retrieved account shadow", accountType);
DummyAccount dummyAccount = getDummyAccountAssert(transformNameFromResource(ACCOUNT_WILL_USERNAME), willIcfUid);
assertTrue(dummyAccount.isEnabled());
syncServiceMock.reset();
long millis = VALID_TO_MILLIS;
ObjectDelta<ShadowType> delta = ObjectDelta.createModificationReplaceProperty(ShadowType.class, ACCOUNT_WILL_OID, SchemaConstants.PATH_ACTIVATION_VALID_TO, prismContext, XmlTypeConverter.createXMLGregorianCalendar(VALID_TO_MILLIS));
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();
// check if activation was changed
dummyAccount = getDummyAccountAssert(transformNameFromResource(ACCOUNT_WILL_USERNAME), willIcfUid);
assertEquals("Wrong account validFrom in account " + transformNameFromResource(ACCOUNT_WILL_USERNAME), new Date(VALID_FROM_MILLIS), dummyAccount.getValidFrom());
assertEquals("Wrong account validTo in account " + transformNameFromResource(ACCOUNT_WILL_USERNAME), new Date(VALID_TO_MILLIS), dummyAccount.getValidTo());
assertTrue("Dummy account " + transformNameFromResource(ACCOUNT_WILL_USERNAME) + " is disabled, expected enabled", dummyAccount.isEnabled());
syncServiceMock.assertNotifySuccessOnly();
assertSteadyResource();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType in project midpoint by Evolveum.
the class TestDummyCaseIgnore method test289DetitleAccountWillPirates.
@Test
public void test289DetitleAccountWillPirates() throws Exception {
final String TEST_NAME = "test289DetitleAccountWillPirates";
TestUtil.displayTestTile(TEST_NAME);
Task task = taskManager.createTaskInstance(TestDummy.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
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();
DummyGroup group = getDummyGroupAssert(GROUP_PIRATES_NAME, piratesIcfUid);
assertNoMember(group, getWillRepoIcfName());
assertNoMember(group, getWillRepoIcfName().toUpperCase());
assertNoMember(group, getWillRepoIcfName().toLowerCase());
// Make sure that account is still there and it has the privilege
DummyAccount dummyAccount = getDummyAccountAssert(ACCOUNT_WILL_USERNAME, willIcfUid);
assertNotNull("Account will is gone!", dummyAccount);
syncServiceMock.assertNotifySuccessOnly();
assertSteadyResource();
}
Aggregations