in src/main/java/com/atlassian/uwc/exporters/MindtouchExporterTest.java [195:316]
public void testGetContent() {
Vector<MindtouchPage> pages = tester.getPages();
assertNotNull(pages);
Vector<MindtouchPage> actual = tester.getContent(pages);
assertNotNull(actual);
MindtouchPage root = actual.get(0);
assertNotNull(root);
Vector<MindtouchPage> lvl1 = root.getSubpages();
assertNotNull(lvl1);
MindtouchPage sandbox = lvl1.get(2);
assertNotNull(sandbox);
assertNotNull(sandbox.content);
assertEquals("<content type=\"text/html\" title=\"Sandbox\"><body>\n" +
"<p>Testing 123</p></body><body target=\"toc\"><em>No headers</em></body></content>", sandbox.content);
Vector<MindtouchPage> lvl2 = sandbox.getSubpages();
assertNotNull(lvl2);
int i = 0;
for (MindtouchPage page : lvl2) {
assertNotNull(page);
assertNotNull(page.content);
String exp = "";
switch(i) {
case 0:
exp = "<content type=\"text/html\" title=\"Test Attachments\"><body>\n" +
"<p>We\'re going to have some attachments content.</p>\n" +
"<p>We need an image that\'s inline, a link to an attachment, and an attached file " +
"with no reference in the page.</p>\n" +
"<p>Inline:</p>\n" +
"<p><img alt=\"cow.jpg\" class=\"internal default\" src=\"http://192.168.2.247/@api" +
"/deki/files/1/=cow.jpg?parent=Test Attachments\" /></p>\n" +
"<p>Link:</p>\n" +
"<p><a rel=\"internal\" href=\"http://192.168.2.247/@api/deki/files/3/=abc.txt?parent=Test Attachments\" " +
"class=\"iconitext-16 ext-txt \">abc.txt</a></p>\n" +
"</body><body target=\"toc\"><em>No headers</em></body></content>";
break;
case 1:
exp = "<content type=\"text/html\" title=\"Test Comments\"><body>\n" +
"<p>This page will have lots of comments, which we\'ll need to keep in order." +
"</p></body><body target=\"toc\"><em>No headers</em></body></content>";
break;
case 2:
exp = "<content type=\"text/html\" title=\"Test Headers\"><body>\n" +
"<p>Headers were a little annoying to control.</p>\n" +
"<div id=\"section_1\"><span id=\"Header_1\" /><h2 class=\"editable\">Header 1</h2>\n" +
"<p>Some text</p>\n" +
"<div id=\"section_2\"><span id=\"Header_2\" /><h3 class=\"editable\">Header 2</h3>\n" +
"<p>Tralala</p>\n" +
"<div id=\"section_3\"><span id=\"Header_3\" /><h4 class=\"editable\">Header 3</h4>\n" +
"<p>Foo bar</p>\n" +
"<div id=\"section_4\"><span id=\"Header_4\" /><h5 class=\"editable\">Header 4</h5>\n" +
"<p>Testing</p>\n" +
"<div id=\"section_5\"><span id=\"Header_5\" /><h6 class=\"editable\">Header 5</h6>\n" +
"<p>Lorem Ipsum</p>\n" +
"<p>Ê</p>\n" +
"<p>What about Fonts?</p>\n" +
"<p><span style=\"font-family: Courier New;\">Testing Courier</span></p>\n" +
"<p><span style=\"font-family: Times New Roman;\">Times</span></p>\n" +
"<p><span style=\"font-family: Verdana;\">Verdana</span></p>\n" +
"<p>Ê</p>\n" +
"<p>and Font size?</p>\n" +
"<p><span style=\"font-size: xx-small;\">xxsmall</span></p>\n" +
"<p><span style=\"font-size: x-small;\">xsmall</span></p>\n" +
"<p><span style=\"font-size: small;\">small</span></p>\n" +
"<p><span style=\"font-size: medium;\">medium</span></p>\n" +
"<p><span style=\"font-size: large;\">large</span></p>\n" +
"<p><span style=\"font-size: x-large;\">xlarge</span></p>\n" +
"<p><span style=\"font-size: xx-large;\">xxlarge</span></p>\n" +
"<p>Ê</p>\n" +
"<p>What happens when we mix and match different stuff</p>\n" +
"<p style=\"margin-left: 40px;\"><code><strong>bold indent code</strong></code></p>\n" +
"<p><span style=\"font-family: Courier New;\"><span style=\"font-size: x-large;\">Courier xlarge</span></span></p>\n" +
"<br />\n" +
"<ul> <li> </li>\n" +
"</ul>\n" +
"</div></div></div></div></div></body><body target=\"toc\"><ol style=\"list-style-type:none; " +
"margin-left:0px; padding-left:0px;\"><li><span>1.</span> <a href=\"#Header_1\" rel=\"internal\">" +
"Header 1</a><ol style=\"list-style-type:none; margin-left:0px; padding-left:15px;\"><li>" +
"<span>1.1.</span> <a href=\"#Header_2\" rel=\"internal\">Header 2</a>" +
"<ol style=\"list-style-type:none; margin-left:0px; padding-left:15px;\">" +
"<li><span>1.1.1.</span> <a href=\"#Header_3\" rel=\"internal\">Header 3</a>" +
"<ol style=\"list-style-type:none; margin-left:0px; padding-left:15px;\"><li>" +
"<span>1.1.1.1.</span> <a href=\"#Header_4\" rel=\"internal\">Header 4</a>" +
"<ol style=\"list-style-type:none; margin-left:0px; padding-left:15px;\"><li>" +
"<span>1.1.1.1.1.</span> <a href=\"#Header_5\" rel=\"internal\">Header 5</a></li></ol>" +
"</li></ol></li></ol></li></ol></li></ol></body></content>";
break;
case 3:
exp = "<content type=\"text/html\" title=\"Test Permissions\"><body>\n" +
"<p>This will be a restricted page, so we can test authentication, " +
"and export thoroughness." +
"</p></body><body target=\"toc\"><em>No headers</em></body></content>";
break;
case 4:
i++;
continue; //ignore this one Dekiscript makes it complicated
case 5:
exp = "<content type=\"text/html\" title=\"Test Tags\"><body>\n" +
"<p>This page will have tags associated with it that will need to be " +
"turned into labels</p></body><body target=\"toc\"><em>No headers</em>" +
"</body></content>";
break;
case 6:
exp = "<content type=\"text/html\" title=\"Test Titles\"><body>\n" +
"<p>Titles seem problematic.</p>\n" +
"<p>Firstly, what happens if we have two titles?</p>\n" +
"<div id=\"section_1\"><span id=\"Title_.23_2\" /><h1 class=\"editable\">" +
"Title # 2</h1>\n" +
"<p>I have no idea. Probably it\'s the first title that matters?</p>" +
"</div></body><body target=\"toc\"><ol style=\"list-style-type:none; " +
"margin-left:0px; padding-left:0px;\"><li><span>1.</span> " +
"<a href=\"#Title_.23_2\" rel=\"internal\">Title # 2</a></li></ol>" +
"</body></content>";
break;
default: continue;
}
assertEquals(exp, page.content);
i++;
}
}