Package org.eurekastreams.server.domain

Examples of org.eurekastreams.server.domain.Person


        String message = "lists should be set appropriately";

        final String email = "joe@schmoe.com";
        final String newEmail = "joe@gmail.com";
        Person person = new Person("jschmoe", "Joe", "X", "Schmoe", "Joey");
        person.setEmail(email);
        person.setWorkPhone("1234567890");
        person.setTitle("Better than you!");
        person.setJobDescription("ahhh, snuts!");

        HashMap<String, Serializable> map = new HashMap<String, Serializable>();
        map.put("email", newEmail);

        ReflectiveUpdater reflector = new ReflectiveUpdater();
        reflector.setProperties(person, map);

        assertEquals(message, newEmail, person.getEmail());

    }
View Full Code Here


    public void validateParams()
    {

        HashSet<Person> coordinators = new HashSet<Person>();

        Person fakePerson = context.mock(Person.class);
        coordinators.add(fakePerson);

        final HashMap<String, Serializable> formData = new HashMap<String, Serializable>();

        formData.put(DomainGroupModelView.URL_KEY, "http://lockheedmartin.com");
View Full Code Here

    {

        String message = "sets should be set appropriately";

        final DomainGroup group = new DomainGroup();
        final Person person = new Person("jschmoe", "Joe", "X", "Schmoe", "Joey");
        person.setEmail("joe@schmoe.com");
        person.setWorkPhone("1234567890");
        person.setTitle("Better than you!");
        person.setJobDescription("ahhh, snuts!");

        HashSet<Person> coords = new HashSet<Person>();
        coords.add(person);

        HashMap<String, Serializable> map = new HashMap<String, Serializable>();
View Full Code Here

    public void inValidateParamsHackingAttempt()
    {

        HashSet<Person> coordinators = new HashSet<Person>();

        Person fakePerson = context.mock(Person.class);
        coordinators.add(fakePerson);

        final HashMap<String, Serializable> formData = new HashMap<String, Serializable>();

        formData.put(DomainGroupModelView.ID_KEY, 2L);
View Full Code Here

     */
    private List<Gadget> makeGadgets()
    {
        List<Gadget> gadgetList = new ArrayList<Gadget>();
        gadgetList.add(new Gadget(new GadgetDefinition("gadget0", UUID.randomUUID().toString(),
                 new GalleryItemCategory("somecategory")), 0, 0, new Person(), ""));
        gadgetList.add(new Gadget(new GadgetDefinition("gadget1", UUID.randomUUID().toString(),
                 new GalleryItemCategory("somecategory")), 0, 1, new Person(), ""));
        gadgetList.add(new Gadget(new GadgetDefinition("gadget2", UUID.randomUUID().toString(),
                 new GalleryItemCategory("somecategory")), 1, 0, new Person(), ""));
        gadgetList.add(new Gadget(new GadgetDefinition("gadget3", UUID.randomUUID().toString(),
                 new GalleryItemCategory("somecategory")), 1, 1, new Person(), ""));
        gadgetList.add(new Gadget(new GadgetDefinition("gadget4", UUID.randomUUID().toString(),
                 new GalleryItemCategory("somecategory")), 1, 2, new Person(), ""));
        gadgetList.add(new Gadget(new GadgetDefinition("gadget5", UUID.randomUUID().toString(),
                 new GalleryItemCategory("somecategory")), 2, 0, new Person(), ""));
        gadgetList.add(new Gadget(new GadgetDefinition("gadget6", UUID.randomUUID().toString(),
                 new GalleryItemCategory("somecategory")), 2, 1, new Person(), ""));

        return gadgetList;
    }
View Full Code Here

    @Test
    public void testAddFollower()
    {
        DomainGroup group = jpaGroupMapper.findByShortName("group1");

        Person fordp2 = jpaPersonMapper.findByAccountId("fordp2");
        Person csagan = jpaPersonMapper.findByAccountId("csagan");

        // Verify initial state
        assertFalse(jpaGroupMapper.isFollowing("fordp2", "group1"));
        assertFalse(jpaGroupMapper.isFollowing("csagan", "group1"));
        assertEquals(0, fordp2.getFollowingCount());
        assertEquals(0, fordp2.getGroupCount());
        assertEquals(0, csagan.getFollowingCount());
        assertEquals(1, csagan.getGroupCount());

        // ford wants to follow the group
        jpaGroupMapper.addFollower(fordp2.getId(), group.getId());

        getEntityManager().clear();

        fordp2 = jpaPersonMapper.findByAccountId("fordp2");
        csagan = jpaPersonMapper.findByAccountId("csagan");

        // verify new state
        assertTrue(jpaGroupMapper.isFollowing("fordp2", "group1"));
        // Test case insensitivity (everything should be lower cased by the mapper).
        assertTrue(jpaGroupMapper.isFollowing("fordp2", "Group1"));
        assertFalse(jpaGroupMapper.isFollowing("csagan", "group1"));
        assertEquals(0, fordp2.getFollowingCount());
        assertEquals(1, fordp2.getGroupCount());
        assertEquals(0, csagan.getFollowingCount());
        assertEquals(1, csagan.getGroupCount());

        // csagan wants to follow the group
        jpaGroupMapper.addFollower(csagan.getId(), group.getId());

        getEntityManager().clear();

        fordp2 = jpaPersonMapper.findByAccountId("fordp2");
        csagan = jpaPersonMapper.findByAccountId("csagan");

        // verify new state
        assertTrue(jpaGroupMapper.isFollowing("fordp2", "group1"));
        assertTrue(jpaGroupMapper.isFollowing("csagan", "group1"));
        // and verify csagan's counts after the change
        assertEquals(0, csagan.getFollowingCount());
        assertEquals(2, csagan.getGroupCount());
    }
View Full Code Here

    public void testAddFollowerWhenAlreadyFollowing()
    {
        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

    public void testInputUserIsGroupCoordinator()
    {
        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);
View Full Code Here

    public void testInputUserIsNotGroupCoordinator()
    {
        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

    public void testGetGroupCoordinatorCount()
    {
        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);
View Full Code Here

TOP

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

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.