Examples of StreamDiscoverListsDTO


Examples of org.eurekastreams.server.domain.dto.StreamDiscoverListsDTO

        final SuggestedStreamsRequest request = new SuggestedStreamsRequest(personId, 10);

        final PrincipalActionContext actionContext = context.mock(PrincipalActionContext.class);
        final Principal principal = context.mock(Principal.class);

        final StreamDiscoverListsDTO result = new StreamDiscoverListsDTO();

        people.add(new PersonModelView(1L, "a", "foo", "bar", null, "", 100, new Date(), 1L));
        people.add(new PersonModelView(2L, "b", "foo", "bar", null, "", 900, new Date(), 2L)); // 3
        people.add(new PersonModelView(3L, "c", "foo", "bar", null, "", 200, new Date(), 3L));
        people.add(new PersonModelView(4L, "d", "foo", "bar", null, "", 800, new Date(), 4L)); // 5
        people.add(new PersonModelView(5L, "e", "foo", "bar", null, "", 300, new Date(), 5L)); // 9
        people.add(new PersonModelView(6L, "f", "foo", "bar", null, "", 200, new Date(), 6L));
        people.add(new PersonModelView(7L, "g", "foo", "bar", null, "", 700, new Date(), 7L)); // 7
        people.get(4).setAccountLocked(true);

        groups.add(new DomainGroupModelView(8L, "h", "foobar", 50L, new Date(), 8L));
        groups.add(new DomainGroupModelView(9L, "i", "foobar", 250L, new Date(), 9L)); // 10
        groups.add(new DomainGroupModelView(10L, "j", "foobar", 200L, new Date(), 10L));
        groups.add(new DomainGroupModelView(11L, "k", "foobar", 300L, new Date(), 11L)); // 8
        groups.add(new DomainGroupModelView(12L, "l", "foobar", 700L, new Date(), 12L)); // 6
        groups.add(new DomainGroupModelView(13L, "m", "foobar", 900L, new Date(), 13L)); // 2
        groups.add(new DomainGroupModelView(14L, "n", "foobar", 800L, new Date(), 14L)); // 4
        groups.add(new DomainGroupModelView(15L, "o", "foobar", 950L, new Date(), 15L)); // 1

        // displayInfoSettables.addAll(result.getFeaturedStreams());
        // displayInfoSettables.addAll(result.getMostFollowedStreams());
        // displayInfoSettables.addAll(result.getMostRecentStreams());
        // displayInfoSettables.addAll(result.getMostViewedStreams());
        // displayInfoSettables.addAll(result.getSuggestedStreams());
        // displayInfoSettables.addAll(result.getMostActiveStreams().getResultsSublist());

        FeaturedStreamDTO featured = new FeaturedStreamDTO(111L, "", 111L, ScopeType.RESOURCE, "", 111L);

        result.setFeaturedStreams(Collections.singletonList(featured));
        result.setMostFollowedStreams(Collections.singletonList((StreamDTO) people.get(0)));
        result.setMostRecentStreams(Collections.singletonList((StreamDTO) people.get(0)));
        result.setMostViewedStreams(Collections.singletonList((StreamDTO) people.get(2)));

        result.setMostActiveStreams(new SublistWithResultCount<StreamDTO>(Collections.singletonList((StreamDTO) groups
                .get(0)), 3L));

        final List<DisplayInfoSettable> combinedList = new ArrayList<DisplayInfoSettable>();

        // featured list
        combinedList.add(featured);

        // most followed
        combinedList.add(people.get(0));

        // most recent
        combinedList.add(people.get(0));

        // most viewed
        combinedList.add(people.get(2));

        // suggestions
        combinedList.add(groups.get(7));
        combinedList.add(groups.get(5));
        combinedList.add(people.get(1));
        combinedList.add(groups.get(6));
        combinedList.add(people.get(3));
        combinedList.add(groups.get(4));
        combinedList.add(people.get(6));
        combinedList.add(groups.get(3));
        combinedList.add(people.get(4));
        combinedList.add(groups.get(1));

        // most active
        combinedList.add(groups.get(0));

        if (displayInfoSettableDataPopulator == null)
        {
            throw new RuntimeException("WTH?");
        }

        final List<PersonModelView> peopleFetched = Arrays.asList(people.get(0), people.get(1), people.get(3),
                people.get(4), people.get(6));
        // final Set<Long> peopleIdsToFetch = new HashSet<Long>(Arrays.asList(1L, 2L, 4L, 5L, 7L));
        final List<Long> peopleIdsToFetch = Arrays.asList(1L, 2L, 3L, 4L, 5L, 7L);

        context.checking(new Expectations()
        {
            {
                oneOf(actionContext).getPrincipal();
                will(returnValue(principal));

                oneOf(principal).getId();
                will(returnValue(personId));

                oneOf(suggestedPersonMapper).execute(with(IsEqualInternally.equalInternally(request)));
                will(returnValue(people));

                oneOf(suggestedGroupMapper).execute(with(IsEqualInternally.equalInternally(request)));
                will(returnValue(groups));

                oneOf(streamDiscoveryListsMapper).execute(null);
                will(returnValue(result));

                oneOf(displayInfoSettableDataPopulator).execute(with(IsEqualInternally.equalInternally(combinedList)));
                will(returnValue(combinedList));

                oneOf(followerStatusPopulator).execute(with(personId), with(combinedList),
                        with(FollowerStatus.NOTFOLLOWING));
                will(returnValue(combinedList));

                oneOf(getPersonModelViewsByIdsDAO).execute(with(new EasyMatcher<List<Long>>()
                {
                    @Override
                    protected boolean isMatch(final List<Long> t)
                    {
                        boolean isMatch = t.size() == peopleIdsToFetch.size() && t.containsAll(peopleIdsToFetch);
                        return isMatch;
                    }
                }));
                will(returnValue(peopleFetched));
            }
        });

        Assert.assertSame(result, sut.execute(actionContext));

        List<StreamDTO> suggestions = result.getSuggestedStreams();

        Assert.assertEquals(9, suggestions.size());

        Assert.assertEquals(15, suggestions.get(0).getId());
        Assert.assertEquals(13, suggestions.get(1).getId());
