use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType in project midpoint by Evolveum.
the class TestDummyNoActivation method test162UnlockAccount.
@Test
@Override
public void test162UnlockAccount() throws Exception {
final String TEST_NAME = "test162UnlockAccount";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestDummy.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
syncServiceMock.reset();
ObjectDelta<ShadowType> delta = ObjectDelta.createModificationReplaceProperty(ShadowType.class, ACCOUNT_WILL_OID, SchemaConstants.PATH_ACTIVATION_LOCKOUT_STATUS, prismContext, LockoutStatusType.NORMAL);
display("ObjectDelta", delta);
delta.checkConsistence();
try {
// WHEN
provisioningService.modifyObject(ShadowType.class, delta.getOid(), delta.getModifications(), new OperationProvisioningScriptsType(), null, task, result);
AssertJUnit.fail("Unexpected success");
} catch (SchemaException e) {
// This is expected
}
// THEN
TestUtil.displayThen(TEST_NAME);
result.computeStatus();
display("modifyObject result", result);
TestUtil.assertFailure(result);
delta.checkConsistence();
syncServiceMock.assertNotifyFailureOnly();
assertSteadyResource();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType in project midpoint by Evolveum.
the class TestDummyNoActivation method test157SetValidTo.
@Test
@Override
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();
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();
try {
// WHEN
provisioningService.modifyObject(ShadowType.class, delta.getOid(), delta.getModifications(), new OperationProvisioningScriptsType(), null, task, result);
AssertJUnit.fail("Unexpected success");
} catch (SchemaException e) {
// This is expected
}
// THEN
result.computeStatus();
display("modifyObject result", result);
TestUtil.assertFailure(result);
delta.checkConsistence();
// check if activation was changed
DummyAccount dummyAccount = dummyResource.getAccountByUsername(ACCOUNT_WILL_USERNAME);
assertTrue("Dummy account " + ACCOUNT_WILL_USERNAME + " is disabled, expected enabled", dummyAccount.isEnabled());
assertNull("Unexpected account validFrom in account " + ACCOUNT_WILL_USERNAME + ": " + dummyAccount.getValidFrom(), dummyAccount.getValidFrom());
assertNull("Unexpected account validTo in account " + ACCOUNT_WILL_USERNAME + ": " + dummyAccount.getValidTo(), dummyAccount.getValidTo());
syncServiceMock.assertNotifyFailureOnly();
assertSteadyResource();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType in project midpoint by Evolveum.
the class TestDummyNoActivation method test154EnableAccount.
@Test
@Override
public void test154EnableAccount() throws Exception {
final String TEST_NAME = "test154EnableAccount";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
Task task = taskManager.createTaskInstance(TestDummy.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
syncServiceMock.reset();
ObjectDelta<ShadowType> delta = ObjectDelta.createModificationReplaceProperty(ShadowType.class, ACCOUNT_WILL_OID, SchemaConstants.PATH_ACTIVATION_ADMINISTRATIVE_STATUS, prismContext, ActivationStatusType.ENABLED);
display("ObjectDelta", delta);
delta.checkConsistence();
try {
// WHEN
provisioningService.modifyObject(ShadowType.class, delta.getOid(), delta.getModifications(), new OperationProvisioningScriptsType(), null, task, result);
AssertJUnit.fail("Unexpected success");
} catch (SchemaException e) {
// This is expected
}
// THEN
result.computeStatus();
display("modifyObject result", result);
TestUtil.assertFailure(result);
delta.checkConsistence();
// check if activation was unchanged
DummyAccount dummyAccount = dummyResource.getAccountByUsername(ACCOUNT_WILL_USERNAME);
assertTrue("Dummy account " + ACCOUNT_WILL_USERNAME + " is disabled, expected enabled", dummyAccount.isEnabled());
syncServiceMock.assertNotifyFailureOnly();
assertSteadyResource();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType in project midpoint by Evolveum.
the class TestDummyPrioritiesAndReadReplace method test123ModifyObjectReplace.
@Test
public void test123ModifyObjectReplace() throws Exception {
final String TEST_NAME = "test123ModifyObjectReplace";
TestUtil.displayTestTile(TEST_NAME);
Task task = taskManager.createTaskInstance(TestDummyPrioritiesAndReadReplace.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
syncServiceMock.reset();
// todo add correct definition
ObjectDelta<ShadowType> objectDelta = ObjectDelta.createModificationReplaceProperty(ShadowType.class, ACCOUNT_WILL_OID, dummyResourceCtl.getAttributeFullnamePath(), prismContext, "Pirate Master Will Turner");
PropertyDelta weaponDelta = objectDelta.createPropertyModification(dummyResourceCtl.getAttributeWeaponPath());
weaponDelta.setDefinition(getAttributeDefinition(resourceType, ShadowKindType.ACCOUNT, null, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_WEAPON_NAME));
weaponDelta.setValuesToReplace(new PrismPropertyValue<>("Gun"));
objectDelta.addModification(weaponDelta);
PropertyDelta lootDelta = objectDelta.createPropertyModification(dummyResourceCtl.getAttributeLootPath());
lootDelta.setDefinition(getAttributeDefinition(resourceType, ShadowKindType.ACCOUNT, null, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOOT_NAME));
lootDelta.setValuesToReplace(new PrismPropertyValue<>(43));
objectDelta.addModification(lootDelta);
PropertyDelta titleDelta = objectDelta.createPropertyModification(dummyResourceCtl.getAttributePath(DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME));
titleDelta.setDefinition(getAttributeDefinition(resourceType, ShadowKindType.ACCOUNT, null, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME));
titleDelta.setValuesToReplace(new PrismPropertyValue<>("Pirate Master"));
objectDelta.addModification(titleDelta);
display("ObjectDelta", objectDelta);
objectDelta.checkConsistence();
// WHEN
provisioningService.modifyObject(ShadowType.class, objectDelta.getOid(), objectDelta.getModifications(), new OperationProvisioningScriptsType(), null, task, result);
// THEN
result.computeStatus();
display("modifyObject result", result);
TestUtil.assertSuccess(result);
objectDelta.checkConsistence();
assertDummyAccountAttributeValues(ACCOUNT_WILL_USERNAME, willIcfUid, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, "Pirate Master Will Turner");
assertDummyAccountAttributeValues(ACCOUNT_WILL_USERNAME, willIcfUid, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME, "Pirate Master");
assertDummyAccountAttributeValues(ACCOUNT_WILL_USERNAME, willIcfUid, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOOT_NAME, 43);
assertDummyAccountAttributeValues(ACCOUNT_WILL_USERNAME, willIcfUid, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_WEAPON_NAME, "Gun");
// BEWARE: very brittle!
List<OperationResult> updatesExecuted = TestUtil.selectSubresults(result, ProvisioningTestUtil.CONNID_CONNECTOR_FACADE_CLASS_NAME + ".update");
assertEquals("Wrong number of updates executed", 3, updatesExecuted.size());
checkAttributesUpdated(updatesExecuted.get(0), "update", DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_WEAPON_NAME);
checkAttributesUpdated(updatesExecuted.get(1), "update", DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOOT_NAME);
checkAttributesUpdated(updatesExecuted.get(2), "update", DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_FULLNAME_NAME, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_TITLE_NAME);
syncServiceMock.assertNotifySuccessOnly();
//assertSteadyResource();
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.OperationProvisioningScriptsType in project midpoint by Evolveum.
the class TestDummySecurity method test200ModifyAccountDrink.
@Test
public void test200ModifyAccountDrink() throws Exception {
final String TEST_NAME = "test200ModifyAccountDrink";
TestUtil.displayTestTile(TEST_NAME);
Task task = taskManager.createTaskInstance(TestDummy.class.getName() + "." + TEST_NAME);
OperationResult result = task.getResult();
syncServiceMock.reset();
ObjectDelta<ShadowType> delta = ObjectDelta.createModificationReplaceProperty(ShadowType.class, ACCOUNT_WILL_OID, dummyResourceCtl.getAttributePath(DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME), prismContext, "RUM");
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();
assertDummyAccountAttributeValues(ACCOUNT_WILL_USERNAME, willIcfUid, DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME, "RUM");
syncServiceMock.assertNotifySuccessOnly();
}
Aggregations