public void testHTMLTableImageToWiki() throws Exception {
    // Stage a project for the cache
    Project project = new Project();
    project.setId(9999999);
    project.setTitle("Some Project");
    project.setUniqueId("some-project");
    CacheUtils.updateValue(Constants.SYSTEM_PROJECT_CACHE, 9999999, project);
    CacheUtils.updateValue(Constants.SYSTEM_PROJECT_UNIQUE_ID_CACHE, "some-project", 9999999);

    String wiki = HTMLToWikiUtils.htmlToWiki(htmlSample1, "", project.getId());
    assertEquals(
        ""
            + "||Site||Description||\n"
            + "|[[Image:tzvids.arizona.stimulus.gi.jpg]]|This is the first picture\n"
            + "!\n"
            + "!(nice)|\n"
            + "|[[Image:tzvids.haiti.aid.afp.gi.jpg]]|This is the second picture|\n"
            + "",
        wiki);

    // Read it, re-write it, and compare
    Wiki thisWiki = new Wiki();
    thisWiki.setProjectId(project.getId());
    thisWiki.setContent(wiki);
    WikiToHTMLContext wikiContext =
        new WikiToHTMLContext(thisWiki, new HashMap<String, ImageInfo>(), -1, false, "");
    String html = WikiToHTMLUtils.getHTML(wikiContext, null);
    assertEquals(wiki, HTMLToWikiUtils.htmlToWiki(html, "", project.getId()));
  }
コード例 #2
0
  public void testHTMLTableToWiki() throws Exception {
    // Stage a project for the cache
    Project project = new Project();
    project.setId(9999999);
    project.setTitle("Some Project");
    project.setUniqueId("some-project");
    CacheUtils.updateValue(Constants.SYSTEM_PROJECT_CACHE, 9999999, project);
    CacheUtils.updateValue(Constants.SYSTEM_PROJECT_UNIQUE_ID_CACHE, "some-project", 9999999);

    String wiki = HTMLToWikiUtils.htmlToWiki(htmlSample1, "", project.getId());
    assertEquals(
        ""
            + "||ConcourseConnect||ConcourseSuite||\n"
            + "|ConcourseConnect is the first platform that enables the creation of true commercial networks. Commercial networks are the intersection of social networking, web 2.0 collaboration and sales and marketing tools.\n"
            + "!\n"
            + "!ConcourseConnect enables organizations to create dynamic communities to connect various stakeholders and manage the entire ecosystem with an integrated management console and backend CRM tools. [[Security, Registration, Invitation|Installation Options]]|ConcourseSuite is Concursive's dedicated Customer Relationship Management (CRM) product. It is a complete front office solution that integrates CRM, website creation, content management and team collaboration capabilities into one easy to use, easy to deploy solution that is available in both hosted and on-premise configurations. [[Technical Documentation]] (Owner)|\n"
            + "",
        wiki);

    // Read it, re-write it, and compare
    Wiki thisWiki = new Wiki();
    thisWiki.setProjectId(project.getId());
    thisWiki.setContent(wiki);
    WikiToHTMLContext wikiContext =
        new WikiToHTMLContext(thisWiki, new HashMap<String, ImageInfo>(), -1, false, "");
    String html = WikiToHTMLUtils.getHTML(wikiContext, null);
    assertEquals(wiki, HTMLToWikiUtils.htmlToWiki(html, "", project.getId()));
  }