@Test public void test020AssignAccountToJackSync() throws Exception { final String TEST_NAME = "test020AssignAccountToJackSync"; TestUtil.displayTestTile(this, TEST_NAME); try { Task task = taskManager.createTaskInstance(TestClockwork.class.getName() + "." + TEST_NAME); OperationResult result = task.getResult(); LensContext<UserType> context = createJackAssignAccountContext(result); display("Input context", context); assertFocusModificationSanity(context); mockClockworkHook.reset(); mockClockworkHook.setRecord(true); rememberCounter(InternalCounters.SHADOW_FETCH_OPERATION_COUNT); displayWhen(TEST_NAME); clockwork.run(context, task, result); displayThen(TEST_NAME); mockClockworkHook.setRecord(false); display("Output context", context); display("Hook contexts", mockClockworkHook); assertCounterIncrement(InternalCounters.SHADOW_FETCH_OPERATION_COUNT, 0); assertJackAssignAccountContext(context); assertJackAccountShadow(context); List<LensContext<?>> hookContexts = mockClockworkHook.getContexts(); assertFalse("No contexts recorded by the hook", hookContexts.isEmpty()); } finally { displayCleanup(TEST_NAME); mockClockworkHook.reset(); unassignJackAccount(); assertNoDummyAccount(ACCOUNT_JACK_DUMMY_USERNAME); } }
public <F extends ObjectType> HookOperationMode run(LensContext<F> context, Task task, OperationResult result) throws SchemaException, PolicyViolationException, ExpressionEvaluationException, ObjectNotFoundException, ObjectAlreadyExistsException, CommunicationException, ConfigurationException, SecurityViolationException { LOGGER.trace("Running clockwork for context {}", context); if (InternalsConfig.consistencyChecks) { context.checkConsistence(); } int clicked = 0; boolean focusConflictPresent = false; HookOperationMode finalMode; try { context.reportProgress(new ProgressInformation(CLOCKWORK, ENTERING)); if (context.getFocusContext() != null && context.getFocusContext().getOid() != null) { context.createAndRegisterConflictWatcher(context.getFocusContext().getOid(), repositoryService); } FocusConstraintsChecker.enterCache(); enterAssociationSearchExpressionEvaluatorCache(); provisioningService.enterConstraintsCheckerCache(); while (context.getState() != ModelState.FINAL) { int maxClicks = getMaxClicks(context, result); if (clicked >= maxClicks) { throw new IllegalStateException("Model operation took too many clicks (limit is " + maxClicks + "). Is there a cycle?"); } clicked++; HookOperationMode mode = click(context, task, result); if (mode == HookOperationMode.BACKGROUND) { result.recordInProgress(); return mode; } else if (mode == HookOperationMode.ERROR) { return mode; } } finalMode = click(context, task, result); if (finalMode == HookOperationMode.FOREGROUND) { focusConflictPresent = checkFocusConflicts(context, task, result); } } finally { context.unregisterConflictWatchers(repositoryService); FocusConstraintsChecker.exitCache(); exitAssociationSearchExpressionEvaluatorCache(); provisioningService.exitConstraintsCheckerCache(); context.reportProgress(new ProgressInformation(CLOCKWORK, EXITING)); } if (focusConflictPresent) { assert finalMode == HookOperationMode.FOREGROUND; finalMode = resolveFocusConflict(context, task, result); } else if (context.getConflictResolutionAttemptNumber() > 0) { LOGGER.info("Resolved update conflict on attempt number {}", context.getConflictResolutionAttemptNumber()); } return finalMode; }
Clockwork { public <F extends ObjectType> HookOperationMode run(LensContext<F> context, Task task, OperationResult result) throws SchemaException, PolicyViolationException, ExpressionEvaluationException, ObjectNotFoundException, ObjectAlreadyExistsException, CommunicationException, ConfigurationException, SecurityViolationException { LOGGER.trace("Running clockwork for context {}", context); if (InternalsConfig.consistencyChecks) { context.checkConsistence(); } int clicked = 0; boolean focusConflictPresent = false; HookOperationMode finalMode; try { context.reportProgress(new ProgressInformation(CLOCKWORK, ENTERING)); if (context.getFocusContext() != null && context.getFocusContext().getOid() != null) { context.createAndRegisterConflictWatcher(context.getFocusContext().getOid(), repositoryService); } FocusConstraintsChecker.enterCache(); enterAssociationSearchExpressionEvaluatorCache(); provisioningService.enterConstraintsCheckerCache(); while (context.getState() != ModelState.FINAL) { int maxClicks = getMaxClicks(context, result); if (clicked >= maxClicks) { throw new IllegalStateException("Model operation took too many clicks (limit is " + maxClicks + "). Is there a cycle?"); } clicked++; HookOperationMode mode = click(context, task, result); if (mode == HookOperationMode.BACKGROUND) { result.recordInProgress(); return mode; } else if (mode == HookOperationMode.ERROR) { return mode; } } finalMode = click(context, task, result); if (finalMode == HookOperationMode.FOREGROUND) { focusConflictPresent = checkFocusConflicts(context, task, result); } } finally { context.unregisterConflictWatchers(repositoryService); FocusConstraintsChecker.exitCache(); exitAssociationSearchExpressionEvaluatorCache(); provisioningService.exitConstraintsCheckerCache(); context.reportProgress(new ProgressInformation(CLOCKWORK, EXITING)); } if (focusConflictPresent) { assert finalMode == HookOperationMode.FOREGROUND; finalMode = resolveFocusConflict(context, task, result); } else if (context.getConflictResolutionAttemptNumber() > 0) { LOGGER.info("Resolved update conflict on attempt number {}", context.getConflictResolutionAttemptNumber()); } return finalMode; } }
Clockwork { public <F extends ObjectType> HookOperationMode run(LensContext<F> context, Task task, OperationResult result) throws SchemaException, PolicyViolationException, ExpressionEvaluationException, ObjectNotFoundException, ObjectAlreadyExistsException, CommunicationException, ConfigurationException, SecurityViolationException { LOGGER.trace("Running clockwork for context {}", context); if (InternalsConfig.consistencyChecks) { context.checkConsistence(); } int clicked = 0; boolean focusConflictPresent = false; HookOperationMode finalMode; try { context.reportProgress(new ProgressInformation(CLOCKWORK, ENTERING)); if (context.getFocusContext() != null && context.getFocusContext().getOid() != null) { context.createAndRegisterConflictWatcher(context.getFocusContext().getOid(), repositoryService); } FocusConstraintsChecker.enterCache(); enterAssociationSearchExpressionEvaluatorCache(); provisioningService.enterConstraintsCheckerCache(); while (context.getState() != ModelState.FINAL) { int maxClicks = getMaxClicks(context, result); if (clicked >= maxClicks) { throw new IllegalStateException("Model operation took too many clicks (limit is " + maxClicks + "). Is there a cycle?"); } clicked++; HookOperationMode mode = click(context, task, result); if (mode == HookOperationMode.BACKGROUND) { result.recordInProgress(); return mode; } else if (mode == HookOperationMode.ERROR) { return mode; } } finalMode = click(context, task, result); if (finalMode == HookOperationMode.FOREGROUND) { focusConflictPresent = checkFocusConflicts(context, task, result); } } finally { context.unregisterConflictWatchers(repositoryService); FocusConstraintsChecker.exitCache(); exitAssociationSearchExpressionEvaluatorCache(); provisioningService.exitConstraintsCheckerCache(); context.reportProgress(new ProgressInformation(CLOCKWORK, EXITING)); } if (focusConflictPresent) { assert finalMode == HookOperationMode.FOREGROUND; finalMode = resolveFocusConflict(context, task, result); } else if (context.getConflictResolutionAttemptNumber() > 0) { LOGGER.info("Resolved update conflict on attempt number {}", context.getConflictResolutionAttemptNumber()); } return finalMode; }  }
Clockwork { public <F extends ObjectType> HookOperationMode run(LensContext<F> context, Task task, OperationResult result) throws SchemaException, PolicyViolationException, ExpressionEvaluationException, ObjectNotFoundException, ObjectAlreadyExistsException, CommunicationException, ConfigurationException, SecurityViolationException { LOGGER.trace("Running clockwork for context {}", context); if (InternalsConfig.consistencyChecks) { context.checkConsistence(); } int clicked = 0; boolean focusConflictPresent = false; HookOperationMode finalMode; try { context.reportProgress(new ProgressInformation(CLOCKWORK, ENTERING)); if (context.getFocusContext() != null && context.getFocusContext().getOid() != null) { context.createAndRegisterConflictWatcher(context.getFocusContext().getOid(), repositoryService); } FocusConstraintsChecker.enterCache(); enterAssociationSearchExpressionEvaluatorCache(); provisioningService.enterConstraintsCheckerCache(); while (context.getState() != ModelState.FINAL) { int maxClicks = getMaxClicks(context, result); if (clicked >= maxClicks) { throw new IllegalStateException("Model operation took too many clicks (limit is " + maxClicks + "). Is there a cycle?"); } clicked++; HookOperationMode mode = click(context, task, result); if (mode == HookOperationMode.BACKGROUND) { result.recordInProgress(); return mode; } else if (mode == HookOperationMode.ERROR) { return mode; } } finalMode = click(context, task, result); if (finalMode == HookOperationMode.FOREGROUND) { focusConflictPresent = checkFocusConflicts(context, task, result); } } finally { context.unregisterConflictWatchers(repositoryService); FocusConstraintsChecker.exitCache(); exitAssociationSearchExpressionEvaluatorCache(); provisioningService.exitConstraintsCheckerCache(); context.reportProgress(new ProgressInformation(CLOCKWORK, EXITING)); } if (focusConflictPresent) { assert finalMode == HookOperationMode.FOREGROUND; finalMode = resolveFocusConflict(context, task, result); } else if (context.getConflictResolutionAttemptNumber() > 0) { LOGGER.info("Resolved update conflict on attempt number {}", context.getConflictResolutionAttemptNumber()); } return finalMode; }  LensDebugListener getDebugListener(); void setDebugListener(LensDebugListener debugListener); HookOperationMode run(LensContext<F> context, Task task, OperationResult result); HookOperationMode click(LensContext<F> context, Task task, OperationResult result); static void throwException(Throwable e); }
Clockwork { public <F extends ObjectType> HookOperationMode run(LensContext<F> context, Task task, OperationResult result) throws SchemaException, PolicyViolationException, ExpressionEvaluationException, ObjectNotFoundException, ObjectAlreadyExistsException, CommunicationException, ConfigurationException, SecurityViolationException { LOGGER.trace("Running clockwork for context {}", context); if (InternalsConfig.consistencyChecks) { context.checkConsistence(); } int clicked = 0; boolean focusConflictPresent = false; HookOperationMode finalMode; try { context.reportProgress(new ProgressInformation(CLOCKWORK, ENTERING)); if (context.getFocusContext() != null && context.getFocusContext().getOid() != null) { context.createAndRegisterConflictWatcher(context.getFocusContext().getOid(), repositoryService); } FocusConstraintsChecker.enterCache(); enterAssociationSearchExpressionEvaluatorCache(); provisioningService.enterConstraintsCheckerCache(); while (context.getState() != ModelState.FINAL) { int maxClicks = getMaxClicks(context, result); if (clicked >= maxClicks) { throw new IllegalStateException("Model operation took too many clicks (limit is " + maxClicks + "). Is there a cycle?"); } clicked++; HookOperationMode mode = click(context, task, result); if (mode == HookOperationMode.BACKGROUND) { result.recordInProgress(); return mode; } else if (mode == HookOperationMode.ERROR) { return mode; } } finalMode = click(context, task, result); if (finalMode == HookOperationMode.FOREGROUND) { focusConflictPresent = checkFocusConflicts(context, task, result); } } finally { context.unregisterConflictWatchers(repositoryService); FocusConstraintsChecker.exitCache(); exitAssociationSearchExpressionEvaluatorCache(); provisioningService.exitConstraintsCheckerCache(); context.reportProgress(new ProgressInformation(CLOCKWORK, EXITING)); } if (focusConflictPresent) { assert finalMode == HookOperationMode.FOREGROUND; finalMode = resolveFocusConflict(context, task, result); } else if (context.getConflictResolutionAttemptNumber() > 0) { LOGGER.info("Resolved update conflict on attempt number {}", context.getConflictResolutionAttemptNumber()); } return finalMode; }  LensDebugListener getDebugListener(); void setDebugListener(LensDebugListener debugListener); HookOperationMode run(LensContext<F> context, Task task, OperationResult result); HookOperationMode click(LensContext<F> context, Task task, OperationResult result); static void throwException(Throwable e);  }