Package org.eurekastreams.server.domain

Examples of org.eurekastreams.server.domain.Person


     * Test the DBUnit XML Dataset - person.
     */
    @Test
    public void testDBUnitDatasetPerson()
    {
        Person ford = jpaPersonMapper.findByAccountId("fordp");
        assertEquals("Expected the first name of the user with accountId='fordp' to be 'Ford' from DBUnit setup.",
                "Ford", ford.getFirstName());
        assertEquals("Expected the last name of the user with accountId='fordp' to be 'Prefect' from DBUnit setup.",
                "Prefect", ford.getLastName());
        assertEquals("Expected the preferred name of the user with accountId='fordp' "
                + "to be 'Volgon-Swatter' from DBUnit setup.", "Volgon-Swatter", ford.getPreferredName());
    }
View Full Code Here


     * Test the DBUnit XML Dataset - tabs.
     */
    @Test
    public void testDBUnitDatasetTabs()
    {
        Person ford = jpaPersonMapper.findByAccountId("fordp");
        TabGroup tabGroup = ford.getStartTabGroup();
        List<Tab> tabs = tabGroup.getTabs();

        // Assert the order is 1,2,3
        assertEquals("Expected Ford's first tab in his first TabGroup to be called 'Ford Tab 1' from DBUnit setup.",
                "Ford Tab 1", tabs.get(0).getTabName());
View Full Code Here

    public void testInsert()
    {
        final long id = 4231L;
        TabGroup tg = jpaTabGroupMapper.findById(id);

        Person p = new Person("ndtyson", "Neil", "d", "deGrasse Tyson", "Dr. To You");
        p.setWorkPhone("1234567890");
        p.setTitle("Better than you!");
        p.setEmail("foo.blah@example.com");
        p.setJobDescription("some description!");
        p.setStartTabGroup(tg);
        jpaPersonMapper.insert(p);
        assertTrue("Inserting a Person did not get a positive id.",
                jpaPersonMapper.findByAccountId("ndtyson").getId() > 0);
    }
View Full Code Here

    public void testInsertWithProfileProperties()
    {
        final long id = 4231L;
        TabGroup tg = jpaTabGroupMapper.findById(id);

        Person p = new Person("yoyojoe", "Joe", "hey", "Yoyo", "Call Me Joe");
        p.setWorkPhone("1234567890");
        p.setTitle("Better than you!");
        p.setEmail("foo.blah@example.com");
        p.setJobDescription("some description!");
        p.setAvatarId("avatar");
        p.setStartTabGroup(tg);

        // phone types not set should return null.
        assertNull("Phone types not set should return null", p.getCellPhone());
        assertNull("Phone types not set should return null", p.getFax());

        p.setCellPhone("5555555555");
        p.setFax("4444444444");

        jpaPersonMapper.insert(p);
        assertTrue("Inserting a Person did not get a positive id.",
                jpaPersonMapper.findByAccountId("yoyojoe").getId() > 0);

        this.getEntityManager().clear();
        Person sut = jpaPersonMapper.findByAccountId("yoyojoe");
        assertTrue(sut.getTitle().equals("Better than you!"));
        assertTrue(sut.getEmail().equals("foo.blah@example.com"));
        assertTrue(sut.getJobDescription().equals("some description!"));
        assertTrue("1234567890".equals(sut.getWorkPhone()));
        assertTrue("5555555555".equals(sut.getCellPhone()));
        assertTrue("4444444444".equals(sut.getFax()));
        assertTrue("avatar".equals(sut.getAvatarId()));
        assertEquals(id, sut.getStartTabGroup().getId());
    }
View Full Code Here

                oneOf(ppr).getTheme();
                will(returnValue(null));
            }
        });

        Person p = sut.get(null, inFields);
        context.assertIsSatisfied();

        assertNotNull(p);
        assertNotNull(p.getStartTabGroup());
        assertEquals("nflanders", p.getAccountId());
        assertEquals("Ned", p.getFirstName());
        assertEquals("", p.getMiddleName());
        assertEquals("Flanders", p.getLastName());
        assertEquals("Ned-diddly", p.getPreferredName());
        assertEquals("", p.getDisplayNameSuffix());

        // test stream order
        // IDs: 1, 5, 3
        assertEquals(3, p.getStreams().size());
        assertEquals(1, p.getStreams().get(0).getId());
        assertEquals(5, p.getStreams().get(1).getId());
        assertEquals(3, p.getStreams().get(2).getId());
    }
