Package org.eurekastreams.server.domain

Examples of org.eurekastreams.server.domain.Background


    @Test
    public void testInsert()
    {
        final long personId = 142L;
        Person person = jpaPersonMapper.findById(personId);
        Background background = new Background(person);
        jpaBackgroundMapper.insert(background);
        long backgroundId = background.getId();
        jpaBackgroundMapper.getEntityManager().clear();

        assertTrue("Inserting a Background did not get a positive id.", jpaBackgroundMapper.findById(backgroundId)
                .getId() > 0);
    }
View Full Code Here


     */
    @Test
    public void testDelete()
    {
        final long backgroundId = 1042L;
        Background background = jpaBackgroundMapper.findById(backgroundId);
        jpaBackgroundMapper.delete(background);

        try
        {
            background = jpaBackgroundMapper.findById(backgroundId);
View Full Code Here

     */
    @Test
    public void testfindPersonBackground()
    {
        final String openSocialId = "2d359911-0977-418a-9490-57e8252b1a42";
        Background background = jpaBackgroundMapper.findPersonBackground(openSocialId);

        assertNotNull("No background found", background);
    }
View Full Code Here

    public void testfindPersonBackgroundItems()
    {
        final long personId = 142L;
        final String openSocialId = "2d359911-0977-418a-9490-57e8252b1142";
        Person person = jpaPersonMapper.findById(personId);
        Background background = new Background(person);

        jpaBackgroundMapper.insert(background);

        List<BackgroundItem> expectedBackgroundItems = new ArrayList<BackgroundItem>();
        expectedBackgroundItems.add(new BackgroundItem("sports", BackgroundItemType.INTEREST));
        expectedBackgroundItems.add(new BackgroundItem("music", BackgroundItemType.INTEREST));
        expectedBackgroundItems.add(new BackgroundItem("software", BackgroundItemType.INTEREST));
        background.setBackgroundItems(expectedBackgroundItems, BackgroundItemType.HONOR);

        jpaBackgroundMapper.getEntityManager().flush();
        jpaBackgroundMapper.getEntityManager().clear();

        background = jpaBackgroundMapper.findPersonBackground(openSocialId);

        assertNotNull("No background items found for person with id fordp", background
                .getBackgroundItems(BackgroundItemType.HONOR));

        // the list.toString() prints out the same thing though they are
        // different objects
        assertEquals(expectedBackgroundItems.toString(), background.getBackgroundItems(BackgroundItemType.HONOR)
                .toString());

    }
View Full Code Here

     * Test that null is returned when findPersonBackground() is called for a user that doesn't have a background.
     */
    @Test
    public void testFindPersonBackgroundWithNoData()
    {
        Background background = jpaBackgroundMapper.findPersonBackground("2d359911-0977-418a-9490-57e8252b1a98");

        assertNull(background);
    }
View Full Code Here

    @Test
    public void testFindOrCreatePersonBackground()
    {
        String openSocialId = "2d359911-0977-418a-9490-57e8252b1a98";

        Background background = jpaBackgroundMapper.findOrCreatePersonBackground(openSocialId);

        assertNotNull(background);

        Background confirmBg = jpaBackgroundMapper.findById(background.getId());

        assertEquals(background, confirmBg);
    }
View Full Code Here

    @Test
    public void testFindOrCreatePersonBackgroundWithExistingBackground()
    {
        String openSocialId = "2d359911-0977-418a-9490-57e8252b1a42";

        Background background = jpaBackgroundMapper.findOrCreatePersonBackground(openSocialId);

        assertNotNull(background);

        Background confirmBg = jpaBackgroundMapper.findById(background.getId());

        assertEquals(background, confirmBg);
    }
View Full Code Here

     */
    @Test
    public void performActionWithValidAcctIdParameter() throws Exception
    {
        List<BackgroundItem> bgItems = new ArrayList<BackgroundItem>();
        final Background bg = new Background(null);
        bg.setBackgroundItems(bgItems, BackgroundItemType.SKILL);
        final String username = "ntid1234";

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

     */
    @Test
    public void testObjectToString()
    {
        Person person = context.mock(Person.class);
        Background bg = new Background(person);

        bg.setBackgroundItems(Arrays.asList(new BackgroundItem("ACM", BackgroundItemType.SKILL), new BackgroundItem(
                "Skull and Crossbones", BackgroundItemType.SKILL),
                new BackgroundItem("Java", BackgroundItemType.SKILL),
                new BackgroundItem("C#", BackgroundItemType.SKILL), new BackgroundItem("Technology",
                        BackgroundItemType.SKILL), new BackgroundItem("Apple", BackgroundItemType.SKILL),
                new BackgroundItem("SRA", BackgroundItemType.SKILL), new BackgroundItem("SPOT",
View Full Code Here

     */
    @Before
    public void setup()
    {

        background = new Background(new Person());


        background.setBackgroundItems(parseItems("a,b,c", BackgroundItemType.AFFILIATION),
                BackgroundItemType.AFFILIATION);
        background.setBackgroundItems(parseItems("d,e,f", BackgroundItemType.HONOR),
View Full Code Here

TOP

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

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.