Package com.iqser.core.model

Examples of com.iqser.core.model.Content


    // add current status
    contentList.add(status2Content(sm));
   
    // get comments
    for (Comment c : sm.getComments()) {
      Content commentContent = comment2Content(c);
      contentList.add(commentContent);
    }
   
    return contentList;
  }
View Full Code Here


   */
  public Content getContent(String contentURL) {
    String statusID = URLUtils.getFbId(contentURL);
    StatusMessage sm = getFbClient().getFacebookObjectByID(statusID,
        StatusMessage.class);
    Content content = status2Content(sm);
    content.setContentUrl(contentURL);
   
    return content;
  }
View Full Code Here

   
 

  public void testDoHousekeeping() throws IQserTechnicalException {
    //add some content that does not exists in server
    Content deletedContent = createDummyContentFromUrl("facebook/atk1/100/post");
    repo.addContent(deletedContent);
   
    Content existingContent = createDummyContentFromUrl("facebook/atk2/101/comment");
    repo.addContent(existingContent);
   
    Collection<Content> contentList = (Collection<Content>)repo.getContentByProvider(fbcp.getId(), true);
    assertTrue(contentList.size()>0);
       
    //expected behavior   
    expect(mockFactory.createFacebookAPIClient(EasyMock.anyObject(String.class))).andReturn(mockFbClient).anyTimes();
    expect(mockFbClient.getObjectExistsOnFacebook("100")).andReturn(false);
    expect(mockFbClient.getObjectExistsOnFacebook("101")).andReturn(true);
   
    //register behavior
    replay(mockFactory, mockFbClient);
   
    fbcp.doHousekeeping();
   
    //verify
    verify();
   
    //after test the - dummy content should be deleted, existingContent should not be deleted
    contentList = (Collection<Content>)repo.getContentByProvider(fbcp.getId(), true);
    assertTrue(contentList.size()==1);   
   
    Content c = contentList.iterator().next();
    assertEquals(existingContent.getContentUrl(), c.getContentUrl())
  }
View Full Code Here

    return builder.comment2Content(comment);
  }
 
  private Content status2Content(StatusMessage sm) {
    ArrayList<String> values;
    Content content = new Content();
    content.setProvider(getFbContentProvider().getId());
    content.setType(ContentTypeEnum.STATUS.name());
    content.setContentUrl(URLUtils.makeContentURL( sm.getId(), ContentTypeEnum.STATUS.name()));
   
    if (sm.getUpdatedTime() != null){
      content.setModificationDate(sm.getUpdatedTime().getTime());
    }
    else{
      content.setModificationDate(new Date().getTime());
    }
   
    addAttribute(content, "id", sm.getId());
    addAttribute(content, "from_name", sm.getFrom().getName());
    addAttribute(content, "from_id", sm.getFrom().getId());
    addAttribute(content, "message", sm.getMessage());
    addAttribute(content, "updateTime", sm.getUpdatedTime() + "");
   
    if (sm.getMessage() != null){
      content.setFulltext(sm.getMessage());
    }
   
    values = new ArrayList<String>();
    if (sm.getLikes() != null){
      for (NamedFacebookType nft : sm.getLikes()) {
View Full Code Here

    Content c = contentList.iterator().next();
    assertEquals(existingContent.getContentUrl(), c.getContentUrl())
  }

  public void testGetBinaryData() {
    Content content = new Content();
    content.setContentUrl("facebook/atk/fbid/post");
   
    String jsonString = "{\"data\":\"value\"}";       
    byte[] expectedData = jsonString.getBytes();
   
View Full Code Here

    // Assert that the ID is correct
    assertEquals(new String(expectedData), new String(actualData));
  }

  public void testGetActionsContent() {
    Content content = new Content();
   
    Collection actions = fbcp.getActions(content);
       
    assertTrue(actions.size() == 2);
   
View Full Code Here

    expect(mockFbClient.getFacebookObjectByID("fbid", Post.class)).andReturn(expectedPost);
       
    //register behavior
    EasyMock.replay(mockFactory, mockFbClient);

    Content content = fbcp.getContent(contentUrl);
   
    //verify
    EasyMock.verify();
       
    //assertions
    assertNotNull(content);
    assertNotNull(content.getModificationDate());
    assertEquals(ContentTypeEnum.POST.name(), content.getType())
    assertEquals(fbcp.getId(), content.getProvider());
   
    assertEquals("Facebook Platform",content.getAttributeByName("from_name").getValue());
    assertEquals("19292868552",content.getAttributeByName("from_id").getValue());
   
    assertNotNull(content.getAttributeByName("comments"));
   
    assertTrue(content.getAttributes().size() > 0);
   
  }
View Full Code Here

   
    // update graph with new content
    String contentURL = URLUtils.makeContentURL(postMessage.getId(), ContentTypeEnum.STATUS.name());
   
    // fetch object from Facebook
    Content newContent = getContent(contentURL);
   
    // add object to graph
    getFbContentProvider().facebookAddContent(newContent);
    content.setContentUrl(contentURL);
  }
View Full Code Here

  public void testPerformActionDeleteContent() throws IQserTechnicalException {
   
    //add a facebook note
    String contentUrl = URLUtils.makeContentURL("100", "note");
    Content content = createDummyContentFromUrl(contentUrl);
   
    repo.addContent(content);
   
    //check if documents exists in object graph
    assertTrue(repo.getContentByProvider(fbcp.getId(), true).size() == 1);
View Full Code Here

  }

  public void testPerformActionPostContent() throws IQserTechnicalException, IOException {
    //create facebook note
    String contentUrl = URLUtils.makeContentURL("122788341354", "note");
    Content content = createDummyContentFromUrl(contentUrl);
    content.addAttribute(new Attribute("subject", "note subject", Attribute.ATTRIBUTE_TYPE_TEXT));
    content.addAttribute(new Attribute("message", "note message", Attribute.ATTRIBUTE_TYPE_TEXT));
   
    //check if documents exists in object graph
    assertTrue(repo.getContentByProvider(fbcp.getId(), true).size() == 0);
       
    //expected behavior
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.