View Full Code Here

     * Test adding a tab to a user's tab group persists when we update the person.
     */
    @Test
    public void testUpdateAddNewTab()
    {
        Person ford = jpaPersonMapper.findById(fordPersonId);
        ford.getStartTabGroup().getTabs().add(new Tab("Foo", Layout.THREECOLUMN));
        jpaPersonMapper.flush();

        getEntityManager().clear();

        ford = jpaPersonMapper.findById(fordPersonId);
        assertEquals("Attemped updating a Person after adding a Tab to his first "
                + "TabGroup, then clearing the EntityManager.  "
                + "Expected to see the new tab after re-loading the Person.", "Foo", ford.getStartTabGroup().getTabs()
                .get(ford.getStartTabGroup().getTabs().size() - 1).getTabName());
    }
View Full Code Here

        (readonlyStreamsMapper).setEntityManager(getEntityManager());
        List<String> streamNames = new ArrayList<String>(CollectionUtils.asList("My saved items", "Everyone"));

        PersonCreator localSut = new PersonCreator(personMapperMock, readonlyStreamsMapper, streamNames, ppg);

        Person p = localSut.get(null, inFields);
        context.assertIsSatisfied();

        assertNotNull(p);
        assertNotNull(p.getStartTabGroup());
        assertEquals("nflanders", p.getAccountId());
        assertEquals("Ned", p.getFirstName());
        assertEquals("", p.getMiddleName());
        assertEquals("Flanders", p.getLastName());
        assertEquals("Ned-diddly", p.getPreferredName());
        assertEquals(" SUFFIX", p.getDisplayNameSuffix());

        // test stream order
        // IDs: 1, 5,
        assertEquals(2, p.getStreams().size());
        assertEquals(5, p.getStreams().get(0).getId());
        assertEquals(1, p.getStreams().get(1).getId());
    }
View Full Code Here

     */
    @Test
    @ExpectedException(PersistenceException.class)
    public void testInsertThrowsExceptionWithExistingAccountIdOfSameCase()
    {
        jpaPersonMapper.insert(new Person("fordp", "Niels", "A", "Bohr", "Atom-Head"));
    }
View Full Code Here

     */
    @Test
    @ExpectedException(PersistenceException.class)
    public void testInsertThrowsExceptionWithExistingAccountIdOfDifferentCase()
    {
        jpaPersonMapper.insert(new Person("fOrDp", "Niels", "A", "Bohr", "Atom-Head"));
    }
View Full Code Here

    public void testTabOrder()
    {
        final int expectedTabCount = 3;

        // Load Ford, and rearrange his tabs
        Person ford = jpaPersonMapper.findByAccountId("fordp");
        TabGroup tabGroup = ford.getStartTabGroup();
        List<Tab> tabs = tabGroup.getTabs();

        Tab t2 = tabs.get(1);
        tabs.remove(t2);
        tabs.add(t2);

        // update all modified entities
        jpaPersonMapper.flush();

        // clear the entity manager
        getEntityManager().clear();

        // reload
        ford = jpaPersonMapper.findByAccountId("fordp");
        tabGroup = ford.getStartTabGroup();
        tabs = tabGroup.getTabs();

        // assert there's 3 tabs
        assertEquals("Ford Prefect should have 3 (non-deleted) tabs in the DBUnit fixture", expectedTabCount, tabs
                .size());
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.