Package org.eurekastreams.server.domain

Examples of org.eurekastreams.server.domain.GroupFollower


            // already following
            return;
        }

        // add follower
        getEntityManager().persist(new GroupFollower(followerId, followingId));

        // now update the counts for persons.
        getEntityManager()
                .createQuery(
                        "update versioned Person set groupsCount = followingGroup.size,"
View Full Code Here


        getEntityManager().persist(new Follower(42, 98));
        getEntityManager().persist(new Follower(42, 99));

        // ---
        // person 142, 4507, and 98 are following group 5
        getEntityManager().persist(new GroupFollower(142, 5));
        getEntityManager().persist(new GroupFollower(4507, 5));
        getEntityManager().persist(new GroupFollower(98, 5));

        // person 142, 4507 follow group 1
        getEntityManager().persist(new GroupFollower(142, 1));
        getEntityManager().persist(new GroupFollower(4507, 1));

        // person 98 follow group 3, 42 (current user - should be ignored)
        getEntityManager().persist(new GroupFollower(142, 3));

        // ---
        //

        List<DomainGroupModelView> suggestedGroups = sut.execute(new SuggestedStreamsRequest(42L, 4));
        Assert.assertEquals(3, suggestedGroups.size());
        Assert.assertEquals(5, suggestedGroups.get(0).getId());
        Assert.assertEquals("group5", suggestedGroups.get(0).getShortName());
        Assert.assertEquals("A Group 1 Name", suggestedGroups.get(0).getName());
        Assert.assertEquals(3, suggestedGroups.get(0).getFollowersCount());

        Assert.assertEquals(1, suggestedGroups.get(1).getId());
        Assert.assertEquals("group1", suggestedGroups.get(1).getShortName());
        Assert.assertEquals("E Group 1 Name", suggestedGroups.get(1).getName());
        Assert.assertEquals(2, suggestedGroups.get(1).getFollowersCount());

        Assert.assertEquals(3, suggestedGroups.get(2).getId());
        Assert.assertEquals("group3", suggestedGroups.get(2).getShortName());
        Assert.assertEquals("C Group 1 Name", suggestedGroups.get(2).getName());
        Assert.assertEquals(1, suggestedGroups.get(2).getFollowersCount());

        suggestedGroups = sut.execute(new SuggestedStreamsRequest(42L, 2));
        Assert.assertEquals(2, suggestedGroups.size());
        Assert.assertEquals(5, suggestedGroups.get(0).getId());
        Assert.assertEquals(1, suggestedGroups.get(1).getId());

        // now follow group 1 so it's removed from the list
        getEntityManager().persist(new GroupFollower(42, 1));
        suggestedGroups = sut.execute(new SuggestedStreamsRequest(42L, 3));
        Assert.assertEquals(2, suggestedGroups.size());
        Assert.assertEquals(5, suggestedGroups.get(0).getId());
        Assert.assertEquals(3, suggestedGroups.get(1).getId());
    }
View Full Code Here

TOP

Related Classes of org.eurekastreams.server.domain.GroupFollower

Copyright © 2018 www.massapicom. 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.