Package org.apache.rave.portal.model.impl

Examples of org.apache.rave.portal.model.impl.ActivityStreamsObjectImpl


    @Before
    public void setup() {
        conversionUtilTest=new ActivityConversionUtil();

        activityStreamsEntry = new ActivityStreamsEntryImpl();
        activityStreamsObject = new ActivityStreamsObjectImpl();
        authorObject = new ActivityStreamsObjectImpl();
        authorObject.setDisplayName("Test Author");
        activityStreamsObject.setAuthor(authorObject);
        activityStreamsObject.setDisplayName("Test Streams Object");
        activityStreamsObject.setPublished(new Date());
        activityStreamsObject.setId("Test ID");
        activityStreamsEntry.setUserId(ID_1);
        activityStreamsEntry.setActor(activityStreamsObject);
        activityStreamsEntry.setContent("Activity Content");
        activityStreamsEntry.setGenerator(new ActivityStreamsObjectImpl());
        activityStreamsEntry.setIcon(new ActivityStreamsMediaLinkImpl());
        activityStreamsEntry.setId(ACTIVITY_ID);
        activityStreamsEntry.setObject(activityStreamsObject);
        activityStreamsEntry.setPublished(new Date());
        activityStreamsEntry.setProvider(new ActivityStreamsObjectImpl());
        activityStreamsEntry.setTarget(new ActivityStreamsObjectImpl());
        activityStreamsEntry.setTitle(ACTIVITY_TITLE);
        activityStreamsEntry.setUpdated(new Date());
        activityStreamsEntry.setUrl("Activity URL");
        activityStreamsEntry.setVerb("Activity Verb");
        activityStreamsEntry.setOpenSocial(new ActivityObjectImpl());
        activityObjects = new ArrayList<ActivityObject>();
        activityObjects.add(new ActivityObjectImpl());

        activityStreamsObjects = new ArrayList<ActivityStreamsObjectImpl>();
        activityStreamsObjects.add(new ActivityStreamsObjectImpl());

        activityEntry = new ActivityEntryImpl();
        activityEntry.setId("entry id");
        activityEntry.setTitle("activity title");
        activityEntry.setVerb("activity verb");
View Full Code Here


        if (activity.getExtensions()!=null){entity.setExtensions(convert(activity.getExtensions())); }
        return entity;
    }

    public ActivityStreamsObject convert(ActivityObject object){
        ActivityStreamsObject entity = new ActivityStreamsObjectImpl();

        if (object.getAuthor()!=null){entity.setAuthor(convert(object.getAuthor()));}
        if (object.getAttachments()!=null){entity.setAttachments(convertObjectEntries(object.getAttachments()));}
        if (object.getContent()!=null){ entity.setContent(object.getContent());}
        if (object.getDisplayName()!=null){ entity.setDisplayName(object.getDisplayName());}
        if (object.getDownstreamDuplicates()!=null){entity.setDownstreamDuplicates(object.getDownstreamDuplicates());}
        if (object.getId()!=null){ entity.setId(object.getId());   }
        if (object.getImage()!=null){entity.setImage(convert(object.getImage()));}
        if (object.getObjectType()!=null){entity.setObjectType(object.getObjectType())}
        if (object.getPublished()!=null){entity.setPublished(ModelUtil.stringToDate(object.getPublished()));   }
        if (object.getSummary()!=null){entity.setSummary(object.getSummary())}
        if (object.getUpdated()!=null){entity.setUpdated(ModelUtil.stringToDate(object.getUpdated()));   }
        if (object.getUpstreamDuplicates()!=null){entity.setUpstreamDuplicates(object.getUpstreamDuplicates()); }
        if (object.getUrl()!=null){entity.setUrl(object.getUrl())}
        if (object.getOpenSocial()!=null){entity.setOpenSocial(convert(object.getOpenSocial()))}
        return entity;

    }
View Full Code Here

    }


    @Test
    public void convertValid() {
        ActivityStreamsObject template = new ActivityStreamsObjectImpl();
        template.setContent("TEST_A");
        template.setDisplayName("TEST_B");
        template.setDc("TEST_C");
        template.setLd("TEST_D");
        template.setDc("TEST_E");
        template.setMood("TEST_F");
        template.setLocation("TEST_G");
        template.setRating("TEST_H");
        template.setSource("TEST_I");
        template.setLinks("TEST_J");



        JpaActivityStreamsObject jpaTemplate = converter.convert(template);

        assertThat(jpaTemplate, is(not(sameInstance(template))));
        assertThat(jpaTemplate, is(instanceOf(JpaActivityStreamsObject.class)));
        assertThat(jpaTemplate.getContent(), is(equalTo(template.getContent())));
        assertThat(jpaTemplate.getDisplayName(), is(equalTo(template.getDisplayName())));
        assertThat(jpaTemplate.getContent(), is(equalTo(template.getContent())));
        assertThat(jpaTemplate.getDc(), is(equalTo(template.getDc())));
        assertThat(jpaTemplate.getMood(), is(equalTo(template.getMood())));
        assertThat(jpaTemplate.getLocation(), is(equalTo(template.getLocation())));
        assertThat(jpaTemplate.getRating(), is(equalTo(template.getRating())));
        assertThat(jpaTemplate.getSource(), is(equalTo(template.getSource())));
        assertThat(jpaTemplate.getLinks(), is(equalTo(template.getLinks())));

    }
