Package org.eurekastreams.server.domain

Examples of org.eurekastreams.server.domain.Follower$FollowerPk


            // already following
            return;
        }

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

        // now update the counts for persons subtracting 1 for themselves.
        getEntityManager().createQuery(
                "update versioned Person set followingCount = following.size - 1 where id=:followerId").setParameter(
                "followerId", followerId).executeUpdate();
View Full Code Here


    public void testExecute()
    {
        getEntityManager().createQuery("DELETE FROM Follower").executeUpdate();

        // person 42 is following 98, 4507
        getEntityManager().persist(new Follower(42L, 98));
        getEntityManager().persist(new Follower(42L, 4507));

        // -- ask for more than exist
        // 98 and 4507 are following 142
        getEntityManager().persist(new Follower(98, 142));
        getEntityManager().persist(new Follower(4507, 142));

        // 98 is following 99
        getEntityManager().persist(new Follower(98, 99));

        List<PersonModelView> suggestions = sut.execute(new SuggestedStreamsRequest(42, 5));
        Assert.assertEquals(2, suggestions.size());
        Assert.assertEquals(142, suggestions.get(0).getId());
        Assert.assertEquals("fordp2", suggestions.get(0).getAccountId());
        Assert.assertEquals("Volgon-Vwatter Prefect", suggestions.get(0).getDisplayName());
        Assert.assertEquals(2, suggestions.get(0).getFollowersCount());

        Assert.assertEquals(99L, suggestions.get(1).getId());
        Assert.assertEquals("mrburns", suggestions.get(1).getAccountId());
        Assert.assertEquals("Mr.Burns Burns", suggestions.get(1).getDisplayName());
        Assert.assertEquals(1, suggestions.get(1).getFollowersCount());

        // -- now only ask for 1
        suggestions = sut.execute(new SuggestedStreamsRequest(42, 1));
        Assert.assertEquals(1, suggestions.size());
        Assert.assertEquals(142L, suggestions.get(0).getId());
        Assert.assertEquals("fordp2", suggestions.get(0).getAccountId());
        Assert.assertEquals("Volgon-Vwatter Prefect", suggestions.get(0).getDisplayName());
        Assert.assertEquals(2, suggestions.get(0).getFollowersCount());

        // -- now follow 99, which will no longer suggest it
        getEntityManager().persist(new Follower(42, 99));
        suggestions = sut.execute(new SuggestedStreamsRequest(42, 5));
        Assert.assertEquals(1, suggestions.size());
        Assert.assertEquals(142L, suggestions.get(0).getId());
        Assert.assertEquals("fordp2", suggestions.get(0).getAccountId());
        Assert.assertEquals("Volgon-Vwatter Prefect", suggestions.get(0).getDisplayName());
View Full Code Here

        getEntityManager().createQuery("DELETE FROM GroupFollower").executeUpdate();
        getEntityManager().createQuery("DELETE FROM Follower").executeUpdate();

        // ---
        // person 42 is following 142, 4507, 98, 99
        getEntityManager().persist(new Follower(42, 142));
        getEntityManager().persist(new Follower(42, 4507));
        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));
View Full Code Here

TOP

Related Classes of org.eurekastreams.server.domain.Follower$FollowerPk

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.