@Test public void testExecute() { final FeaturedStreamDTO featuredDTO = new FeaturedStreamDTO(); final StreamDTO mostActiveDTO = new PersonModelView(); final Long mostActiveCount = 82L; final StreamDTO mostViewedDTO = new PersonModelView(); final StreamDTO mostFollowedDTO = new PersonModelView(); final StreamDTO mostRecentDTO = new PersonModelView(); final List<FeaturedStreamDTO> featuredDTOs = new ArrayList<FeaturedStreamDTO>(); featuredDTOs.add(featuredDTO); final SublistWithResultCount<StreamDTO> mostActiveDTOs = new SublistWithResultCount<StreamDTO>(); mostActiveDTOs.setResultsSublist(new ArrayList<StreamDTO>()); mostActiveDTOs.getResultsSublist().add(mostActiveDTO); mostActiveDTOs.setTotalResultsCount(mostActiveCount); final List<StreamDTO> mostViewedDTOs = new ArrayList<StreamDTO>(); mostViewedDTOs.add(mostViewedDTO); final List<StreamDTO> mostFollowedDTOs = new ArrayList<StreamDTO>(); mostFollowedDTOs.add(mostFollowedDTO); final List<StreamDTO> mostRecentDTOs = new ArrayList<StreamDTO>(); mostRecentDTOs.add(mostRecentDTO); context.checking(new Expectations() { { oneOf(repopulateTempWeekdaysSinceDateStrategy).execute(numberOfDaysOfWeekdayCountDataToGenerate); oneOf(featuredStreamDTOMapper).execute(null); will(returnValue(featuredDTOs)); oneOf(mostActiveStreamsMapper).execute(null); will(returnValue(mostActiveDTOs)); oneOf(mostViewedStreamsMapper).execute(null); will(returnValue(mostViewedDTOs)); oneOf(mostFollowedStreamsMapper).execute(null); will(returnValue(mostFollowedDTOs)); oneOf(mostRecentStreamsMapper).execute(null); will(returnValue(mostRecentDTOs)); } }); StreamDiscoverListsDTO result = sut.execute(null); Assert.assertSame(featuredDTO, result.getFeaturedStreams().get(0)); Assert.assertSame(mostActiveDTO, result.getMostActiveStreams().getResultsSublist().get(0)); Assert.assertEquals(mostActiveCount, result.getMostActiveStreams().getTotalResultsCount()); Assert.assertSame(mostViewedDTO, result.getMostViewedStreams().get(0)); Assert.assertSame(mostFollowedDTO, result.getMostFollowedStreams().get(0)); Assert.assertSame(mostRecentDTO, result.getMostRecentStreams().get(0)); context.assertIsSatisfied(); }
@Override public StreamDiscoverListsDTO execute(final Serializable inRequest) { log.info("Beginning to generate Stream Discovery lists for all users."); log.info("Regenerating weekday count temp data for " + numberOfDaysOfWeekdayCountDataToGenerate + " days"); repopulateTempWeekdaysSinceDateStrategy.execute(numberOfDaysOfWeekdayCountDataToGenerate); StreamDiscoverListsDTO result = new StreamDiscoverListsDTO(); log.info("Generating the list of featured streams"); result.setFeaturedStreams(featuredStreamDTOMapper.execute(null)); log.info("Generating the list of most active streams"); result.setMostActiveStreams(mostActiveStreamsMapper.execute(null)); log.info("Generating the list of most viewed streams."); result.setMostViewedStreams(mostViewedStreamsMapper.execute(null)); log.info("Generating the list of most followed streams."); result.setMostFollowedStreams(mostFollowedStreamsMapper.execute(null)); log.info("Generating the list of most recent streams."); result.setMostRecentStreams(mostRecentStreamsMapper.execute(null)); log.info("Finished generating Stream Discovery lists for all users."); return result; }
StreamDiscoverListsMapper extends BaseArgDomainMapper<Serializable, StreamDiscoverListsDTO> { @Override public StreamDiscoverListsDTO execute(final Serializable inRequest) { log.info("Beginning to generate Stream Discovery lists for all users."); log.info("Regenerating weekday count temp data for " + numberOfDaysOfWeekdayCountDataToGenerate + " days"); repopulateTempWeekdaysSinceDateStrategy.execute(numberOfDaysOfWeekdayCountDataToGenerate); StreamDiscoverListsDTO result = new StreamDiscoverListsDTO(); log.info("Generating the list of featured streams"); result.setFeaturedStreams(featuredStreamDTOMapper.execute(null)); log.info("Generating the list of most active streams"); result.setMostActiveStreams(mostActiveStreamsMapper.execute(null)); log.info("Generating the list of most viewed streams."); result.setMostViewedStreams(mostViewedStreamsMapper.execute(null)); log.info("Generating the list of most followed streams."); result.setMostFollowedStreams(mostFollowedStreamsMapper.execute(null)); log.info("Generating the list of most recent streams."); result.setMostRecentStreams(mostRecentStreamsMapper.execute(null)); log.info("Finished generating Stream Discovery lists for all users."); return result; } }
StreamDiscoverListsMapper extends BaseArgDomainMapper<Serializable, StreamDiscoverListsDTO> { @Override public StreamDiscoverListsDTO execute(final Serializable inRequest) { log.info("Beginning to generate Stream Discovery lists for all users."); log.info("Regenerating weekday count temp data for " + numberOfDaysOfWeekdayCountDataToGenerate + " days"); repopulateTempWeekdaysSinceDateStrategy.execute(numberOfDaysOfWeekdayCountDataToGenerate); StreamDiscoverListsDTO result = new StreamDiscoverListsDTO(); log.info("Generating the list of featured streams"); result.setFeaturedStreams(featuredStreamDTOMapper.execute(null)); log.info("Generating the list of most active streams"); result.setMostActiveStreams(mostActiveStreamsMapper.execute(null)); log.info("Generating the list of most viewed streams."); result.setMostViewedStreams(mostViewedStreamsMapper.execute(null)); log.info("Generating the list of most followed streams."); result.setMostFollowedStreams(mostFollowedStreamsMapper.execute(null)); log.info("Generating the list of most recent streams."); result.setMostRecentStreams(mostRecentStreamsMapper.execute(null)); log.info("Finished generating Stream Discovery lists for all users."); return result; } StreamDiscoverListsMapper(
            final DomainMapper<MapperRequest< ? >, List<FeaturedStreamDTO>> inFeaturedStreamDTOMapper,
            final DomainMapper<Serializable, SublistWithResultCount<StreamDTO>> inMostActiveStreamsMapper,
            final DomainMapper<Serializable, List<StreamDTO>> inMostViewedStreamsMapper,
            final DomainMapper<Serializable, List<StreamDTO>> inMostFollowedStreamsMapper,
            final DomainMapper<Serializable, List<StreamDTO>> inMostRecentStreamsMapper,
            final RepopulateTempWeekdaysSinceDateStrategy inRepopulateTempWeekdaysSinceDateStrategy,
            final long inNumberOfDaysOfWeekdayCountDataToGenerate); }
