You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by gn...@apache.org on 2009/06/23 00:27:14 UTC

svn commit: r787428 [3/3] - in /felix/trunk/gogo: ./ src/main/java/org/apache/felix/gogo/cpeg/ src/main/java/org/apache/felix/gogo/launcher/ src/main/java/org/apache/felix/gogo/shell/console/ src/main/java/org/apache/felix/gogo/shell/equinox/ src/main/...

Modified: felix/trunk/gogo/src/main/java/org/osgi/service/command/CommandSession.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/src/main/java/org/osgi/service/command/CommandSession.java?rev=787428&r1=787427&r2=787428&view=diff
==============================================================================
--- felix/trunk/gogo/src/main/java/org/osgi/service/command/CommandSession.java (original)
+++ felix/trunk/gogo/src/main/java/org/osgi/service/command/CommandSession.java Mon Jun 22 22:27:13 2009
@@ -18,75 +18,75 @@
  */
 package org.osgi.service.command;
 
-import java.io.*;
+import java.io.InputStream;
+import java.io.PrintStream;
 
-public interface CommandSession {
-	/**
-	 * Execute a program in this session.
-	 * 
-	 * @param commandline 
-	 * @return the result of the execution
-	 */
-	Object execute(CharSequence commandline) throws Exception;
-
-	/**
-	 * Close this command session. After the session is closed, it will throw
-	 * IllegalStateException when it is used.
-	 * 
-	 * @param
-	 */
-	void close();
-
-	/**
-	 * Return the input stream that is the first of the pipeline. This stream is
-	 * sometimes necessary to communicate directly to the end user. For example,
-	 * a "less" or "more" command needs direct input from the keyboard to
-	 * control the paging.
-	 * 
-	 * @return InpuStream used closest to the user or null if input is from a
-	 *         file.
-	 */
-	InputStream getKeyboard();
-
-	/**
-	 * Return the PrintStream for the console. This must always be the stream
-	 * "closest" to the user. This stream can be used to post messages that
-	 * bypass the piping. If the output is piped to a file, then the object
-	 * returned must be null.
-	 * 
-	 * @return
-	 */
-	PrintStream getConsole();
-
-	/**
-	 * Get the value of a variable.
-	 * 
-	 * @param name
-	 * @return
-	 */
-	Object get(String name);
-
-	/**
-	 * Set the value of a variable.
-	 * 
-	 * @param name
-	 *            Name of the variable.
-	 * @param value
-	 *            Value of the variable
-	 */
-	void put(String name, Object value);
-
-	/**
-	 * Convert an object to string form (CharSequence). The level is defined in
-	 * the Converter interface, it can be one of INSPECT, LINE, PART. This
-	 * function always returns a non null value. As a last resort, toString is
-	 * called on the Object.
-	 * 
-	 * @param target
-	 * @param level
-	 * @return
-	 */
-	CharSequence format(Object target, int level);
+public interface CommandSession
+{
+    /**
+     * Execute a program in this session.
+     *
+     * @param commandline
+     * @return the result of the execution
+     */
+    Object execute(CharSequence commandline) throws Exception;
+
+    /**
+     * Close this command session. After the session is closed, it will throw
+     * IllegalStateException when it is used.
+     *
+     * @param
+     */
+    void close();
+
+    /**
+     * Return the input stream that is the first of the pipeline. This stream is
+     * sometimes necessary to communicate directly to the end user. For example,
+     * a "less" or "more" command needs direct input from the keyboard to
+     * control the paging.
+     *
+     * @return InpuStream used closest to the user or null if input is from a
+     *         file.
+     */
+    InputStream getKeyboard();
+
+    /**
+     * Return the PrintStream for the console. This must always be the stream
+     * "closest" to the user. This stream can be used to post messages that
+     * bypass the piping. If the output is piped to a file, then the object
+     * returned must be null.
+     *
+     * @return
+     */
+    PrintStream getConsole();
+
+    /**
+     * Get the value of a variable.
+     *
+     * @param name
+     * @return
+     */
+    Object get(String name);
+
+    /**
+     * Set the value of a variable.
+     *
+     * @param name  Name of the variable.
+     * @param value Value of the variable
+     */
+    void put(String name, Object value);
+
+    /**
+     * Convert an object to string form (CharSequence). The level is defined in
+     * the Converter interface, it can be one of INSPECT, LINE, PART. This
+     * function always returns a non null value. As a last resort, toString is
+     * called on the Object.
+     *
+     * @param target
+     * @param level
+     * @return
+     */
+    CharSequence format(Object target, int level);
 
 	/**
 	 * Convert an object to another type.

Modified: felix/trunk/gogo/src/main/java/org/osgi/service/command/Converter.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/src/main/java/org/osgi/service/command/Converter.java?rev=787428&r1=787427&r2=787428&view=diff
==============================================================================
--- felix/trunk/gogo/src/main/java/org/osgi/service/command/Converter.java (original)
+++ felix/trunk/gogo/src/main/java/org/osgi/service/command/Converter.java Mon Jun 22 22:27:13 2009
@@ -22,70 +22,65 @@
 /**
  * A converter is a service that can help create specific object types from a
  * string, and vice versa.
- * 
+ * <p/>
  * The shell is capable of coercing arguments to the their proper type. However,
  * sometimes commands require extra help to do this conversion. This service can
  * implement a converter for a number of types.
- * 
+ * <p/>
  * The command shell will rank these services in order of service.ranking and
  * will then call them until one of the converters succeeds.
- * 
  */
-public interface Converter {
-	/**
-	 * This property is a string, or array of strings, and defines the classes
-	 * or interfaces that this converter recognizes. Recognized classes can be
-	 * converted from a string to a class and they can be printed in 3 different
-	 * modes.
-	 */
-	String	CONVERTER_CLASSES	= "osgi.converter.classes";
+public interface Converter
+{
+    /**
+     * This property is a string, or array of strings, and defines the classes
+     * or interfaces that this converter recognizes. Recognized classes can be
+     * converted from a string to a class and they can be printed in 3 different
+     * modes.
+     */
+    String CONVERTER_CLASSES = "osgi.converter.classes";
 
-	/**
-	 * Print the object in detail. This can contain multiple lines.
-	 */
-	int		INSPECT				= 0;
+    /**
+     * Print the object in detail. This can contain multiple lines.
+     */
+    int INSPECT = 0;
 
-	/**
-	 * Print the object as a row in a table. The columns should align for
-	 * multiple objects printed beneath each other. The print may run over
-	 * multiple lines but must not end in a CR.
-	 */
-	int		LINE				= 1;
+    /**
+     * Print the object as a row in a table. The columns should align for
+     * multiple objects printed beneath each other. The print may run over
+     * multiple lines but must not end in a CR.
+     */
+    int LINE = 1;
 
-	/**
-	 * Print the value in a small format so that it is identifiable. This
-	 * printed format must be recognizable by the conversion method.
-	 */
-	int		PART				= 2;
+    /**
+     * Print the value in a small format so that it is identifiable. This
+     * printed format must be recognizable by the conversion method.
+     */
+    int PART = 2;
 
-	/**
-	 * Convert an object to the desired type.
-	 * 
-	 * Return null if the conversion can not be done. Otherwise return and
-	 * object that extends the desired type or implements it.
-	 * 
-	 * @param desiredType
-	 *            The type that the returned object can be assigned to
-	 * @param in
-	 *            The object that must be converted
-	 * @return An object that can be assigned to the desired type or null.
-	 * @throws Exception
-	 */
-	Object convert(Class<?> desiredType, Object in) throws Exception;
+    /**
+     * Convert an object to the desired type.
+     * <p/>
+     * Return null if the conversion can not be done. Otherwise return and
+     * object that extends the desired type or implements it.
+     *
+     * @param desiredType The type that the returned object can be assigned to
+     * @param in          The object that must be converted
+     * @return An object that can be assigned to the desired type or null.
+     * @throws Exception
+     */
+    Object convert(Class<?> desiredType, Object in) throws Exception;
 
-	/**
-	 * Convert an objet to a CharSequence object in the requested format. The
-	 * format can be INSPECT, LINE, or PART. Other values must throw
-	 * IllegalArgumentException.
-	 * 
-	 * @param target
-	 *            The object to be converted to a String
-	 * @param level
-	 *            One of INSPECT, LINE, or PART.
-	 * @param escape
-	 *            Use this object to format sub ordinate objects.
-	 * @return A printed object of potentially multiple lines
-	 * @throws Exception 
-	 */
-	CharSequence format(Object target, int level, Converter escape) throws Exception;
+    /**
+     * Convert an objet to a CharSequence object in the requested format. The
+     * format can be INSPECT, LINE, or PART. Other values must throw
+     * IllegalArgumentException.
+     *
+     * @param target The object to be converted to a String
+     * @param level  One of INSPECT, LINE, or PART.
+     * @param escape Use this object to format sub ordinate objects.
+     * @return A printed object of potentially multiple lines
+     * @throws Exception
+     */
+    CharSequence format(Object target, int level, Converter escape) throws Exception;
 }

Modified: felix/trunk/gogo/src/main/java/org/osgi/service/command/Function.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/src/main/java/org/osgi/service/command/Function.java?rev=787428&r1=787427&r2=787428&view=diff
==============================================================================
--- felix/trunk/gogo/src/main/java/org/osgi/service/command/Function.java (original)
+++ felix/trunk/gogo/src/main/java/org/osgi/service/command/Function.java Mon Jun 22 22:27:13 2009
@@ -18,21 +18,19 @@
  */
 package org.osgi.service.command;
 
-import java.util.*;
+import java.util.List;
 
 /**
  * A Function is a a block of code that can be executed with a set of arguments,
  * it returns the result object of executing the script.
  */
-public interface Function {
-	/**
-	 * Execute this function and return the result.
-	 * 
-	 * @return the result from the execution.
-	 * 
-	 * @throws Exception
-	 *             if anything goes terribly wrong
-	 */
-	Object execute(CommandSession session, List<Object> arguments)
-			throws Exception;
+public interface Function
+{
+    /**
+     * Execute this function and return the result.
+     *
+     * @return the result from the execution.
+     * @throws Exception if anything goes terribly wrong
+     */
+    Object execute(CommandSession session, List<Object> arguments) throws Exception;
 }

Modified: felix/trunk/gogo/src/main/java/org/osgi/service/threadio/ThreadIO.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/src/main/java/org/osgi/service/threadio/ThreadIO.java?rev=787428&r1=787427&r2=787428&view=diff
==============================================================================
--- felix/trunk/gogo/src/main/java/org/osgi/service/threadio/ThreadIO.java (original)
+++ felix/trunk/gogo/src/main/java/org/osgi/service/threadio/ThreadIO.java Mon Jun 22 22:27:13 2009
@@ -18,39 +18,40 @@
  */
 package org.osgi.service.threadio;
 
-import java.io.*;
+import java.io.InputStream;
+import java.io.PrintStream;
 
 /**
  * Enable multiplexing of the standard IO streams for input, output, and error.
- * 
+ * <p/>
  * This service guards the central resource of IO streams. The standard streams
  * are singletons. This service replaces the singletons with special versions that
  * can find a unique stream for each thread. If no stream is associated with a
  * thread, it will use the standard input/output that was originally set.
- * 
- * @author aqute
  *
+ * @author aqute
  */
-public interface ThreadIO {
-	/**
-	 * Associate this streams with the current thread.
-	 * 
-	 * Ensure that when output is performed on System.in, System.out, System.err it
-	 * will happen on the given streams. 
-	 * 
-	 * The streams will automatically be canceled when the bundle that has gotten
-	 * this service is stopped or returns this service.
-	 * 
-	 * @param in InputStream to use for the current thread when System.in is used
-	 * @param out PrintStream to use for the current thread when System.out is used
-	 * @param err PrintStream to use for the current thread when System.err is used
-	 */
-	void setStreams(InputStream in, PrintStream out, PrintStream err);
+public interface ThreadIO
+{
+    /**
+     * Associate this streams with the current thread.
+     * <p/>
+     * Ensure that when output is performed on System.in, System.out, System.err it
+     * will happen on the given streams.
+     * <p/>
+     * The streams will automatically be canceled when the bundle that has gotten
+     * this service is stopped or returns this service.
+     *
+     * @param in  InputStream to use for the current thread when System.in is used
+     * @param out PrintStream to use for the current thread when System.out is used
+     * @param err PrintStream to use for the current thread when System.err is used
+     */
+    void setStreams(InputStream in, PrintStream out, PrintStream err);
 
-	/**
-	 * Cancel the streams associated with the current thread.
-	 * 
-	 * This method will not do anything when no streams are associated.
-	 */
+    /**
+     * Cancel the streams associated with the current thread.
+     * <p/>
+     * This method will not do anything when no streams are associated.
+     */
 	void close();
 }

Modified: felix/trunk/gogo/src/test/java/org/apache/felix/gogo/shell/runtime/Context.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/src/test/java/org/apache/felix/gogo/shell/runtime/Context.java?rev=787428&r1=787427&r2=787428&view=diff
==============================================================================
--- felix/trunk/gogo/src/test/java/org/apache/felix/gogo/shell/runtime/Context.java (original)
+++ felix/trunk/gogo/src/test/java/org/apache/felix/gogo/shell/runtime/Context.java Mon Jun 22 22:27:13 2009
@@ -18,29 +18,35 @@
  */
 package org.apache.felix.gogo.shell.runtime;
 
-import org.apache.felix.gogo.threadio.*;
+import org.apache.felix.gogo.threadio.ThreadIOImpl;
+
+public class Context extends CommandShellImpl
+{
+    public static final String EMPTY = "";
+    CommandSessionImpl session = (CommandSessionImpl) createSession(System.in, System.out, System.err);
+    static ThreadIOImpl threadio;
+
+    static
+    {
+        threadio = new ThreadIOImpl();
+        threadio.start();
+
+    }
+
+    public Context()
+    {
+        setThreadio(threadio);
+    }
+
+    public Object execute(CharSequence source) throws Exception
+    {
+        return session.execute(source);
+    }
+
+    public void addCommand(String name, Object target)
+    {
+        put("test:" + name, target);
+    }
 
-public class Context extends CommandShellImpl {
-	public static final String EMPTY = "";
-	CommandSessionImpl session = (CommandSessionImpl) createSession(System.in,System.out,System.err);
-	static ThreadIOImpl threadio; 
-	
-	static  {
-		threadio = new ThreadIOImpl();
-		threadio.start();
-		
-	}
-	public Context() {
-		setThreadio( threadio );
-	}
-
-	public Object execute(CharSequence source) throws Exception {
-		return session.execute(source);
-	}
-
-	public void addCommand(String name, Object target ) {
-	    put("test:" + name, target );
-	}
-	
 
 }

Modified: felix/trunk/gogo/src/test/java/org/apache/felix/gogo/shell/runtime/TestParser.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/src/test/java/org/apache/felix/gogo/shell/runtime/TestParser.java?rev=787428&r1=787427&r2=787428&view=diff
==============================================================================
--- felix/trunk/gogo/src/test/java/org/apache/felix/gogo/shell/runtime/TestParser.java (original)
+++ felix/trunk/gogo/src/test/java/org/apache/felix/gogo/shell/runtime/TestParser.java Mon Jun 22 22:27:13 2009
@@ -18,32 +18,37 @@
  */
 package org.apache.felix.gogo.shell.runtime;
 
-import java.io.*;
-import java.util.*;
-import java.util.regex.*;
+import junit.framework.TestCase;
+import org.osgi.service.command.CommandSession;
+import org.osgi.service.command.Function;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.regex.Pattern;
 
-import junit.framework.*;
-
-import org.osgi.service.command.*;
-
-public class TestParser extends TestCase {
+public class TestParser extends TestCase
+{
     int beentheredonethat = 0;
 
-    public void testPipe() throws Exception {
+    public void testPipe() throws Exception
+    {
         Context c = new Context();
         c.addCommand("echo", this);
         c.addCommand("capture", this);
         c.addCommand("grep", this);
-        assertEquals("def", c
-                .execute("echo def|grep (d.*)|capture"));
-        assertEquals("def", c
-                .execute("echo abc; echo def; echo ghi|grep (d.*)|capture"));
+        assertEquals("def", c.execute("echo def|grep (d.*)|capture"));
+        assertEquals("def", c.execute("echo abc; echo def; echo ghi|grep (d.*)|capture"));
         assertEquals("hello world", c.execute("echo hello world|capture"));
-        assertEquals("defghi", c
-                .execute("echo abc; echo def; echo ghi|grep (def|ghi)|capture"));
+        assertEquals("defghi", c.execute("echo abc; echo def; echo ghi|grep (def|ghi)|capture"));
     }
 
-    public void testAssignment() throws Exception {
+    public void testAssignment() throws Exception
+    {
         Context c = new Context();
         c.addCommand("echo", this);
         c.addCommand("capture", this);
@@ -56,18 +61,19 @@
         assertEquals("a", c.execute("a = a; echo $$a").toString());
     }
 
-    public void testComment() throws Exception {
+    public void testComment() throws Exception
+    {
         Context c = new Context();
         c.addCommand("echo", this);
         assertEquals("1", c.execute("echo 1 // hello").toString());
 
     }
 
-    public void testClosure() throws Exception {
+    public void testClosure() throws Exception
+    {
         Context c = new Context();
         c.addCommand("echo", this);
-        assertEquals("http://www.aqute.biz?com=2&biz=1", c.execute(
-                "['http://www.aqute.biz?com=2&biz=1'] get 0").toString());
+        assertEquals("http://www.aqute.biz?com=2&biz=1", c.execute("['http://www.aqute.biz?com=2&biz=1'] get 0").toString());
         assertEquals("{a=2, b=3}", c.execute("[a=2 b=3]").toString());
         assertEquals("3", c.execute("[a=2 <b>=<3>] get b").toString());
         assertEquals("[3, 4]", c.execute("[1 2 [3 4] 5 6] get 2").toString());
@@ -75,10 +81,10 @@
 
     }
 
-    public void testArray() throws Exception {
+    public void testArray() throws Exception
+    {
         Context c = new Context();
-        assertEquals("http://www.aqute.biz?com=2&biz=1", c.execute(
-                "['http://www.aqute.biz?com=2&biz=1'] get 0").toString());
+        assertEquals("http://www.aqute.biz?com=2&biz=1", c.execute("['http://www.aqute.biz?com=2&biz=1'] get 0").toString());
         assertEquals("{a=2, b=3}", c.execute("[a=2 b=3]").toString());
         assertEquals("3", c.execute("[a=2 <b>=<3>] get b").toString());
         assertEquals("[3, 4]", c.execute("[1 2 [3 4] 5 6] get 2").toString());
@@ -86,7 +92,8 @@
 
     }
 
-    public void testEscape() {
+    public void testEscape()
+    {
         Parser parser = new Parser("'a|b;c'");
         CharSequence cs = parser.messy();
         assertEquals("a|b;c", cs.toString());
@@ -94,7 +101,8 @@
     }
 
 
-    public void testParentheses() {
+    public void testParentheses()
+    {
         Parser parser = new Parser("(a|b)|(d|f)");
         List<List<List<CharSequence>>> p = parser.program();
         assertEquals("(a|b)", p.get(0).get(0).get(0));
@@ -104,47 +112,52 @@
         assertEquals("(d.*)", p.get(0).get(0).get(1));
     }
 
-    public void testEcho() throws Exception {
+    public void testEcho() throws Exception
+    {
         Context c = new Context();
         c.addCommand("echo", this);
         c.execute("echo peter");
     }
 
-    public void grep(String match) throws IOException {
+    public void grep(String match) throws IOException
+    {
         Pattern p = Pattern.compile(match);
-        BufferedReader rdr = new BufferedReader(
-                new InputStreamReader(System.in));
+        BufferedReader rdr = new BufferedReader(new InputStreamReader(System.in));
         String s = rdr.readLine();
-        while (s != null) {
-            if (p.matcher(s).find()) {
+        while (s != null)
+        {
+            if (p.matcher(s).find())
+            {
                 System.out.println(s);
             }
             s = rdr.readLine();
         }
     }
 
-    public String capture() throws IOException {
+    public String capture() throws IOException
+    {
         StringWriter sw = new StringWriter();
-        BufferedReader rdr = new BufferedReader(
-                new InputStreamReader(System.in));
+        BufferedReader rdr = new BufferedReader(new InputStreamReader(System.in));
         String s = rdr.readLine();
-        while (s != null) {
+        while (s != null)
+        {
             sw.write(s);
             s = rdr.readLine();
         }
         return sw.toString();
     }
 
-    public void testVars() throws Exception {
+    public void testVars() throws Exception
+    {
         Context c = new Context();
         c.addCommand("echo", this);
 
-        assertEquals("", c.execute(
-                "echo ${very.likely.that.this.does.not.exist}").toString());
+        assertEquals("", c.execute("echo ${very.likely.that.this.does.not.exist}").toString());
         assertNotNull(c.execute("echo ${java.runtime.name}"));
     }
 
-    public void testFunny() throws Exception {
+    public void testFunny() throws Exception
+    {
         Context c = new Context();
         c.addCommand("echo", this);
         assertEquals("a", c.execute("echo a") + "");
@@ -152,15 +165,20 @@
         assertEquals("a", c.execute("<<echo echo> echo> <echo a>") + "");
     }
 
-    public CharSequence echo(Object args[]) {
+    public CharSequence echo(Object args[])
+    {
         if (args == null)
+        {
             return "";
-        
+        }
+
         StringBuilder sb = new StringBuilder();
         String del = "";
-        for (Object arg : args) {
+        for (Object arg : args)
+        {
             sb.append(del);
-            if (arg != null) {
+            if (arg != null)
+            {
                 sb.append(arg);
                 del = " ";
             }
@@ -168,7 +186,8 @@
         return sb;
     }
 
-    public void testContext() throws Exception {
+    public void testContext() throws Exception
+    {
         Context c = new Context();
         c.addCommand("ls", this);
         beentheredonethat = 0;
@@ -190,28 +209,33 @@
 
     }
 
-    public void ls() {
+    public void ls()
+    {
         beentheredonethat++;
         System.out.println("ls(): Yes!");
     }
 
-    public int ls(int onoff) {
+    public int ls(int onoff)
+    {
         beentheredonethat += onoff;
         System.out.println("ls(int) " + onoff);
         return onoff;
     }
 
-    public void ls(Object args[]) {
+    public void ls(Object args[])
+    {
         beentheredonethat = args.length;
         System.out.print("ls(Object[]) [");
         for (Object i : args)
+        {
             System.out.print(i + " ");
+        }
         System.out.println("]");
     }
 
-    public void testProgram() {
-        List<List<List<CharSequence>>> x = new Parser(
-                "abc def|ghi jkl;mno pqr|stu vwx").program();
+    public void testProgram()
+    {
+        List<List<List<CharSequence>>> x = new Parser("abc def|ghi jkl;mno pqr|stu vwx").program();
         assertEquals("abc", x.get(0).get(0).get(0));
         assertEquals("def", x.get(0).get(0).get(1));
         assertEquals("ghi", x.get(1).get(0).get(0));
@@ -222,9 +246,9 @@
         assertEquals("vwx", x.get(2).get(0).get(1));
     }
 
-    public void testStatements() {
-        List<List<CharSequence>> x = new Parser("abc def;ghi jkl;mno pqr")
-                .statements();
+    public void testStatements()
+    {
+        List<List<CharSequence>> x = new Parser("abc def;ghi jkl;mno pqr").statements();
         assertEquals("abc", x.get(0).get(0));
         assertEquals("def", x.get(0).get(1));
         assertEquals("ghi", x.get(1).get(0));
@@ -233,10 +257,9 @@
         assertEquals("pqr", x.get(2).get(1));
     }
 
-    public void testSimpleValue() {
-        List<CharSequence> x = new Parser(
-                "abc def.ghi http://www.osgi.org?abc=&x=1 [1,2,3] {{{{{{{xyz}}}}}}} <immediate> {'{{{{{'} {\\}} 'abc{}'")
-                .statement();
+    public void testSimpleValue()
+    {
+        List<CharSequence> x = new Parser("abc def.ghi http://www.osgi.org?abc=&x=1 [1,2,3] {{{{{{{xyz}}}}}}} <immediate> {'{{{{{'} {\\}} 'abc{}'").statement();
         assertEquals("abc", x.get(0));
         assertEquals("def.ghi", x.get(1));
         assertEquals("http://www.osgi.org?abc=&x=1", x.get(2));
@@ -248,11 +271,13 @@
         assertEquals("abc{}", x.get(8));
     }
 
-    void each(CommandSession session, Collection<Object> list, Function closure) throws Exception {
+    void each(CommandSession session, Collection<Object> list, Function closure) throws Exception
+    {
         List<Object> args = new ArrayList<Object>();
         args.add(null);
-        for (Object x : list) {
-            args.set(0, x );
+        for (Object x : list)
+        {
+            args.set(0, x);
             closure.execute(session, args);
         }
     }

Modified: felix/trunk/gogo/src/test/java/org/apache/felix/gogo/threadio/TestThreadIO.java
URL: http://svn.apache.org/viewvc/felix/trunk/gogo/src/test/java/org/apache/felix/gogo/threadio/TestThreadIO.java?rev=787428&r1=787427&r2=787428&view=diff
==============================================================================
--- felix/trunk/gogo/src/test/java/org/apache/felix/gogo/threadio/TestThreadIO.java (original)
+++ felix/trunk/gogo/src/test/java/org/apache/felix/gogo/threadio/TestThreadIO.java Mon Jun 22 22:27:13 2009
@@ -18,61 +18,72 @@
  */
 package org.apache.felix.gogo.threadio;
 
-import java.io.*;
-import java.util.*;
+import junit.framework.TestCase;
 
-import junit.framework.*;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
+
+public class TestThreadIO extends TestCase
+{
 
-public class TestThreadIO extends TestCase {
-    
     /**
      * Test if the threadio works in a nested fashion. We first push
      * ten markers on the stack and print a message for each, capturing
      * the output in a ByteArrayOutputStream. Then we pop them, also printing
      * a message identifying the level. Then we verify the output for each level.
      */
-    public void testNested() {
+    public void testNested()
+    {
         ThreadIOImpl tio = new ThreadIOImpl();
         tio.start();
         List<ByteArrayOutputStream> list = new ArrayList<ByteArrayOutputStream>();
-        for ( int i =0; i<10; i++) {
+        for (int i = 0; i < 10; i++)
+        {
             ByteArrayOutputStream out = new ByteArrayOutputStream();
             list.add(out);
-            tio.setStreams(System.in, new PrintStream(out), System.err);            
+            tio.setStreams(System.in, new PrintStream(out), System.err);
             System.out.print("b" + i);
         }
-        for ( int i =9; i>=0; i--) {
-            System.out.println("e" + i);            
+        for (int i = 9; i >= 0; i--)
+        {
+            System.out.println("e" + i);
             tio.close();
         }
-        tio.stop();        
-        for ( int i =0; i<10; i++) {
+        tio.stop();
+        for (int i = 0; i < 10; i++)
+        {
             String message = list.get(i).toString().trim();
-            assertEquals("b"+i+"e"+i, message );
+            assertEquals("b" + i + "e" + i, message);
         }
     }
 
     /**
      * Simple test too see if the basics work.
      */
-    public void testSimple() {
+    public void testSimple()
+    {
         ThreadIOImpl tio = new ThreadIOImpl();
         tio.start();
-        System.out.println("Hello World");   
+        System.out.println("Hello World");
         ByteArrayOutputStream out = new ByteArrayOutputStream();
         ByteArrayOutputStream err = new ByteArrayOutputStream();
         tio.setStreams(System.in, new PrintStream(out), new PrintStream(err));
-        try {
+        try
+        {
             System.out.println("Simple Normal Message");
             System.err.println("Simple Error Message");
-        } finally {
+        }
+        finally
+        {
             tio.close();
         }
         tio.stop();
         String normal = out.toString().trim();
         //String error = err.toString().trim();
-        assertEquals("Simple Normal Message", normal );
+        assertEquals("Simple Normal Message", normal);
         //assertEquals("Simple Error Message", error );
-        System.out.println("Goodbye World");           
+        System.out.println("Goodbye World");
     }
 }