Skip to content

Commit

Permalink
Fixing and expanding the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Jan 13, 2017
1 parent 32ded14 commit 624bca3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
Expand Up @@ -34,6 +34,7 @@
import com.evolveum.icf.dummy.resource.BreakMode;
import com.evolveum.icf.dummy.resource.DummyAccount;
import com.evolveum.icf.dummy.resource.DummyResource;
import com.evolveum.midpoint.model.api.ModelExecuteOptions;
import com.evolveum.midpoint.model.api.PolicyViolationException;
import com.evolveum.midpoint.model.impl.trigger.RecomputeTriggerHandler;
import com.evolveum.midpoint.prism.PrismObject;
Expand All @@ -47,6 +48,7 @@
import com.evolveum.midpoint.schema.constants.MidPointConstants;
import com.evolveum.midpoint.schema.result.OperationResult;
import com.evolveum.midpoint.schema.result.OperationResultStatus;
import com.evolveum.midpoint.schema.util.MiscSchemaUtil;
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.test.DummyResourceContoller;
import com.evolveum.midpoint.test.util.TestUtil;
Expand Down Expand Up @@ -1392,7 +1394,7 @@ public void test204DummyCrimsonReconcile() throws Exception {
* and nothing should be destroyed.
* MID-3661
*/
@Test(enabled=false) // MID-3661, legacy
@Test
public void test206DummyCrimsonReconcileIOError() throws Exception {
final String TEST_NAME = "test206DummyCrimsonReconcileIOError";
TestUtil.displayTestTile(this, TEST_NAME);
Expand Down Expand Up @@ -1455,7 +1457,11 @@ public void test210ModifyUserLocality() throws Exception {

// WHEN
TestUtil.displayWhen(TEST_NAME);
modifyUserReplace(USER_GUYBRUSH_OID, UserType.F_LOCALITY, task, result, PrismTestUtil.createPolyString("Scabb Island"));
ObjectDelta<UserType> objectDelta = createModifyUserReplaceDelta(USER_GUYBRUSH_OID, new ItemPath(UserType.F_LOCALITY),
PrismTestUtil.createPolyString("Scabb Island"));
Collection<ObjectDelta<? extends ObjectType>> deltas = MiscSchemaUtil.createCollection(objectDelta);
ModelExecuteOptions options = ModelExecuteOptions.createReconcile();
modelService.executeChanges(deltas, options, task, result);

// THEN
TestUtil.displayThen(TEST_NAME);
Expand All @@ -1473,7 +1479,9 @@ public void test210ModifyUserLocality() throws Exception {
display("Dummy account after", dummyAccountAfter);
assertDummyAccountAttribute(RESOURCE_DUMMY_CRIMSON_NAME, ACCOUNT_GUYBRUSH_DUMMY_USERNAME,
DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_LOCATION_NAME, "Scabb Island");
// TODO: assert drink
assertDummyAccountAttribute(RESOURCE_DUMMY_CRIMSON_NAME, ACCOUNT_GUYBRUSH_DUMMY_USERNAME,
DummyResourceContoller.DUMMY_ACCOUNT_ATTRIBUTE_DRINK_NAME,
"vodka", "whisky", "rum from Scabb Island");

}

Expand Down
Expand Up @@ -2988,15 +2988,11 @@ protected void assertPasswordMetadata(PrismObject<UserType> user, boolean create
protected void reconcileUser(String oid, Task task, OperationResult result) throws CommunicationException, ObjectAlreadyExistsException, ExpressionEvaluationException, PolicyViolationException, SchemaException, SecurityViolationException, ConfigurationException, ObjectNotFoundException {
ObjectDelta<UserType> emptyDelta = ObjectDelta.createEmptyModifyDelta(UserType.class, oid, prismContext);
modelService.executeChanges(MiscSchemaUtil.createCollection(emptyDelta), ModelExecuteOptions.createReconcile(), task, result);
result.computeStatus();
TestUtil.assertSuccess(result);
}

protected void reconcileOrg(String oid, Task task, OperationResult result) throws CommunicationException, ObjectAlreadyExistsException, ExpressionEvaluationException, PolicyViolationException, SchemaException, SecurityViolationException, ConfigurationException, ObjectNotFoundException {
ObjectDelta<OrgType> emptyDelta = ObjectDelta.createEmptyModifyDelta(OrgType.class, oid, prismContext);
modelService.executeChanges(MiscSchemaUtil.createCollection(emptyDelta), ModelExecuteOptions.createReconcile(), task, result);
result.computeStatus();
TestUtil.assertSuccess(result);
}

protected void assertRefEquals(String message, ObjectReferenceType expected, ObjectReferenceType actual) {
Expand Down

0 comments on commit 624bca3

Please sign in to comment.