StreamDiscoverListsMapper extends BaseArgDomainMapper<Serializable, StreamDiscoverListsDTO> { @Override public StreamDiscoverListsDTO execute(final Serializable inRequest) { log.info("Beginning to generate Stream Discovery lists for all users."); log.info("Regenerating weekday count temp data for " + numberOfDaysOfWeekdayCountDataToGenerate + " days"); repopulateTempWeekdaysSinceDateStrategy.execute(numberOfDaysOfWeekdayCountDataToGenerate); StreamDiscoverListsDTO result = new StreamDiscoverListsDTO(); log.info("Generating the list of featured streams"); result.setFeaturedStreams(featuredStreamDTOMapper.execute(null)); log.info("Generating the list of most active streams"); result.setMostActiveStreams(mostActiveStreamsMapper.execute(null)); log.info("Generating the list of most viewed streams."); result.setMostViewedStreams(mostViewedStreamsMapper.execute(null)); log.info("Generating the list of most followed streams."); result.setMostFollowedStreams(mostFollowedStreamsMapper.execute(null)); log.info("Generating the list of most recent streams."); result.setMostRecentStreams(mostRecentStreamsMapper.execute(null)); log.info("Finished generating Stream Discovery lists for all users."); return result; } StreamDiscoverListsMapper(
            final DomainMapper<MapperRequest< ? >, List<FeaturedStreamDTO>> inFeaturedStreamDTOMapper,
            final DomainMapper<Serializable, SublistWithResultCount<StreamDTO>> inMostActiveStreamsMapper,
            final DomainMapper<Serializable, List<StreamDTO>> inMostViewedStreamsMapper,
            final DomainMapper<Serializable, List<StreamDTO>> inMostFollowedStreamsMapper,
            final DomainMapper<Serializable, List<StreamDTO>> inMostRecentStreamsMapper,
            final RepopulateTempWeekdaysSinceDateStrategy inRepopulateTempWeekdaysSinceDateStrategy,
            final long inNumberOfDaysOfWeekdayCountDataToGenerate); @Override StreamDiscoverListsDTO execute(final Serializable inRequest); }
StreamDiscoverListsMapper extends BaseArgDomainMapper<Serializable, StreamDiscoverListsDTO> { @Override public StreamDiscoverListsDTO execute(final Serializable inRequest) { log.info("Beginning to generate Stream Discovery lists for all users."); log.info("Regenerating weekday count temp data for " + numberOfDaysOfWeekdayCountDataToGenerate + " days"); repopulateTempWeekdaysSinceDateStrategy.execute(numberOfDaysOfWeekdayCountDataToGenerate); StreamDiscoverListsDTO result = new StreamDiscoverListsDTO(); log.info("Generating the list of featured streams"); result.setFeaturedStreams(featuredStreamDTOMapper.execute(null)); log.info("Generating the list of most active streams"); result.setMostActiveStreams(mostActiveStreamsMapper.execute(null)); log.info("Generating the list of most viewed streams."); result.setMostViewedStreams(mostViewedStreamsMapper.execute(null)); log.info("Generating the list of most followed streams."); result.setMostFollowedStreams(mostFollowedStreamsMapper.execute(null)); log.info("Generating the list of most recent streams."); result.setMostRecentStreams(mostRecentStreamsMapper.execute(null)); log.info("Finished generating Stream Discovery lists for all users."); return result; } StreamDiscoverListsMapper(
            final DomainMapper<MapperRequest< ? >, List<FeaturedStreamDTO>> inFeaturedStreamDTOMapper,
            final DomainMapper<Serializable, SublistWithResultCount<StreamDTO>> inMostActiveStreamsMapper,
            final DomainMapper<Serializable, List<StreamDTO>> inMostViewedStreamsMapper,
            final DomainMapper<Serializable, List<StreamDTO>> inMostFollowedStreamsMapper,
            final DomainMapper<Serializable, List<StreamDTO>> inMostRecentStreamsMapper,
            final RepopulateTempWeekdaysSinceDateStrategy inRepopulateTempWeekdaysSinceDateStrategy,
            final long inNumberOfDaysOfWeekdayCountDataToGenerate); @Override StreamDiscoverListsDTO execute(final Serializable inRequest);  }