Package com.iqser.core.model

Examples of com.iqser.core.model.Content


   */
  private List<Content> contents4Synch(Note note) {
    List<Content> contentList = new ArrayList<Content>();

    // post
    Content content = note2Content(note);
    contentList.add(content);

    // the API does not retrieve comments and likes
    // add comments
    List<Comment> noteComments = getFbClient().getFacebookConnectionByID(
        note.getId() + "/comments", Comment.class);
    addComments(content, noteComments);

    // add likes
    List<NamedFacebookType> likes = getFbClient().getFacebookConnectionByID(
        note.getId() + "/likes", NamedFacebookType.class);
    addLikes(content, likes);

    // for each comment create a new content
    if (noteComments != null) {
      for (Comment comment : noteComments) {
        Content commentContent = comment2Content(comment);
        contentList.add(commentContent);
      }
    }

    return contentList;
View Full Code Here


    String fbid = resp.getId();

    String contentURL = URLUtils.makeContentURL(fbid, "note");

    // get object from facebook
    Content newContent = getContent(contentURL);
    // add object in GIN graph
    getFbContentProvider().facebookAddContent(newContent);

    // change content URL
    content.setContentUrl(contentURL);
View Full Code Here

   
    public void testGetContent(){
     
      String contentURL = "facebook/accessTokenKey/19292868552_475058873552_14173716/comment";
     
      Content c = builder.getContent(contentURL);
         
      assertEquals(fbcp.getId(), c.getProvider());
      assertEquals(ContentTypeEnum.COMMENT.name(), c.getType());
      assertEquals(contentURL, c.getContentUrl());
      assertTrue(c.getModificationDate() > 0);
             
      assertTrue(c.getAttributes().size() > 0);
     
      assertEquals("19292868552_475058873552_14173716", c.getAttributeByName("id").getValue());     
      assertEquals("19292868552_475058873552", c.getAttributeByName("parent_id").getValue());
     
      assertNotNull(c.getAttributeByName("created_time"));
      assertNotNull(c.getAttributeByName("from_id"));
      assertNotNull(c.getAttributeByName("from_name"));   
      assertNotNull(c.getAttributeByName("likes_count"));
     
      assertNotNull(c.getFulltext());       
    }
View Full Code Here

 
  public void testGetContent(){
   
    String contentURL = "facebook/accessTokenKey/122788341354/note";
   
    Content c = builder.getContent(contentURL);
       
    assertEquals(fbcp.getId(), c.getProvider());
    assertEquals(ContentTypeEnum.NOTE.name(), c.getType());
    assertEquals(contentURL, c.getContentUrl());
           
    assertTrue(c.getAttributes().size() > 0);
   
    assertEquals("122788341354", c.getAttributeByName("id").getValue());
   
    assertTrue(c.getModificationDate() > 0);
   
    assertNotNull(c.getAttributeByName("created_time"));
    assertNotNull(c.getAttributeByName("updated_time"));
    assertNotNull(c.getAttributeByName("from_id"));
    assertNotNull(c.getAttributeByName("from_name"));
    assertNotNull(c.getAttributeByName("subject"));
    assertNotNull(c.getAttributeByName("icon"));
   
    assertNotNull(c.getFulltext());
   
    assertTrue(c.getAttributeByName("comments").isMultiValue());
    assertTrue(c.getAttributeByName("likes").isMultiValue());         
   
  }
View Full Code Here

 
  public void testPerformAction() throws IQserTechnicalException{
       
    assertEquals(0, repo.getContentByProvider(fbcp.getId()).size());
   
    Content noteContent = new Content();
    noteContent.setContentUrl(URLUtils.makeContentURL("noIdYet", "note"));
    noteContent.getAttributes().add(new Attribute("subject","My test note",Attribute.ATTRIBUTE_TYPE_TEXT));
    noteContent.getAttributes().add(new Attribute("message","Check out this funny article",Attribute.ATTRIBUTE_TYPE_TEXT));
           
    builder.performAction(FacebookContentProvider.ACTION_POST, noteContent);
   
    String fbid = URLUtils.getFbId(noteContent.getContentUrl());
   
    //note should be removed from object graph
    assertEquals(1, repo.getContentByProvider(fbcp.getId()).size());
    //note should be in from Facebook   
    assertTrue(fbClient.getObjectExistsOnFacebook(fbid));
                             
    //delete content
    Content newContent = builder.getContent(noteContent.getContentUrl());
    builder.performAction(FacebookContentProvider.ACTION_DELETE, newContent);

    //note should be removed from object graph
    assertEquals(0, repo.getContentByProvider(fbcp.getId()).size());
    //note should be removed from Facebook   
View Full Code Here

 
  public void testGetContent(){
   
    String contentURL = "facebook/accessTokenKey/19292868552_118464504835613/post";
   
    Content c = builder.getContent(contentURL);
       
    assertEquals(fbcp.getId(), c.getProvider());
    assertEquals(ContentTypeEnum.POST.name(), c.getType());
    assertEquals(contentURL, c.getContentUrl());
           
    assertTrue(c.getAttributes().size() > 0);
   
    assertEquals("19292868552_118464504835613", c.getAttributeByName("id").getValue());
   
    assertNotNull(c.getAttributeByName("created_time"));
    assertNotNull(c.getAttributeByName("updated_time"));
    assertNotNull(c.getAttributeByName("from_id"));
    assertNotNull(c.getAttributeByName("from_name"));   
    assertNotNull(c.getAttributeByName("to"));
    assertTrue(c.getAttributeByName("to").isMultiValue());
   
    assertNotNull(c.getFulltext());       
  }
View Full Code Here

 
 
  public void testPerformAction() throws IQserTechnicalException{
    assertEquals(0, repo.getContentByProvider(fbcp.getId()).size());
   
    Content noteContent = new Content();
    noteContent.setContentUrl(URLUtils.makeContentURL("noIdYet", "note"));
    noteContent.getAttributes().add(new Attribute("name","My post name",Attribute.ATTRIBUTE_TYPE_TEXT));
    noteContent.getAttributes().add(new Attribute("message","Check out this funny article",Attribute.ATTRIBUTE_TYPE_TEXT));   
           
    builder.performAction(FacebookContentProvider.ACTION_POST, noteContent);
   
    String fbid = URLUtils.getFbId(noteContent.getContentUrl());
   
    //note should be removed from object graph
    assertEquals(1, repo.getContentByProvider(fbcp.getId()).size());
    //note should be in from Facebook   
    assertTrue(fbClient.getObjectExistsOnFacebook(fbid));
           
    //delete content
    Content newContent = builder.getContent(noteContent.getContentUrl());
    builder.performAction(FacebookContentProvider.ACTION_DELETE, newContent);

    //note should be removed from object graph
    assertEquals(0, repo.getContentByProvider(fbcp.getId()).size());
    //note should be removed from Facebook   
View Full Code Here

 
 
  public void testPerformActionOnFriendWall() throws IQserTechnicalException{
    assertEquals(0, repo.getContentByProvider(fbcp.getId()).size());
   
    Content noteContent = new Content();
    noteContent.setContentUrl(URLUtils.makeContentURL("noIdYet", "note"));
    noteContent.getAttributes().add(new Attribute("name","My post name",Attribute.ATTRIBUTE_TYPE_TEXT));
    noteContent.getAttributes().add(new Attribute("message","Check out this funny article",Attribute.ATTRIBUTE_TYPE_TEXT));
    noteContent.getAttributes().add(new Attribute("from_id","543824877",Attribute.ATTRIBUTE_TYPE_TEXT));   
           
    builder.performAction(FacebookContentProvider.ACTION_POST, noteContent);
   
    String fbid = URLUtils.getFbId(noteContent.getContentUrl());
   
    //note should be removed from object graph
    assertEquals(1, repo.getContentByProvider(fbcp.getId()).size());
    //note should be in from Facebook   
    assertTrue(fbClient.getObjectExistsOnFacebook(fbid));
           
    //delete content
    Content newContent = builder.getContent(noteContent.getContentUrl());
    builder.performAction(FacebookContentProvider.ACTION_DELETE, newContent);

    //note should be removed from object graph
    assertEquals(0, repo.getContentByProvider(fbcp.getId()).size());
    //note should be removed from Facebook   
View Full Code Here

  }

  public void testPerformPostAction() throws IQserTechnicalException {
    assertEquals(0, repository.getContentByProvider(contentProvider.getId()).size());
   
    Content statusContent = new Content();
    statusContent.setContentUrl(URLUtils.makeContentURL("noIdYet", "status"));
    statusContent.getAttributes().add(new Attribute("message","Random status message",Attribute.ATTRIBUTE_TYPE_TEXT));   
           
    statusBuilder.performAction(FacebookContentProvider.ACTION_POST, statusContent);
   
    String fbid = URLUtils.getFbId(statusContent.getContentUrl());
   
    //status should be removed from object graph
    assertEquals(1, repository.getContentByProvider(contentProvider.getId()).size());
    //status should be in from Facebook   
    assertTrue(fbClient.getObjectExistsOnFacebook(fbid));
View Full Code Here

    }
  }

  public void testGetContent() {
    String contentURL = "facebook/accessTokenKey/10150230402319878/status";
    Content c = statusBuilder.getContent(contentURL);

    assertEquals(contentProvider.getId(), c.getProvider());
    assertEquals(ContentTypeEnum.STATUS.name(), c.getType());
    assertEquals(contentURL, c.getContentUrl());

    assertTrue(c.getAttributes().size() > 0);

    assertEquals("10150230402319878", c.getAttributeByName("id").getValue());
    assertEquals("FB_App publish test", c.getAttributeByName("message").getValue());
    assertEquals("George Boosley", c.getAttributeByName("from_name").getValue());
  }
View Full Code Here

TOP

Related Classes of com.iqser.core.model.Content

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.