@Test public void testExecuteWithDisplayNameUpdate() { final ArrayList<UserActionRequest> requests = new ArrayList<UserActionRequest>(); final List<UserActionRequest> displayNameRequests = new ArrayList<UserActionRequest>(); UserActionRequest updateRequest = new UserActionRequest("foo", null, null); displayNameRequests.add(updateRequest); context.checking(new Expectations() { { allowing(taskHandlerActionContext).getActionContext(); will(returnValue(actionContext)); allowing(actionContext).getParams(); will(returnValue(ldapPerson)); oneOf(updatePersonMapper).execute(with(ldapPerson)); will(returnValue(new UpdatePersonResponse(1L, true, true))); allowing(taskHandlerActionContext).getUserActionRequests(); will(returnValue(requests)); allowing(ldapPerson).getAccountId(); will(returnValue("foo")); oneOf(personActivityCacheUpdater).getUpdateCacheRequests(null, new Long(1L)); will(returnValue(displayNameRequests)); } }); sut.execute(taskHandlerActionContext); assertEquals(2, requests.size()); assertTrue(requests.contains(updateRequest)); context.assertIsSatisfied(); }
@Override public Serializable execute(final TaskHandlerActionContext<ActionContext> inActionContext) { Person ldapPerson = (Person) inActionContext.getActionContext().getParams(); UpdatePersonResponse response = personMapper.execute(ldapPerson); if (response.wasUserUpdated()) { log.debug("Person " + ldapPerson.getAccountId() + " was updated - updating cache"); inActionContext.getUserActionRequests().add( new UserActionRequest("cachePerson", null, response.getPersonId())); } if (response.wasDisplayNameUpdated()) { log.debug("Person " + ldapPerson.getAccountId() + " display name was updated - updating display name everywhere"); inActionContext.getUserActionRequests().addAll( personActivityCacheUpdater.getUpdateCacheRequests(null, response.getPersonId())); } return Boolean.TRUE; }
RefreshPersonExecution implements TaskHandlerExecutionStrategy<ActionContext> { @Override public Serializable execute(final TaskHandlerActionContext<ActionContext> inActionContext) { Person ldapPerson = (Person) inActionContext.getActionContext().getParams(); UpdatePersonResponse response = personMapper.execute(ldapPerson); if (response.wasUserUpdated()) { log.debug("Person " + ldapPerson.getAccountId() + " was updated - updating cache"); inActionContext.getUserActionRequests().add( new UserActionRequest("cachePerson", null, response.getPersonId())); } if (response.wasDisplayNameUpdated()) { log.debug("Person " + ldapPerson.getAccountId() + " display name was updated - updating display name everywhere"); inActionContext.getUserActionRequests().addAll( personActivityCacheUpdater.getUpdateCacheRequests(null, response.getPersonId())); } return Boolean.TRUE; } }
RefreshPersonExecution implements TaskHandlerExecutionStrategy<ActionContext> { @Override public Serializable execute(final TaskHandlerActionContext<ActionContext> inActionContext) { Person ldapPerson = (Person) inActionContext.getActionContext().getParams(); UpdatePersonResponse response = personMapper.execute(ldapPerson); if (response.wasUserUpdated()) { log.debug("Person " + ldapPerson.getAccountId() + " was updated - updating cache"); inActionContext.getUserActionRequests().add( new UserActionRequest("cachePerson", null, response.getPersonId())); } if (response.wasDisplayNameUpdated()) { log.debug("Person " + ldapPerson.getAccountId() + " display name was updated - updating display name everywhere"); inActionContext.getUserActionRequests().addAll( personActivityCacheUpdater.getUpdateCacheRequests(null, response.getPersonId())); } return Boolean.TRUE; } RefreshPersonExecution(final UpdatePersonMapper inPersonMapper,
            final CacheUpdater inPersonActivityCacheUpdater); }
RefreshPersonExecution implements TaskHandlerExecutionStrategy<ActionContext> { @Override public Serializable execute(final TaskHandlerActionContext<ActionContext> inActionContext) { Person ldapPerson = (Person) inActionContext.getActionContext().getParams(); UpdatePersonResponse response = personMapper.execute(ldapPerson); if (response.wasUserUpdated()) { log.debug("Person " + ldapPerson.getAccountId() + " was updated - updating cache"); inActionContext.getUserActionRequests().add( new UserActionRequest("cachePerson", null, response.getPersonId())); } if (response.wasDisplayNameUpdated()) { log.debug("Person " + ldapPerson.getAccountId() + " display name was updated - updating display name everywhere"); inActionContext.getUserActionRequests().addAll( personActivityCacheUpdater.getUpdateCacheRequests(null, response.getPersonId())); } return Boolean.TRUE; } RefreshPersonExecution(final UpdatePersonMapper inPersonMapper,
            final CacheUpdater inPersonActivityCacheUpdater); @Override Serializable execute(final TaskHandlerActionContext<ActionContext> inActionContext); }
RefreshPersonExecution implements TaskHandlerExecutionStrategy<ActionContext> { @Override public Serializable execute(final TaskHandlerActionContext<ActionContext> inActionContext) { Person ldapPerson = (Person) inActionContext.getActionContext().getParams(); UpdatePersonResponse response = personMapper.execute(ldapPerson); if (response.wasUserUpdated()) { log.debug("Person " + ldapPerson.getAccountId() + " was updated - updating cache"); inActionContext.getUserActionRequests().add( new UserActionRequest("cachePerson", null, response.getPersonId())); } if (response.wasDisplayNameUpdated()) { log.debug("Person " + ldapPerson.getAccountId() + " display name was updated - updating display name everywhere"); inActionContext.getUserActionRequests().addAll( personActivityCacheUpdater.getUpdateCacheRequests(null, response.getPersonId())); } return Boolean.TRUE; } RefreshPersonExecution(final UpdatePersonMapper inPersonMapper,
            final CacheUpdater inPersonActivityCacheUpdater); @Override Serializable execute(final TaskHandlerActionContext<ActionContext> inActionContext);  }