Examples of DomainGroup


Examples of org.eurekastreams.server.domain.DomainGroup

     * Test objectToString with null mapper.
     */
    @Test
    public void testObjectToStringOnSuccess()
    {
        final DomainGroup group = context.mock(DomainGroup.class);
        final DomainGroupMapper groupMapper = context.mock(DomainGroupMapper.class);
        final Long[] personIds = { 1L, 2L, 5L, 8L, 10L, 382L };

        context.checking(new Expectations()
        {
View Full Code Here

Examples of org.eurekastreams.server.domain.DomainGroup

    {
        final long personId = 99L;
        final long groupId = 1L;

        Person p = jpaPersonMapper.findById(personId);
        DomainGroup g = jpaGroupMapper.findById(groupId);

        int initialGroupsCount = p.getGroupCount();
        int initialFollowersCount = g.getFollowersCount();

        // invoke SUT
        jpaGroupMapper.addFollower(p.getId(), g.getId());

        // clear the entity manager, reload the entities, and assert the counts haven't changed
        getEntityManager().clear();

        p = jpaPersonMapper.findById(personId);
        g = jpaGroupMapper.findById(groupId);

        assertEquals(initialGroupsCount, p.getGroupCount());
        assertEquals(initialFollowersCount, g.getFollowersCount());
    }
View Full Code Here

Examples of org.eurekastreams.server.domain.DomainGroup

    {
        final long personId = 99L;
        final long groupId = 1L;

        Person p = jpaPersonMapper.findById(personId);
        DomainGroup g = jpaGroupMapper.findById(groupId);

        if (!jpaGroupMapper.isInputUserGroupCoordinator(personId, groupId))
        {
            g.addCoordinator(p);
        }

        boolean result = jpaGroupMapper.isInputUserGroupCoordinator(personId, groupId);

        assertEquals(true, result);
View Full Code Here

Examples of org.eurekastreams.server.domain.DomainGroup

    {
        final long personId = 99L;
        final long groupId = 1L;

        Person p = jpaPersonMapper.findById(personId);
        DomainGroup g = jpaGroupMapper.findById(groupId);

        if (jpaGroupMapper.isInputUserGroupCoordinator(personId, groupId))
        {
            jpaGroupMapper.removeGroupCoordinator(personId, groupId);
        }
View Full Code Here

Examples of org.eurekastreams.server.domain.DomainGroup

    {
        final long personId = 99L;
        final long groupId = 1L;

        Person p = jpaPersonMapper.findById(personId);
        DomainGroup g = jpaGroupMapper.findById(groupId);

        int numberOfGroupCoordinators = g.getCoordinators().size();
        int result = jpaGroupMapper.getGroupCoordinatorCount(groupId);

        assertEquals(numberOfGroupCoordinators, result);
    }
View Full Code Here

Examples of org.eurekastreams.server.domain.DomainGroup

    {
        final long personId = 99L;
        final long groupId = 1L;

        Person p = jpaPersonMapper.findById(personId);
        DomainGroup g = jpaGroupMapper.findById(groupId);

        int numberOfGroupCoordinatorsBeforeRemoval = jpaGroupMapper.getGroupCoordinatorCount(groupId);

        Object[] groupCoordinators = g.getCoordinators().toArray();

        long firstGroupCoordinatorId = ((Person) groupCoordinators[0]).getEntityId();

        jpaGroupMapper.removeGroupCoordinator(firstGroupCoordinatorId, groupId);
View Full Code Here

Examples of org.eurekastreams.server.domain.DomainGroup

    {
        final long personId = 99L;
        final long groupId = 1L;

        Person p = jpaPersonMapper.findById(personId);
        DomainGroup g = jpaGroupMapper.findById(groupId);

        if (g.isPublicGroup())
        {
            g.setPublicGroup(false);
        }

        boolean result = jpaGroupMapper.isGroupPrivate(groupId);

        assertEquals(true, result);
View Full Code Here

Examples of org.eurekastreams.server.domain.DomainGroup

    {
        final long personId = 99L;
        final long groupId = 1L;

        Person p = jpaPersonMapper.findById(personId);
        DomainGroup g = jpaGroupMapper.findById(groupId);

        if (!g.isPublicGroup())
        {
            g.setPublicGroup(true);
        }

        boolean result = jpaGroupMapper.isGroupPrivate(groupId);

        assertEquals(false, result);
View Full Code Here

Examples of org.eurekastreams.server.domain.DomainGroup

     */
    @Test
    @Transactional
    public void testRemoveFollower()
    {
        DomainGroup group = jpaGroupMapper.findByShortName("group1");
        Person burns = jpaPersonMapper.findByAccountId("mrburns");

        assertEquals(0, burns.getFollowingCount());
        assertEquals(1, burns.getGroupCount());
        assertEquals(3, group.getFollowersCount());
        assertTrue(jpaGroupMapper.isFollowing("mrburns", "group1"));

        jpaGroupMapper.removeFollower(burns.getId(), group.getId());
        getEntityManager().clear();
        group = jpaGroupMapper.findByShortName("group1");
        burns = jpaPersonMapper.findByAccountId("mrburns");

        assertEquals(0, burns.getFollowingCount());
        assertEquals(0, burns.getGroupCount());
        assertEquals(2, group.getFollowersCount());
        assertFalse(jpaGroupMapper.isFollowing("mrburns", "group1"));
    }
View Full Code Here

Examples of org.eurekastreams.server.domain.DomainGroup

    @Test
    public void testGetFollowers()
    {
        final int maxFollowers = 10;

        DomainGroup group = jpaGroupMapper.findByShortName("group1");
        Person fordp2 = jpaPersonMapper.findByAccountId("fordp2");
        Person csagan = jpaPersonMapper.findByAccountId("csagan");

        PagedSet<Person> followers = jpaGroupMapper.getFollowers("group1", 0, maxFollowers);

        assertEquals(3, followers.getTotal());

        jpaGroupMapper.addFollower(fordp2.getId(), group.getId());
        jpaGroupMapper.addFollower(csagan.getId(), group.getId());

        followers = jpaGroupMapper.getFollowers("group1", 0, maxFollowers);

        assertEquals(5, followers.getTotal());
    }
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.