@Test public void testExecuteNoActivity() { context.checking(new Expectations() { { oneOf(asyncActionContextMock).getParams(); will(returnValue(postActivityRequestMock)); oneOf(postActivityRequestMock).getActivityDTO(); will(returnValue(activityDTOMock)); allowing(activityDTOMock).getId(); will(returnValue(3L)); oneOf(findByIdMapper).execute( with(IsEqualInternally.equalInternally(new FindByIdRequest("Activity", 3L)))); will(returnValue(null)); } }); sut.execute(asyncActionContextMock); context.assertIsSatisfied(); }
@Override public Serializable execute(final AsyncActionContext inActionContext) throws ExecutionException { ActivityDTO currentActivity = ((PostActivityRequest) inActionContext.getParams()).getActivityDTO(); Activity activity = findByIdMapper.execute(new FindByIdRequest("Activity", currentActivity.getId())); if (activity != null) { log.info("Updating caches for activity #" + currentActivity.getId()); postCachedActivityMapper.execute(activity); log.info("Activity #" + currentActivity.getId() + " was found - parsing and storing its hashtags"); storeStreamHashTagStrategy.execute(activity); } return null; }
PostActivityAsyncExecutionStrategy implements ExecutionStrategy<AsyncActionContext> { @Override public Serializable execute(final AsyncActionContext inActionContext) throws ExecutionException { ActivityDTO currentActivity = ((PostActivityRequest) inActionContext.getParams()).getActivityDTO(); Activity activity = findByIdMapper.execute(new FindByIdRequest("Activity", currentActivity.getId())); if (activity != null) { log.info("Updating caches for activity #" + currentActivity.getId()); postCachedActivityMapper.execute(activity); log.info("Activity #" + currentActivity.getId() + " was found - parsing and storing its hashtags"); storeStreamHashTagStrategy.execute(activity); } return null; } }
PostActivityAsyncExecutionStrategy implements ExecutionStrategy<AsyncActionContext> { @Override public Serializable execute(final AsyncActionContext inActionContext) throws ExecutionException { ActivityDTO currentActivity = ((PostActivityRequest) inActionContext.getParams()).getActivityDTO(); Activity activity = findByIdMapper.execute(new FindByIdRequest("Activity", currentActivity.getId())); if (activity != null) { log.info("Updating caches for activity #" + currentActivity.getId()); postCachedActivityMapper.execute(activity); log.info("Activity #" + currentActivity.getId() + " was found - parsing and storing its hashtags"); storeStreamHashTagStrategy.execute(activity); } return null; } PostActivityAsyncExecutionStrategy(final PostCachedActivity inPostCachedActivityMapper,
            final FindByIdMapper<Activity> inFindByIdMapper,
            final StoreStreamHashTagsForActivityStrategy inStoreStreamHashTagStrategy); }
PostActivityAsyncExecutionStrategy implements ExecutionStrategy<AsyncActionContext> { @Override public Serializable execute(final AsyncActionContext inActionContext) throws ExecutionException { ActivityDTO currentActivity = ((PostActivityRequest) inActionContext.getParams()).getActivityDTO(); Activity activity = findByIdMapper.execute(new FindByIdRequest("Activity", currentActivity.getId())); if (activity != null) { log.info("Updating caches for activity #" + currentActivity.getId()); postCachedActivityMapper.execute(activity); log.info("Activity #" + currentActivity.getId() + " was found - parsing and storing its hashtags"); storeStreamHashTagStrategy.execute(activity); } return null; } PostActivityAsyncExecutionStrategy(final PostCachedActivity inPostCachedActivityMapper,
            final FindByIdMapper<Activity> inFindByIdMapper,
            final StoreStreamHashTagsForActivityStrategy inStoreStreamHashTagStrategy); @Override Serializable execute(final AsyncActionContext inActionContext); }
PostActivityAsyncExecutionStrategy implements ExecutionStrategy<AsyncActionContext> { @Override public Serializable execute(final AsyncActionContext inActionContext) throws ExecutionException { ActivityDTO currentActivity = ((PostActivityRequest) inActionContext.getParams()).getActivityDTO(); Activity activity = findByIdMapper.execute(new FindByIdRequest("Activity", currentActivity.getId())); if (activity != null) { log.info("Updating caches for activity #" + currentActivity.getId()); postCachedActivityMapper.execute(activity); log.info("Activity #" + currentActivity.getId() + " was found - parsing and storing its hashtags"); storeStreamHashTagStrategy.execute(activity); } return null; } PostActivityAsyncExecutionStrategy(final PostCachedActivity inPostCachedActivityMapper,
            final FindByIdMapper<Activity> inFindByIdMapper,
            final StoreStreamHashTagsForActivityStrategy inStoreStreamHashTagStrategy); @Override Serializable execute(final AsyncActionContext inActionContext);  }