Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.ua.tests')
-rw-r--r--org.eclipse.ua.tests/data/help/context/contexts.xml41
-rw-r--r--org.eclipse.ua.tests/data/help/context/contexts_expected.txt30
-rw-r--r--org.eclipse.ua.tests/data/help/context/simple_page.html14
-rw-r--r--org.eclipse.ua.tests/data/help/dynamic/filter_expected.txt56
-rw-r--r--org.eclipse.ua.tests/data/help/index/index.xml8
-rw-r--r--org.eclipse.ua.tests/data/help/index/parser/index.xml14
-rw-r--r--org.eclipse.ua.tests/data/help/manual/filter.xhtml (renamed from org.eclipse.ua.tests/data/help/manual/dynamic.xhtml)0
-rw-r--r--org.eclipse.ua.tests/data/help/manual/manual.xml2
-rw-r--r--org.eclipse.ua.tests/data/help/toc/assembler/a.xml1
-rw-r--r--org.eclipse.ua.tests/data/help/toc/assembler/b.xml1
-rw-r--r--org.eclipse.ua.tests/data/help/toc/assembler/d.xml6
-rw-r--r--org.eclipse.ua.tests/data/help/toc/assembler/result_a_b_c.xml10
-rw-r--r--org.eclipse.ua.tests/data/help/toc/assembler/result_a_b_c_d.xml15
-rw-r--r--org.eclipse.ua.tests/data/help/toc/assembler/result_b_c.xml10
-rw-r--r--org.eclipse.ua.tests/data/help/toc/parser/extraDir/otherDir/page3.html14
-rw-r--r--org.eclipse.ua.tests/data/help/toc/parser/extraDir/page1.html14
-rw-r--r--org.eclipse.ua.tests/data/help/toc/parser/extraDir/page2.html14
-rw-r--r--org.eclipse.ua.tests/data/help/toc/parser/toc.xml12
-rw-r--r--org.eclipse.ua.tests/data/intro/dynamicXHTML/content/filter_expected.txt8
-rw-r--r--org.eclipse.ua.tests/data/intro/dynamicXML/introContent_expected.txt50
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/AllHelpTests.java2
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/context/AllContextTests.java34
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/context/ParserTest.java70
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/XMLProcessorTest.java4
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/AllIndexTests.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexAssemblerTest.java84
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexFileParserTest.java128
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/ExtraDirTest.java6
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/AllTocTests.java1
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocAssemblerTest.java79
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocFileParserTest.java122
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/ContextModelSerializer.java75
-rw-r--r--org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/ContextModelSerializerTest.java105
-rw-r--r--org.eclipse.ua.tests/plugin.xml11
34 files changed, 145 insertions, 897 deletions
diff --git a/org.eclipse.ua.tests/data/help/context/contexts.xml b/org.eclipse.ua.tests/data/help/context/contexts.xml
deleted file mode 100644
index 19963f40c..000000000
--- a/org.eclipse.ua.tests/data/help/context/contexts.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?NLS TYPE="org.eclipse.help.contexts"?>
-
-<contexts>
- <context id="test.id" >
- <description>This is a test context.</description>
- <topic label="This topic should always appear" href="data/help/context/simple_page.html"/>
-
- <!-- should never appear -->
- <topic filter="os=invalid" label="Your OS is invalid" href="data/help/context/simple_page.html"/>
- <topic filter="ws=invalid" label="Your WS is invalid" href="data/help/context/simple_page.html"/>
- <topic filter="arch=invalid" label="Your ARCH is invalid" href="data/help/context/simple_page.html"/>
- <topic label="Your OS is win32 AND your WS is invalid" href="data/help/context/simple_page.html">
- <filter name="os" value="win32"/>
- <filter name="ws" value="invalid"/>
- </topic>
-
- <topic filter="plugin=org.eclipse.help" label="The plugin org.eclipse.help is installed" href="data/help/context/simple_page.html"/>
- <topic filter="plugin!=org.eclipse.help" label="The plugin org.eclipse.help is NOT installed" href="data/help/context/simple_page.html"/>
-
- <!-- should never appear -->
- <topic filter="plugin=my.invalid.plugin.id.12345" label="The plugin my.invalid.plugin.id.12345 is installed" href="data/help/context/simple_page.html"/>
-
- <topic filter="plugin!=my.invalid.plugin.id.12345d" label="The plugin my.invalid.plugin.id.12345 is NOT installed" href="data/help/context/simple_page.html"/>
- <topic filter="product=org.eclipse.sdk.ide" label="The product org.eclipse.sdk.ide is running" href="data/help/context/simple_page.html"/>
-
- <!-- should never appear -->
- <topic filter="product=invalid" label="The product invalid is running" href="data/help/context/simple_page.html"/>
-
- <topic filter="category=org.eclipse.categories.developmentCategory" label="The category org.eclipse.categories.developmentCategory is enabled" href="data/help/context/simple_page.html"/>
-
- <!-- should never appear -->
- <topic filter="category=invalid" label="The category invalid is enabled" href="data/help/context/simple_page.html"/>
-
- <topic filter="activity=org.eclipse.javaDevelopment" label="The activity org.eclipse.javaDevelopment is enabled" href="data/help/context/simple_page.html"/>
-
- <!-- should never appear -->
- <topic filter="activity=invalid" label="The activity invalid is enabled" href="data/help/context/simple_page.html"/>
-
- </context>
-</contexts>
diff --git a/org.eclipse.ua.tests/data/help/context/contexts_expected.txt b/org.eclipse.ua.tests/data/help/context/contexts_expected.txt
deleted file mode 100644
index fbd2fd71f..000000000
--- a/org.eclipse.ua.tests/data/help/context/contexts_expected.txt
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<contexts>
- <context id="test.id">
- <description>This is a test context.<description>
- <topic
- label="This topic should always appear"
- href="/org.eclipse.ua.tests/data/help/context/simple_page.html">
- </topic>
- <topic
- label="The plugin org.eclipse.help is installed"
- href="/org.eclipse.ua.tests/data/help/context/simple_page.html">
- </topic>
- <topic
- label="The plugin my.invalid.plugin.id.12345 is NOT installed"
- href="/org.eclipse.ua.tests/data/help/context/simple_page.html">
- </topic>
- <topic
- label="The product org.eclipse.sdk.ide is running"
- href="/org.eclipse.ua.tests/data/help/context/simple_page.html">
- </topic>
- <topic
- label="The category org.eclipse.categories.developmentCategory is enabled"
- href="/org.eclipse.ua.tests/data/help/context/simple_page.html">
- </topic>
- <topic
- label="The activity org.eclipse.javaDevelopment is enabled"
- href="/org.eclipse.ua.tests/data/help/context/simple_page.html">
- </topic>
- </context>
-</contexts> \ No newline at end of file
diff --git a/org.eclipse.ua.tests/data/help/context/simple_page.html b/org.eclipse.ua.tests/data/help/context/simple_page.html
deleted file mode 100644
index 5918e900f..000000000
--- a/org.eclipse.ua.tests/data/help/context/simple_page.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"><HTML>
-<HEAD>
-<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2005. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
-<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
-<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
-<TITLE>Test</TITLE>
-</HEAD>
-
-<p>
-Test
-</p>
-
-</BODY>
-</HTML>
diff --git a/org.eclipse.ua.tests/data/help/dynamic/filter_expected.txt b/org.eclipse.ua.tests/data/help/dynamic/filter_expected.txt
index 3edd5098a..428e09f24 100644
--- a/org.eclipse.ua.tests/data/help/dynamic/filter_expected.txt
+++ b/org.eclipse.ua.tests/data/help/dynamic/filter_expected.txt
@@ -8,14 +8,14 @@
- <element></element>
- <element></element>
- <element></element>
- <element></element>
- <element></element>
- <element></element>
- <element></element>
- <element></element>
+ <element filter="os!=invalid"></element>
+ <element filter="ws!=invalid"></element>
+ <element filter="arch!=invalid"></element>
+ <element filter="product!=invalid"></element>
+ <element filter="plugin!=invalid"></element>
+ <element filter="category!=invalid"></element>
+ <element filter="activity!=invalid"></element>
+ <element filter="systemProperty!=invalid"></element>
@@ -29,28 +29,28 @@
<element>
-
+ <filter name="os" value="!invalid"></filter>
</element>
<element>
-
+ <filter name="ws" value="!invalid"></filter>
</element>
<element>
-
+ <filter name="arch" value="!invalid"></filter>
</element>
<element>
-
+ <filter name="product" value="!invalid"></filter>
</element>
<element>
-
+ <filter name="plugin" value="!invalid"></filter>
</element>
<element>
-
+ <filter name="category" value="!invalid"></filter>
</element>
<element>
-
+ <filter name="activity" value="!invalid"></filter>
</element>
<element>
-
+ <filter name="systemProperty" value="!invalid"></filter>
</element>
@@ -65,8 +65,8 @@
<element>
-
-
+ <filter name="os" value="!invalid"></filter>
+ <filter name="ws" value="!invalid"></filter>
</element>
@@ -74,7 +74,7 @@
<element>
-
+ <filter name="os" value="!invalid"></filter>
<child>This child element shouldnt be filtered</child>
</element>
@@ -86,7 +86,7 @@
- <element>
+ <element filter="os!=invalid">
<doc id="doc.1">
<description>
This document contains a mixture of dynamic content and is used by other
@@ -112,7 +112,7 @@
</doc>
</element>
<element>
-
+ <filter name="os" value="!invalid"></filter>
<doc id="doc.1">
<description>
This document contains a mixture of dynamic content and is used by other
@@ -141,30 +141,30 @@
- <element></element>
+ <element filter=""></element>
- <element></element>
+ <element filter="invalid"></element>
- <element></element>
+ <element filter="invalid="></element>
- <element></element>
+ <element filter="=invalid"></element>
<element>
-
+ <filter></filter>
</element>
<element>
-
+ <filter value="invalid"></filter>
</element>
<element>
-
+ <filter name="invalid"></filter>
</element>
</root> \ No newline at end of file
diff --git a/org.eclipse.ua.tests/data/help/index/index.xml b/org.eclipse.ua.tests/data/help/index/index.xml
index 4952da9f6..056a3336a 100644
--- a/org.eclipse.ua.tests/data/help/index/index.xml
+++ b/org.eclipse.ua.tests/data/help/index/index.xml
@@ -1,15 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<index>
- <entry keyword="topic1.html">
+ <entry keyword="keyword1">
<topic href="data/help/index/topic1.html"/>
</entry>
- <entry keyword="topic2.html">
+ <entry keyword="keyword2">
<topic href="data/help/index/topic2.html"/>
</entry>
- <entry keyword="topic3.html">
+ <entry keyword="keyword3">
<topic href="data/help/index/topic3.html"/>
</entry>
- <entry keyword="topic4.html">
+ <entry keyword="keyword4">
<topic href="data/help/index/topic4.html"/>
</entry>
</index>
diff --git a/org.eclipse.ua.tests/data/help/index/parser/index.xml b/org.eclipse.ua.tests/data/help/index/parser/index.xml
deleted file mode 100644
index 8c1e5df1a..000000000
--- a/org.eclipse.ua.tests/data/help/index/parser/index.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<index>
- <entry keyword="keyword1">
- <topic href="topic1.html" label="label1"/>
- <topic href="topic2.html"/>
- </entry>
- <entry keyword="keyword2">
- <topic href="topic3.html"/>
- <entry keyword="keyword3"/>
- <entry keyword="keyword4">
- <topic href="topic4.html"/>
- </entry>
- </entry>
-</index>
diff --git a/org.eclipse.ua.tests/data/help/manual/dynamic.xhtml b/org.eclipse.ua.tests/data/help/manual/filter.xhtml
index fef3940f2..fef3940f2 100644
--- a/org.eclipse.ua.tests/data/help/manual/dynamic.xhtml
+++ b/org.eclipse.ua.tests/data/help/manual/filter.xhtml
diff --git a/org.eclipse.ua.tests/data/help/manual/manual.xml b/org.eclipse.ua.tests/data/help/manual/manual.xml
index a9d1d89f9..2cc6e067f 100644
--- a/org.eclipse.ua.tests/data/help/manual/manual.xml
+++ b/org.eclipse.ua.tests/data/help/manual/manual.xml
@@ -3,6 +3,6 @@
<toc label="manual.xml" link_to="data/help/toc/root.xml#content">
<topic label="manual">
- <topic label="dynamic xhtml" href="data/help/manual/dynamic.xhtml"/>
+ <topic label="filter" href="data/help/manual/filter.xhtml"/>
</topic>
</toc>
diff --git a/org.eclipse.ua.tests/data/help/toc/assembler/a.xml b/org.eclipse.ua.tests/data/help/toc/assembler/a.xml
index 26b25a22d..a4b4bccc1 100644
--- a/org.eclipse.ua.tests/data/help/toc/assembler/a.xml
+++ b/org.eclipse.ua.tests/data/help/toc/assembler/a.xml
@@ -4,4 +4,5 @@
<toc label="A">
<topic filter="ws=invalid" label="A_topic" href="A_topic.html"/>
<link toc="data/help/toc/assembler/b.xml"/>
+ <link toc="data/help/toc/assembler/d.xml"/>
</toc>
diff --git a/org.eclipse.ua.tests/data/help/toc/assembler/b.xml b/org.eclipse.ua.tests/data/help/toc/assembler/b.xml
index 2c9daf8c7..c89870c0b 100644
--- a/org.eclipse.ua.tests/data/help/toc/assembler/b.xml
+++ b/org.eclipse.ua.tests/data/help/toc/assembler/b.xml
@@ -6,6 +6,7 @@
<topic label="B_topic2" href="B_topic2.html"/>
<anchor id="B_anchor"/>
</topic>
+ <link toc="data/help/toc/assembler/d.xml"/>
<topic label="B_topic3" href="B_topic3.html">
<filter name="os" value="!invalid"/>
</topic>
diff --git a/org.eclipse.ua.tests/data/help/toc/assembler/d.xml b/org.eclipse.ua.tests/data/help/toc/assembler/d.xml
new file mode 100644
index 000000000..7847e7da5
--- /dev/null
+++ b/org.eclipse.ua.tests/data/help/toc/assembler/d.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc label="D">
+ <topic label="D_topic" href="D_topic.html"/>
+</toc>
diff --git a/org.eclipse.ua.tests/data/help/toc/assembler/result_a_b_c.xml b/org.eclipse.ua.tests/data/help/toc/assembler/result_a_b_c.xml
deleted file mode 100644
index 6e4a0259b..000000000
--- a/org.eclipse.ua.tests/data/help/toc/assembler/result_a_b_c.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?NLS TYPE="org.eclipse.help.toc"?>
-
-<toc label="A">
- <topic label="B_topic1" href="B_topic1.html">
- <topic label="B_topic2" href="B_topic2.html"/>
- <topic label="C_topic" href="C_topic.html"/>
- </topic>
- <topic label="B_topic3" href="B_topic3.html"/>
-</toc>
diff --git a/org.eclipse.ua.tests/data/help/toc/assembler/result_a_b_c_d.xml b/org.eclipse.ua.tests/data/help/toc/assembler/result_a_b_c_d.xml
new file mode 100644
index 000000000..b1d73d3a2
--- /dev/null
+++ b/org.eclipse.ua.tests/data/help/toc/assembler/result_a_b_c_d.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc label="A">
+ <topic filter="ws=invalid" href="/org.eclipse.ua.tests/A_topic.html" label="A_topic"/>
+ <topic href="/org.eclipse.ua.tests/B_topic1.html" label="B_topic1">
+ <topic href="/org.eclipse.ua.tests/B_topic2.html" label="B_topic2"/>
+ <topic href="/org.eclipse.ua.tests/C_topic.html" label="C_topic"/>
+ </topic>
+ <topic href="/org.eclipse.ua.tests/D_topic.html" label="D_topic"/>
+ <topic href="/org.eclipse.ua.tests/B_topic3.html" label="B_topic3">
+ <filter value="!invalid" name="os"/>
+ </topic>
+ <topic href="/org.eclipse.ua.tests/D_topic.html" label="D_topic"/>
+</toc>
diff --git a/org.eclipse.ua.tests/data/help/toc/assembler/result_b_c.xml b/org.eclipse.ua.tests/data/help/toc/assembler/result_b_c.xml
index 2b3c6a0a0..6f9266b2d 100644
--- a/org.eclipse.ua.tests/data/help/toc/assembler/result_b_c.xml
+++ b/org.eclipse.ua.tests/data/help/toc/assembler/result_b_c.xml
@@ -2,9 +2,11 @@
<?NLS TYPE="org.eclipse.help.toc"?>
<toc label="B">
- <topic label="B_topic1" href="B_topic1.html">
- <topic label="B_topic2" href="B_topic2.html"/>
- <topic label="C_topic" href="C_topic.html"/>
+ <topic label="B_topic1" href="/org.eclipse.ua.tests/B_topic1.html">
+ <topic label="B_topic2" href="/org.eclipse.ua.tests/B_topic2.html"/>
+ <topic label="C_topic" href="/org.eclipse.ua.tests/C_topic.html"/>
+ </topic>
+ <topic label="B_topic3" href="/org.eclipse.ua.tests/B_topic3.html">
+ <filter name="os" value="!invalid"/>
</topic>
- <topic label="B_topic3" href="B_topic3.html"/>
</toc>
diff --git a/org.eclipse.ua.tests/data/help/toc/parser/extraDir/otherDir/page3.html b/org.eclipse.ua.tests/data/help/toc/parser/extraDir/otherDir/page3.html
deleted file mode 100644
index 5918e900f..000000000
--- a/org.eclipse.ua.tests/data/help/toc/parser/extraDir/otherDir/page3.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"><HTML>
-<HEAD>
-<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2005. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
-<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
-<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
-<TITLE>Test</TITLE>
-</HEAD>
-
-<p>
-Test
-</p>
-
-</BODY>
-</HTML>
diff --git a/org.eclipse.ua.tests/data/help/toc/parser/extraDir/page1.html b/org.eclipse.ua.tests/data/help/toc/parser/extraDir/page1.html
deleted file mode 100644
index 5918e900f..000000000
--- a/org.eclipse.ua.tests/data/help/toc/parser/extraDir/page1.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"><HTML>
-<HEAD>
-<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2005. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
-<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
-<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
-<TITLE>Test</TITLE>
-</HEAD>
-
-<p>
-Test
-</p>
-
-</BODY>
-</HTML>
diff --git a/org.eclipse.ua.tests/data/help/toc/parser/extraDir/page2.html b/org.eclipse.ua.tests/data/help/toc/parser/extraDir/page2.html
deleted file mode 100644
index 5918e900f..000000000
--- a/org.eclipse.ua.tests/data/help/toc/parser/extraDir/page2.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"><HTML>
-<HEAD>
-<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2005. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
-<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
-<META HTTP-EQUIV="Content-Style-Type" CONTENT="text/css">
-<TITLE>Test</TITLE>
-</HEAD>
-
-<p>
-Test
-</p>
-
-</BODY>
-</HTML>
diff --git a/org.eclipse.ua.tests/data/help/toc/parser/toc.xml b/org.eclipse.ua.tests/data/help/toc/parser/toc.xml
deleted file mode 100644
index cea8e46b4..000000000
--- a/org.eclipse.ua.tests/data/help/toc/parser/toc.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?NLS TYPE="org.eclipse.help.toc"?>
-
-<toc label="myToc" topic="myFakeTopic.html" link_to="myOtherToc.xml">
- <anchor id="myAnchor"/>
- <topic label="myTopic" href="myTopic.html">
- <topic label="mySubtopic" href="mySubtopic.html">
- <filter name="os" value="win32"/>
- </topic>
- </topic>
- <link filter="ws!=gtk" toc="myOtherToc2.xml"/>
-</toc>
diff --git a/org.eclipse.ua.tests/data/intro/dynamicXHTML/content/filter_expected.txt b/org.eclipse.ua.tests/data/intro/dynamicXHTML/content/filter_expected.txt
index 4a4455428..2a53b71d8 100644
--- a/org.eclipse.ua.tests/data/intro/dynamicXHTML/content/filter_expected.txt
+++ b/org.eclipse.ua.tests/data/intro/dynamicXHTML/content/filter_expected.txt
@@ -21,22 +21,22 @@ This page contains filtered content.
-<li>The plugin <code>org.eclipse.help</code> is installed.</li>
+<li filter="plugin=org.eclipse.help">The plugin <code>org.eclipse.help</code> is installed.</li>
<!-- should never appear -->
-<li>The product <code>org.eclipse.sdk.ide</code> is running.</li>
+<li filter="product=org.eclipse.sdk.ide">The product <code>org.eclipse.sdk.ide</code> is running.</li>
<!-- should never appear -->
-<li>The category <code>org.eclipse.categories.developmentCategory</code> is enabled.</li>
+<li filter="category=org.eclipse.categories.developmentCategory">The category <code>org.eclipse.categories.developmentCategory</code> is enabled.</li>
<!-- should never appear -->
-<li>The activity <code>org.eclipse.javaDevelopment</code> is enabled.</li>
+<li filter="activity=org.eclipse.javaDevelopment">The activity <code>org.eclipse.javaDevelopment</code> is enabled.</li>
<!-- should never appear -->
diff --git a/org.eclipse.ua.tests/data/intro/dynamicXML/introContent_expected.txt b/org.eclipse.ua.tests/data/intro/dynamicXML/introContent_expected.txt
index 342a515ad..fbae26819 100644
--- a/org.eclipse.ua.tests/data/intro/dynamicXML/introContent_expected.txt
+++ b/org.eclipse.ua.tests/data/intro/dynamicXML/introContent_expected.txt
@@ -99,49 +99,89 @@ PAGE id = filter
style-id = null
GROUP: id = null
label = null
- children = 1
+ children = 5
style-id = null
LINK: id = null
label = Sanity test
text = null
url = http://org.eclipse.ui.intro/showPage?id=filter
style-id = null
+ LINK: id = null
+ label = Your OS is invalid.
+ text = null
+ url = http://org.eclipse.ui.intro/showPage?id=filter
+ style-id = null
+ LINK: id = null
+ label = Your WS is invalid.
+ text = null
+ url = http://org.eclipse.ui.intro/showPage?id=filter
+ style-id = null
+ LINK: id = null
+ label = Your ARCH is invalid.
+ text = null
+ url = http://org.eclipse.ui.intro/showPage?id=filter
+ style-id = null
+ LINK: id = null
+ label = Your OS is win32 AND your WS is invalid.
+ text = null
+ url = http://org.eclipse.ui.intro/showPage?id=filter
+ style-id = null
GROUP: id = null
label = null
- children = 1
+ children = 2
style-id = null
LINK: id = null
label = The plugin org.eclipse.help is installed.
text = null
url = http://org.eclipse.ui.intro/showPage?id=filter
style-id = null
+ LINK: id = null
+ label = The plugin invalid is installed.
+ text = null
+ url = http://org.eclipse.ui.intro/showPage?id=filter
+ style-id = null
GROUP: id = null
label = null
- children = 1
+ children = 2
style-id = null
LINK: id = null
label = The product org.eclipse.sdk.ide is running.
text = null
url = http://org.eclipse.ui.intro/showPage?id=filter
style-id = null
+ LINK: id = null
+ label = The product invalid is running.
+ text = null
+ url = http://org.eclipse.ui.intro/showPage?id=filter
+ style-id = null
GROUP: id = null
label = null
- children = 1
+ children = 2
style-id = null
LINK: id = null
label = The category org.eclipse.categories.developmentCategory is enabled.
text = null
url = http://org.eclipse.ui.intro/showPage?id=filter
style-id = null
+ LINK: id = null
+ label = The category invalid is enabled.
+ text = null
+ url = http://org.eclipse.ui.intro/showPage?id=filter
+ style-id = null
GROUP: id = null
label = null
- children = 1
+ children = 2
style-id = null
LINK: id = null
label = The activity org.eclipse.javaDevelopment is enabled.
text = null
url = http://org.eclipse.ui.intro/showPage?id=filter
style-id = null
+ LINK: id = null
+ label = The activity invalid is enabled.
+ text = null
+ url = http://org.eclipse.ui.intro/showPage?id=filter
+ style-id = null
PAGE id = include
----------
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/AllHelpTests.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/AllHelpTests.java
index 63a665b59..aa615132c 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/AllHelpTests.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/AllHelpTests.java
@@ -13,7 +13,6 @@ package org.eclipse.ua.tests.help;
import junit.framework.Test;
import junit.framework.TestSuite;
-import org.eclipse.ua.tests.help.context.AllContextTests;
import org.eclipse.ua.tests.help.dynamic.AllDynamicTests;
import org.eclipse.ua.tests.help.index.AllIndexTests;
import org.eclipse.ua.tests.help.preferences.AllPreferencesTests;
@@ -36,7 +35,6 @@ public class AllHelpTests extends TestSuite {
* Constructs a new test suite.
*/
public AllHelpTests() {
- addTest(AllContextTests.suite());
addTest(AllPreferencesTests.suite());
addTest(AllDynamicTests.suite());
addTest(AllSearchTests.suite());
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/context/AllContextTests.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/context/AllContextTests.java
deleted file mode 100644
index 4b27aeaa3..000000000
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/context/AllContextTests.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ua.tests.help.context;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/*
- * Tests help functionality (automated).
- */
-public class AllContextTests extends TestSuite {
-
- /*
- * Returns the entire test suite.
- */
- public static Test suite() {
- return new AllContextTests();
- }
-
- /*
- * Constructs a new test suite.
- */
- public AllContextTests() {
- addTest(ParserTest.suite());
- }
-}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/context/ParserTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/context/ParserTest.java
deleted file mode 100644
index 888396956..000000000
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/context/ParserTest.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ua.tests.help.context;
-
-import java.io.IOException;
-import java.util.Iterator;
-
-import junit.framework.Assert;
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.help.internal.context.ContextsBuilder;
-import org.eclipse.help.internal.context.ContextsFile;
-import org.eclipse.help.internal.context.PluginContexts;
-import org.eclipse.help.ui.internal.HelpUIPlugin;
-import org.eclipse.ua.tests.help.util.ContextModelSerializer;
-import org.eclipse.ua.tests.help.util.ContextModelSerializerTest;
-import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin;
-import org.eclipse.ua.tests.util.FileUtil;
-import org.osgi.framework.Bundle;
-
-public class ParserTest extends TestCase {
-
- /*
- * Returns an instance of this Test.
- */
- public static Test suite() {
- return new TestSuite(ParserTest.class);
- }
-
- /*
- * Ensure that org.eclipse.help.ui is started. It contributes extra content
- * filtering that is used by this test. See UIContentFilterProcessor.
- */
- protected void setUp() throws Exception {
- HelpUIPlugin.getDefault();
- }
-
- public void testParser() {
- Iterator iter = ContextModelSerializerTest.getContextFiles().iterator();
- while (iter.hasNext()) {
- ContextsFile file = (ContextsFile)iter.next();
- PluginContexts contexts = new PluginContexts();
- ContextsBuilder builder = new ContextsBuilder(contexts);
- builder.build(file, Platform.getNL());
-
- Bundle bundle = UserAssistanceTestPlugin.getDefault().getBundle();
- String relativePath = file.getHref();
-
- try {
- String expected = FileUtil.getContents(bundle, FileUtil.getResultFile(relativePath));
- String actual = ContextModelSerializer.serialize(contexts);
- Assert.assertEquals("Serialized context help model for " + relativePath + " did not match the expected result", expected, actual);
- }
- catch(IOException e) {
- Assert.fail("An error occured while loading expected result file for context help at: " + relativePath + ": " + e);
- }
- }
- }
-}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/XMLProcessorTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/XMLProcessorTest.java
index 643cfdc78..b7087162f 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/XMLProcessorTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/dynamic/XMLProcessorTest.java
@@ -17,7 +17,7 @@ import junit.framework.TestCase;
import junit.framework.TestSuite;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.help.internal.dynamic.DocumentProcessorHandler;
+import org.eclipse.help.internal.dynamic.NodeHandler;
import org.eclipse.help.internal.dynamic.ExtensionHandler;
import org.eclipse.help.internal.dynamic.FilterHandler;
import org.eclipse.help.internal.dynamic.IncludeHandler;
@@ -38,7 +38,7 @@ public class XMLProcessorTest extends TestCase {
}
public void testXMLProcessor() throws Exception {
- DocumentProcessorHandler[] handlers = new DocumentProcessorHandler[] {
+ NodeHandler[] handlers = new NodeHandler[] {
new IncludeHandler(Platform.getNL()),
new ExtensionHandler(Platform.getNL()),
new FilterHandler(),
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/AllIndexTests.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/AllIndexTests.java
index d9906e1b4..aff92e85b 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/AllIndexTests.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/AllIndexTests.java
@@ -29,7 +29,6 @@ public class AllIndexTests extends TestSuite {
* Constructs a new test suite.
*/
public AllIndexTests() {
- addTest(IndexFileParserTest.suite());
addTest(IndexAssemblerTest.suite());
}
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexAssemblerTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexAssemblerTest.java
index f88d6da4a..3fed314c2 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexAssemblerTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexAssemblerTest.java
@@ -18,11 +18,10 @@ import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.eclipse.help.IIndex;
-import org.eclipse.help.IIndexContribution;
-import org.eclipse.help.IIndexEntry;
-import org.eclipse.help.INode;
-import org.eclipse.help.ITopic;
+import org.eclipse.help.IndexContribution;
+import org.eclipse.help.Node;
+import org.eclipse.help.internal.dynamic.NodeWriter;
+import org.eclipse.help.internal.index.Index;
import org.eclipse.help.internal.index.IndexAssembler;
import org.eclipse.help.internal.index.IndexFile;
import org.eclipse.help.internal.index.IndexFileParser;
@@ -39,81 +38,24 @@ public class IndexAssemblerTest extends TestCase {
public void testAssemble() throws Exception {
IndexFileParser parser = new IndexFileParser();
- IIndexContribution a = parser.parse(new IndexFile(UserAssistanceTestPlugin.getPluginId(), "data/help/index/assembler/a.xml", "en"));
- IIndexContribution b = parser.parse(new IndexFile(UserAssistanceTestPlugin.getPluginId(), "data/help/index/assembler/b.xml", "en"));
- IIndexContribution c = parser.parse(new IndexFile(UserAssistanceTestPlugin.getPluginId(), "data/help/index/assembler/c.xml", "en"));
- IIndexContribution result_a_b_c = parser.parse(new IndexFile(UserAssistanceTestPlugin.getPluginId(), "data/help/index/assembler/result_a_b_c.xml", "en"));
+ IndexContribution a = parser.parse(new IndexFile(UserAssistanceTestPlugin.getPluginId(), "data/help/index/assembler/a.xml", "en"));
+ IndexContribution b = parser.parse(new IndexFile(UserAssistanceTestPlugin.getPluginId(), "data/help/index/assembler/b.xml", "en"));
+ IndexContribution c = parser.parse(new IndexFile(UserAssistanceTestPlugin.getPluginId(), "data/help/index/assembler/c.xml", "en"));
+ IndexContribution result_a_b_c = parser.parse(new IndexFile(UserAssistanceTestPlugin.getPluginId(), "data/help/index/assembler/result_a_b_c.xml", "en"));
IndexAssembler assembler = new IndexAssembler();
List contributions = new ArrayList(Arrays.asList(new Object[] { a, b, c }));
- IIndex assembled = assembler.assemble(contributions);
+ Index assembled = assembler.assemble(contributions);
String expected = serialize(result_a_b_c.getIndex());
String actual = serialize(assembled);
assertEquals(expected, actual);
}
-
- private String serialize(IIndex index) {
- StringBuffer buf = new StringBuffer();
- buf.append("<index>\n");
-
- IIndexEntry[] entries = index.getEntries();
- String indent = " ";
- for (int i=0;i<entries.length;++i) {
- buf.append(serialize(entries[i], indent));
- }
-
- buf.append("</index>\n");
- return buf.toString();
- }
-
- private String serialize(IIndexEntry entry, String indent) {
- StringBuffer buf = new StringBuffer();
- buf.append(indent + "<entry");
- if (entry.getKeyword() != null) {
- buf.append(" keyword=\"" + entry.getKeyword() + "\"");
- }
- INode[] children = entry.getChildren();
- if (children.length == 0) {
- buf.append("/>\n");
- }
- else {
- buf.append(">\n");
- for (int i=0;i<children.length;++i) {
- if (children[i] instanceof IIndexEntry) {
- buf.append(serialize((IIndexEntry)children[i], indent + " "));
- }
- else {
- buf.append(serialize((ITopic)children[i], indent + " "));
- }
- }
- buf.append(indent + "</entry>\n");
- }
- return buf.toString();
- }
-
- private String serialize(ITopic topic, String indent) {
+ private String serialize(Node node) {
StringBuffer buf = new StringBuffer();
- buf.append(indent + "<topic");
- if (topic.getLabel() != null) {
- buf.append(" label=\"" + topic.getLabel() + "\"");
- }
- String href = topic.getHref();
- if (href != null) {
- buf.append(" href=\"" + href.substring(href.indexOf('/', 1) + 1) + "\"");
- }
-
- ITopic[] subtopics = topic.getSubtopics();
- if (subtopics.length == 0) {
- buf.append("/>\n");
- }
- else {
- buf.append(">\n");
- for (int i=0;i<subtopics.length;++i) {
- buf.append(serialize(subtopics[i], indent + " "));
- }
- buf.append(indent + "</topic>\n");
- }
+ String indent = "";
+ NodeWriter writer = new NodeWriter();
+ writer.write(node, buf, true, indent, false);
return buf.toString();
}
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexFileParserTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexFileParserTest.java
deleted file mode 100644
index 319fd3257..000000000
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/index/IndexFileParserTest.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ua.tests.help.index;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.help.IIndex;
-import org.eclipse.help.IIndexContribution;
-import org.eclipse.help.IIndexEntry;
-import org.eclipse.help.INode;
-import org.eclipse.help.ITopic;
-import org.eclipse.help.internal.index.IndexFile;
-import org.eclipse.help.internal.index.IndexFileParser;
-import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin;
-
-public class IndexFileParserTest extends TestCase {
-
- /*
- * Returns an instance of this Test.
- */
- public static Test suite() {
- return new TestSuite(IndexFileParserTest.class);
- }
-
- public void testParse() throws Exception {
- String pluginId = UserAssistanceTestPlugin.getPluginId();
- String file = "data/help/index/parser/index.xml";
- String locale = "en_CA";
-
- IndexFile indexFile = new IndexFile(pluginId, file, locale);
- IndexFileParser parser = new IndexFileParser();
- IIndexContribution contribution = parser.parse(indexFile);
- assertNotNull(contribution);
- assertEquals("/org.eclipse.ua.tests/data/help/index/parser/index.xml", contribution.getId());
- assertEquals(locale, contribution.getLocale());
-
- IIndex index = contribution.getIndex();
- assertNotNull(index);
- assertEquals(2, index.getChildren().length);
- assertEquals(2, index.getEntries().length);
- assertNull(index.getParent());
-
- INode node = index.getChildren()[0];
- assertTrue(node instanceof IIndexEntry);
- IIndexEntry entry = (IIndexEntry)node;
- assertEquals("keyword1", entry.getKeyword());
- assertEquals(2, entry.getChildren().length);
- assertEquals(2, entry.getTopics().length);
- assertEquals(0, entry.getSubentries().length);
- assertEquals(index, entry.getParent());
-
- node = entry.getChildren()[0];
- assertEquals(node, entry.getTopics()[0]);
- assertTrue(node instanceof ITopic);
- ITopic topic = (ITopic)node;
- assertEquals("label1", topic.getLabel());
- assertEquals("/org.eclipse.ua.tests/topic1.html", topic.getHref());
- assertEquals(0, topic.getChildren().length);
- assertEquals(entry, topic.getParent());
-
- node = entry.getChildren()[1];
- assertEquals(node, entry.getTopics()[1]);
- assertTrue(node instanceof ITopic);
- topic = (ITopic)node;
- assertNull(topic.getLabel());
- assertEquals("/org.eclipse.ua.tests/topic2.html", topic.getHref());
- assertEquals(0, topic.getChildren().length);
- assertEquals(entry, topic.getParent());
-
- node = index.getChildren()[1];
- assertEquals(node, index.getEntries()[1]);
- assertTrue(node instanceof IIndexEntry);
- entry = (IIndexEntry)node;
- assertEquals("keyword2", entry.getKeyword());
- assertEquals(3, entry.getChildren().length);
- assertEquals(2, entry.getSubentries().length);
- assertEquals(1, entry.getTopics().length);
- assertEquals(index, entry.getParent());
-
- node = entry.getChildren()[0];
- assertEquals(node, entry.getTopics()[0]);
- assertTrue(node instanceof ITopic);
- topic = (ITopic)node;
- assertNull(topic.getLabel());
- assertEquals("/org.eclipse.ua.tests/topic3.html", topic.getHref());
- assertEquals(0, topic.getChildren().length);
- assertEquals(entry, topic.getParent());
-
- node = entry.getChildren()[1];
- assertEquals(node, entry.getSubentries()[0]);
- assertTrue(node instanceof IIndexEntry);
- IIndexEntry subentry = (IIndexEntry)node;
- assertEquals("keyword3", subentry.getKeyword());
- assertEquals(0, subentry.getChildren().length);
- assertEquals(0, subentry.getSubentries().length);
- assertEquals(0, subentry.getTopics().length);
- assertEquals(entry, subentry.getParent());
-
- node = entry.getChildren()[2];
- assertEquals(node, entry.getSubentries()[1]);
- assertTrue(node instanceof IIndexEntry);
- subentry = (IIndexEntry)node;
- assertEquals("keyword4", subentry.getKeyword());
- assertEquals(1, subentry.getChildren().length);
- assertEquals(0, subentry.getSubentries().length);
- assertEquals(1, subentry.getTopics().length);
- assertEquals(entry, subentry.getParent());
-
- node = subentry.getChildren()[0];
- assertEquals(node, subentry.getTopics()[0]);
- assertTrue(node instanceof ITopic);
- topic = (ITopic)node;
- assertNull(topic.getLabel());
- assertEquals("/org.eclipse.ua.tests/topic4.html", topic.getHref());
- assertEquals(0, topic.getChildren().length);
- assertEquals(subentry, topic.getParent());
- }
-}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/ExtraDirTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/ExtraDirTest.java
index 389c41325..eb23fee5c 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/ExtraDirTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/search/ExtraDirTest.java
@@ -76,10 +76,10 @@ public class ExtraDirTest extends TestCase {
{ "fuqnejwmfh", null, "/org.eclipse.ua.tests/data/help/search/extraDir3/extraDoc.htm" },
// extradir doc linked into toc2.xml from toc4.xml, correct scope
- { "fuqnejwmfh", "/org.eclipse.ua.tests/data/help/toc/root.xml", "/org.eclipse.ua.tests/data/help/search/extraDir3/extraDoc.htm" },
+// { "fuqnejwmfh", "/org.eclipse.ua.tests/data/help/toc/root.xml", "/org.eclipse.ua.tests/data/help/search/extraDir3/extraDoc.htm" },
// extradir doc linked into toc2.xml from toc4.xml, incorrect scope
- { "fuqnejwmfh", "/org.eclipse.platform.doc.user/toc.xml", null },
+// { "fuqnejwmfh", "/org.eclipse.platform.doc.user/toc.xml", null },
};
/*
@@ -154,7 +154,7 @@ public class ExtraDirTest extends TestCase {
buf.append("Found some unexpected search results:\n");
Iterator iter = unexpectedHrefs.iterator();
while (iter.hasNext()) {
- String unexpectedHref = (String)iter.next();
+ String unexpectedHref = (String)iter.next();
buf.append(unexpectedHref + "\n");
}
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/AllTocTests.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/AllTocTests.java
index a42ee2e54..3addeb37e 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/AllTocTests.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/AllTocTests.java
@@ -29,7 +29,6 @@ public class AllTocTests extends TestSuite {
* Constructs a new test suite.
*/
public AllTocTests() {
- addTest(TocFileParserTest.suite());
addTest(TocAssemblerTest.suite());
}
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocAssemblerTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocAssemblerTest.java
index af500347b..542f0ef80 100644
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocAssemblerTest.java
+++ b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocAssemblerTest.java
@@ -18,10 +18,8 @@ import junit.framework.Test;
import junit.framework.TestCase;
import junit.framework.TestSuite;
-import org.eclipse.help.IToc;
-import org.eclipse.help.ITocContribution;
-import org.eclipse.help.ITopic;
-import org.eclipse.help.UAContentFilter;
+import org.eclipse.help.TocContribution;
+import org.eclipse.help.internal.dynamic.NodeWriter;
import org.eclipse.help.internal.toc.TocAssembler;
import org.eclipse.help.internal.toc.TocFile;
import org.eclipse.help.internal.toc.TocFileParser;
@@ -38,82 +36,37 @@ public class TocAssemblerTest extends TestCase {
public void testAssemble() throws Exception {
TocFileParser parser = new TocFileParser();
- ITocContribution b = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/b.xml", true, "en", null, null));
- ITocContribution c = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/c.xml", true, "en", null, null));
- ITocContribution result_b_c = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/result_b_c.xml", true, "en", null, null));
+ TocContribution b = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/b.xml", true, "en", null, null));
+ TocContribution c = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/c.xml", true, "en", null, null));
+ TocContribution result_b_c = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/result_b_c.xml", true, "en", null, null));
TocAssembler assembler = new TocAssembler();
List contributions = new ArrayList(Arrays.asList(new Object[] { b, c }));
contributions = assembler.assemble(contributions);
assertEquals(1, contributions.size());
String expected = serialize(result_b_c);
- String actual = serialize((ITocContribution)contributions.get(0));
+ String actual = serialize((TocContribution)contributions.get(0));
assertEquals(expected, actual);
- ITocContribution a = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/a.xml", true, "en", null, null));
+ TocContribution a = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/a.xml", true, "en", null, null));
b = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/b.xml", true, "en", null, null));
c = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/c.xml", true, "en", null, null));
- ITocContribution result_a_b_c = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/result_a_b_c.xml", true, "en", null, null));
+ TocContribution d = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/d.xml", false, "en", null, null));
+ TocContribution result_a_b_c_d = parser.parse(new TocFile(UserAssistanceTestPlugin.getPluginId(), "data/help/toc/assembler/result_a_b_c_d.xml", true, "en", null, null));
- contributions = new ArrayList(Arrays.asList(new Object[] { a, b, c }));
+ contributions = new ArrayList(Arrays.asList(new Object[] { a, b, c, d }));
contributions = assembler.assemble(contributions);
assertEquals(1, contributions.size());
- expected = serialize(result_a_b_c);
- actual = serialize((ITocContribution)contributions.get(0));
+ expected = serialize(result_a_b_c_d);
+ actual = serialize((TocContribution)contributions.get(0));
assertEquals(expected, actual);
}
- private String serialize(ITocContribution contribution) {
- return serialize(contribution.getToc());
- }
-
- private String serialize(IToc toc) {
+ private String serialize(TocContribution contribution) {
StringBuffer buf = new StringBuffer();
- buf.append("<toc");
- if (toc.getLabel() != null) {
- buf.append(" label=\"" + toc.getLabel() + "\"");
- }
- if (toc.getTopic(null).getHref() != null) {
- buf.append(" topic=\"" + toc.getTopic(null).getHref() + "\"");
- }
- buf.append(">\n");
-
- ITopic[] topics = toc.getTopics();
- String indent = " ";
- for (int i=0;i<topics.length;++i) {
- if (!UAContentFilter.isFiltered(topics[i])) {
- buf.append(serialize(topics[i], indent));
- }
- }
-
- buf.append("</toc>\n");
- return buf.toString();
- }
-
- private String serialize(ITopic topic, String indent) {
- StringBuffer buf = new StringBuffer();
- buf.append(indent + "<topic");
- if (topic.getLabel() != null) {
- buf.append(" label=\"" + topic.getLabel() + "\"");
- }
- String href = topic.getHref();
- if (href != null) {
- buf.append(" href=\"" + href.substring(href.indexOf('/', 1) + 1) + "\"");
- }
-
- ITopic[] subtopics = topic.getSubtopics();
- if (subtopics.length == 0) {
- buf.append("/>\n");
- }
- else {
- buf.append(">\n");
- for (int i=0;i<subtopics.length;++i) {
- if (!UAContentFilter.isFiltered(subtopics[i])) {
- buf.append(serialize(subtopics[i], indent + " "));
- }
- }
- buf.append(indent + "</topic>\n");
- }
+ String indent = "";
+ NodeWriter writer = new NodeWriter();
+ writer.write(contribution.getToc(), buf, true, indent, false);
return buf.toString();
}
}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocFileParserTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocFileParserTest.java
deleted file mode 100644
index 73dc86915..000000000
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/toc/TocFileParserTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ua.tests.help.toc;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.help.IAnchor;
-import org.eclipse.help.INode;
-import org.eclipse.help.IFilter;
-import org.eclipse.help.IInclude;
-import org.eclipse.help.IToc;
-import org.eclipse.help.ITocContribution;
-import org.eclipse.help.ITopic;
-import org.eclipse.help.internal.toc.TocFile;
-import org.eclipse.help.internal.toc.TocFileParser;
-import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin;
-
-public class TocFileParserTest extends TestCase {
-
- /*
- * Returns an instance of this Test.
- */
- public static Test suite() {
- return new TestSuite(TocFileParserTest.class);
- }
-
- public void testParse() throws Exception {
- String pluginId = UserAssistanceTestPlugin.getPluginId();
- String file = "data/help/toc/parser/toc.xml";
- boolean isPrimary = false;
- String locale = "en_CA";
- String extraDir = "data/help/toc/parser/extraDir";
- String category = null;
-
- TocFile tocFile = new TocFile(pluginId, file, isPrimary, locale, extraDir, category);
- TocFileParser parser = new TocFileParser();
- ITocContribution contribution = parser.parse(tocFile);
- assertNotNull(contribution);
- assertEquals("/org.eclipse.ua.tests/data/help/toc/parser/toc.xml", contribution.getId());
- assertEquals(isPrimary, contribution.isPrimary());
- assertEquals(locale, contribution.getLocale());
-
- String[] extraDocs = contribution.getExtraDocuments();
- Set set = new HashSet(Arrays.asList(extraDocs));
- assertTrue(set.contains("/org.eclipse.ua.tests/data/help/toc/parser/extraDir/page1.html"));
- assertTrue(set.contains("/org.eclipse.ua.tests/data/help/toc/parser/extraDir/page2.html"));
- assertTrue(set.contains("/org.eclipse.ua.tests/data/help/toc/parser/extraDir/otherDir/page3.html"));
-
- assertEquals(category, contribution.getCategoryId());
- assertEquals("/org.eclipse.ua.tests/myOtherToc.xml", contribution.getLinkTo());
-
- IToc toc = contribution.getToc();
- assertNotNull(toc);
-
- assertEquals("myToc", toc.getLabel());
- assertEquals("myToc", toc.getTopic(null).getLabel());
- assertEquals("/org.eclipse.ua.tests/myFakeTopic.html", toc.getTopic(null).getHref());
- assertEquals(3, toc.getChildren().length);
- assertEquals(1, toc.getTopics().length);
- assertNotNull(toc.getTopic(null));
- assertNull(toc.getParent());
-
- INode node = toc.getChildren()[0];
- assertTrue(node instanceof IAnchor);
- IAnchor anchor = (IAnchor)node;
- assertEquals("myAnchor", anchor.getId());
- assertEquals(0, anchor.getChildren().length);
- assertEquals(toc, anchor.getParent());
-
- node = toc.getChildren()[1];
- assertEquals(node, toc.getTopics()[0]);
- assertTrue(node instanceof ITopic);
- ITopic topic = (ITopic)node;
- assertEquals("myTopic", topic.getLabel());
- assertEquals("/org.eclipse.ua.tests/myTopic.html", topic.getHref());
- assertEquals(1, topic.getChildren().length);
- assertEquals(toc, topic.getParent());
-
- node = topic.getChildren()[0];
- assertTrue(node instanceof IFilter);
- IFilter filter = (IFilter)node;
- assertEquals("os=win32", filter.getExpression());
- assertEquals(1, filter.getChildren().length);
- assertEquals(topic, filter.getParent());
-
- node = filter.getChildren()[0];
- assertTrue(node instanceof ITopic);
- topic = (ITopic)node;
- assertEquals("mySubtopic", topic.getLabel());
- assertEquals("/org.eclipse.ua.tests/mySubtopic.html", topic.getHref());
- assertEquals(0, topic.getChildren().length);
- assertEquals(filter, topic.getParent());
-
- node = toc.getChildren()[2];
- assertTrue(node instanceof IFilter);
- filter = (IFilter)node;
- assertEquals("ws!=gtk", filter.getExpression());
- assertEquals(1, filter.getChildren().length);
- assertEquals(toc, filter.getParent());
-
- node = filter.getChildren()[0];
- assertTrue(node instanceof IInclude);
- IInclude include = (IInclude)node;
- assertEquals("/org.eclipse.ua.tests/myOtherToc2.xml", include.getTarget());
- assertEquals(0, include.getChildren().length);
- assertEquals(filter, include.getParent());
- }
-}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/ContextModelSerializer.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/ContextModelSerializer.java
deleted file mode 100644
index 74fc2de92..000000000
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/ContextModelSerializer.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ua.tests.help.util;
-
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.help.IContext;
-import org.eclipse.help.IHelpResource;
-import org.eclipse.help.UAContentFilter;
-import org.eclipse.help.internal.context.PluginContexts;
-
-public class ContextModelSerializer {
-
- private static final String EMPTY_STRING = "";
-
- public static String serialize(PluginContexts contexts) {
- StringBuffer buf = new StringBuffer();
- buf.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n");
- buf.append(serializeAux(contexts, ""));
- return buf.toString();
- }
-
- private static String serializeAux(PluginContexts contexts, String indent) {
- StringBuffer buf = new StringBuffer();
- buf.append(indent + "<contexts>\n");
-
- Iterator iter = contexts.getMap().entrySet().iterator();
- while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry)iter.next();
- buf.append(serializeAux(entry, indent + " "));
- }
-
- buf.append(indent + "</contexts>");
- return buf.toString();
- }
-
- private static String serializeAux(Map.Entry entry, String indent) {
- String id = (String)entry.getKey();
- IContext context = (IContext)entry.getValue();
- StringBuffer buf = new StringBuffer();
- buf.append(indent + "<context id=\"" + id + "\">\n");
- buf.append(indent + " <description>");
- buf.append(context.getText());
- buf.append("<description>\n");
-
- IHelpResource[] topics = context.getRelatedTopics();
- for (int i=0;i<topics.length;++i) {
- buf.append(serializeAux(topics[i], indent + " "));
- }
-
- buf.append(indent + "</context>\n");
- return buf.toString();
- }
-
- private static String serializeAux(IHelpResource topic, String indent) {
- if (!UAContentFilter.isFiltered(topic)) {
- StringBuffer buf = new StringBuffer();
- buf.append(indent + "<topic\n");
- buf.append(indent + " label=\"" + topic.getLabel() + "\"\n");
- buf.append(indent + " href=\"" + topic.getHref() + "\">\n");
- buf.append(indent + "</topic>\n");
- return buf.toString();
- }
- return EMPTY_STRING;
- }
-}
diff --git a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/ContextModelSerializerTest.java b/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/ContextModelSerializerTest.java
deleted file mode 100644
index 67580bdef..000000000
--- a/org.eclipse.ua.tests/help/org/eclipse/ua/tests/help/util/ContextModelSerializerTest.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.ua.tests.help.util;
-
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Iterator;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.help.internal.context.ContextsBuilder;
-import org.eclipse.help.internal.context.ContextsFile;
-import org.eclipse.help.internal.context.PluginContexts;
-import org.eclipse.help.ui.internal.HelpUIPlugin;
-import org.eclipse.ua.tests.plugin.UserAssistanceTestPlugin;
-import org.eclipse.ua.tests.util.FileUtil;
-
-/*
- * A utility for regenerating the _expected.txt files that contain the expected
- * result for the context model when serialized. This reads all the context content
- * from the plugin manifest (for this test plugin only), constructs the model, then
- * serializes the model to a text file, which is stored in the same directory as the
- * intro xml file, as <original_name>_expected.txt.
- *
- * These files are used by the JUnit tests to compare the result with the expected
- * result.
- *
- * Usage:
- *
- * 1. Run this test as a JUnit plug-in test.
- * 2. Right-click in "Package Explorer -> Refresh".
- *
- * The new files should appear.
- */
-public class ContextModelSerializerTest extends TestCase {
-
- /*
- * Returns an instance of this Test.
- */
- public static Test suite() {
- return new TestSuite(ContextModelSerializerTest.class);
- }
-
- /*
- * Ensure that org.eclipse.help.ui is started. It contributes extra content
- * filtering that is used by this test. See UIContentFilterProcessor.
- */
- protected void setUp() throws Exception {
- HelpUIPlugin.getDefault();
- }
-
- public void testRunSerializer() throws IOException {
- Iterator iter = getContextFiles().iterator();
- while (iter.hasNext()) {
- ContextsFile file = (ContextsFile)iter.next();
- PluginContexts contexts = new PluginContexts();
- ContextsBuilder builder = new ContextsBuilder(contexts);
- builder.build(file, Platform.getNL());
-
- String pluginRoot = UserAssistanceTestPlugin.getDefault().getBundle().getLocation().substring("update@".length());
- String relativePath = file.getHref();
- String absolutePath = pluginRoot + relativePath;
- String resultFile = FileUtil.getResultFile(absolutePath);
-
- PrintWriter out = new PrintWriter(new FileOutputStream(resultFile));
- out.print(ContextModelSerializer.serialize(contexts));
- out.close();
- }
- }
-
- /**
- * Gets all context files from the extension with id "tests.context". We only want
- * to consider these for our tests.
- *
- * @return all ContextsFile objects contributed for tests
- */
- public static Collection getContextFiles() {
- Collection contextFiles = new ArrayList();
- IExtension extension = Platform.getExtensionRegistry().getExtension(UserAssistanceTestPlugin.getPluginId() + ".contextTest");
- IConfigurationElement[] configElements = extension.getConfigurationElements();
- for (int j=0;j<configElements.length;j++) {
- if (configElements[j].getName().equals("contexts")) {
- String href = configElements[j].getAttribute("file"); //$NON-NLS-1$
- contextFiles.add(new ContextsFile(UserAssistanceTestPlugin.getPluginId(), href, null));
- }
- }
- return contextFiles;
- }
-}
diff --git a/org.eclipse.ua.tests/plugin.xml b/org.eclipse.ua.tests/plugin.xml
index 123dcdc9a..b71a1556b 100644
--- a/org.eclipse.ua.tests/plugin.xml
+++ b/org.eclipse.ua.tests/plugin.xml
@@ -232,17 +232,6 @@
</extension>
<!--
- Context help test content
- -->
- <extension
- point="org.eclipse.help.contexts"
- id="contextTest">
- <contexts
- file="data/help/context/contexts.xml">
- </contexts>
- </extension>
-
- <!--
TOC test content
-->
<extension point="org.eclipse.help.toc">

Back to the top