View Full Code Here

        service = new DefaultActivityStreamsService(repository,personService);

        conversionUtilTest=new ActivityConversionUtil();

        activityStreamsEntry = new ActivityStreamsEntryImpl();
        activityStreamsObject = new ActivityStreamsObjectImpl();
        authorObject = new ActivityStreamsObjectImpl();
        authorObject.setDisplayName("Test Author");
        activityStreamsObject.setAuthor(authorObject);
        activityStreamsObject.setDisplayName("Test Streams Object");
        activityStreamsObject.setPublished(new Date());
        activityStreamsObject.setId("Test ID");
        activityStreamsEntry.setUserId(ID_1);
        activityStreamsEntry.setActor(activityStreamsObject);
        activityStreamsEntry.setContent("Activity Content");
        activityStreamsEntry.setGenerator(new ActivityStreamsObjectImpl());
        activityStreamsEntry.setIcon(new ActivityStreamsMediaLinkImpl());
        activityStreamsEntry.setId(ACTIVITY_ID);
        activityStreamsEntry.setObject(activityStreamsObject);
        activityStreamsEntry.setPublished(new Date());
        activityStreamsEntry.setProvider(new ActivityStreamsObjectImpl());
        activityStreamsEntry.setTarget(new ActivityStreamsObjectImpl());
        activityStreamsEntry.setTitle(ACTIVITY_TITLE);
        activityStreamsEntry.setUpdated(new Date());
        activityStreamsEntry.setUrl("Activity URL");
        activityStreamsEntry.setVerb("Activity Verb");
        activityStreamsEntry.setOpenSocial(new ActivityObjectImpl());
View Full Code Here

import static org.junit.Assert.*;

