Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Dykstal2006-09-07 01:51:42 +0000
committerDavid Dykstal2006-09-07 01:51:42 +0000
commit7d8d9716b7c0db62ac968caa9d07425958bc949a (patch)
tree9aac2979c66cc379a09c87d6036dcff44e60e20d
parent24a95320d3d7cc129e393edf20ae8a497e375bf2 (diff)
downloadorg.eclipse.tm-7d8d9716b7c0db62ac968caa9d07425958bc949a.tar.gz
org.eclipse.tm-7d8d9716b7c0db62ac968caa9d07425958bc949a.tar.xz
org.eclipse.tm-7d8d9716b7c0db62ac968caa9d07425958bc949a.zip
bug 149080 initial population of test framework
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/.classpath7
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/.project28
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/META-INF/MANIFEST.MF17
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/build.properties9
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/html/ResultsPane.jpgbin0 -> 74376 bytes
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/html/SampleWindow.jpgbin0 -> 39227 bytes
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/html/book.css125
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/html/futures.html21
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/html/plugging.html83
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/html/purpose.html1
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/html/view.html1
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/icons/ConsoleView.gifbin0 -> 326 bytes
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/icons/GreenCheck.gifbin0 -> 326 bytes
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/icons/GreenDot.gifbin0 -> 347 bytes
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/icons/HolderView.gifbin0 -> 326 bytes
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/icons/ImageView.gifbin0 -> 326 bytes
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/icons/RedDot.gifbin0 -> 555 bytes
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/icons/RedX.gifbin0 -> 331 bytes
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/icons/WhiteBlock.gifbin0 -> 55 bytes
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/icons/YellowQuestion.gifbin0 -> 321 bytes
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/plugin.xml98
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/schema/suites.exsd173
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/AbstractTestSuiteHolder.java212
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/AnnotatingTestCase.java56
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/DelegatingTestSuiteHolder.java160
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ITestSuiteHolder.java79
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ITestSuiteHolderListener.java34
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ITestSuiteProvider.java30
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/TestFrameworkPlugin.java57
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/actions/ResetHolderDelegate.java61
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/actions/RunHolderDelegate.java93
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/actions/SelectAllHoldersDelegate.java52
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/impl/BasicTestSuiteHolder.java42
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/impl/StandardTestSuiteHolder.java36
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/impl/TestSuiteGeneratorHolder.java39
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ConsoleContext.java92
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/PerspectiveContext.java99
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/Script.java49
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptContext.java95
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptInterpreter.java58
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptParser.java132
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptParserMessage.java116
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptParserMessageList.java48
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptPause.java31
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptShow.java30
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptStep.java50
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptTell.java31
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptTestCase.java43
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptTestSuiteHolder.java56
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/SyntaxNode.java88
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/SyntaxTreeVisitor.java29
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ui/TestPerspectiveFactory.java30
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ui/TestSuiteConsoleView.java62
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ui/TestSuiteHolderView.java427
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ui/TestSuiteImageView.java65
-rw-r--r--rse/tests/org.eclipse.rse.tests.framework/toc.xml9
56 files changed, 3154 insertions, 0 deletions
diff --git a/rse/tests/org.eclipse.rse.tests.framework/.classpath b/rse/tests/org.eclipse.rse.tests.framework/.classpath
new file mode 100644
index 000000000..751c8f2e5
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/rse/tests/org.eclipse.rse.tests.framework/.project b/rse/tests/org.eclipse.rse.tests.framework/.project
new file mode 100644
index 000000000..12cad5589
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.rse.tests.framework</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/rse/tests/org.eclipse.rse.tests.framework/META-INF/MANIFEST.MF b/rse/tests/org.eclipse.rse.tests.framework/META-INF/MANIFEST.MF
new file mode 100644
index 000000000..50c5984a6
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/META-INF/MANIFEST.MF
@@ -0,0 +1,17 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: RSE Test Framework
+Bundle-SymbolicName: org.eclipse.rse.tests.framework;singleton:=true
+Bundle-Version: 1.0.0
+Bundle-Activator: org.eclipse.rse.tests.framework.TestFrameworkPlugin
+Bundle-Vendor: Eclipse.org
+Bundle-Localization: plugin
+Export-Package: org.eclipse.rse.tests.framework,
+ org.eclipse.rse.tests.framework.scripting
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.ui,
+ org.eclipse.jface.text,
+ org.eclipse.help,
+ org.eclipse.core.resources,
+ org.junit
+Eclipse-LazyStart: true
diff --git a/rse/tests/org.eclipse.rse.tests.framework/build.properties b/rse/tests/org.eclipse.rse.tests.framework/build.properties
new file mode 100644
index 000000000..0bd0937cb
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/build.properties
@@ -0,0 +1,9 @@
+bin.includes = .,\
+ plugin.xml,\
+ toc.xml,\
+ html/,\
+ icons/,\
+ schema/
+jars.compile.order = .
+source.. = src/
+output.. = bin/
diff --git a/rse/tests/org.eclipse.rse.tests.framework/html/ResultsPane.jpg b/rse/tests/org.eclipse.rse.tests.framework/html/ResultsPane.jpg
new file mode 100644
index 000000000..99fb9c99e
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/html/ResultsPane.jpg
Binary files differ
diff --git a/rse/tests/org.eclipse.rse.tests.framework/html/SampleWindow.jpg b/rse/tests/org.eclipse.rse.tests.framework/html/SampleWindow.jpg
new file mode 100644
index 000000000..b42573954
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/html/SampleWindow.jpg
Binary files differ
diff --git a/rse/tests/org.eclipse.rse.tests.framework/html/book.css b/rse/tests/org.eclipse.rse.tests.framework/html/book.css
new file mode 100644
index 000000000..953fcfcba
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/html/book.css
@@ -0,0 +1,125 @@
+P.Code {
+ display: block;
+ text-align: left;
+ text-indent: 0.00pt;
+ margin-top: 0.000000pt;
+ margin-bottom: 0.000000pt;
+ margin-right: 0.000000pt;
+ margin-left: 15pt;
+ font-size: 10.000000pt;
+ font-weight: medium;
+ font-style: Regular;
+ color: #4444CC;
+ text-decoration: none;
+ vertical-align: baseline;
+ text-transform: none;
+ font-family: "Courier New";
+}
+pre.code {
+ display: block;
+ text-align: left;
+ text-indent: 0.00pt;
+ margin-top: 0.000000pt;
+ margin-bottom: 0.000000pt;
+ margin-right: 0.000000pt;
+ margin-left: 15pt;
+ font-size: 10.000000pt;
+ font-weight: medium;
+ font-style: Regular;
+ color: #4444CC;
+ text-decoration: none;
+ vertical-align: baseline;
+ text-transform: none;
+ font-family: "Courier New";
+}
+H6.CaptionFigColumn {
+ display: block;
+ text-align: left;
+ text-indent: 0.000000pt;
+ margin-top: 3.000000pt;
+ margin-bottom: 11.000000pt;
+ margin-right: 0.000000pt;
+ margin-left: 0.000000pt;
+ font-size: 9.000000pt;
+ font-weight: medium;
+ font-style: Italic;
+ color: #000000;
+ text-decoration: none;
+ vertical-align: baseline;
+ text-transform: none;
+ font-family: "Arial";
+}
+P.Note {
+ display: block;
+ text-align: left;
+ text-indent: 0pt;
+ margin-top: 19.500000pt;
+ margin-bottom: 19.500000pt;
+ margin-right: 0.000000pt;
+ margin-left: 30pt;
+ font-size: 11.000000pt;
+ font-weight: medium;
+ font-style: Italic;
+ color: #000000;
+ text-decoration: none;
+ vertical-align: baseline;
+ text-transform: none;
+ font-family: "Arial";
+}
+EM.UILabel {
+ font-weight: Bold;
+ font-style: Regular;
+ text-decoration: none;
+ vertical-align: baseline;
+ text-transform: none;
+}
+EM.CodeName {
+ font-weight: Bold;
+ font-style: Regular;
+ text-decoration: none;
+ vertical-align: baseline;
+ text-transform: none;
+ font-family:"Courier New";
+}
+
+TH {
+ background-color: #e5e5e5;
+ font-weight: bold;
+}
+
+
+/* following font face declarations need to be removed for DBCS */
+
+body, h1, h2, h3, h4, ,h5, h6, p, table, td, caption, th, ul, ol, dl, li, dd, dt {font-family: Arial, Helvetica, sans-serif; color: #000000}
+pre { font-family: Courier, monospace}
+
+/* end font face declarations */
+
+/* following font size declarations should be OK for DBCS */
+body, h1, h2, h3, h4, h5, h6, p, table, td, caption, th, ul, ol, dl, li, dd, dt {font-size: 10pt; }
+pre { font-size: 10pt}
+
+/* end font size declarations */
+
+body { background: #FFFFFF}
+h1 { font-size: 18pt; margin-top: 5; margin-bottom: 1 }
+h2 { font-size: 14pt; margin-top: 25; margin-bottom: 3 }
+h3 { font-size: 11pt; margin-top: 20; margin-bottom: 3 }
+h4 { font-size: 10pt; margin-top: 20; margin-bottom: 3; font-style: italic }
+p { margin-top: 10px; margin-bottom: 10px }
+pre { margin-left: 6; font-size: 9pt }
+a:link { color: #0000FF }
+a:hover { color: #000080 }
+a:visited { text-decoration: underline }
+ul { margin-top: 0; margin-bottom: 10 }
+li { margin-top: 0; margin-bottom: 0 }
+li p { margin-top: 0; margin-bottom: 0 }
+ol { margin-top: 0; margin-bottom: 10 }
+dl { margin-top: 0; margin-bottom: 10 }
+dt { margin-top: 0; margin-bottom: 0; font-weight: bold }
+dd { margin-top: 0; margin-bottom: 0 }
+strong { font-weight: bold}
+em { font-style: italic}
+var { font-style: italic}
+div.revision { border-left-style: solid; border-left-width: thin;
+ border-left-color: #7B68EE; padding-left:5 }
diff --git a/rse/tests/org.eclipse.rse.tests.framework/html/futures.html b/rse/tests/org.eclipse.rse.tests.framework/html/futures.html
new file mode 100644
index 000000000..1a9d32954
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/html/futures.html
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>Artemis Test Framework</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta http-equiv="Content-Style-Type" content="text/css"/>
+ <link rel="stylesheet" type="text/css" href="../book.css"/>
+</head>
+<body>
+ <h2>Future Items</h2>
+ <h3>Semi-Automatic Tests</h3>
+ <p>Scriptable tests would run in the background, but would interact with the user
+ on a step by step basis. The steps would be externally defined and contain an image
+ (perhaps a screen shot) and some instructions. The user would follow the instructions
+ and provide feedback along the way as the test was run. The user could pass or
+ fail the test at any point. This would allow for script driven user-interface
+ testing suitable for TVT, CRT, and GVT kinds of tests.</p>
+</body>
+</html>
diff --git a/rse/tests/org.eclipse.rse.tests.framework/html/plugging.html b/rse/tests/org.eclipse.rse.tests.framework/html/plugging.html
new file mode 100644
index 000000000..1f3fdb905
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/html/plugging.html
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+ <title>Artemis Test Framework</title>
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ <meta http-equiv="Content-Style-Type" content="text/css"/>
+ <link rel="stylesheet" type="text/css" href="../book.css"/>
+</head>
+<body>
+ <h2>Plugging into the Test Suite View</h2>
+ <p>The Test Suite View shows test cases that have registered with the plugin.
+ This section describes how this is done. The tags provide for both static declaration and
+ dynamic generation of test suites. You can define several suites and suite providers
+ in a single extension as follows:</p>
+<pre class="code">
+&lt;extension point="org.eclipse.rse.tests.framework.suites"&gt;
+ &lt;suite ... /&gt;
+ &lt;suite ... /&gt;
+ &lt;type ... /&gt;
+ &lt;suite ... /&gt;
+ &lt;type ... /&gt;
+&lt;/extension&gt;
+</pre>
+ </p>
+ <h3>Defining A Test Suite</h3>
+ <p>An existing JUnit test suite can be registered as follows:</p>
+<pre class="code">
+&lt;extension point="org.eclipse.rse.tests.framework.suites"&gt;
+ &lt;suite type="standard" name="My Test Suite"&gt;
+ &lt;arg name="class" value="com.xyz.MyTestSuite"&gt;
+ &lt;/suite&gt;
+&lt;/extension&gt;
+</pre>
+ <p>This defines a test suite that shows up in the view as "My Test Suite".
+ The <code>class</code> argument references a class that ultimately extends
+ <code>junit.framework.TestSuite</code>.
+ The <code>name</code> attribute is optional, but if it isn't specified the framework
+ will ask the suite for its name.</p>
+ <h3>Defining A Test Suite Provider</h3>
+ <p>If you prefer to dynamically generate test suites based on external criteria,
+ you can implement the <code>org.eclipse.rse.tests.framework.ITestSuiteProvider</code>
+ interface.
+ This allows you to programatically assemble a test suite from individual
+ testcases based on whatever criteria present in the workbench that you wish to use,
+ including an argument provided on the registration. To register your
+ <code>ITestSuiteProvider</code> use the <code>suite</code> tag with the <code>generator</code> type.</p>
+<pre class="code">
+&lt;extension point="org.eclipse.rse.tests.framework.suites"&gt;
+ ...
+ &lt;suite type="generated" name="BVT Test Suite"&gt;
+ &lt;arg name="class" value="com.xyz.MySuiteProvider"/&gt;
+ &lt;arg name="argument" value="bvt"/&gt;
+ &lt;/suite&gt;
+ ...
+&lt;/extension&gt;
+</pre>
+ <p>See the examples and either the javadoc or the source code for ITestSuiteProvider.</p>
+ <h3>Using The AnnotatingTestCase Class</h3>
+ <p>The class <code>AnnotatingTestCase</code> can be used as a superclass for your tests instead of
+ <code>junit.framework.TestCase</code>. This allows you to use the <code>remark(String)</code>
+ method in your testcases to cause a line to be printed in the results pane before the final status of
+ the tests. It's a reasonable replacement for <code>System.out.println()</code>
+ if you want to have extra stuff print for your tests.
+ <h3>How Your Test Is Run</h3>
+ <p>You test suite will run inside of a eclipse user job.
+ This means you don't have direct access to the UI thread or
+ any of its resources at this time unless you use the SWT <code>Display#execInUI</code>
+ or <code>Display#syncExecInUI</code> methods. In the future, semi-automatic
+ testing support will provide the ability for testing UI constructs from the test job.</p>
+ <h3>Configuration And Prerequisites</h3>
+ <p>The Test Suite View is contributed by the plugin
+ <code>org.eclipse.rse.tests.framework</code>.
+ <p>Your test suites need only require those plugins that you directly
+ reference -- which would be at least the <code>org.junit</code> plugin. If
+ you implement TestSuiteProvider or use any of the utility classes for annotating
+ the result log you must also require <code>org.eclipse.rse.tests.framework</code>.</p>
+ <p>The plugin <code>org.eclipse.rse.tests.framework</code> does not
+ depend on anything other than <code>org.junit</code> and
+ <code>org.eclipse.*</code> plugins.
+</body>
+</html>
diff --git a/rse/tests/org.eclipse.rse.tests.framework/html/purpose.html b/rse/tests/org.eclipse.rse.tests.framework/html/purpose.html
new file mode 100644
index 000000000..1270e2eaa
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/html/purpose.html
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>RSE Test Framework</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css"/> <link rel="stylesheet" type="text/css" href="../book.css"/> </head> <body> <h2>What's The Point?</h2> <p>You're an eclipse developer and you've become <em>test-infected</em>. You've made the leap and bought into the JUnit and XP philosophy of writing your testcases first and running them after every significant change you make. You just wish you had three things: (1) an easy way to repeatedly run them while debugging (2) a way to run several times without starting up and taking down a workbench each time and (3) an easy way for others to use them to verify that their work didn't impact yours.</p> <p>The <strong>RSE Test Framework</strong> is for you.</p> <p>The framework provides a means for presenting and running your JUnit tests inside a runtime workbench without using the PDE JUnit driver. This lets you to ship test suites that other teams can run for either verification, testing, or diagnostic purposes. The framework exploits the JUnit unit test framework and provides much of the function that a test runner from that framework provides inside a <em>bona fide</em> eclipse view.</p> <p>It provides a framework in which your tests are easily repeatable and allows function to be tested off the main UI thread.</p> <h3>What Does This Do That JUnit Doesn't?</h3> <p>The answer is "not much" -- yet.</p> <p>The ATF performs essentially the same function as a JUnit test runner, but does it in an eclipse and SWT compatible way. It provides a means for registering tests with a workbench so that they can easily be run repetitively during debug sessions and during driver build verification tests (aka <em>sniff tests</em>).</p> <p>Results are captured and presented in a text pane and can be copied from there to a document of your choice, such as a bug report.</p> <p>"But," you say, "I can do all this with JUnit and PDE!" Of course, but PDE doesn't provide you with a way of delivering your test suites in a build. PDE's JUnit support allows you to run tests from a development workbench in a runtime workbench. The framework, on the other hand, allows you to run them directly in a standard build or in a standard build that is being run as a runtime workbench under control of your development workbench.</p> <p>With the addition of some support for "test scripts" (see <a href="futures.html">Future Items</a>) semi-automated UI testing should become much easier.</p> <h3>How This Might Be Used</h3> <p>There are two different places the framework can help you. One is in running and tracking the tests on your own. The other is automating test suites that others can run.</p> <h4>Unit Test</h4> <p>Since the framework has its origins in JUnit, it should be no suprise that it can be used for unit testing -- either of the tests themselves or of the function being tested. You can easily construct a new plugin to point at or contain your JUnit Test Suites, start up a runtime workbench under debug, run the tests, and if things go wrong set breakpoints and replace code in either the test suite or in the tested function. You can use the framework as your test driver.</p> <h4>Various post development tests</h4> <p>All of these test phases use tests developed by you or your testing team. Some of these can be fully automated under the framework, particularly for sniff tests and regression tests. When the scripting facility becomes available, you should be able to semi-automate tests that require UI verification.</p> </body> </html> \ No newline at end of file
diff --git a/rse/tests/org.eclipse.rse.tests.framework/html/view.html b/rse/tests/org.eclipse.rse.tests.framework/html/view.html
new file mode 100644
index 000000000..36bc5b01d
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/html/view.html
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="utf-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Artemis Test Framework</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Style-Type" content="text/css"/> <link rel="stylesheet" type="text/css" href="../book.css"/> </head> <body> <h2>Using The Test Suite View</h2> <p><img src="SampleWindow.jpg" alt="Sample Test Suite View"/></p> <p>The <strong>Test Suite View</strong> shows the registered test suites in the workbench. The view allows them to be sorted by clicking on the column headings, run individually, run in batches, run in the background or in the UI thread. You can reset the tests and re-run them. This is useful when debugging the function driven by a test, when debugging the test itself, or when testing varitions between intial and subsequent runs. You can also see the test results of any test suite that has been run.</p> <p>To open the Test Suite View use the Window -> Show View -> Other... menu item and select the Test Suites View from the Testing category. <h3>Columns</h3> <p>The <strong>Graphic</strong> column shows the status of the test. It show a question mark if the test has not been run or has been reset, a red X if the test suite has a test case that has failed or produced an exception, and a green check if the test has run to completion. In keeping with the philosophy of JUnit it is updated as the test suite is run so you know immediately if there are any failures.</p> <p>The <strong>Test Suite</strong> columns show the name of the test suite.</p> <p>The <strong>Summary</strong> column is blank if the test has not yet been run. It shows the number of test cases run, the number failed, and the number of unexpected errors. It is updated as the test suite is run.</p> <p>The <strong>Time Run</strong> column is blank if the test has not yet been run. It shows the time the test suite began running, not the time it finished.</p> <h3>Actions</h3> <p>You bring up a context menu containing the test suite actions by selecting a test suite (or several) and right-clicking. The actions may be grayed out if they are not available for that particular selection of tests. You select tests by clicking on them. You can add test suites to (and remove test suites from) the selection by using control-click. You can select a range of tests by using shift-click.</p> <dl> <dt>Select All</dt> <dd>The "Select All" action selects all the test suites in the view. It is available no matter how many test suites are currently selected.</dd> <dt>Run</dt> <dd>This action will run the selected test suites, in the order in which they are presented in the list. The suites are run in an eclipse "job" that can be relegated to the background. The Test Suite View is busy while the tests are being run. This action is available if there is at least one test suite selected.</dd> <dt>Reset</dt> <dd>The "Reset" action will erase the results of the selected test suites and show them as "not yet run". It is available if there is at least one test suite selected.</dd> </dl> <h3>The Results Pane</h3> <img src="ResultsPane.jpg" alt="Results Pane"/> <p>The <strong>Results Pane</strong> shows the results of a test suite that has been run. Each test case in the suite has an entry that shows its success or failure with any remarks generated by a testcase during its run. If the test case fails, the entry shows the reason for the failure along with the stack trace for the exception. The results pane may be copied so you can place it in a defect or an e-mail.</p> <p>You can move the divider between the Test Suite Pane and the Results Pane up and down as necessary. </body> </html> \ No newline at end of file
diff --git a/rse/tests/org.eclipse.rse.tests.framework/icons/ConsoleView.gif b/rse/tests/org.eclipse.rse.tests.framework/icons/ConsoleView.gif
new file mode 100644
index 000000000..0dcd76c4b
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/icons/ConsoleView.gif
Binary files differ
diff --git a/rse/tests/org.eclipse.rse.tests.framework/icons/GreenCheck.gif b/rse/tests/org.eclipse.rse.tests.framework/icons/GreenCheck.gif
new file mode 100644
index 000000000..0dcd76c4b
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/icons/GreenCheck.gif
Binary files differ
diff --git a/rse/tests/org.eclipse.rse.tests.framework/icons/GreenDot.gif b/rse/tests/org.eclipse.rse.tests.framework/icons/GreenDot.gif
new file mode 100644
index 000000000..397c38b9c
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/icons/GreenDot.gif
Binary files differ
diff --git a/rse/tests/org.eclipse.rse.tests.framework/icons/HolderView.gif b/rse/tests/org.eclipse.rse.tests.framework/icons/HolderView.gif
new file mode 100644
index 000000000..0dcd76c4b
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/icons/HolderView.gif
Binary files differ
diff --git a/rse/tests/org.eclipse.rse.tests.framework/icons/ImageView.gif b/rse/tests/org.eclipse.rse.tests.framework/icons/ImageView.gif
new file mode 100644
index 000000000..0dcd76c4b
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/icons/ImageView.gif
Binary files differ
diff --git a/rse/tests/org.eclipse.rse.tests.framework/icons/RedDot.gif b/rse/tests/org.eclipse.rse.tests.framework/icons/RedDot.gif
new file mode 100644
index 000000000..b32f548f6
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/icons/RedDot.gif
Binary files differ
diff --git a/rse/tests/org.eclipse.rse.tests.framework/icons/RedX.gif b/rse/tests/org.eclipse.rse.tests.framework/icons/RedX.gif
new file mode 100644
index 000000000..8ad4f9ef3
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/icons/RedX.gif
Binary files differ
diff --git a/rse/tests/org.eclipse.rse.tests.framework/icons/WhiteBlock.gif b/rse/tests/org.eclipse.rse.tests.framework/icons/WhiteBlock.gif
new file mode 100644
index 000000000..bd1153ab4
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/icons/WhiteBlock.gif
Binary files differ
diff --git a/rse/tests/org.eclipse.rse.tests.framework/icons/YellowQuestion.gif b/rse/tests/org.eclipse.rse.tests.framework/icons/YellowQuestion.gif
new file mode 100644
index 000000000..dc7e18b12
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/icons/YellowQuestion.gif
Binary files differ
diff --git a/rse/tests/org.eclipse.rse.tests.framework/plugin.xml b/rse/tests/org.eclipse.rse.tests.framework/plugin.xml
new file mode 100644
index 000000000..c27d03771
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/plugin.xml
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.0"?>
+<plugin>
+
+ <extension-point id="suites" name="Test Suites" schema="schema/suites.exsd"/>
+
+ <extension point="org.eclipse.ui.views">
+ <category
+ id="org.eclipse.rse.projects.testing"
+ name="RSE Testing">
+ </category>
+ <view
+ icon="icons/HolderView.gif"
+ class="org.eclipse.rse.tests.framework.ui.TestSuiteHolderView"
+ category="org.eclipse.rse.projects.testing"
+ name="Test Suites"
+ id="org.eclipse.rse.tests.framework.HolderView">
+ </view>
+ <!--
+ <view
+ icon="icons/ConsoleView.gif"
+ class="org.eclipse.rse.tests.framework.ui.TestSuiteConsoleView"
+ category="org.eclipse.rse.projects.testing"
+ name="Test Console"
+ id="org.eclipse.rse.tests.framework.ConsoleView">
+ </view>
+ <view
+ icon="icons/ImageView.gif"
+ class="org.eclipse.rse.tests.framework.ui.TestSuiteImageView"
+ category="org.eclipse.rse.projects.testing"
+ name="Test Image"
+ id="org.eclipse.rse.tests.framework.ImageView">
+ </view>
+ -->
+ </extension>
+
+ <extension point="org.eclipse.ui.popupMenus">
+ <viewerContribution
+ targetID="org.eclipse.rse.tests.framework.HolderView"
+ id="org.eclipse.rse.tests.framework.HolderViewerContributions">
+ <action
+ enablesFor="*"
+ label="Select All"
+ class="org.eclipse.rse.tests.framework.actions.SelectAllHoldersDelegate"
+ menubarPath="additions"
+ id="org.eclipse.rse.tests.framework.SelectAllHolders"/>
+ </viewerContribution>
+ <objectContribution
+ objectClass="org.eclipse.rse.tests.framework.ITestSuiteHolder"
+ id="org.eclipse.rse.tests.framework.HolderObjectContributions">
+ <action
+ enablesFor="+"
+ label="Reset"
+ class="org.eclipse.rse.tests.framework.actions.ResetHolderDelegate"
+ menubarPath="additions"
+ id="org.eclipse.rse.tests.framework.ResetHolder"/>
+ <action
+ enablesFor="+"
+ label="Run"
+ class="org.eclipse.rse.tests.framework.actions.RunHolderDelegate"
+ menubarPath="additions"
+ id="org.eclipse.rse.tests.framework.RunHolder"/>
+ </objectContribution>
+ </extension>
+ <extension point="org.eclipse.help.toc">
+ <toc primary="true" file="toc.xml"/>
+ </extension>
+ <!--
+ <extension
+ point="org.eclipse.ui.perspectives">
+ <perspective
+ icon="icons/HolderView.gif"
+ class="org.eclipse.rse.tests.framework.ui.TestPerspectiveFactory"
+ name="RSE Test Perspective"
+ id="org.eclipse.rse.tests.framework.TestPerspective">
+
+ <description>
+ This perspective provides a place from which to run automatic and semi-automatic testcases. Semi-automatic testcases use the Test Image View and the Test Transcript.
+ </description>
+ </perspective>
+ </extension>
+ -->
+ <extension
+ point="org.eclipse.rse.tests.framework.suites">
+ <type
+ class="org.eclipse.rse.tests.framework.impl.StandardTestSuiteHolder"
+ name="standard"/>
+ <type
+ class="org.eclipse.rse.tests.framework.impl.TestSuiteGeneratorHolder"
+ name="generated"/>
+ <!--
+ <type
+ class="org.eclipse.rse.tests.framework.scripting.ScriptTestSuiteHolder"
+ name="scripted"/>
+ -->
+ </extension>
+
+</plugin>
diff --git a/rse/tests/org.eclipse.rse.tests.framework/schema/suites.exsd b/rse/tests/org.eclipse.rse.tests.framework/schema/suites.exsd
new file mode 100644
index 000000000..9d2a78e36
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/schema/suites.exsd
@@ -0,0 +1,173 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.rse.tests.framework">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.eclipse.rse.tests.framework" id="suites" name="Test Suites"/>
+ </appInfo>
+ <documentation>
+ Use this extension point to tell the test framework about the existence of your test suite classes. Only test suites that use this extension point show up in the Test Suites view.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <documentation>
+ Use this element to register a list of test suites with the framework. There are two ways to register, using extensions of &lt;code&gt;junit.framework.TestSuite&lt;/code&gt; or using an implementer of &lt;code&gt;org.eclipse.rse.tests.framework.ITestSuiteProvider&lt;/code&gt;.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <choice>
+ <element ref="suite"/>
+ <element ref="type"/>
+ </choice>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ The id of the extension point you are extending. This should be &lt;code&gt;org.eclipse.rse.tests.framework.suites&lt;/code&gt;.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ The id of this particular extension.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ The external translatable name of this particular extension.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="suite">
+ <annotation>
+ <documentation>
+ Use this element to describe the existence of a test suite to the framework.
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <element ref="arg"/>
+ </sequence>
+ <attribute name="type" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class of the test suite. This must be an extension of &lt;code&gt;junit.framework.TestSuite&lt;/code&gt;.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ This is the name of the test suite that will appear in the test suite view. If it is not present then the suite provider will be asked for the suite&apos;s name, but that may cause activation of the plugin that contains the suite. To delay this activation use this attribute.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="arg">
+ <annotation>
+ <documentation>
+ Use this element to describe an argument to the creator of the test suite.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="value" type="string" use="required">
+ <annotation>
+ <documentation>
+ Provide an argument to the &lt;code&gt;getSuite(String)&lt;/code&gt; method of the provider. This argument can be used to control the generation of the test suite by the provider. If no argument is provided here then &lt;code&gt;null&lt;/code&gt; is passed.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="type">
+ <annotation>
+ <documentation>
+ Use this element to describe a test suite type and the class that will process it.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ Version 1.0.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ The framework comes supplied with an example in the plugin &lt;code&gt;org.eclipse.rse.tests.framework.examples&lt;/code&gt;. This example enables several JUnit test suites using both &lt;code&gt;suite&lt;/code&gt; and &lt;code&gt;suiteProvider&lt;/code&gt; declarations. Some suites exhibit failures and some exhibit errors. The rest succeed completely.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiInfo"/>
+ </appInfo>
+ <documentation>
+ There is no API other than the JUnit API associated with this framework. One only needs to register a test suite with this extension point to have it appear and be runnable from within the Test Suites view.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ Not applicable.
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="copyright"/>
+ </appInfo>
+ <documentation>
+ (c) Copyright IBM Corporation 2004, 2006.
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/AbstractTestSuiteHolder.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/AbstractTestSuiteHolder.java
new file mode 100644
index 000000000..70442f918
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/AbstractTestSuiteHolder.java
@@ -0,0 +1,212 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework;
+
+import java.io.StringWriter;
+import java.util.Calendar;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+import junit.framework.AssertionFailedError;
+import junit.framework.Test;
+import junit.framework.TestFailure;
+import junit.framework.TestListener;
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.ui.IActionFilter;
+
+/**
+ * Instances of AbstractHolder hold either predefined or generated test suites. Subclass this only if you are providing
+ * another means of delivering a test suite to the framework that is not already defined in the framework.
+ */
+public abstract class AbstractTestSuiteHolder implements ITestSuiteHolder, TestListener, IActionFilter {
+ private Calendar myCalendar = null;
+ private TestResult testResult = null;
+ private StringWriter stringWriter = null;
+ private IProgressMonitor monitor = null;
+ private List listeners = new Vector();
+ private TestFailure failure;
+
+ /**
+ * Construct a new AbstractTestSuiteHolder. Subclasses should invoke super() (usually implicit)
+ * and implement their own constructors.
+ */
+ protected AbstractTestSuiteHolder() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.IHolder#run(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public final void run(IProgressMonitor monitor) {
+ stringWriter = new StringWriter(1000);
+ myCalendar = Calendar.getInstance();
+ TestSuite suite = getTestSuite();
+ monitor.beginTask("Running " + suite.getName(), suite.countTestCases());
+ setTestResult(new TestResult());
+ this.monitor = monitor;
+ testResult.addListener(this);
+ suite.run(testResult);
+ testResult.removeListener(this);
+ this.monitor = null;
+ monitor.done();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.ITestSuiteHolder#reset()
+ */
+ public final void reset() {
+ stringWriter = null;
+ monitor = null;
+ testResult = null;
+ myCalendar = null;
+ for (Iterator z = listeners.iterator(); z.hasNext();) {
+ ITestSuiteHolderListener listener = (ITestSuiteHolderListener) z.next();
+ listener.testHolderReset(this);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.ITestSuiteHolder#getResultString()
+ */
+ public final String getResultString() {
+ if (stringWriter == null) {
+ return "Results not available.\n";
+ }
+ return stringWriter.toString();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.ITestSuiteHolder#addListener(org.eclipse.rse.tests.framework.ITestSuiteHolderListener)
+ */
+ public final void addListener(ITestSuiteHolderListener listener) {
+ listeners.add(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.ITestSuiteHolder#removeListener(org.eclipse.rse.tests.framework.ITestSuiteHolderListener)
+ */
+ public final void removeListener(ITestSuiteHolderListener listener) {
+ listeners.remove(listener);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.ITestSuiteHolder#getTestResult()
+ */
+ public synchronized final TestResult getTestResult() {
+ return testResult;
+ }
+
+ /**
+ * Used to predefine a test result for this holder.
+ * @param testResult
+ */
+ private synchronized final void setTestResult(TestResult testResult) {
+ this.testResult = testResult;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.ITestSuiteHolder#getLastRunTime()
+ */
+ public final Calendar getLastRunTime() {
+ return myCalendar;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see junit.framework.TestListener#addError(junit.framework.Test,
+ * java.lang.Throwable)
+ */
+ public final void addError(Test test, Throwable t) {
+ failure = new TestFailure(test, t);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see junit.framework.TestListener#addFailure(junit.framework.Test,
+ * junit.framework.AssertionFailedError)
+ */
+ public final void addFailure(Test test, AssertionFailedError t) {
+ failure = new TestFailure(test, t);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see junit.framework.TestListener#startTest(junit.framework.Test)
+ */
+ public final void startTest(Test test) {
+ failure = null;
+ if (test instanceof AnnotatingTestCase) {
+ AnnotatingTestCase a = (AnnotatingTestCase) test;
+ a.reset();
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see junit.framework.TestListener#endTest(junit.framework.Test)
+ */
+ public final void endTest(Test test) {
+ monitor.worked(1);
+ writeRemarks(test);
+ if (failure != null) {
+ stringWriter.write(failure.trace());
+ stringWriter.write("*** " + failure.toString() + "\n");
+ } else {
+ stringWriter.write("*** " + test.toString() + " passed\n");
+ }
+ for (Iterator z = listeners.iterator(); z.hasNext();) {
+ ITestSuiteHolderListener listener = (ITestSuiteHolderListener) z.next();
+ listener.testEnded(this);
+ }
+ if (monitor.isCanceled()) {
+ testResult.stop();
+ }
+ }
+
+ /**
+ * Writes the remarks for a test onto the log maintained by this holder.
+ * @param test The test whose remarks are being obtained. This will be an instance of Test, but
+ * it will do nothing unless the test is an AnnotatingTestCase.
+ * @see AnnotatingTestCase
+ */
+ private void writeRemarks(Test test) {
+ if (test instanceof AnnotatingTestCase) {
+ stringWriter.write("\n");
+ AnnotatingTestCase a = (AnnotatingTestCase) test;
+ stringWriter.write(a.getAnnotations());
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IActionFilter#testAttribute(java.lang.Object,
+ * java.lang.String, java.lang.String)
+ */
+ public boolean testAttribute(Object target, String name, String value) {
+ return (target == this && name.equals("hasResult") && value.equals("true") && testResult != null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.ITestSuiteHolder#getTestSuite()
+ */
+ public abstract TestSuite getTestSuite();
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.ITestSuiteHolder#getName()
+ */
+ public abstract String getName();
+
+} \ No newline at end of file
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/AnnotatingTestCase.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/AnnotatingTestCase.java
new file mode 100644
index 000000000..ed53f854c
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/AnnotatingTestCase.java
@@ -0,0 +1,56 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import junit.framework.TestCase;
+
+/**
+ * AnnotatingTestCase extends TestCase by adding the capability to store remarks on the
+ * test during its execution. These remarks can be gathered by the environment that
+ * runs the test and presented to a user by whatever means is interesting in that environment.
+ * For example, a view may choose to chose these in a pane immediately after running the
+ * testcase.
+ */
+public class AnnotatingTestCase extends TestCase {
+
+ private PrintWriter out;
+ private StringWriter base;
+
+ public AnnotatingTestCase() {
+ reset();
+ }
+
+ /**
+ * @param methodName The name of the method to run for this test.
+ * Usually "testSomething".
+ */
+ public AnnotatingTestCase(String methodName) {
+ super(methodName);
+ reset();
+ }
+
+ protected void remark(String remark) {
+ out.println(remark);
+ }
+
+ public String getAnnotations() {
+ return base.toString();
+ }
+
+ public void reset() {
+ base = new StringWriter(1000);
+ out = new PrintWriter(base);
+ }
+
+}
+
+
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/DelegatingTestSuiteHolder.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/DelegatingTestSuiteHolder.java
new file mode 100644
index 000000000..f5cc40df8
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/DelegatingTestSuiteHolder.java
@@ -0,0 +1,160 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework;
+
+import java.util.List;
+import java.util.Vector;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IContributor;
+import org.eclipse.core.runtime.IExtensionRegistry;
+import org.eclipse.core.runtime.Platform;
+import org.osgi.framework.Bundle;
+
+/**
+ * A delegating holder is the abstract superclass of all suite holders that are
+ * defined in extension points.
+ */
+public abstract class DelegatingTestSuiteHolder extends AbstractTestSuiteHolder {
+
+ private static final String SUITE_EXTENSION_POINT_NAME = "org.eclipse.rse.tests.framework.suites"; // $NON-NLS-1$
+
+ // elements
+ private static final String TYPE_ELEMENT = "type"; // $NON-NLS-1$
+ private static final String SUITE_ELEMENT = "suite"; // $NON-NLS-1$
+ private static final String ARGUMENT_ELEMENT = "arg"; // $NON-NLS-1$
+
+ // attributes
+ private static final String TYPE_ATTRIBUTE = "type"; // $NON-NLS-1$
+ private static final String NAME_ATTRIBUTE = "name"; // $NON-NLS-1$
+ private static final String CLASS_ATTRIBUTE = "class"; // $NON-NLS-1$
+ private static final String VALUE_ATTRIBUTE = "value"; // $NON-NLS-1$
+
+ /**
+ * Returns a newly minted suite holder of the given type.
+ * @param wantedTypeName the type name of the suite holder
+ * @return a new suite holder of that type or null if that type is not defined
+ */
+ private static DelegatingTestSuiteHolder getSuiteHolder(String wantedTypeName) {
+ DelegatingTestSuiteHolder holder = null;
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IConfigurationElement[] configs = registry.getConfigurationElementsFor(SUITE_EXTENSION_POINT_NAME);
+ for (int i = 0; i < configs.length; i++) {
+ IConfigurationElement config = configs[i];
+ String elementName = config.getName();
+ if (elementName.equals(TYPE_ELEMENT)) {
+ String candidateTypeName = config.getAttribute(NAME_ATTRIBUTE);
+ if (candidateTypeName.equals(wantedTypeName)) {
+ try {
+ holder = (DelegatingTestSuiteHolder) config.createExecutableExtension(CLASS_ATTRIBUTE);
+ } catch (CoreException e) {
+ }
+ }
+ }
+ }
+ return holder;
+ }
+
+ /**
+ * Retrieve all suite holders defined by extension points.
+ * @return an array of suite holders.
+ * @throws IllegalArgumentException if any suite holder is ill-defined
+ */
+ public static DelegatingTestSuiteHolder[] getHolders() {
+ List holders = new Vector();
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IConfigurationElement[] configs = registry.getConfigurationElementsFor(SUITE_EXTENSION_POINT_NAME);
+ for (int i = 0; i < configs.length; i++) {
+ IConfigurationElement config = configs[i];
+ String elementName = config.getName();
+ if (elementName.equals(SUITE_ELEMENT)) {
+ String suiteType = config.getAttribute(TYPE_ATTRIBUTE);
+ String suiteName = config.getAttribute(NAME_ATTRIBUTE);
+ DelegatingTestSuiteHolder holder = getSuiteHolder(suiteType);
+ if (holder != null) {
+ holder.setConfiguration(config);
+ holder.setName(suiteName);
+ holders.add(holder);
+ }
+ }
+ }
+ DelegatingTestSuiteHolder[] result = new DelegatingTestSuiteHolder[holders.size()];
+ holders.toArray(result);
+ return result;
+ }
+
+ private String name;
+ private IConfigurationElement config;
+
+ /**
+ * Retrieves the argument configuration element for an argument of a given name
+ * @param name the name of the argument
+ * @return the configuration element of that name, or null if not found.
+ */
+ protected IConfigurationElement getArgumentElement(String name) {
+ IConfigurationElement result = null;
+ IConfigurationElement[] argumentElements = config.getChildren(ARGUMENT_ELEMENT);
+ for (int i = 0; i < argumentElements.length && result == null; i++) {
+ IConfigurationElement argumentElement = argumentElements[i];
+ String argumentName = argumentElement.getAttribute(NAME_ATTRIBUTE);
+ if (argumentName.equals(name)) {
+ result = argumentElement;
+ }
+ }
+ return result;
+ }
+
+ protected String getStringValue(String name) {
+ String result = null;
+ IConfigurationElement element = getArgumentElement(name);
+ if (element != null) {
+ result = element.getAttribute(VALUE_ATTRIBUTE);
+ }
+ return result;
+ }
+
+ protected Object getObjectValue(String name) {
+ Object result = null;
+ IConfigurationElement element = getArgumentElement(name);
+ if (element != null) {
+ try {
+ result = element.createExecutableExtension("value");
+ } catch (CoreException e) {
+ }
+ }
+ return result;
+ }
+
+ protected Bundle getBundle() {
+ IContributor contributor = config.getContributor();
+ String bundleName = contributor.getName();
+ Bundle bundle = Platform.getBundle(bundleName);
+ return bundle;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getName()
+ */
+ public String getName() {
+ return name;
+ }
+
+ private void setName(String name) {
+ this.name = name;
+ }
+
+ private void setConfiguration(IConfigurationElement config) {
+ this.config = config;
+ }
+
+}
+
+
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ITestSuiteHolder.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ITestSuiteHolder.java
new file mode 100644
index 000000000..21cb41b51
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ITestSuiteHolder.java
@@ -0,0 +1,79 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework;
+
+import java.util.Calendar;
+import junit.framework.TestResult;
+import junit.framework.TestSuite;
+import org.eclipse.core.runtime.IProgressMonitor;
+
+/**
+ * Instances of this type deliver JUnit test suites on demand.
+ */
+public interface ITestSuiteHolder {
+
+ /**
+ * Runs the test suite held by this holder. Saves the result which is
+ * available through getResult().
+ *
+ * @param monitor a fresh progress monitor for this run. It is advanced by one
+ * for each testcase executed in this suite.
+ */
+ public void run(IProgressMonitor monitor);
+
+ /**
+ * Resets this result used by this job monitor and notifies any listeners.
+ */
+ public void reset();
+
+ /**
+ * @return the string that is the result of the last time this was run.
+ */
+ public String getResultString();
+
+ /**
+ * @return the test result from the last time this was run.
+ * This will be null if the test has not been run since it was created
+ * or reset.
+ */
+ public TestResult getTestResult();
+
+ /**
+ * @return the Calendar representing the time this test was last run.
+ * This will be null if the test has not been run since it was created or
+ * reset.
+ */
+ public Calendar getLastRunTime();
+
+ /**
+ * @return the test suite held by this holder.
+ */
+ public abstract TestSuite getTestSuite();
+
+ /**
+ * @return the name of the test suite held by this holder.
+ */
+ public abstract String getName();
+
+ /**
+ * Adds a new listener to this holder. This listener can process events that happen in the
+ * lifecycle of the test suite held by this holder.
+ * @param listener the listener to add
+ */
+ public void addListener(ITestSuiteHolderListener listener);
+
+ /**
+ * Removes a listener from this holder. Does nothing if the holder has no knowledge of
+ * this listener
+ * @param listener the listener to remove.
+ */
+ public void removeListener(ITestSuiteHolderListener listener);
+
+} \ No newline at end of file
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ITestSuiteHolderListener.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ITestSuiteHolderListener.java
new file mode 100644
index 000000000..4364810fe
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ITestSuiteHolderListener.java
@@ -0,0 +1,34 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework;
+
+/**
+ * Implementers of this interface can register with a test suite holder to listen for the
+ * events regarding the test suite in the holder.
+ * @see ITestSuiteHolder
+ */
+public interface ITestSuiteHolderListener {
+
+ /**
+ * A test in the suite held by a test holder has ended. The holder may be queried for
+ * the result.
+ * @param holder
+ */
+ public void testEnded(ITestSuiteHolder holder);
+
+ /**
+ * A test holder has been reset.
+ * @param holder
+ */
+ public void testHolderReset(ITestSuiteHolder holder);
+
+}
+
+
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ITestSuiteProvider.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ITestSuiteProvider.java
new file mode 100644
index 000000000..ebfab462c
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ITestSuiteProvider.java
@@ -0,0 +1,30 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework;
+
+import junit.framework.TestSuite;
+
+/**
+ * A test suite provider will generate and deliver a test suite when asked to do so.
+ */
+public interface ITestSuiteProvider {
+
+ /**
+ * Generates a test suite.
+ * @param argument a String that can be used to discriminate among test suites generated
+ * by this provider.
+ * @return the TestSuite provided by this provider.
+ * @see TestSuite
+ */
+ public TestSuite getSuite(String argument);
+
+}
+
+
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/TestFrameworkPlugin.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/TestFrameworkPlugin.java
new file mode 100644
index 000000000..360132712
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/TestFrameworkPlugin.java
@@ -0,0 +1,57 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework;
+
+import org.eclipse.core.runtime.Status;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class TestFrameworkPlugin extends AbstractUIPlugin {
+
+ private static TestFrameworkPlugin plugin;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * @return the shared instance of this plugin.
+ */
+ public static TestFrameworkPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Logs an unexpected exception.
+ * @param e the exception to log
+ */
+ public void logUnexpectedException(Exception e) {
+ e.printStackTrace();
+ String id = getBundle().getSymbolicName();
+ Status status = new Status(Status.ERROR, id, 0, "Unexpected Exception", e);
+ getLog().log(status);
+ }
+
+}
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/actions/ResetHolderDelegate.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/actions/ResetHolderDelegate.java
new file mode 100644
index 000000000..fee57b084
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/actions/ResetHolderDelegate.java
@@ -0,0 +1,61 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.actions;
+
+import java.util.Iterator;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.tests.framework.AbstractTestSuiteHolder;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * This implements the delegate for the "Reset Test Suite" action presented in the UI.
+ * The UI Proxy invokes this delegate.
+ * @see IObjectActionDelegate
+ */
+public class ResetHolderDelegate implements IObjectActionDelegate {
+
+ private ISelection selection;
+
+ /**
+ * The constructor.
+ */
+ public ResetHolderDelegate() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ for (Iterator z = ss.iterator(); z.hasNext();) {
+ AbstractTestSuiteHolder holder = (AbstractTestSuiteHolder) z.next();
+ holder.reset();
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ this.selection = selection;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
+ */
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ }
+
+} \ No newline at end of file
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/actions/RunHolderDelegate.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/actions/RunHolderDelegate.java
new file mode 100644
index 000000000..390b7303e
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/actions/RunHolderDelegate.java
@@ -0,0 +1,93 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.actions;
+
+import java.util.Iterator;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.SubProgressMonitor;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.rse.tests.framework.AbstractTestSuiteHolder;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.IWorkbenchPartSite;
+import org.eclipse.ui.progress.IWorkbenchSiteProgressService;
+
+/**
+ * This implements the delegate for the "Run Test Suite" action presented in the
+ * UI. The UI Proxy invokes this delegate.
+ *
+ * @see IObjectActionDelegate
+ */
+public class RunHolderDelegate implements IObjectActionDelegate {
+ private IWorkbenchPart part;
+ private ISelection selection;
+
+ /**
+ * The constructor.
+ */
+ public RunHolderDelegate() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ this.selection = selection;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction,
+ * org.eclipse.ui.IWorkbenchPart)
+ */
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ this.part = targetPart;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ final ISelection selection = this.selection;
+ Job job = new Job("Running JUnit Tests Suites") {
+ IStatus result = Status.OK_STATUS;
+
+ protected IStatus run(IProgressMonitor monitor) {
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ monitor.beginTask("", ss.size());
+ for (Iterator z = ss.iterator(); z.hasNext();) {
+ AbstractTestSuiteHolder holder = (AbstractTestSuiteHolder) z.next();
+ monitor.subTask(holder.getName());
+ IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 1);
+ holder.run(subMonitor);
+ if (monitor.isCanceled()) {
+ result = Status.CANCEL_STATUS;
+ break;
+ }
+ }
+ monitor.done();
+ }
+ return result;
+ }
+ };
+ job.setPriority(Job.LONG);
+ job.setUser(true);
+ IWorkbenchPartSite site = part.getSite();
+ IWorkbenchSiteProgressService siteService = (IWorkbenchSiteProgressService) site.getAdapter(IWorkbenchSiteProgressService.class);
+ siteService.schedule(job, 0, true);
+ }
+} \ No newline at end of file
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/actions/SelectAllHoldersDelegate.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/actions/SelectAllHoldersDelegate.java
new file mode 100644
index 000000000..12317cb89
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/actions/SelectAllHoldersDelegate.java
@@ -0,0 +1,52 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.actions;
+
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.rse.tests.framework.ui.TestSuiteHolderView;
+import org.eclipse.ui.IViewActionDelegate;
+import org.eclipse.ui.IViewPart;
+
+/**
+ * This implements the delegate for the "Select All" action presented in the UI.
+ * The UI Proxy invokes this delegate.
+ * @see IViewActionDelegate
+ */
+public class SelectAllHoldersDelegate implements IViewActionDelegate {
+
+ private IViewPart view;
+
+ /**
+ * The constructor.
+ */
+ public SelectAllHoldersDelegate() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ ((TestSuiteHolderView)view).selectAll();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IViewActionDelegate#init(org.eclipse.ui.IViewPart)
+ */
+ public void init(IViewPart view) {
+ this.view = view;
+ }
+} \ No newline at end of file
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/impl/BasicTestSuiteHolder.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/impl/BasicTestSuiteHolder.java
new file mode 100644
index 000000000..523d985b4
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/impl/BasicTestSuiteHolder.java
@@ -0,0 +1,42 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.impl;
+
+import org.eclipse.rse.tests.framework.AbstractTestSuiteHolder;
+
+import junit.framework.TestSuite;
+
+/**
+ * A BasicHolder provides a simple wrapper for a test suite. Use this if you just want to contribute a JUnit
+ * test suite that you already have without defining it in an extension point.
+ */
+public class BasicTestSuiteHolder extends AbstractTestSuiteHolder {
+
+ private TestSuite testSuite;
+
+ public BasicTestSuiteHolder(TestSuite testSuite) {
+ this.testSuite = testSuite;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getName()
+ */
+ public String getName() {
+ return testSuite.getName();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite()
+ */
+ public TestSuite getTestSuite() {
+ return testSuite;
+ }
+
+} \ No newline at end of file
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/impl/StandardTestSuiteHolder.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/impl/StandardTestSuiteHolder.java
new file mode 100644
index 000000000..3fb5dc221
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/impl/StandardTestSuiteHolder.java
@@ -0,0 +1,36 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.impl;
+
+import junit.framework.TestSuite;
+
+import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder;
+
+/**
+ * A SuiteHolder can deliver a test suite when asked. It references
+ * a JUnit TestSuite named by a "suite" tag to do this.
+ */
+public class StandardTestSuiteHolder extends DelegatingTestSuiteHolder {
+
+ private TestSuite suite;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite()
+ */
+ public TestSuite getTestSuite() {
+ if (suite == null) {
+ suite = (TestSuite) getObjectValue("class");
+ }
+ return suite;
+ }
+
+}
+
+
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/impl/TestSuiteGeneratorHolder.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/impl/TestSuiteGeneratorHolder.java
new file mode 100644
index 000000000..a10a59b52
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/impl/TestSuiteGeneratorHolder.java
@@ -0,0 +1,39 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.impl;
+
+import junit.framework.TestSuite;
+
+import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder;
+import org.eclipse.rse.tests.framework.ITestSuiteProvider;
+
+/**
+ * A suite generator holder can deliver a test suite when asked. It uses a suite
+ * generator supplied by an extension point to build that test suite.
+ */
+public class TestSuiteGeneratorHolder extends DelegatingTestSuiteHolder {
+
+ private TestSuite suite;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite()
+ */
+ public TestSuite getTestSuite() {
+ if (suite == null) {
+ ITestSuiteProvider p = (ITestSuiteProvider)getObjectValue("class");
+ String arg = getStringValue("argument");
+ suite = p.getSuite(arg);
+ }
+ return suite;
+ }
+
+}
+
+
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ConsoleContext.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ConsoleContext.java
new file mode 100644
index 000000000..895d25f8e
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ConsoleContext.java
@@ -0,0 +1,92 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.scripting;
+
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.net.URL;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.ImageData;
+
+/**
+ * This kind of ScriptContext only prints information on the PrintStream it is
+ * given. Useful for making sure that instructions read properly.
+ */
+public class ConsoleContext extends ScriptContext {
+
+ private PrintWriter transcript;
+
+ /**
+ * @param home
+ * @param out The print stream on which to write messages.
+ */
+ public ConsoleContext(PrintStream out, URL home) {
+ super(home);
+ this.transcript = new PrintWriter(out);
+ }
+
+ /**
+ * A show operation will resolve a name to an image and show that image
+ * in the current environment.
+ * @param imageName the name of the image to resolve and show.
+ */
+ public void show(String imageName) {
+ log("showing " + imageName);
+ String message = "image not found";
+ URL imageURL = getResourceURL(imageName);
+ if (imageURL != null) {
+ ImageDescriptor descriptor = ImageDescriptor.createFromURL(imageURL);
+ ImageData data = descriptor.getImageData();
+ if (data != null) {
+ String type = "Unknown";
+ switch (data.type) {
+ case SWT.IMAGE_GIF:
+ type = "GIF";
+ break;
+ case SWT.IMAGE_JPEG:
+ type = "JPEG";
+ break;
+ case SWT.IMAGE_PNG:
+ type = "PNG";
+ break;
+ default:
+ type = "Other";
+ }
+ message = type + "(" + Integer.toString(data.width) + " x " + Integer.toString(data.height) + ")";
+ }
+ }
+ log(message);
+ }
+
+ /**
+ * A tell operation will show a string in the environment.
+ * @param text the String to show.
+ */
+ public void tell(String text) {
+ log(text);
+ }
+
+ /**
+ * A pause operation will stop and wait for a "continue" or "fail" indication
+ * from the environment.
+ * @param text the message to display during the pause
+ */
+ public void pause(String text) {
+ if (text.length() == 0) text = "pausing";
+ log(text);
+ }
+
+ private void log(String message) {
+ transcript.println(message);
+ transcript.flush();
+ }
+
+}
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/PerspectiveContext.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/PerspectiveContext.java
new file mode 100644
index 000000000..e1854ac95
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/PerspectiveContext.java
@@ -0,0 +1,99 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.scripting;
+
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.rse.tests.framework.ui.TestSuiteConsoleView;
+import org.eclipse.rse.tests.framework.ui.TestSuiteHolderView;
+import org.eclipse.rse.tests.framework.ui.TestSuiteImageView;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IViewReference;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchPage;
+
+/**
+ * A perspective context is a kind of script context that coordinates among
+ * the several different views in the testing perspective.
+ */
+public class PerspectiveContext extends ScriptContext {
+
+ private TestSuiteHolderView holderView;
+
+ /**
+ * Constructs a new PerspectiveContext for running the suites with a user interface. The suites
+ * are run from the holder view named here, the image and console views used for show and tell
+ * are located on the same workbench page as the holder view.
+ * @param holderView the test suite holder view that will drive the scripts.
+ * @param home the URL that names the location that contains the script's resources
+ */
+ public PerspectiveContext(TestSuiteHolderView holderView, URL home) {
+ super(home);
+ this.holderView = holderView;
+ }
+
+ /**
+ * A show operation will resolve a name to an image and show that image
+ * in the current environment.
+ * @param imageName the name of the image to resolve and show.
+ */
+ public void show(String imageName) {
+ TestSuiteImageView view = findImageView();
+ URL imageURL = getResourceURL(imageName);
+ if (imageURL != null) {
+ ImageDescriptor descriptor = ImageDescriptor.createFromURL(imageURL);
+ view.setImage(descriptor);
+ }
+ }
+
+ /**
+ * A tell operation will show a string in the environment.
+ * @param text the String to show.
+ */
+ public void tell(String text) {
+ TestSuiteConsoleView view = findConsoleView();
+ view.add(text);
+ }
+
+ /**
+ * A pause operation will stop and wait for a "continue" or "fail" indication
+ * from the environment.
+ * @param text the message to display during the pause
+ */
+ public void pause(String text) {
+ tell("pausing");
+ // TODO this doesn't really pause yet. still need a way to continue.
+ }
+
+ private TestSuiteImageView findImageView() {
+ return (TestSuiteImageView) findView("org.eclipse.rse.tests.framework.ImageView");
+ }
+
+ private TestSuiteConsoleView findConsoleView() {
+ return (TestSuiteConsoleView) findView("org.eclipse.rse.tests.framework.ConsoleView");
+ }
+
+ private IViewPart findView(String viewId) {
+ IViewPart result = null;
+ IViewSite site = holderView.getViewSite();
+ IWorkbenchPage page = site.getPage();
+ IViewReference[] references = page.getViewReferences();
+ for (int i = 0; i < references.length; i++) {
+ IViewReference reference = references[i];
+ String referenceId = reference.getId();
+ if (referenceId.equals(viewId)) {
+ result = reference.getView(true);
+ }
+ }
+ return result;
+ }
+
+}
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/Script.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/Script.java
new file mode 100644
index 000000000..26e7cf860
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/Script.java
@@ -0,0 +1,49 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.scripting;
+
+/**
+ * A Script is a collection of steps.
+ */
+public class Script extends SyntaxNode {
+
+ private boolean failed = false;
+
+ /**
+ * Creates a new script node. This is the base of the syntax tree for
+ * scripts. These always have a line number of zero.
+ */
+ public Script() {
+ super(0);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.scripting.SyntaxNode#enter(org.eclipse.rse.tests.framework.scripting.ScriptContext)
+ */
+ public void enter(ScriptContext context) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.scripting.SyntaxNode#leave(org.eclipse.rse.tests.framework.scripting.ScriptContext)
+ */
+ public void leave(ScriptContext context) {
+ failed = context.getFailed();
+ }
+
+ /**
+ * @return the failure state of the script.
+ */
+ public boolean hasFailed() {
+ return failed;
+ }
+
+}
+
+
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptContext.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptContext.java
new file mode 100644
index 000000000..0df0b8c29
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptContext.java
@@ -0,0 +1,95 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.scripting;
+
+import java.net.MalformedURLException;
+import java.net.URL;
+import org.eclipse.core.runtime.ILog;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.rse.tests.framework.TestFrameworkPlugin;
+import org.osgi.framework.Bundle;
+
+/**
+ * Provides a context in which a script may be run. The steps of the script will
+ * ask the context to accomplish things. Think of a ScriptContext the platform
+ * on which Steps express themselves to the outside world.
+ */
+public abstract class ScriptContext {
+
+ private boolean failed = false;
+ private URL home;
+
+ /**
+ * Create a new ScriptContext.
+ * @param home the location relative to which all resource names are resolved.
+ */
+ public ScriptContext(URL home) {
+ this.home = home;
+ }
+
+ /**
+ * @param resourceName the resource name relative to the location specified by
+ * the home for this Context.
+ * @return a new URL for this specific resource or null if no URL can be formed.
+ */
+ public final URL getResourceURL(String resourceName) {
+ URL result = null;
+ try {
+ result = new URL(home, resourceName);
+ } catch (MalformedURLException e) {
+ setFailing(true);
+ Plugin plugin = TestFrameworkPlugin.getDefault();
+ Bundle bundle = plugin.getBundle();
+ String pluginId = bundle.getSymbolicName();
+ ILog log = plugin.getLog();
+ IStatus status = new Status(IStatus.ERROR, pluginId, IStatus.OK, "bad resource name in script", e);
+ log.log(status);
+ }
+ return result;
+ }
+
+ /**
+ * @return true if the Context has received an indication to fail from the environment.
+ */
+ public final boolean getFailed() {
+ return failed;
+ }
+
+ /**
+ * Indicate that the script has failed.
+ * @param flag true if the test has failed
+ */
+ public final void setFailing(boolean flag) {
+ failed = flag;
+ }
+
+ /**
+ * A pause operation will stop and wait for a "continue" or "fail" indication
+ * from the environment.
+ * @param text the message to print on the environment during the pause
+ */
+ public abstract void pause(String text);
+
+ /**
+ * A show operation will resolve a name to an image and show that image
+ * in the current environment.
+ * @param imageName the name of the image to resolve and show.
+ */
+ public abstract void show(String imageName);
+
+ /**
+ * A tell operation will show a string in the environment.
+ * @param text the String to show.
+ */
+ public abstract void tell(String text);
+
+}
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptInterpreter.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptInterpreter.java
new file mode 100644
index 000000000..70764c21a
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptInterpreter.java
@@ -0,0 +1,58 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.scripting;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * An interpreter runs a script in a particular context.
+ */
+public class ScriptInterpreter extends SyntaxTreeVisitor {
+
+ private ScriptContext context;
+ private ScriptParserMessageList messageList = null;
+
+ public ScriptInterpreter(ScriptContext context) {
+ this.context = context;
+ }
+
+ /**
+ * @param in the InputStream to be interpreted
+ * @return true if the parsing and interpretation concluded successfully.
+ * @throws IOException
+ */
+ public boolean run(InputStream in) throws IOException {
+ messageList = new ScriptParserMessageList();
+ ScriptParser p = new ScriptParser(messageList);
+ Script script = p.parse(in);
+ boolean success = false;
+ if (script != null) {
+ script.accept(this);
+ success = !script.hasFailed();
+ }
+ return success;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.scripting.SyntaxTreeVisitor#enter(org.eclipse.rse.tests.framework.scripting.SyntaxNode)
+ */
+ public void enter(SyntaxNode node) {
+ node.enter(context);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.scripting.SyntaxTreeVisitor#leave(org.eclipse.rse.tests.framework.scripting.SyntaxNode)
+ */
+ public void leave(SyntaxNode node) {
+ node.leave(context);
+ }
+
+}
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptParser.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptParser.java
new file mode 100644
index 000000000..0c2e8e37f
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptParser.java
@@ -0,0 +1,132 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.scripting;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.Stack;
+
+/**
+ * A Parser is an object capable of taking a reader and producing a script from it.
+ */
+public class ScriptParser {
+ private ScriptParserMessageList messageList;
+ private int lineNumber = 0;
+ private String statement = null;
+ private int statementLineNumber = 0;
+ private BufferedReader in = null;
+ private Stack nodes = null;
+
+ /**
+ * Creates a new parser on an existing MessageList. Any messages found
+ * during parsing are added to this list.
+ * @param messageList
+ */
+ public ScriptParser(ScriptParserMessageList messageList) {
+ this.messageList = messageList;
+ }
+
+ /**
+ * @param inStream The InputStream holding the input to the parser. The stream is left
+ * open after parsing is completed. It is up to the client to close the stream
+ * if necessary.
+ * @return the Script produced by the parser or null if none was produced.
+ * @throws IOException if an IO error occurs while reading the stream
+ */
+ public Script parse(InputStream inStream) throws IOException {
+ lineNumber = 0;
+ nodes = new Stack();
+ nodes.push(new Script());
+ in = new BufferedReader(new InputStreamReader(inStream));
+ for (getStatement(); statement != null; getStatement()) {
+ parseStatement();
+ }
+ Script result = null;
+ SyntaxNode top = getCurrentNode();
+ if (top != null) {
+ if (top instanceof Script) {
+ result = (Script) top;
+ } else {
+ messageList.add(new ScriptParserMessage(lineNumber, ScriptParserMessage.ERROR, "Incomplete statement"));
+ }
+ } else {
+ messageList.add(new ScriptParserMessage(lineNumber, ScriptParserMessage.ERROR, "Internal error"));
+ }
+ return result;
+ }
+
+ private void parseStatement() {
+ if (statement.startsWith("tell"))
+ parseTell();
+ else if (statement.startsWith("show"))
+ parseShow();
+ else if (statement.startsWith("pause"))
+ parsePause();
+ else
+ messageList.add(new ScriptParserMessage(lineNumber, ScriptParserMessage.ERROR, "Unrecognized statement"));
+ }
+
+ private void parseTell() {
+ String remark = statement.substring(4);
+ remark = remark.trim();
+ SyntaxNode tell = new ScriptTell(remark, statementLineNumber);
+ getCurrentNode().add(tell);
+ }
+
+ private void parseShow() {
+ String imageName = statement.substring(4);
+ imageName = imageName.trim();
+ SyntaxNode show = new ScriptShow(imageName, statementLineNumber);
+ getCurrentNode().add(show);
+ }
+
+ private void parsePause() {
+ String remark = statement.substring(5);
+ remark = remark.trim();
+ SyntaxNode pause = new ScriptPause(remark, statementLineNumber);
+ getCurrentNode().add(pause);
+ }
+
+ private void getStatement() throws IOException {
+ statement = null;
+ String line = in.readLine();
+ while (line != null) {
+ lineNumber++;
+ line = trimComment(line);
+ line = line.trim();
+ if (statement == null) {
+ statementLineNumber = lineNumber;
+ statement = line;
+ } else {
+ statement += line;
+ }
+ if (!statement.endsWith("+")) break;
+ statement = statement.substring(0, statement.length() - 1);
+ line = in.readLine();
+ }
+ }
+
+ private String trimComment(String line) {
+ int n = line.indexOf('#');
+ if (n >= 0) {
+ line = line.substring(0, n);
+ }
+ return line;
+ }
+
+ private SyntaxNode getCurrentNode() {
+ if (nodes.isEmpty()) return null;
+ return (SyntaxNode) nodes.peek();
+ }
+
+
+} \ No newline at end of file
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptParserMessage.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptParserMessage.java
new file mode 100644
index 000000000..c311bcdc7
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptParserMessage.java
@@ -0,0 +1,116 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.scripting;
+
+import java.text.MessageFormat;
+
+/**
+ * A message may indicate an error, warning or informational bit of information.
+ * It may also contain data which may be retrieved.
+ */
+public class ScriptParserMessage {
+
+ public static final int INFO = 0;
+ public static final int WARNING = 1;
+ public static final int ERROR = 2;
+ public static final int SEVERE = 3;
+ private int severity = 0;
+ private String text = "";
+ private Object[] data = new Object[0];
+ private int lineNumber;
+
+ /**
+ * Creates a new message with the given severity and text. The message is
+ * not bound to any data values.
+ * @param lineNumber the line number to which this message applies.
+ * @param severity the severity of the message. Must be one of INFO, WARNING,
+ * ERROR, or SEVERE.
+ * @param text the text of the message in the form processable by MessageFormat.
+ * @see MessageFormat
+ * @throws IllegalArgumentException if the severity is invalid.
+ */
+ public ScriptParserMessage(int lineNumber, int severity, String text) {
+ if (severity < INFO || severity > SEVERE) throw new IllegalArgumentException();
+ this.lineNumber = lineNumber;
+ this.severity = severity;
+ this.text = text;
+ }
+
+ /**
+ * Creates a new message with the given severity and text. The message is
+ * bound to the given data values.
+ * @param lineNumber the line number to which this message applies.
+ * @param severity the severity of the message. Must be one of INFO, WARNING,
+ * ERROR, or SEVERE.
+ * @param text the text of the message in the form processable by MessageFormat.
+ * @see MessageFormat
+ * @param data the data values to which the message will be bound.
+ * @throws IllegalArgumentException if the severity is invalid.
+ */
+ public ScriptParserMessage(int lineNumber, int severity, String text, Object[] data) {
+ this.lineNumber = lineNumber;
+ this.severity = severity;
+ this.text = text;
+ bind(data);
+ }
+
+ /**
+ * @return the severity of the message.
+ */
+ public int getSeverity() {
+ return severity;
+ }
+
+ /**
+ * @return the unbound text of the message.
+ */
+ public String getText() {
+ return text;
+ }
+
+ /**
+ * @return the data values that this message is bound to. If the message is
+ * unbound then this will return null.
+ */
+ public Object[] getData() {
+ Object[] result = new Object[data.length];
+ System.arraycopy(result, 0, data, 0, data.length);
+ return result;
+ }
+
+ /**
+ * @return Returns the line number of this message.
+ */
+ public int getLineNumber() {
+ return lineNumber;
+ }
+
+ /**
+ * Binds the data values to the message. It does not perform any subtitutions
+ * at this time. A shallow copy of the array is made.
+ * @param data the values to be bound to the message
+ * @return the message itself.
+ */
+ public ScriptParserMessage bind(Object[] data) {
+ this.data = new Object[data.length];
+ System.arraycopy(data, 0, this.data, 0, data.length);
+ return this;
+ }
+
+ /**
+ * @return the string result of formating the text of the message using
+ * the message data for substitution.
+ */
+ public String toString() {
+ String result = MessageFormat.format(text, data);
+ return result;
+ }
+
+}
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptParserMessageList.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptParserMessageList.java
new file mode 100644
index 000000000..24f57980e
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptParserMessageList.java
@@ -0,0 +1,48 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.scripting;
+
+import java.util.List;
+import java.util.Vector;
+
+/**
+ * A MessageList is a collection of messages. Its severity is the highest
+ * severity of the messages it contains.
+ */
+public class ScriptParserMessageList {
+
+ private List messages = new Vector(10); // the initial size is arbitrary
+ private int severity = ScriptParserMessage.INFO;
+
+ /**
+ * @param message the message to add to this MessageList
+ */
+ public void add(ScriptParserMessage message) {
+ messages.add(message);
+ severity = Math.max(severity, message.getSeverity());
+ }
+
+ /**
+ * @return the severity of this MessageList
+ */
+ public int getSeverity() {
+ return severity;
+ }
+
+ /**
+ * @return the messages in this message list
+ */
+ public ScriptParserMessage[] getMessages() {
+ ScriptParserMessage[] result = new ScriptParserMessage[messages.size()];
+ messages.toArray(result);
+ return result;
+ }
+
+}
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptPause.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptPause.java
new file mode 100644
index 000000000..1a5c35c6d
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptPause.java
@@ -0,0 +1,31 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.scripting;
+
+/**
+ * A Pause step will stop and wait during interpretation
+ */
+public class ScriptPause extends ScriptStep {
+
+ private String text;
+
+ public ScriptPause(String text, int lineNumber) {
+ super(lineNumber);
+ this.text = text;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.scripting.ScriptStep#run(org.eclipse.rse.tests.framework.scripting.ScriptContext)
+ */
+ public void run(ScriptContext context) {
+ context.pause(text);
+ }
+
+}
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptShow.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptShow.java
new file mode 100644
index 000000000..377a78b16
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptShow.java
@@ -0,0 +1,30 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.scripting;
+
+/**
+ * The Show step shows an image on the current context when run.
+ */
+public class ScriptShow extends ScriptStep {
+ private String imageName;
+
+ public ScriptShow(String imageName, int lineNumber) {
+ super(lineNumber);
+ this.imageName = imageName;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.scripting.ScriptStep#run(org.eclipse.rse.tests.framework.scripting.ScriptContext)
+ */
+ public void run(ScriptContext context) {
+ context.show(imageName);
+ }
+
+} \ No newline at end of file
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptStep.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptStep.java
new file mode 100644
index 000000000..eec629d0d
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptStep.java
@@ -0,0 +1,50 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.scripting;
+
+/**
+ * A Step accomplishes a single action. If the context is in fail mode then steps
+ * are not executed.
+ * show anImageName
+ * tell aTextString
+ * pause
+ */
+abstract class ScriptStep extends SyntaxNode {
+
+ /**
+ * @param lineNumber The line number of this step. Used for diagnostics.
+ */
+ public ScriptStep(int lineNumber) {
+ super(lineNumber);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.scripting.SyntaxNode#enter(org.eclipse.rse.tests.framework.scripting.ScriptContext)
+ */
+ public void enter(ScriptContext context) {
+ if (context.getFailed()) return;
+ run(context);
+ }
+
+ /**
+ * Perform the action to be done by this step.
+ * @param context the Context on which to perform the action.
+ */
+ public abstract void run(ScriptContext context);
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.scripting.SyntaxNode#leave(org.eclipse.rse.tests.framework.scripting.ScriptContext)
+ */
+ public final void leave(ScriptContext context) {
+ }
+
+}
+
+
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptTell.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptTell.java
new file mode 100644
index 000000000..87d94b5d8
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptTell.java
@@ -0,0 +1,31 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.scripting;
+
+/**
+ * The Tell step shows an image on the current context when run.
+ */
+public class ScriptTell extends ScriptStep {
+
+ private String text;
+
+ public ScriptTell(String text, int lineNumber) {
+ super(lineNumber);
+ this.text = text;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.scripting.ScriptStep#run(org.eclipse.rse.tests.framework.scripting.ScriptContext)
+ */
+ public void run(ScriptContext context) {
+ context.tell(text);
+ }
+
+} \ No newline at end of file
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptTestCase.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptTestCase.java
new file mode 100644
index 000000000..5406e9b73
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptTestCase.java
@@ -0,0 +1,43 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.scripting;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+
+import org.eclipse.rse.tests.framework.AnnotatingTestCase;
+
+/**
+ * All test scripts are instances of ScriptedTestCase.
+ */
+public class ScriptTestCase extends AnnotatingTestCase {
+
+ private URL scriptLocation;
+ private ScriptContext context;
+
+ public ScriptTestCase(ScriptContext context, URL scriptLocation) {
+ super("runScript");
+ this.context = context;
+ this.scriptLocation = scriptLocation;
+ }
+
+ public void runScript() {
+ ScriptInterpreter interpreter = new ScriptInterpreter(context);
+ try {
+ InputStream in = scriptLocation.openStream();
+ boolean success = interpreter.run(in);
+ in.close();
+ assertTrue(success);
+ } catch (IOException e) {
+ fail("error reading " + scriptLocation.getPath());
+ }
+ }
+}
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptTestSuiteHolder.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptTestSuiteHolder.java
new file mode 100644
index 000000000..49755d3b4
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/ScriptTestSuiteHolder.java
@@ -0,0 +1,56 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.scripting;
+
+import java.net.URL;
+import java.text.MessageFormat;
+
+import junit.framework.TestSuite;
+
+import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder;
+import org.osgi.framework.Bundle;
+
+/**
+ * A script test suite holder is holds a scripted test case which is present in a file
+ * referenced by the extension point.
+ */
+public class ScriptTestSuiteHolder extends DelegatingTestSuiteHolder {
+
+ private TestSuite suite;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.AbstractTestSuiteHolder#getTestSuite()
+ */
+ public TestSuite getTestSuite() {
+ if (suite == null) {
+ String folderName = getStringValue("folder");
+ if (folderName != null) {
+ if (!folderName.endsWith("/")) {
+ folderName += "/";
+ }
+ String scriptName = getStringValue("script");
+ if (scriptName == null) {
+ scriptName = "script.txt";
+ }
+ Bundle bundle = getBundle();
+ URL resourceLocation = bundle.getEntry(folderName);
+ ScriptContext context = new ConsoleContext(System.out, resourceLocation);
+ URL scriptLocation = context.getResourceURL(scriptName);
+ ScriptTestCase test = new ScriptTestCase(context, scriptLocation);
+ String title = MessageFormat.format("Script from folder {0}", new String[] {folderName});
+ suite = new TestSuite(title);
+ suite.addTest(test);
+ } else {
+ suite = new TestSuite("ERROR: Missing folder argument");
+ }
+ }
+ return suite;
+ }
+}
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/SyntaxNode.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/SyntaxNode.java
new file mode 100644
index 000000000..e70f992f2
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/SyntaxNode.java
@@ -0,0 +1,88 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.scripting;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.Vector;
+
+/**
+ * A syntax tree node. These are typically created by parsing some sort of
+ * source document.
+ */
+public abstract class SyntaxNode {
+
+ private List children = new Vector(10); // the size is arbitrary
+ private int lineNumber;
+
+ /**
+ * Constructs a syntax node for a particular line in the script. The line number
+ * is used for diagnostic purposes.
+ * @param lineNumber
+ */
+ public SyntaxNode(int lineNumber) {
+ this.lineNumber = lineNumber;
+ }
+
+ /**
+ * Adds a child to the list of children maintained by this node.
+ * @param child the child node to add.
+ */
+ public void add(SyntaxNode child) {
+ children.add(child);
+ }
+
+ /**
+ * Accept a visitor to this node. The visitor is told to enter, each selected
+ * child told to accept the visitor and then the visitor is told to leave.
+ * @param visitor
+ * @see SyntaxTreeVisitor#enter(SyntaxNode)
+ * @see SyntaxTreeVisitor#leave(SyntaxNode)
+ * @see SyntaxNode#accept(SyntaxTreeVisitor)
+ * @see SyntaxNode#getSelectedChildren()
+ */
+ public void accept(SyntaxTreeVisitor visitor) {
+ visitor.enter(this);
+ List selected = getSelectedChildren();
+ for (Iterator z = selected.iterator(); z.hasNext();) {
+ SyntaxNode child = (SyntaxNode) z.next();
+ child.accept(visitor);
+ }
+ visitor.leave(this);
+ }
+
+ /**
+ * Perform any actions required when the Node is entered. This could include
+ * setting any criteria for selection of children later on. (hint, hint)
+ * @param context The context on which the action may be performed.
+ */
+ public abstract void enter(ScriptContext context);
+
+ /**
+ * Perform any actions required when the Node is left.
+ * @param context The context on which the action may be performed.
+ */
+ public abstract void leave(ScriptContext context);
+
+ /**
+ * Returns the list of selected children.
+ * The default implementation is to select all children.
+ * Subclasses can override if necessary.
+ * @return the List of selected children.
+ */
+ protected List getSelectedChildren() {
+ return children;
+ }
+
+ public final int getLineNumber() {
+ return lineNumber;
+ }
+
+}
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/SyntaxTreeVisitor.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/SyntaxTreeVisitor.java
new file mode 100644
index 000000000..761eaab90
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/scripting/SyntaxTreeVisitor.java
@@ -0,0 +1,29 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.scripting;
+
+/**
+ * A visitor visits a node in a syntax tree.
+ */
+public abstract class SyntaxTreeVisitor {
+
+ /**
+ * Inform the visitor that a node is being entered.
+ * @param node
+ */
+ public abstract void enter(SyntaxNode node);
+
+ /**
+ * Inform the visitor that a node is being left.
+ * @param node
+ */
+ public abstract void leave(SyntaxNode node);
+
+}
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ui/TestPerspectiveFactory.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ui/TestPerspectiveFactory.java
new file mode 100644
index 000000000..b1c79954e
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ui/TestPerspectiveFactory.java
@@ -0,0 +1,30 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.ui;
+
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+
+/**
+ * Creates the test perspective.
+ */
+public class TestPerspectiveFactory implements IPerspectiveFactory {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IPerspectiveFactory#createInitialLayout(org.eclipse.ui.IPageLayout)
+ */
+ public void createInitialLayout(IPageLayout layout) {
+ layout.setEditorAreaVisible(false);
+ layout.addView("org.eclipse.rse.tests.framework.ConsoleView", IPageLayout.RIGHT, 0.30f, null);
+ layout.addView("org.eclipse.rse.tests.framework.ImageView", IPageLayout.LEFT, 0.70f, "org.eclipse.rse.tests.framework.ConsoleView");
+ layout.addView("org.eclipse.rse.tests.framework.HolderView", IPageLayout.BOTTOM, 0.70f, "org.eclipse.rse.tests.framework.ImageView");
+ }
+
+}
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ui/TestSuiteConsoleView.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ui/TestSuiteConsoleView.java
new file mode 100644
index 000000000..dc037fc82
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ui/TestSuiteConsoleView.java
@@ -0,0 +1,62 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.ui;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * Provides a view of any image that needs to be displayed by a test case.
+ */
+public class TestSuiteConsoleView extends ViewPart {
+
+ private Text console;
+ private Color backgroundColor;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createPartControl(Composite parent) {
+ console = new Text(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
+ backgroundColor = new Color(parent.getDisplay(), new RGB(255, 255, 255));
+ clear();
+ }
+
+ public void add(String text) {
+ if (!(console == null || console.isDisposed())) {
+ String consoleText = console.getText();
+ consoleText += text;
+ console.setText(consoleText);
+ }
+ }
+
+ public void clear() {
+ if (!(console == null || console.isDisposed())) {
+ console.setBackground(backgroundColor);
+ console.setText("");
+ }
+ }
+
+ public void setFocus() {
+ }
+
+ public void dispose() {
+ if (!(backgroundColor == null || backgroundColor.isDisposed())) {
+ backgroundColor.dispose();
+ }
+ }
+
+} \ No newline at end of file
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ui/TestSuiteHolderView.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ui/TestSuiteHolderView.java
new file mode 100644
index 000000000..780c0feec
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ui/TestSuiteHolderView.java
@@ -0,0 +1,427 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.ui;
+
+import java.net.URL;
+import java.text.DateFormat;
+import java.text.MessageFormat;
+import java.util.Calendar;
+import junit.framework.TestResult;
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.jface.action.GroupMarker;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.rse.tests.framework.AbstractTestSuiteHolder;
+import org.eclipse.rse.tests.framework.DelegatingTestSuiteHolder;
+import org.eclipse.rse.tests.framework.ITestSuiteHolder;
+import org.eclipse.rse.tests.framework.ITestSuiteHolderListener;
+import org.eclipse.rse.tests.framework.TestFrameworkPlugin;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Sash;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.part.ViewPart;
+import org.osgi.framework.Bundle;
+
+/**
+ * Provides a view of the test suites installed in this workbench.
+ */
+public class TestSuiteHolderView extends ViewPart implements ITestSuiteHolderListener, ISelectionChangedListener {
+ private class MyLabelProvider implements ITableLabelProvider {
+ public Image getColumnImage(Object element, int columnIndex) {
+ AbstractTestSuiteHolder holder = (AbstractTestSuiteHolder) element;
+ Image columnImage = null;
+ switch (columnIndex) {
+ case 1: // name column
+ break;
+ case 0: { // graphic column
+ TestResult result = holder.getTestResult();
+ if (result != null) {
+ if (result.wasSuccessful()) {
+ columnImage = graphicPassed;
+ } else {
+ columnImage = graphicFailed;
+ }
+ } else {
+ columnImage = graphicUnknown;
+ }
+ break;
+ }
+ case 2: // status column
+ break;
+ case 3: // date column
+ break;
+ default:
+ break;
+ }
+ return columnImage;
+ }
+
+ public String getColumnText(Object element, int columnIndex) {
+ AbstractTestSuiteHolder holder = (AbstractTestSuiteHolder) element;
+ String columnText = null;
+ switch (columnIndex) {
+ case 1: // name column
+ columnText = holder.getName();
+ break;
+ case 0: // graphic column
+ columnText = "";
+ break;
+ case 2: // status column
+ TestResult result = holder.getTestResult();
+ if (result != null) {
+ Object[] values = { new Integer(result.runCount()), new Integer(result.failureCount()), new Integer(result.errorCount()) };
+ String template = "{0,number,integer} run, {1,number,integer} failed, {2,number,integer} errors";
+ columnText = MessageFormat.format(template, values);
+ } else {
+ columnText = "";
+ }
+ break;
+ case 3: // run date/time column
+ Calendar stamp = holder.getLastRunTime();
+ if (stamp != null) {
+ DateFormat formatter = DateFormat.getDateTimeInstance();
+ columnText = formatter.format(stamp.getTime());
+ } else {
+ columnText = "";
+ }
+ break;
+ default:
+ break;
+ }
+ return columnText;
+ };
+
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ public void dispose() {
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+ }
+
+ private abstract class ColumnSorter extends ViewerSorter {
+ boolean ascending = false;
+ public void reverse() {
+ ascending = !ascending;
+ }
+ public int compare(Viewer viewer, Object e1, Object e2) {
+ String key1 = getKey(e1);
+ String key2 = getKey(e2);
+ int result = key1.compareTo(key2);
+ if (!ascending) result = -result;
+ return result;
+ }
+ public abstract String getKey(Object e);
+ }
+
+ private class GraphicSorter extends ColumnSorter {
+ public String getKey(Object e) {
+ AbstractTestSuiteHolder h = (AbstractTestSuiteHolder) e;
+ TestResult r = h.getTestResult();
+ if (r == null) return "0" + r;
+ if (r.failureCount() > 0) return "1" + r;
+ if (r.errorCount() > 0) return "1" + r;
+ return "2" + r;
+ }
+ }
+
+ private class NameSorter extends ColumnSorter {
+ public String getKey(Object e) {
+ return ((AbstractTestSuiteHolder)e).getName();
+ }
+ }
+
+ private class StatusSorter extends ColumnSorter {
+ public String getKey(Object e) {
+ return "";
+ }
+ }
+
+ private class StampSorter extends ColumnSorter {
+ public String getKey(Object e) {
+ AbstractTestSuiteHolder h = (AbstractTestSuiteHolder) e;
+ Calendar c = h.getLastRunTime();
+ long t = 0;
+ if (c != null) t = c.getTimeInMillis();
+ String k = "0000000000000000000000000" + Long.toString(t);
+ k = k.substring(k.length() - 25);
+ k += h.getName();
+ return k;
+ }
+ }
+
+ private class ColumnListener implements SelectionListener {
+ ColumnSorter sorter;
+ public ColumnListener(ColumnSorter sorter) {
+ this.sorter = sorter;
+ }
+ public void widgetSelected(SelectionEvent e) {
+ if (holderViewer.getSorter() == sorter) {
+ sorter.reverse();
+ holderViewer.refresh();
+ } else {
+ holderViewer.setSorter(sorter);
+ }
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ }
+
+ private SelectionListener graphicListener = new ColumnListener(new GraphicSorter());
+ private SelectionListener nameListener = new ColumnListener(new NameSorter());
+ private SelectionListener statusListener = new ColumnListener(new StatusSorter());
+ private SelectionListener stampListener = new ColumnListener(new StampSorter());
+
+ private TableViewer holderViewer;
+ private Text resultsText;
+ private ArrayContentProvider contentProvider = new ArrayContentProvider();
+ private MyLabelProvider labelProvider = new MyLabelProvider();
+ private ITestSuiteHolder[] holders = DelegatingTestSuiteHolder.getHolders();
+ private String[] columnIds = {"graphic", "name", "status", "stamp"};
+ private int[] columnWidths = {20, 200, 150, 150};
+ private String[] columnTitles = {"", "Test Suite", "Summary", "Time Run"};
+ private SelectionListener[] columnListeners = {graphicListener, nameListener, statusListener, stampListener};
+ private boolean[] columnResizable = {false, true, true, true};
+ private Image graphicFailed = null;
+ private Image graphicPassed = null;
+ private Image graphicUnknown = null;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createPartControl(Composite parent) {
+ // create images
+ graphicFailed = createImage("icons/RedX.gif");
+ graphicPassed = createImage("icons/GreenCheck.gif");
+ graphicUnknown = createImage("icons/YellowQuestion.gif");
+
+ // holders viewer
+ Table table = new Table(parent, SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION);
+ table.setHeaderVisible(true);
+ table.setLinesVisible(false);
+ int n = columnIds.length;
+ for (int i = 0; i < n; i++) {
+ TableColumn column = new TableColumn(table, SWT.NONE);
+ column.setText(columnTitles[i]);
+ column.setWidth(columnWidths[i]);
+ column.setResizable(columnResizable[i]);
+ column.addSelectionListener(columnListeners[i]);
+ }
+ holderViewer = new TableViewer(table);
+
+ // menu for above viewer
+ MenuManager menuManager = new MenuManager();
+ getSite().registerContextMenu(menuManager, holderViewer);
+ Control control = holderViewer.getControl();
+ control.setMenu(menuManager.createContextMenu(control));
+ IContributionItem item = new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS);
+ menuManager.add(item);
+
+ // sash
+ Sash sash = new Sash(parent, SWT.HORIZONTAL);
+ sash.addSelectionListener(
+ new SelectionListener() {
+ public void widgetSelected(SelectionEvent e) {
+ Sash s = (Sash) e.widget;
+ FormData fd = (FormData) s.getLayoutData();
+ fd.top = new FormAttachment(0, e.y);
+ s.getParent().layout();
+ }
+ public void widgetDefaultSelected(SelectionEvent e) {
+ }
+ }
+ );
+
+ // results viewer
+ resultsText = new Text(parent, SWT.READ_ONLY | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+
+ // control layout
+ parent.setLayout(new FormLayout());
+ FormData fd = null;
+
+ // holder viewer layout
+ fd = new FormData();
+ fd.top = new FormAttachment(0, 0);
+ fd.bottom = new FormAttachment(sash, 0);
+ fd.left = new FormAttachment(0, 0);
+ fd.right = new FormAttachment(100, 0);
+ holderViewer.getControl().setLayoutData(fd);
+
+ // sash layout
+ fd = new FormData();
+ fd.top = new FormAttachment(50, 0);
+ fd.height = 3;
+ fd.left = new FormAttachment(0, 0);
+ fd.right = new FormAttachment(100, 0);
+ sash.setLayoutData(fd);
+
+ // results viewer layout
+ fd = new FormData();
+ fd.top = new FormAttachment(sash, 0);
+ fd.bottom = new FormAttachment(100, 0);
+ fd.left = new FormAttachment(0, 0);
+ fd.right = new FormAttachment(100, 0);
+ resultsText.setLayoutData(fd);
+
+ // set up the contents of the holder viewer
+ holderViewer.setContentProvider(contentProvider);
+ holderViewer.setLabelProvider(labelProvider);
+ holderViewer.setInput(holders);
+ for (int i = 0; i < holders.length; i++) {
+ ITestSuiteHolder holder = holders[i];
+ holder.addListener(this);
+ }
+ holderViewer.setSelection(new StructuredSelection());
+ holderViewer.addSelectionChangedListener(this);
+
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
+ */
+ public void selectionChanged(SelectionChangedEvent event) {
+ StructuredSelection sel = (StructuredSelection)event.getSelection();
+ if (sel.size() == 1) {
+ AbstractTestSuiteHolder holder = (AbstractTestSuiteHolder)sel.getFirstElement();
+ resultsText.setText(holder.getResultString());
+ } else {
+ resultsText.setText("");
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchPart#setFocus()
+ */
+ public void setFocus() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.ITestSuiteHolderListener#testEnded(org.eclipse.rse.tests.framework.ITestSuiteHolder)
+ */
+ public void testEnded(ITestSuiteHolder holder) {
+ updateHolderInView(holder);
+ updateResultString(holder);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.tests.framework.ITestSuiteHolderListener#testHolderReset(org.eclipse.rse.tests.framework.ITestSuiteHolder)
+ */
+ public void testHolderReset(ITestSuiteHolder holder) {
+ updateHolderInView(holder);
+ updateResultString(holder);;
+ }
+
+ /**
+ * Updates the view of the particular holder. Can be run from a non-UI thread.
+ * @param holder
+ */
+ private void updateHolderInView(final ITestSuiteHolder holder) {
+ Runnable runnable = new Runnable() {
+ public void run() {
+ holderViewer.update(holder, null);
+ }
+ };
+ Control control = holderViewer.getControl();
+ if (!control.isDisposed()) {
+ control.getDisplay().syncExec(runnable);
+ }
+ }
+
+ /**
+ * Updates the result string for the holder if the holder is the only one in the
+ * current selection. Can be run from a non-UI thread.
+ * @param holder
+ */
+ private void updateResultString(final ITestSuiteHolder holder) {
+ Runnable runnable = new Runnable() {
+ public void run() {
+ StructuredSelection sel = (StructuredSelection)holderViewer.getSelection();
+ if (sel.size() == 1) {
+ AbstractTestSuiteHolder holder = (AbstractTestSuiteHolder)sel.getFirstElement();
+ resultsText.setText(holder.getResultString());
+ } else {
+ resultsText.setText("");
+ }
+ }
+ };
+ if (!resultsText.isDisposed()) {
+ resultsText.getDisplay().syncExec(runnable);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchPart#dispose()
+ */
+ public void dispose() {
+ for (int i = 0; i < holders.length; i++) {
+ ITestSuiteHolder holder = holders[i];
+ holder.removeListener(this);
+ }
+ graphicFailed.dispose();
+ graphicPassed.dispose();
+ graphicUnknown.dispose();
+ }
+
+ public Image createImage(String imageName) {
+ Plugin plugin = TestFrameworkPlugin.getDefault();
+ IPath path = new Path(imageName);
+ Bundle bundle = plugin.getBundle();
+ URL url = FileLocator.find(bundle, path, null);
+ ImageDescriptor descriptor = ImageDescriptor.createFromURL(url);
+ Image image = descriptor.createImage();
+ return image;
+ }
+
+ /**
+ * Selects all the holders in the view.
+ */
+ public void selectAll() {
+ if (!holderViewer.getControl().isDisposed()) {
+ StructuredSelection selection = new StructuredSelection(holders);
+ holderViewer.setSelection(selection);
+ }
+ }
+} \ No newline at end of file
diff --git a/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ui/TestSuiteImageView.java b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ui/TestSuiteImageView.java
new file mode 100644
index 000000000..4293509fc
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/src/org/eclipse/rse/tests/framework/ui/TestSuiteImageView.java
@@ -0,0 +1,65 @@
+/* *******************************************************************************
+ * Copyright (c) 2006 IBM Corporation. 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:
+ * David Dykstal (IBM) - initial contribution.
+ * *******************************************************************************/
+package org.eclipse.rse.tests.framework.ui;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * Provides a view of any image that needs to be displayed by a test case.
+ */
+public class TestSuiteImageView extends ViewPart {
+
+ private Canvas imageCanvas;
+ private Image image;
+ private Color backgroundColor;
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.IWorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createPartControl(Composite parent) {
+ imageCanvas = new Canvas(parent, SWT.H_SCROLL | SWT.V_SCROLL);
+ backgroundColor = new Color(parent.getDisplay(), new RGB(255, 255, 255));
+ clearImage();
+ }
+
+ public void setImage(ImageDescriptor descriptor) {
+ clearImage();
+ image = descriptor.createImage();
+ imageCanvas.setBackgroundImage(image);
+ }
+
+ public void clearImage() {
+ if (imageCanvas != null) {
+ imageCanvas.setBackground(backgroundColor);
+ }
+ if (image != null) {
+ image.dispose();
+ }
+ image = null;
+ }
+
+ public void setFocus() {
+ }
+
+ public void dispose() {
+ clearImage();
+ backgroundColor.dispose();
+ }
+
+} \ No newline at end of file
diff --git a/rse/tests/org.eclipse.rse.tests.framework/toc.xml b/rse/tests/org.eclipse.rse.tests.framework/toc.xml
new file mode 100644
index 000000000..e03920b92
--- /dev/null
+++ b/rse/tests/org.eclipse.rse.tests.framework/toc.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc label="The Artemis Test Framework">
+ <topic label="Purpose" href="html/purpose.html"/>
+ <topic label="Using The Test Suite View" href="html/view.html"/>
+ <topic label="Plugging in" href="html/plugging.html"/>
+ <topic label="Future Items" href="html/futures.html"/>
+</toc>

Back to the top