Skip to content

Commit

Permalink
Consistency update: fixing provisioning tests (MID-3603)
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Aug 7, 2018
1 parent 1686257 commit 175f866
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 37 deletions.
Expand Up @@ -816,7 +816,7 @@ private <F extends ObjectType> void updateSituationInShadow(Task task,
// result.recordSuccess();
// return;
// }
LOGGER.trace("Updating synchronization situation {} -> {}", currentSynchronizationSituation, newSituation);
// LOGGER.trace("Updating synchronization situation {} -> {}", currentSynchronizationSituation, newSituation);

XMLGregorianCalendar now = clock.currentTimeXMLGregorianCalendar();
List<PropertyDelta<?>> syncSituationDeltas = SynchronizationUtils
Expand Down
Expand Up @@ -181,7 +181,8 @@ public void test190DeleteWill() throws Exception {
.delta()
.assertDelete();

assertProvisioningNotFound(ACCOUNT_WILL_OID);
assertShadowProvisioning(ACCOUNT_WILL_OID)
.assertTombstone();

assertSteadyResource();
}
Expand Down Expand Up @@ -376,10 +377,10 @@ public void test209ParallelDelete() throws Exception {
successCounter.assertCount("Wrong number of successful operations", 1);

assertRepoShadow(accountMorganOid)
.assertDead()
.assertIsNotExists();
.assertTombstone();

assertProvisioningNotFound(accountMorganOid);
assertShadowProvisioning(accountMorganOid)
.assertTombstone();

assertDummyResourceWriteOperationCountIncrement(null, 1);

Expand Down Expand Up @@ -589,10 +590,10 @@ public void test229ParallelDeleteSlow() throws Exception {
successCounter.assertCount("Wrong number of successful operations", 1);

assertRepoShadow(accountElizabethOid)
.assertDead()
.assertIsNotExists();
.assertTombstone();

assertProvisioningNotFound(accountElizabethOid);
assertShadowProvisioning(accountElizabethOid)
.assertTombstone();

assertDummyResourceWriteOperationCountIncrement(null, 1);

Expand Down
Expand Up @@ -631,9 +631,11 @@ public void test109GetAccountWillFutureNoFetch() throws Exception {
assertShadowName(shadowProvisioningFuture, ACCOUNT_WILL_USERNAME);
assertEquals("Wrong kind (provisioning)", ShadowKindType.ACCOUNT, shadowTypeProvisioning.getKind());
assertAttribute(shadowProvisioningFuture, ATTR_USERNAME_QNAME, ACCOUNT_WILL_USERNAME);
assertAttributeFromCache(shadowProvisioningFuture, ATTR_FULLNAME_QNAME, ACCOUNT_WILL_FULLNAME);
// Both manual and semimanual resource can see fullname at this point.
// As there is no object in the CSV (no resourceShadow) the pending ADD delta will be used.
assertAttribute(shadowProvisioningFuture, ATTR_FULLNAME_QNAME, ACCOUNT_WILL_FULLNAME);
assertNoAttribute(shadowProvisioningFuture, ATTR_DESCRIPTION_QNAME);
assertShadowActivationAdministrativeStatusFromCache(shadowProvisioningFuture, ActivationStatusType.ENABLED);
assertShadowActivationAdministrativeStatus(shadowProvisioningFuture, ActivationStatusType.ENABLED);
assertShadowExists(shadowProvisioningFuture, true);
// TODO
// assertShadowPassword(shadowProvisioningFuture);
Expand Down
Expand Up @@ -95,6 +95,7 @@
import com.evolveum.midpoint.task.api.Task;
import com.evolveum.midpoint.task.api.TaskManager;
import com.evolveum.midpoint.test.IntegrationTestTools;
import com.evolveum.midpoint.test.asserter.ShadowAsserter;
import com.evolveum.midpoint.test.ldap.OpenDJController;
import com.evolveum.midpoint.test.util.MidPointAsserts;
import com.evolveum.midpoint.test.util.TestUtil;
Expand Down Expand Up @@ -797,39 +798,32 @@ public void test111GetObjectNotFoundRepo() throws Exception {
@Test
public void test112GetObjectNotFoundResource() throws Exception {
final String TEST_NAME = "test112GetObjectNotFoundResource";
TestUtil.displayTestTitle(TEST_NAME);
displayTestTitle(TEST_NAME);

Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();

try {
ObjectType object = provisioningService.getObject(ObjectType.class, ACCOUNT_BAD_OID, null, task, result).asObjectable();
Assert.fail("Expected exception, but haven't got one");
} catch (ObjectNotFoundException e) {
// This is expected

// Just to close the top-level result.
result.recordFatalError("Error :-)");
// WHEN
displayWhen(TEST_NAME);
PrismObject<ShadowType> shadow = provisioningService.getObject(ShadowType.class, ACCOUNT_BAD_OID, null, task, result);

System.out.println("NOT FOUND RESOURCE result:");
System.out.println(result.debugDump());
// THEN
displayWhen(TEST_NAME);

ShadowAsserter.forShadow(shadow, "provisioning")
.assertTombstone();
}

@Test
public void test119Cleanup() throws Exception {
final String TEST_NAME = "test119Cleanup";
displayTestTitle(TEST_NAME);

assertFalse(result.hasUnknownStatus());
// TODO: check result
} catch (CommunicationException e) {
Assert.fail("Expected ObjectNotFoundException, but got" + e);
} catch (SchemaException e) {
Assert.fail("Expected ObjectNotFoundException, but got" + e);
} finally {
try {
repositoryService.deleteObject(ShadowType.class, ACCOUNT_JBOND_OID, result);
} catch (Exception ex) {
}
try {
repositoryService.deleteObject(ShadowType.class, ACCOUNT_BAD_OID, result);
} catch (Exception ex) {
}
}
Task task = createTask(TEST_NAME);
OperationResult result = task.getResult();

repositoryService.deleteObject(ShadowType.class, ACCOUNT_BAD_OID, result);
repositoryService.deleteObject(ShadowType.class, ACCOUNT_JBOND_OID, result);

assertShadows(0 + getNumberOfBaseContextShadows());
}
Expand Down

0 comments on commit 175f866

Please sign in to comment.