public void resetBreakMode() { setBreakMode(BreakMode.NONE); }
/** * Resets the blocking state, error simulation, etc. */ public void reset() { dummyResource.setBreakMode(BreakMode.NONE); dummyResource.setBlockOperations(false); dummyResource.unblockAll(); }
@Override public void postInitSystem(Task initTask, OperationResult initResult) throws Exception { super.postInitSystem(initTask, initResult); // Break it only after resource are reset in super.postInitSystem() getDummyResource(RESOURCE_DUMMY_UNACCESSIBLE_NAME).setBreakMode(BreakMode.NETWORK); }
/** * Attempt to refresh shadow with failed operation. Nothing should happen. */ @Test public void test179RefreshAccountMorganFailed() throws Exception { final String TEST_NAME = "test179RefreshAccountMorganFailed"; displayTestTitle(TEST_NAME); // GIVEN Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); clockForward("PT17M"); syncServiceMock.reset(); dummyResource.setBreakMode(BreakMode.NETWORK); PrismObject<ShadowType> shadowRepoBefore = getShadowRepo(shadowMorganOid); // WHEN displayWhen(TEST_NAME); provisioningService.refreshShadow(shadowRepoBefore, null, task, result); // THEN displayThen(TEST_NAME); display("Result", result); assertSuccess(result); syncServiceMock.assertNoNotifcations(); assertMorganDeleteFailed(); }
/** * Refresh while the resource is down. Retry interval is not yet reached. * Nothing should really happen yet. */ @Test public void test104RefreshAccountMorganCommunicationFailure() throws Exception { final String TEST_NAME = "test104RefreshAccountMorganCommunicationFailure"; displayTestTitle(TEST_NAME); // GIVEN Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); syncServiceMock.reset(); dummyResource.setBreakMode(BreakMode.NETWORK); PrismObject<ShadowType> shadowRepoBefore = getShadowRepo(ACCOUNT_MORGAN_OID); // WHEN displayWhen(TEST_NAME); provisioningService.refreshShadow(shadowRepoBefore, null, task, result); // THEN displayThen(TEST_NAME); display("Result", result); assertSuccess(result); syncServiceMock.assertNoNotifcations(); assertUncreatedMorgan(1); assertSteadyResources(); }
/** * Attempt to refresh dead shadow. Nothing should happen. */ @Test public void test109RefreshAccountMorganDead() throws Exception { final String TEST_NAME = "test109RefreshAccountMorganDead"; displayTestTitle(TEST_NAME); // GIVEN Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); clockForward("PT17M"); syncServiceMock.reset(); dummyResource.setBreakMode(BreakMode.NETWORK); PrismObject<ShadowType> shadowRepoBefore = getShadowRepo(ACCOUNT_MORGAN_OID); // WHEN displayWhen(TEST_NAME); provisioningService.refreshShadow(shadowRepoBefore, null, task, result); // THEN displayThen(TEST_NAME); display("Result", result); assertSuccess(result); syncServiceMock.assertNoNotifcations(); assertMorganDead(); }
/** * Attempt to refresh shadow with failed operation. Nothing should happen. */ @Test public void test129RefreshAccountMorganFailed() throws Exception { final String TEST_NAME = "test129RefreshAccountMorganFailed"; displayTestTitle(TEST_NAME); // GIVEN Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); clockForward("PT17M"); syncServiceMock.reset(); dummyResource.setBreakMode(BreakMode.NETWORK); PrismObject<ShadowType> shadowRepoBefore = getShadowRepo(shadowMorganOid); // WHEN displayWhen(TEST_NAME); provisioningService.refreshShadow(shadowRepoBefore, null, task, result); // THEN displayThen(TEST_NAME); display("Result", result); assertSuccess(result); syncServiceMock.assertNoNotifcations(); assertMorganModifyFailed(); }
/** * Refresh while the resource is down. Retry interval is not yet reached. * Nothing should really happen yet. */ @Test public void test124RefreshAccountMorganCommunicationFailure() throws Exception { final String TEST_NAME = "test124RefreshAccountMorganCommunicationFailure"; displayTestTitle(TEST_NAME); // GIVEN Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); syncServiceMock.reset(); dummyResource.setBreakMode(BreakMode.NETWORK); PrismObject<ShadowType> shadowRepoBefore = getShadowRepo(shadowMorganOid); // WHEN displayWhen(TEST_NAME); provisioningService.refreshShadow(shadowRepoBefore, null, task, result); // THEN displayThen(TEST_NAME); display("Result", result); assertSuccess(result); syncServiceMock.assertNoNotifcations(); assertUnmodifiedMorgan(1, 2, ACCOUNT_MORGAN_FULLNAME_HM); assertSteadyResources(); }
dummyResource.setBreakMode(BreakMode.NETWORK);
/** * Refresh while the resource is down. Retry interval is not yet reached. * Nothing should really happen yet. */ @Test public void test174RefreshAccountMorganCommunicationFailure() throws Exception { final String TEST_NAME = "test174RefreshAccountMorganCommunicationFailure"; displayTestTitle(TEST_NAME); // GIVEN Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); syncServiceMock.reset(); dummyResource.setBreakMode(BreakMode.NETWORK); PrismObject<ShadowType> shadowRepoBefore = getShadowRepo(shadowMorganOid); // WHEN displayWhen(TEST_NAME); provisioningService.refreshShadow(shadowRepoBefore, null, task, result); // THEN displayThen(TEST_NAME); display("Result", result); assertSuccess(result); syncServiceMock.assertNoNotifcations(); assertUndeletedMorgan(1, 4); assertSteadyResources(); }
syncServiceMock.reset(); dummyResource.setBreakMode(BreakMode.NETWORK);
dummyResource.setBreakMode(BreakMode.NETWORK);
dummyResource.setBreakMode(BreakMode.NETWORK);
dummyResource.setBreakMode(BreakMode.NETWORK);
dummyResource.setBreakMode(BreakMode.NETWORK);
syncServiceMock.reset(); dummyResource.setBreakMode(BreakMode.NETWORK); lastRequestStartTs = lastAttemptStartTs = clock.currentTimeXMLGregorianCalendar();
@Test public void test170DeleteMorganCommunicationFailure() throws Exception { final String TEST_NAME = "test170DeleteMorganCommunicationFailure"; displayTestTitle(TEST_NAME); Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); syncServiceMock.reset(); dummyResource.setBreakMode(BreakMode.NETWORK); lastRequestStartTs = lastAttemptStartTs = clock.currentTimeXMLGregorianCalendar(); ObjectDelta<ShadowType> delta = prismContext.deltaFactory().object().createModificationReplaceProperty(ShadowType.class, shadowMorganOid, dummyResourceCtl.getAttributeFullnamePath(), ACCOUNT_MORGAN_FULLNAME_HM); display("ObjectDelta", delta); // WHEN displayWhen(TEST_NAME); provisioningService.deleteObject(ShadowType.class, shadowMorganOid, null, null, task, result); // THEN displayThen(TEST_NAME); assertInProgress(result); lastRequestEndTs = lastAttemptEndTs = clock.currentTimeXMLGregorianCalendar(); syncServiceMock.assertNotifyInProgressOnly(); assertUndeletedMorgan(1, 4); // Resource -> down assertResourceStatusChangeCounterIncrements(); assertSteadyResources(); }
@Test public void test130ModifyMorganFullNameAgainCommunicationFailure() throws Exception { final String TEST_NAME = "test130ModifyMorganFullNameAgainCommunicationFailure"; displayTestTitle(TEST_NAME); Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); syncServiceMock.reset(); dummyResource.setBreakMode(BreakMode.NETWORK); lastRequestStartTs = lastAttemptStartTs = clock.currentTimeXMLGregorianCalendar(); ObjectDelta<ShadowType> delta = prismContext.deltaFactory().object().createModificationReplaceProperty(ShadowType.class, shadowMorganOid, dummyResourceCtl.getAttributeFullnamePath(), ACCOUNT_MORGAN_FULLNAME_CHM); display("ObjectDelta", delta); // WHEN displayWhen(TEST_NAME); provisioningService.modifyObject(ShadowType.class, delta.getOid(), delta.getModifications(), null, null, task, result); // THEN displayThen(TEST_NAME); assertInProgress(result); lastRequestEndTs = lastAttemptEndTs = clock.currentTimeXMLGregorianCalendar(); syncServiceMock.assertNotifyInProgressOnly(); assertUnmodifiedMorgan(1, 3, ACCOUNT_MORGAN_FULLNAME_CHM); assertSteadyResources(); }
@Test public void test120ModifyMorganFullNameCommunicationFailure() throws Exception { final String TEST_NAME = "test120ModifyMorganFullNameCommunicationFailure"; displayTestTitle(TEST_NAME); Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); syncServiceMock.reset(); dummyResource.setBreakMode(BreakMode.NETWORK); lastRequestStartTs = lastAttemptStartTs = clock.currentTimeXMLGregorianCalendar(); ObjectDelta<ShadowType> delta = prismContext.deltaFactory().object().createModificationReplaceProperty(ShadowType.class, shadowMorganOid, dummyResourceCtl.getAttributeFullnamePath(), ACCOUNT_MORGAN_FULLNAME_HM); display("ObjectDelta", delta); // WHEN displayWhen(TEST_NAME); provisioningService.modifyObject(ShadowType.class, delta.getOid(), delta.getModifications(), null, null, task, result); // THEN displayThen(TEST_NAME); assertInProgress(result); lastRequestEndTs = lastAttemptEndTs = clock.currentTimeXMLGregorianCalendar(); syncServiceMock.assertNotifyInProgressOnly(); assertUnmodifiedMorgan(1, 2, ACCOUNT_MORGAN_FULLNAME_HM); // Resource -> down assertResourceStatusChangeCounterIncrements(); assertSteadyResources(); }
public void testUserSharptoothChangePasswordError(final String TEST_NAME, BreakMode breakMode, String oldPassword, String newPassword, OperationResultStatus expectedResultStatus) throws Exception { displayTestTitle(TEST_NAME); // GIVEN Task task = createTask(TEST_NAME); OperationResult result = task.getResult(); assumeAssignmentPolicy(AssignmentPolicyEnforcementType.FULL); getDummyResource().setBreakMode(breakMode); dummyAuditService.clear(); // WHEN displayWhen(TEST_NAME); modifyUserChangePassword(userSharptoothOid, newPassword, task, result); // THEN displayThen(TEST_NAME); result.computeStatus(); TestUtil.assertStatus(result, expectedResultStatus); getDummyResource().resetBreakMode(); PrismObject<UserType> userAfter = getUser(userSharptoothOid); display("User afte", userAfter); assertEncryptedUserPassword(userAfter, newPassword); assertDummyAccount(null, USER_SHARPTOOTH_NAME, USER_SHARPTOOTH_FULLNAME, true); assertDummyPassword(null, USER_SHARPTOOTH_NAME, oldPassword); }