@Test public void testExecute() { final Long personId = 28381L; final Person person = context.mock(Person.class); final String accountId = "sdlkjfsdlkj"; final ActionContext actionContext = context.mock(ActionContext.class); final List<Long> activityIdsAuthoredByPerson = new ArrayList<Long>(); final List<Long> commentIdsAuthoredByPerson = new ArrayList<Long>(); final List<Long> activityIdsWithEmbeddedCommentsAuthoredByPerson = new ArrayList<Long>(); context.checking(new Expectations() { { allowing(person).getAccountId(); will(returnValue(accountId)); oneOf(actionContext).getParams(); will(returnValue(personId)); oneOf(personMapper).findById(personId); will(returnValue(person)); allowing(person).getId(); will(returnValue(personId)); oneOf(getActivityIdsAuthordedByEntityDbMapper).execute(accountId, EntityType.PERSON); will(returnValue(activityIdsAuthoredByPerson)); oneOf(updateAuthorInfoInCachedActivitiesCacheM) .execute(with(activityIdsAuthoredByPerson), with(person)); oneOf(getActivityCommentIdsAuthoredByPersonIdDbMapper).execute(personId); will(returnValue(commentIdsAuthoredByPerson)); oneOf(updateAuthorInfoInCachedCommentsCacheMapper).execute(commentIdsAuthoredByPerson, person); oneOf(getActivityIdsWithFirstOrLastCommentsAuthoredByPersonIdDbMapper).execute(personId); will(returnValue(activityIdsWithEmbeddedCommentsAuthoredByPerson)); oneOf(updateAuthorInfoInActivityEmbeddedCachedCommentsCacheMapper).execute( activityIdsWithEmbeddedCommentsAuthoredByPerson, person); } }); sut.execute(actionContext); context.assertIsSatisfied(); }
@Override public Serializable execute(final ActionContext inActionContext) { Long personId = (Long) inActionContext.getParams(); log.info("Updating the info for user with person id '" + personId + "' in all cached activities and comments."); Person p = personMapper.findById(personId); updateActivityInfo(p); updateCommentInfo(p); updateEmbeddedCommentInfo(p); return null; }
PersonAuthoredActivitiesAndCommentsCacheUpdater implements ExecutionStrategy<ActionContext> { @Override public Serializable execute(final ActionContext inActionContext) { Long personId = (Long) inActionContext.getParams(); log.info("Updating the info for user with person id '" + personId + "' in all cached activities and comments."); Person p = personMapper.findById(personId); updateActivityInfo(p); updateCommentInfo(p); updateEmbeddedCommentInfo(p); return null; } }
PersonAuthoredActivitiesAndCommentsCacheUpdater implements ExecutionStrategy<ActionContext> { @Override public Serializable execute(final ActionContext inActionContext) { Long personId = (Long) inActionContext.getParams(); log.info("Updating the info for user with person id '" + personId + "' in all cached activities and comments."); Person p = personMapper.findById(personId); updateActivityInfo(p); updateCommentInfo(p); updateEmbeddedCommentInfo(p); return null; } PersonAuthoredActivitiesAndCommentsCacheUpdater(
            final GetActivityIdsAuthoredByOrOriginallyAuthoredByEntity inGetActivityIdsAuthordedByEntityDbMapper,
            final GetActivityCommentIdsAuthoredByPersonId inGetActivityCommentIdsAuthoredByPersonIdDbMapper,
            final GetActivityIdsWithFirstOrLastCommentsAuthoredByPersonId
            // line break
            inGetActivityIdsWithFirstOrLastCommentsAuthoredByPersonIdDbMapper,
            final UpdateAuthorInfoInCachedActivities inUpdateAuthorInfoInCachedActivitiesCacheMapper,
            final UpdateAuthorInfoInCachedComments inUpdateAuthorInfoInCachedCommentsCacheMapper,
            final UpdateAuthorInfoInActivityEmbeddedCachedComments
            // line break
            inUpdateAuthorInfoInActivityEmbeddedCachedCommentsCacheMapper, final PersonMapper inPersonMapper); }
PersonAuthoredActivitiesAndCommentsCacheUpdater implements ExecutionStrategy<ActionContext> { @Override public Serializable execute(final ActionContext inActionContext) { Long personId = (Long) inActionContext.getParams(); log.info("Updating the info for user with person id '" + personId + "' in all cached activities and comments."); Person p = personMapper.findById(personId); updateActivityInfo(p); updateCommentInfo(p); updateEmbeddedCommentInfo(p); return null; } PersonAuthoredActivitiesAndCommentsCacheUpdater(
            final GetActivityIdsAuthoredByOrOriginallyAuthoredByEntity inGetActivityIdsAuthordedByEntityDbMapper,
            final GetActivityCommentIdsAuthoredByPersonId inGetActivityCommentIdsAuthoredByPersonIdDbMapper,
            final GetActivityIdsWithFirstOrLastCommentsAuthoredByPersonId
            // line break
            inGetActivityIdsWithFirstOrLastCommentsAuthoredByPersonIdDbMapper,
            final UpdateAuthorInfoInCachedActivities inUpdateAuthorInfoInCachedActivitiesCacheMapper,
            final UpdateAuthorInfoInCachedComments inUpdateAuthorInfoInCachedCommentsCacheMapper,
            final UpdateAuthorInfoInActivityEmbeddedCachedComments
            // line break
            inUpdateAuthorInfoInActivityEmbeddedCachedCommentsCacheMapper, final PersonMapper inPersonMapper); @Override Serializable execute(final ActionContext inActionContext); }
PersonAuthoredActivitiesAndCommentsCacheUpdater implements ExecutionStrategy<ActionContext> { @Override public Serializable execute(final ActionContext inActionContext) { Long personId = (Long) inActionContext.getParams(); log.info("Updating the info for user with person id '" + personId + "' in all cached activities and comments."); Person p = personMapper.findById(personId); updateActivityInfo(p); updateCommentInfo(p); updateEmbeddedCommentInfo(p); return null; } PersonAuthoredActivitiesAndCommentsCacheUpdater(
            final GetActivityIdsAuthoredByOrOriginallyAuthoredByEntity inGetActivityIdsAuthordedByEntityDbMapper,
            final GetActivityCommentIdsAuthoredByPersonId inGetActivityCommentIdsAuthoredByPersonIdDbMapper,
            final GetActivityIdsWithFirstOrLastCommentsAuthoredByPersonId
            // line break
            inGetActivityIdsWithFirstOrLastCommentsAuthoredByPersonIdDbMapper,
            final UpdateAuthorInfoInCachedActivities inUpdateAuthorInfoInCachedActivitiesCacheMapper,
            final UpdateAuthorInfoInCachedComments inUpdateAuthorInfoInCachedCommentsCacheMapper,
            final UpdateAuthorInfoInActivityEmbeddedCachedComments
            // line break
            inUpdateAuthorInfoInActivityEmbeddedCachedCommentsCacheMapper, final PersonMapper inPersonMapper); @Override Serializable execute(final ActionContext inActionContext);  }