Exemple #1
0
  public void testGenerateFeed2() throws Exception {
    Map<String, String> contextPodcast = new HashMap<String, String>();
    contextPodcast.put("exo:feedType", "podcast");
    contextPodcast.put("repository", "repository");
    contextPodcast.put("srcWorkspace", COLLABORATION_WS);
    contextPodcast.put("actionName", "actionName");
    contextPodcast.put("exo:rssVersion", "rss_1.0");
    contextPodcast.put("exo:feedTitle", "Hello Feed");
    contextPodcast.put("exo:link", "Testing");
    contextPodcast.put("exo:summary", "Hello Summary");
    contextPodcast.put("exo:description", "Hello Description");
    contextPodcast.put("exo:storePath", "/Feeds");
    contextPodcast.put("exo:feedName", "podcastName");
    contextPodcast.put(
        "exo:queryPath", "SELECT * FROM exo:article where jcr:path LIKE '/Documents/%'");
    contextPodcast.put("exo:title", "Hello Title");
    contextPodcast.put("exo:url", "http://twitter.com");
    rssService.generateFeed(contextPodcast);

    session.getRootNode().addNode("Feeds");
    Node myFeeds = (Node) session.getItem("/Feeds");
    myFeeds.addNode("podcast");
    Node myPodcast = (Node) session.getItem("/Feeds/podcast");
    myPodcast.addNode("podcastName");
    Node myPodcastName = (Node) session.getItem("/Feeds/podcast/podcastName");
    assertEquals("Feeds", myFeeds.getName());
    assertEquals("podcast", myPodcast.getName());
    assertEquals("podcastName", myPodcastName.getName());
  }
Exemple #2
0
  /**
   * Test method: generateFeed() Input: context Map Consist of among information Expect: Create a
   * Feed file (feed type is RSS or Podcast)
   *
   * @throws Exception
   */
  public void testGenerateFeed() throws Exception {
    Map<String, String> contextRss = new HashMap<String, String>();
    contextRss.put("exo:feedType", "rss");
    contextRss.put("repository", "repository");
    contextRss.put("srcWorkspace", COLLABORATION_WS);
    contextRss.put("actionName", "actionName");
    contextRss.put("exo:rssVersion", "rss_2.0");
    contextRss.put("exo:feedTitle", "Hello Feed");
    contextRss.put("exo:summary", "Hello Summary");
    contextRss.put("exo:description", "Hello Description");
    contextRss.put("exo:storePath", "/Feeds");
    contextRss.put("exo:feedName", "feedName");
    contextRss.put("exo:queryPath", "SELECT * FROM exo:article where jcr:path LIKE '/Documents/%'");
    contextRss.put("exo:title", "Hello Title");
    contextRss.put("exo:url", "http://www.facebook.com");
    rssService.generateFeed(contextRss);

    session.getRootNode().addNode("Feeds");
    Node myFeeds = (Node) session.getItem("/Feeds");
    myFeeds.addNode("rss");
    Node myRSS = (Node) session.getItem("/Feeds/rss");
    myRSS.addNode("feedName");
    Node myFeedName = (Node) session.getItem("/Feeds/rss/feedName");
    myFeedName.addNode("jcr:content");
    Node myJcrContent = myFeedName.getNode("jcr:content");
    assertEquals("Feeds", myFeeds.getName());
    assertEquals("rss", myRSS.getName());
    assertEquals("feedName", myFeedName.getName());
    assertEquals("/Feeds/rss/feedName/jcr:content", myJcrContent.getPath());
    if (myJcrContent.hasProperty("jcr:data")) {
      String jcrData = myJcrContent.getProperty("jcr:data").getString();
      assertNotNull(myJcrContent.getProperty("jcr:data").getString());
      assertTrue(jcrData.indexOf("<title>Hello Feed</title>") > 0);
      assertTrue(jcrData.indexOf("<description>Hello Description</description>") > 0);
      assertTrue(jcrData.indexOf("<description>Not data</description>") < 0);
      assertEquals("application/rss+xml", myJcrContent.getProperty("jcr:mimeType").getString());
    }
  }