View Full Code Here

Examples of org.eurekastreams.server.domain.dto.StreamDiscoverListsDTO

                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();
    }
View Full Code Here

Examples of org.eurekastreams.server.domain.dto.StreamDiscoverListsDTO

        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;
    }
View Full Code Here

Examples of org.eurekastreams.server.domain.dto.StreamDiscoverListsDTO

    public Serializable execute(final PrincipalActionContext inActionContext) throws ExecutionException
    {
        Long personId = inActionContext.getPrincipal().getId();

        log.info("BEGIN getting the lists of streams that apply to all users.");
        StreamDiscoverListsDTO result = streamDiscoveryListsMapper.execute(null);
        log.info("END getting the lists of streams that apply to all users.");

        log.info("BEGIN getting the list of suggested streams for user " + personId);
        getSuggestionsForPerson(personId, result);
        log.info("END getting the list of suggested streams for user " + personId);

        // put all of the streams in a single list for transient data population
        List<DisplayInfoSettable> displayInfoSettables = new ArrayList<DisplayInfoSettable>();
        displayInfoSettables.addAll(result.getFeaturedStreams());
        displayInfoSettables.addAll(result.getMostFollowedStreams());
        displayInfoSettables.addAll(result.getMostRecentStreams());
        displayInfoSettables.addAll(result.getMostViewedStreams());
        displayInfoSettables.addAll(result.getSuggestedStreams());
        displayInfoSettables.addAll(result.getMostActiveStreams().getResultsSublist());

        // determine list of allowed people (not locked/deactivated)
        Set<Long> allowedPeople = getAllowedPeopleList(displayInfoSettables);
        // remove all unallowed people from lists
        filterList(result.getFeaturedStreams(), allowedPeople);
        filterList(result.getMostFollowedStreams(), allowedPeople);
        filterList(result.getMostRecentStreams(), allowedPeople);
        filterList(result.getMostViewedStreams(), allowedPeople);
        filterList(result.getSuggestedStreams(), allowedPeople);
        int oldCount = result.getMostActiveStreams().getResultsSublist().size();
        filterList(result.getMostActiveStreams().getResultsSublist(), allowedPeople);
        result.getMostActiveStreams().setTotalResultsCount(
                result.getMostActiveStreams().getTotalResultsCount()
                        - (oldCount - result.getMostActiveStreams().getResultsSublist().size()));

        // fill in the avatars and display names of all of the StreamDTOs
        log.info("BEGIN setting the display info on " + displayInfoSettables.size()
                + " GroupModelViews and PersonModelViews");
        displayInfoSettableDataPopulator.execute(displayInfoSettables);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.