Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Goldthorpe2011-03-02 23:45:16 +0000
committerChris Goldthorpe2011-03-02 23:45:16 +0000
commitbdec8636e8f9019f834adf77f29f5af33b2ab5cc (patch)
tree2dd8dd1038f3fd6df48a1e7a2ec81ecacf89ca38 /org.eclipse.ua.tests/help/org
parentf80d928f29a67bfad5d8779e0d916627e5c035d7 (diff)
downloadeclipse.platform.ua-bdec8636e8f9019f834adf77f29f5af33b2ab5cc.tar.gz
eclipse.platform.ua-bdec8636e8f9019f834adf77f29f5af33b2ab5cc.tar.xz
eclipse.platform.ua-bdec8636e8f9019f834adf77f29f5af33b2ab5cc.zip
Bug 338732 - [Test] Fix public servlet API enhancement tests
Diffstat (limited to 'org.eclipse.ua.tests/help/org')
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/TocFragmentServiceTest.java40
1 files changed, 30 insertions, 10 deletions
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/TocFragmentServiceTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/TocFragmentServiceTest.java
index 3b65d9fab..9f0d74de8 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/TocFragmentServiceTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/webapp/service/TocFragmentServiceTest.java
@@ -20,9 +20,12 @@ import javax.xml.parsers.DocumentBuilderFactory;
import junit.framework.TestCase;
+import org.eclipse.help.ITopic;
+import org.eclipse.help.internal.HelpPlugin;
import org.eclipse.help.internal.base.BaseHelpSystem;
import org.eclipse.help.internal.entityresolver.LocalEntityResolver;
import org.eclipse.help.internal.server.WebappManager;
+import org.eclipse.help.internal.toc.Toc;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -72,19 +75,17 @@ public class TocFragmentServiceTest extends TestCase {
assertEquals(1, results.length);
}
- /*
- * These tests are still failing - see Bug 338732
- *
- *
public void testReadEnToc() throws Exception {
+ int uaSearch = findUATopicIndex("search", "en");
+ assertTrue(uaSearch >= 0);
int port = WebappManager.getPort();
URL url = new URL("http", "localhost", port,
- "/help/vs/service/tocfragment?lang=en&toc=/org.eclipse.ua.tests/data/help/toc/root.xml&path=7");
+ "/help/vs/service/tocfragment?lang=en&toc=/org.eclipse.ua.tests/data/help/toc/root.xml&path=" + uaSearch);
Node root = getTreeData(url);
Element[] UARoot = findNodeById(root,
"/org.eclipse.ua.tests/data/help/toc/root.xml");
assertEquals(1, UARoot.length);
- Element[] searchNode = findNodeById(UARoot[0], "7");
+ Element[] searchNode = findChildren(UARoot[0], "node", "title", "search");
assertEquals(1, searchNode.length);
Element[] topicEn = findChildren(searchNode[0], "node", "href",
"../topic/org.eclipse.ua.tests/data/help/search/test_en.html");
@@ -92,27 +93,46 @@ public class TocFragmentServiceTest extends TestCase {
Element[] topicDe = findChildren(searchNode[0], "node", "href",
"../topic/org.eclipse.ua.tests/data/help/search/test_de.html");
assertEquals(0, topicDe.length);
+ }
+
+ private int findUATopicIndex(String title, String locale) {
+ int index = -1;
+ Toc[] tocs = HelpPlugin.getTocManager().getTocs(locale);
+ for (int i = 0; i < tocs.length; i++) {
+ if ("/org.eclipse.ua.tests/data/help/toc/root.xml".equals(tocs[i].getHref())) {
+ ITopic[] topics = tocs[i].getTopics();
+ for (int j = 0; j < topics.length; j++) {
+ if (title.equals(topics[j].getLabel())) {
+ index = j;
+ }
+ }
+ }
+ }
+ return index;
}
public void testReadDeToc() throws Exception {
+ int helpMode = BaseHelpSystem.getMode();
+ BaseHelpSystem.setMode(BaseHelpSystem.MODE_INFOCENTER);
+ int uaSearch = findUATopicIndex("search", "de");
+ assertTrue(uaSearch >= 0);
int port = WebappManager.getPort();
URL url = new URL("http", "localhost", port,
- "/help/vs/service/tocfragment?lang=de&toc=/org.eclipse.ua.tests/data/help/toc/root.xml&path=7");
+ "/help/vs/service/tocfragment?lang=de&toc=/org.eclipse.ua.tests/data/help/toc/root.xml&path=" + uaSearch);
Node root = getTreeData(url);
Element[] UARoot = findNodeById(root,
"/org.eclipse.ua.tests/data/help/toc/root.xml");
assertEquals(1, UARoot.length);
- Element[] searchNode = findNodeById(UARoot[0], "7");
+ Element[] searchNode = findChildren(UARoot[0], "node", "title", "search");
Element[] topicEn = findChildren(searchNode[0], "node", "href",
"../topic/org.eclipse.ua.tests/data/help/search/test_en.html");
assertEquals(0, topicEn.length);
Element[] topicDe = findChildren(searchNode[0], "node", "href",
"../topic/org.eclipse.ua.tests/data/help/search/test_de.html");
assertEquals(1, topicDe.length);
+ BaseHelpSystem.setMode(helpMode);
}
- */
-
private Element[] findNodeById(Node root, String id) {
return findChildren(root, "node", "id", id);
}

Back to the top