public class ActivityStreamsObjectTest {
    public static ActivityStreamsObjectImpl testEntity() {
      ActivityStreamsObjectImpl tst = new ActivityStreamsObjectImpl();
      HashMap<String,String> hm = new HashMap<String,String>();
      hm.put("TEST", "TEST");
      hm.put("FOO", "BAR");
      List<String> ls=new ArrayList<String>();
      ls.add("faz");
      ls.add("baz");
      Date d = new Date(10000);

      ActivityStreamsObjectImpl author = new ActivityStreamsObjectImpl();
      author.setDisplayName("apache");
      author.setContent("foobar");

      tst.setUrl("http://apache.org");
      tst.setObjectType("COMMENT");
      tst.setOpenSocial(null);
      tst.setExtensions(hm);
View Full Code Here

    @Test
    public void convertAllTest() { 
      final int numToTest = 23;
      List<ActivityStreamsObjectImpl> ll=new LinkedList<ActivityStreamsObjectImpl>();
      ActivityStreamsObjectImpl tst = testEntity();
      for(int i = 0; i < numToTest; i ++) {
        ll.add(tst);
        tst = testEntity();
      }
      List tstList = tst.convertAll(ll);
      assertEquals(numToTest, tstList.size());
    }
View Full Code Here

        service = new DefaultActivityStreamsService(repository,personService);

        conversionUtilTest=new ActivityConversionUtil();

        activityStreamsEntry = new ActivityStreamsEntryImpl();
        activityStreamsObject = new ActivityStreamsObjectImpl();
        authorObject = new ActivityStreamsObjectImpl();
        authorObject.setDisplayName("Test Author");
        activityStreamsObject.setAuthor(authorObject);
        activityStreamsObject.setDisplayName("Test Streams Object");
        activityStreamsObject.setPublished(new Date());
        activityStreamsObject.setId("Test ID");
        activityStreamsEntry.setUserId(ID_1);
        activityStreamsEntry.setActor(activityStreamsObject);
        activityStreamsEntry.setContent("Activity Content");
        activityStreamsEntry.setGenerator(new ActivityStreamsObjectImpl());
        activityStreamsEntry.setIcon(new ActivityStreamsMediaLinkImpl());
        activityStreamsEntry.setId(ACTIVITY_ID);
        activityStreamsEntry.setObject(activityStreamsObject);
        activityStreamsEntry.setPublished(new Date());
        activityStreamsEntry.setProvider(new ActivityStreamsObjectImpl());
        activityStreamsEntry.setTarget(new ActivityStreamsObjectImpl());
        activityStreamsEntry.setTitle(ACTIVITY_TITLE);
        activityStreamsEntry.setUpdated(new Date());
        activityStreamsEntry.setUrl("Activity URL");
        activityStreamsEntry.setVerb("Activity Verb");
        activityStreamsEntry.setOpenSocial(new ActivityObjectImpl());
View Full Code Here

    @Before
    public void setup() {
        conversionUtilTest=new ActivityConversionUtil();

        activityStreamsEntry = new ActivityStreamsEntryImpl();
        activityStreamsObject = new ActivityStreamsObjectImpl();
        authorObject = new ActivityStreamsObjectImpl();
        authorObject.setDisplayName("Test Author");
        activityStreamsObject.setAuthor(authorObject);
        activityStreamsObject.setDisplayName("Test Streams Object");
        activityStreamsObject.setPublished(new Date());
        activityStreamsObject.setId("Test ID");
        activityStreamsEntry.setUserId(ID_1);
        activityStreamsEntry.setActor(activityStreamsObject);
        activityStreamsEntry.setContent("Activity Content");
        activityStreamsEntry.setGenerator(new ActivityStreamsObjectImpl());
        activityStreamsEntry.setIcon(new ActivityStreamsMediaLinkImpl());
        activityStreamsEntry.setId(ACTIVITY_ID);
        activityStreamsEntry.setObject(activityStreamsObject);
        activityStreamsEntry.setPublished(new Date());
        activityStreamsEntry.setProvider(new ActivityStreamsObjectImpl());
        activityStreamsEntry.setTarget(new ActivityStreamsObjectImpl());
        activityStreamsEntry.setTitle(ACTIVITY_TITLE);
        activityStreamsEntry.setUpdated(new Date());
        activityStreamsEntry.setUrl("Activity URL");
        activityStreamsEntry.setVerb("Activity Verb");
        activityStreamsEntry.setOpenSocial(new ActivityObjectImpl());
        activityObjects = new ArrayList<ActivityObject>();
        activityObjects.add(new ActivityObjectImpl());

        activityStreamsObjects = new ArrayList<ActivityStreamsObjectImpl>();
        activityStreamsObjects.add(new ActivityStreamsObjectImpl());

        activityEntry = new ActivityEntryImpl();
        activityEntry.setId("entry id");
        activityEntry.setTitle("activity title");
        activityEntry.setVerb("activity verb");
View Full Code Here

        if (activity.getExtensions()!=null){entity.setExtensions(convert(activity.getExtensions())); }
        return entity;
    }

    public ActivityStreamsObject convert(ActivityObject object){
        ActivityStreamsObject entity = new ActivityStreamsObjectImpl();

        if (object.getAuthor()!=null){entity.setAuthor(convert(object.getAuthor()));}
        if (object.getAttachments()!=null){entity.setAttachments(convertObjectEntries(object.getAttachments()));}
        if (object.getContent()!=null){ entity.setContent(object.getContent());}
        if (object.getDisplayName()!=null){ entity.setDisplayName(object.getDisplayName());}
        if (object.getDownstreamDuplicates()!=null){entity.setDownstreamDuplicates(object.getDownstreamDuplicates());}
        if (object.getId()!=null){ entity.setId(object.getId());   }
        if (object.getImage()!=null){entity.setImage(convert(object.getImage()));}
        if (object.getObjectType()!=null){entity.setObjectType(object.getObjectType())}
        if (object.getPublished()!=null){entity.setPublished(ModelUtil.stringToDate(object.getPublished()));   }
        if (object.getSummary()!=null){entity.setSummary(object.getSummary())}
        if (object.getUpdated()!=null){entity.setUpdated(ModelUtil.stringToDate(object.getUpdated()));   }
        if (object.getUpstreamDuplicates()!=null){entity.setUpstreamDuplicates(object.getUpstreamDuplicates()); }
        if (object.getUrl()!=null){entity.setUrl(object.getUrl())}
        if (object.getOpenSocial()!=null){entity.setOpenSocial(convert(object.getOpenSocial()))}
        return entity;

    }
View Full Code Here

    }


    @Test
    public void convertValid() {
        ActivityStreamsObject template = new ActivityStreamsObjectImpl();
        template.setContent("TEST_A");
        template.setDisplayName("TEST_B");
        template.setDc("TEST_C");
        template.setLd("TEST_D");
        template.setDc("TEST_E");
        template.setMood("TEST_F");
        template.setLocation("TEST_G");
        template.setRating("TEST_H");
        template.setSource("TEST_I");
        template.setLinks("TEST_J");



        JpaActivityStreamsObject jpaTemplate = converter.convert(template);

        assertThat(jpaTemplate, is(not(sameInstance(template))));
        assertThat(jpaTemplate, is(instanceOf(JpaActivityStreamsObject.class)));
        assertThat(jpaTemplate.getContent(), is(equalTo(template.getContent())));
        assertThat(jpaTemplate.getDisplayName(), is(equalTo(template.getDisplayName())));
        assertThat(jpaTemplate.getContent(), is(equalTo(template.getContent())));
        assertThat(jpaTemplate.getDc(), is(equalTo(template.getDc())));
        assertThat(jpaTemplate.getMood(), is(equalTo(template.getMood())));
        assertThat(jpaTemplate.getLocation(), is(equalTo(template.getLocation())));
        assertThat(jpaTemplate.getRating(), is(equalTo(template.getRating())));
        assertThat(jpaTemplate.getSource(), is(equalTo(template.getSource())));
        assertThat(jpaTemplate.getLinks(), is(equalTo(template.getLinks())));

    }
View Full Code Here

TOP

Related Classes of org.apache.rave.portal.model.impl.ActivityStreamsObjectImpl

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.