@Test public void testExecute() { final String groupShortName = "ldsjkrfsd"; final String existingGroupName = "My Favorite Group"; final Long activityId = 12L; final List<Long> activityIds = new ArrayList<Long>(); activityIds.add(activityId); ActionContext actionContext = new ActionContext() { private static final long serialVersionUID = 1L; @Override public Serializable getParams() { return groupShortName; } @Override public Map<String, Object> getState() { return null; } @Override public String getActionId() { return null; } @Override public void setActionId(final String inActionId) { } }; context.checking(new Expectations() { { oneOf(getDisplayNameMapper).execute(groupShortName); will(returnValue(existingGroupName)); oneOf(activityIdMapper).execute(ScopeType.GROUP, groupShortName); will(returnValue(activityIds)); oneOf(cacheUpdater).execute(activityIds, existingGroupName); } }); sut.execute(actionContext); context.assertIsSatisfied(); }
@Override public Serializable execute(final ActionContext inActionContext) { String streamShortName = (String) inActionContext.getParams(); if (log.isInfoEnabled()) { log.info("Updating the recipient stream name for all activities posted to stream of type " + streamScopeType + " with short name " + streamShortName); } String ownerDisplayName = getDisplayNameMapper.execute(streamShortName); if (log.isInfoEnabled()) { log.info("Found the owner's display name: " + ownerDisplayName); } List<Long> activityIds = activityIdMapper.execute(streamScopeType, streamShortName); if (log.isInfoEnabled()) { log.info("Found " + activityIds.size() + " activities to update."); } cacheUpdater.execute(activityIds, ownerDisplayName); return true; }
ActivityRecipientStreamNameCacheUpdateAsyncExecution implements ExecutionStrategy<ActionContext> { @Override public Serializable execute(final ActionContext inActionContext) { String streamShortName = (String) inActionContext.getParams(); if (log.isInfoEnabled()) { log.info("Updating the recipient stream name for all activities posted to stream of type " + streamScopeType + " with short name " + streamShortName); } String ownerDisplayName = getDisplayNameMapper.execute(streamShortName); if (log.isInfoEnabled()) { log.info("Found the owner's display name: " + ownerDisplayName); } List<Long> activityIds = activityIdMapper.execute(streamScopeType, streamShortName); if (log.isInfoEnabled()) { log.info("Found " + activityIds.size() + " activities to update."); } cacheUpdater.execute(activityIds, ownerDisplayName); return true; } }
ActivityRecipientStreamNameCacheUpdateAsyncExecution implements ExecutionStrategy<ActionContext> { @Override public Serializable execute(final ActionContext inActionContext) { String streamShortName = (String) inActionContext.getParams(); if (log.isInfoEnabled()) { log.info("Updating the recipient stream name for all activities posted to stream of type " + streamScopeType + " with short name " + streamShortName); } String ownerDisplayName = getDisplayNameMapper.execute(streamShortName); if (log.isInfoEnabled()) { log.info("Found the owner's display name: " + ownerDisplayName); } List<Long> activityIds = activityIdMapper.execute(streamScopeType, streamShortName); if (log.isInfoEnabled()) { log.info("Found " + activityIds.size() + " activities to update."); } cacheUpdater.execute(activityIds, ownerDisplayName); return true; } ActivityRecipientStreamNameCacheUpdateAsyncExecution(final ScopeType inStreamScopeType,
            final GetFieldFromTableByUniqueField<String, String> inGetDisplayNameMapper,
            final GetActivityIdsPostedToStreamByUniqueKeyAndScopeType inActivityIdMapper,
            final UpdateDestinationStreamNameInCachedActivity inCacheUpdater); }
ActivityRecipientStreamNameCacheUpdateAsyncExecution implements ExecutionStrategy<ActionContext> { @Override public Serializable execute(final ActionContext inActionContext) { String streamShortName = (String) inActionContext.getParams(); if (log.isInfoEnabled()) { log.info("Updating the recipient stream name for all activities posted to stream of type " + streamScopeType + " with short name " + streamShortName); } String ownerDisplayName = getDisplayNameMapper.execute(streamShortName); if (log.isInfoEnabled()) { log.info("Found the owner's display name: " + ownerDisplayName); } List<Long> activityIds = activityIdMapper.execute(streamScopeType, streamShortName); if (log.isInfoEnabled()) { log.info("Found " + activityIds.size() + " activities to update."); } cacheUpdater.execute(activityIds, ownerDisplayName); return true; } ActivityRecipientStreamNameCacheUpdateAsyncExecution(final ScopeType inStreamScopeType,
            final GetFieldFromTableByUniqueField<String, String> inGetDisplayNameMapper,
            final GetActivityIdsPostedToStreamByUniqueKeyAndScopeType inActivityIdMapper,
            final UpdateDestinationStreamNameInCachedActivity inCacheUpdater); @Override Serializable execute(final ActionContext inActionContext); }
ActivityRecipientStreamNameCacheUpdateAsyncExecution implements ExecutionStrategy<ActionContext> { @Override public Serializable execute(final ActionContext inActionContext) { String streamShortName = (String) inActionContext.getParams(); if (log.isInfoEnabled()) { log.info("Updating the recipient stream name for all activities posted to stream of type " + streamScopeType + " with short name " + streamShortName); } String ownerDisplayName = getDisplayNameMapper.execute(streamShortName); if (log.isInfoEnabled()) { log.info("Found the owner's display name: " + ownerDisplayName); } List<Long> activityIds = activityIdMapper.execute(streamScopeType, streamShortName); if (log.isInfoEnabled()) { log.info("Found " + activityIds.size() + " activities to update."); } cacheUpdater.execute(activityIds, ownerDisplayName); return true; } ActivityRecipientStreamNameCacheUpdateAsyncExecution(final ScopeType inStreamScopeType,
            final GetFieldFromTableByUniqueField<String, String> inGetDisplayNameMapper,
            final GetActivityIdsPostedToStreamByUniqueKeyAndScopeType inActivityIdMapper,
            final UpdateDestinationStreamNameInCachedActivity inCacheUpdater); @Override Serializable execute(final ActionContext inActionContext);  }