|
From: <cr...@us...> - 2009-02-17 14:52:23
|
Revision: 5042
http://jnode.svn.sourceforge.net/jnode/?rev=5042&view=rev
Author: crawley
Date: 2009-02-17 14:52:18 +0000 (Tue, 17 Feb 2009)
Log Message:
-----------
Working on getting black-box testing to work on on JNode ... nearly there
Modified Paths:
--------------
trunk/all/build.xml
trunk/all/conf/tests-plugin-list.xml
trunk/builder/.classpath
trunk/shell/.classpath
trunk/shell/build.xml
trunk/shell/descriptors/org.jnode.test.shell.xml
trunk/shell/src/emu/org/jnode/emu/Emu.java
trunk/shell/src/test/org/jnode/test/shell/bjorne/bjorne-shell-tests.xml
trunk/shell/src/test/org/jnode/test/shell/command/posix/posix-command-tests.xml
trunk/shell/src/test/org/jnode/test/shell/harness/ScriptTestRunner.java
trunk/shell/src/test/org/jnode/test/shell/harness/TestEmu.java
Added Paths:
-----------
trunk/shell/descriptors/net.n3.nanoxml.xml
trunk/shell/lib/nanoxml-2.2.3.jar
Removed Paths:
-------------
trunk/builder/lib/nanoxml-2.2.3.jar
Modified: trunk/all/build.xml
===================================================================
--- trunk/all/build.xml 2009-02-16 21:32:28 UTC (rev 5041)
+++ trunk/all/build.xml 2009-02-17 14:52:18 UTC (rev 5042)
@@ -69,7 +69,7 @@
<property name="derby.jar" value="${root.dir}/distr/lib/derby.jar" />
<property name="derbynet.jar" value="${root.dir}/distr/lib/derbynet.jar" />
<property name="derbytools.jar" value="${root.dir}/distr/lib/derbytools.jar" />
- <property name="nanoxml-java.jar" value="${root.dir}/builder/lib/nanoxml-2.2.3.jar" />
+ <property name="nanoxml-java.jar" value="${root.dir}/shell/lib/nanoxml-2.2.3.jar" />
<!-- libraries needed to run tests -->
<property name="jmock-cglib.jar" value="${root.dir}/core/lib/jmock-cglib-1.0.1.jar"/>
@@ -256,6 +256,7 @@
<libalias name="javax-crypto.jar" alias="${javax-crypto.jar}"/>
<libalias name="log4j.jar" alias="${log4j.jar}"/>
<libalias name="beanshell.jar" alias="${beanshell.jar}"/>
+ <libalias name="nanoxml-java.jar" alias="${nanoxml-java.jar}"/>
<libalias name="js.jar" alias="${js.jar}"/>
<libalias name="lw.jar" alias="${lw.jar}"/>
<libalias name="thinlet.jar" alias="${thinlet.jar}"/>
Modified: trunk/all/conf/tests-plugin-list.xml
===================================================================
--- trunk/all/conf/tests-plugin-list.xml 2009-02-16 21:32:28 UTC (rev 5041)
+++ trunk/all/conf/tests-plugin-list.xml 2009-02-17 14:52:18 UTC (rev 5042)
@@ -16,6 +16,7 @@
<plugin id="net.sf.cglib"/>
<plugin id="org.jmock.cglib"/>
<plugin id="org.jmock"/>
+ <plugin id="net.n3.nanoxml"/>
<plugin id="org.jnode.test"/>
<plugin id="org.jnode.test.fs"/>
Modified: trunk/builder/.classpath
===================================================================
--- trunk/builder/.classpath 2009-02-16 21:32:28 UTC (rev 5041)
+++ trunk/builder/.classpath 2009-02-17 14:52:18 UTC (rev 5042)
@@ -9,6 +9,6 @@
<classpathentry kind="src" path="/shell"/>
<classpathentry kind="lib" path="lib/xml-apis.jar"/>
<classpathentry kind="lib" path="lib/bcel-5.1.jar"/>
- <classpathentry kind="lib" path="lib/nanoxml-2.2.3.jar"/>
+ <classpathentry kind="lib" path="/shell/lib/nanoxml-2.2.3.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
Deleted: trunk/builder/lib/nanoxml-2.2.3.jar
===================================================================
(Binary files differ)
Modified: trunk/shell/.classpath
===================================================================
--- trunk/shell/.classpath 2009-02-16 21:32:28 UTC (rev 5041)
+++ trunk/shell/.classpath 2009-02-17 14:52:18 UTC (rev 5042)
@@ -10,6 +10,6 @@
<classpathentry kind="lib" path="/core/lib/ant.jar"/>
<classpathentry kind="lib" path="/core/lib/junit.jar"/>
<classpathentry kind="lib" path="/core/lib/log4j-1.2.8.jar"/>
- <classpathentry kind="lib" path="/builder/lib/nanoxml-2.2.3.jar"/>
+ <classpathentry kind="lib" path="lib/nanoxml-2.2.3.jar"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
Modified: trunk/shell/build.xml
===================================================================
--- trunk/shell/build.xml 2009-02-16 21:32:28 UTC (rev 5041)
+++ trunk/shell/build.xml 2009-02-17 14:52:18 UTC (rev 5042)
@@ -10,7 +10,7 @@
<!-- Subproject specific classpath -->
<path id="my-cp">
<pathelement location="${jnode-core.jar}"/>
- <pathelement location="${basedir}/../builder/lib/nanoxml-2.2.3.jar"/>
+ <pathelement location="${nanoxml-java.jar}"/>
<path refid="cp"/>
</path>
@@ -19,7 +19,8 @@
<mkdir dir="${my-classes.dir}"/>
<jnode.copy-descriptors/>
<copy todir="${my-classes.dir}">
- <fileset dir="${my-src.dir}/shell" excludes="**/*.java,**/package.html"/>
+ <fileset dir="${my-src.dir}/shell" excludes="**/*.java,**/package.html"/>
+ <fileset dir="${my-src.dir}/test" excludes="**/*.java,**/package.html"/>
</copy>
</target>
Added: trunk/shell/descriptors/net.n3.nanoxml.xml
===================================================================
--- trunk/shell/descriptors/net.n3.nanoxml.xml (rev 0)
+++ trunk/shell/descriptors/net.n3.nanoxml.xml 2009-02-17 14:52:18 UTC (rev 5042)
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plugin SYSTEM "jnode.dtd">
+
+<plugin id="net.n3.nanoxml"
+ name="NanoXML Java classes"
+ version="2.2.3"
+ provider-name="nanoxml.org"
+ license-name="zlib">
+
+ <runtime>
+ <library name="nanoxml-java.jar">
+ <export name="*"/>
+ </library>
+ </runtime>
+
+</plugin>
\ No newline at end of file
Modified: trunk/shell/descriptors/org.jnode.test.shell.xml
===================================================================
--- trunk/shell/descriptors/org.jnode.test.shell.xml 2009-02-16 21:32:28 UTC (rev 5041)
+++ trunk/shell/descriptors/org.jnode.test.shell.xml 2009-02-17 14:52:18 UTC (rev 5042)
@@ -13,6 +13,7 @@
<import plugin="org.jnode.shell.help"/>
<import plugin="org.jnode.shell.syntax"/>
<import plugin="org.junit" version="3.8"/>
+ <import plugin="net.n3.nanoxml"/>
<import plugin="org.jnode.shell.help"/>
<import plugin="org.jnode.testrunner"/>
</requires>
Added: trunk/shell/lib/nanoxml-2.2.3.jar
===================================================================
(Binary files differ)
Property changes on: trunk/shell/lib/nanoxml-2.2.3.jar
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/shell/src/emu/org/jnode/emu/Emu.java
===================================================================
--- trunk/shell/src/emu/org/jnode/emu/Emu.java 2009-02-16 21:32:28 UTC (rev 5041)
+++ trunk/shell/src/emu/org/jnode/emu/Emu.java 2009-02-17 14:52:18 UTC (rev 5042)
@@ -24,6 +24,7 @@
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
+import java.util.HashSet;
import javax.naming.NamingException;
@@ -59,7 +60,7 @@
};
// FIXME configuring a hard-coded list of command plugins is a bad idea.
- private static final String[] DEFAULT_PLUGIN_NAMES = new String[] {
+ private static final String[] DEFAULT_PLUGIN_IDS = new String[] {
"org.jnode.shell.command",
"org.jnode.shell.command.driver.console",
"org.jnode.apps.editor",
@@ -70,9 +71,10 @@
private final File root;
private final AliasManager aliasMgr;
private final SyntaxManager syntaxMgr;
+ private final HashSet<String> configuredPlugins = new HashSet<String>();
public Emu(File root) throws EmuException {
- this(root, DEFAULT_PLUGIN_NAMES);
+ this(root, DEFAULT_PLUGIN_IDS);
}
/**
@@ -94,7 +96,7 @@
aliasMgr = new DefaultAliasManager(new DummyExtensionPoint()).createAliasManager();
syntaxMgr = new DefaultSyntaxManager(new DummyExtensionPoint()).createSyntaxManager();
for (String pluginName : pluginNames) {
- configurePluginCommands(pluginName);
+ configurePlugin(pluginName);
}
System.setProperty("jnode.invoker", "thread");
System.setProperty("jnode.interpreter", "redirecting");
@@ -111,13 +113,16 @@
/**
* Configure any command classes specified by a given plugin's descriptor
*
- * @param pluginName the plugin to be processed
+ * @param pluginId the plugin to be processed
* @throws EmuException
*/
- public void configurePluginCommands(String pluginName) throws EmuException {
- XMLElement pluginDescriptor = loadPluginDescriptor(pluginName);
- extractAliases(pluginDescriptor);
- extractSyntaxBundles(pluginDescriptor);
+ public void configurePlugin(String pluginId) throws EmuException {
+ if (!configuredPlugins.contains(pluginId)) {
+ XMLElement pluginDescriptor = loadPluginDescriptor(pluginId);
+ extractAliases(pluginDescriptor);
+ extractSyntaxBundles(pluginDescriptor);
+ configuredPlugins.add(pluginId);
+ }
}
/**
Modified: trunk/shell/src/test/org/jnode/test/shell/bjorne/bjorne-shell-tests.xml
===================================================================
--- trunk/shell/src/test/org/jnode/test/shell/bjorne/bjorne-shell-tests.xml 2009-02-16 21:32:28 UTC (rev 5041)
+++ trunk/shell/src/test/org/jnode/test/shell/bjorne/bjorne-shell-tests.xml 2009-02-17 14:52:18 UTC (rev 5042)
@@ -613,9 +613,20 @@
</testSpec>
<testSpec title="redirection" command="test" runMode="AS_SCRIPT" rc="0">
<script>#!bjorne
- echo > @TEMP_DIR@/blablah Hi mum
+ echo > @TEMP_DIR@/1 Hi mum
+ echo > @TEMP_DIR@/2 Hi mum
+ echo >> @TEMP_DIR@/2 Hi mum again
+ echo Hello mother
+ echo Hello mother again 1>&2
</script>
- <file name="blablah" input="false">Hi mum
-</file>
+ <file name="1" input="false">Hi mum
+</file>
+ <file name="2" input="false">Hi mum
+Hi mum again
+</file>
+ <output>Hello mother
+</output>
+ <error>Hello mother again
+</error>
</testSpec>
</testSet>
\ No newline at end of file
Modified: trunk/shell/src/test/org/jnode/test/shell/command/posix/posix-command-tests.xml
===================================================================
--- trunk/shell/src/test/org/jnode/test/shell/command/posix/posix-command-tests.xml 2009-02-16 21:32:28 UTC (rev 5041)
+++ trunk/shell/src/test/org/jnode/test/shell/command/posix/posix-command-tests.xml 2009-02-17 14:52:18 UTC (rev 5042)
@@ -12,4 +12,42 @@
<output>2
</output>
</testSpec>
+ <testSpec title="expr 2 * 2" command="org.jnode.shell.command.posix.ExprCommand"
+ runMode="AS_ALIAS" rc="0">
+ <arg>2</arg>
+ <arg>*</arg>
+ <arg>2</arg>
+ <output>4
+</output>
+ </testSpec>
+ <testSpec title="expr 4 / 2" command="org.jnode.shell.command.posix.ExprCommand"
+ runMode="AS_ALIAS" rc="0">
+ <arg>4</arg>
+ <arg>/</arg>
+ <arg>2</arg>
+ <output>2
+</output>
+ </testSpec>
+ <testSpec title="expr 1 + 2 * 2" command="org.jnode.shell.command.posix.ExprCommand"
+ runMode="AS_ALIAS" rc="0">
+ <arg>1</arg>
+ <arg>+</arg>
+ <arg>2</arg>
+ <arg>*</arg>
+ <arg>2</arg>
+ <output>5
+</output>
+ </testSpec>
+ <testSpec title="expr ( 1 + 2 ) * 2" command="org.jnode.shell.command.posix.ExprCommand"
+ runMode="AS_ALIAS" rc="0">
+ <arg>(</arg>
+ <arg>1</arg>
+ <arg>+</arg>
+ <arg>2</arg>
+ <arg>)</arg>
+ <arg>*</arg>
+ <arg>2</arg>
+ <output>6
+</output>
+ </testSpec>
</testSet>
\ No newline at end of file
Modified: trunk/shell/src/test/org/jnode/test/shell/harness/ScriptTestRunner.java
===================================================================
--- trunk/shell/src/test/org/jnode/test/shell/harness/ScriptTestRunner.java 2009-02-16 21:32:28 UTC (rev 5041)
+++ trunk/shell/src/test/org/jnode/test/shell/harness/ScriptTestRunner.java 2009-02-17 14:52:18 UTC (rev 5042)
@@ -46,8 +46,9 @@
@Override
public int run() throws Exception {
Properties props = new Properties();
- props.setProperty("TEMP_DIR", System.getProperty("java.io.tmpdir"));
- tempScriptFile = new File(System.getProperty("java.io.tmpdir"), spec.getCommand());
+ String tempDir = System.getProperty("java.io.tmpdir");
+ props.setProperty("TEMP_DIR", tempDir);
+ tempScriptFile = new File(tempDir, spec.getCommand());
BufferedWriter bw = null;
try {
bw = new BufferedWriter(new FileWriter(tempScriptFile));
Modified: trunk/shell/src/test/org/jnode/test/shell/harness/TestEmu.java
===================================================================
--- trunk/shell/src/test/org/jnode/test/shell/harness/TestEmu.java 2009-02-16 21:32:28 UTC (rev 5041)
+++ trunk/shell/src/test/org/jnode/test/shell/harness/TestEmu.java 2009-02-17 14:52:18 UTC (rev 5042)
@@ -91,16 +91,16 @@
if (!emuInitialized) {
throw new IllegalStateException("Emu not initialized");
}
- if (!loadedPseudoPlugins.contains(className)) {
- try {
+ try {
+ if (!loadedPseudoPlugins.contains(className)) {
Class<?> clazz = Class.forName(className);
clazz.newInstance();
- Method method = emuClass.getMethod("configurePluginCommands", String.class);
- method.invoke(emuObject, pluginId);
- } catch (Exception ex) {
- throw new RuntimeException("Cannot configure plugin '" + pluginId + "'", ex);
+ loadedPseudoPlugins.add(className);
}
- loadedPseudoPlugins.add(className);
+ Method method = emuClass.getMethod("configurePlugin", String.class);
+ method.invoke(emuObject, pluginId);
+ } catch (Exception ex) {
+ throw new RuntimeException("Cannot configure plugin '" + pluginId + "'", ex);
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|