@Test public void testShortCircuitActivityNull() { context.checking(new Expectations() { { oneOf(activityDAO).execute(activityId); will(returnValue(null)); } }); sut.execute(activityId); context.assertIsSatisfied(); }
@Override public Void execute(final Long inRequest) { ActivityDTO activity = activityDAO.execute(inRequest); if (activity == null || activity.getShowInStream() || activity.getDestinationStream().getType() != EntityType.RESOURCE) { return null; } PersonModelView actor = getPersonModelViewByAccountIdMapper.execute(activity.getActor().getUniqueIdentifier()); getCache().removeFromList(CacheKeys.ENTITY_STREAM_BY_SCOPE_ID + actor.getStreamId(), inRequest); List<Long> followingUserIds = userIdsFollowingPersonDAO.execute(actor.getId()); for (Long followerId : followingUserIds) { log.info("Removing activity #" + inRequest + " from followed list for person #" + followerId); getCache().removeFromList(CacheKeys.ACTIVITIES_BY_FOLLOWING + followerId, inRequest); } return null; }
HideResourceActivityCacheUpdateMapper extends BaseArgCachedDomainMapper<Long, Void> { @Override public Void execute(final Long inRequest) { ActivityDTO activity = activityDAO.execute(inRequest); if (activity == null || activity.getShowInStream() || activity.getDestinationStream().getType() != EntityType.RESOURCE) { return null; } PersonModelView actor = getPersonModelViewByAccountIdMapper.execute(activity.getActor().getUniqueIdentifier()); getCache().removeFromList(CacheKeys.ENTITY_STREAM_BY_SCOPE_ID + actor.getStreamId(), inRequest); List<Long> followingUserIds = userIdsFollowingPersonDAO.execute(actor.getId()); for (Long followerId : followingUserIds) { log.info("Removing activity #" + inRequest + " from followed list for person #" + followerId); getCache().removeFromList(CacheKeys.ACTIVITIES_BY_FOLLOWING + followerId, inRequest); } return null; } }
HideResourceActivityCacheUpdateMapper extends BaseArgCachedDomainMapper<Long, Void> { @Override public Void execute(final Long inRequest) { ActivityDTO activity = activityDAO.execute(inRequest); if (activity == null || activity.getShowInStream() || activity.getDestinationStream().getType() != EntityType.RESOURCE) { return null; } PersonModelView actor = getPersonModelViewByAccountIdMapper.execute(activity.getActor().getUniqueIdentifier()); getCache().removeFromList(CacheKeys.ENTITY_STREAM_BY_SCOPE_ID + actor.getStreamId(), inRequest); List<Long> followingUserIds = userIdsFollowingPersonDAO.execute(actor.getId()); for (Long followerId : followingUserIds) { log.info("Removing activity #" + inRequest + " from followed list for person #" + followerId); getCache().removeFromList(CacheKeys.ACTIVITIES_BY_FOLLOWING + followerId, inRequest); } return null; } HideResourceActivityCacheUpdateMapper(final DomainMapper<Long, ActivityDTO> inActivityDAO,
            final DomainMapper<String, PersonModelView> inGetPersonModelViewByAccountIdMapper,
            final DomainMapper<Long, List<Long>> inUserIdsFollowingPersonDAO); }
HideResourceActivityCacheUpdateMapper extends BaseArgCachedDomainMapper<Long, Void> { @Override public Void execute(final Long inRequest) { ActivityDTO activity = activityDAO.execute(inRequest); if (activity == null || activity.getShowInStream() || activity.getDestinationStream().getType() != EntityType.RESOURCE) { return null; } PersonModelView actor = getPersonModelViewByAccountIdMapper.execute(activity.getActor().getUniqueIdentifier()); getCache().removeFromList(CacheKeys.ENTITY_STREAM_BY_SCOPE_ID + actor.getStreamId(), inRequest); List<Long> followingUserIds = userIdsFollowingPersonDAO.execute(actor.getId()); for (Long followerId : followingUserIds) { log.info("Removing activity #" + inRequest + " from followed list for person #" + followerId); getCache().removeFromList(CacheKeys.ACTIVITIES_BY_FOLLOWING + followerId, inRequest); } return null; } HideResourceActivityCacheUpdateMapper(final DomainMapper<Long, ActivityDTO> inActivityDAO,
            final DomainMapper<String, PersonModelView> inGetPersonModelViewByAccountIdMapper,
            final DomainMapper<Long, List<Long>> inUserIdsFollowingPersonDAO); @Override Void execute(final Long inRequest); }
HideResourceActivityCacheUpdateMapper extends BaseArgCachedDomainMapper<Long, Void> { @Override public Void execute(final Long inRequest) { ActivityDTO activity = activityDAO.execute(inRequest); if (activity == null || activity.getShowInStream() || activity.getDestinationStream().getType() != EntityType.RESOURCE) { return null; } PersonModelView actor = getPersonModelViewByAccountIdMapper.execute(activity.getActor().getUniqueIdentifier()); getCache().removeFromList(CacheKeys.ENTITY_STREAM_BY_SCOPE_ID + actor.getStreamId(), inRequest); List<Long> followingUserIds = userIdsFollowingPersonDAO.execute(actor.getId()); for (Long followerId : followingUserIds) { log.info("Removing activity #" + inRequest + " from followed list for person #" + followerId); getCache().removeFromList(CacheKeys.ACTIVITIES_BY_FOLLOWING + followerId, inRequest); } return null; } HideResourceActivityCacheUpdateMapper(final DomainMapper<Long, ActivityDTO> inActivityDAO,
            final DomainMapper<String, PersonModelView> inGetPersonModelViewByAccountIdMapper,
            final DomainMapper<Long, List<Long>> inUserIdsFollowingPersonDAO); @Override Void execute(final Long inRequest);  }