commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1103095 [21/24] - in /incubator/ognl/trunk/src: main/java/org/apache/commons/ognl/ main/java/org/apache/commons/ognl/enhance/ main/java/org/apache/commons/ognl/internal/ test/java/org/apache/commons/ognl/ test/java/org/apache/commons/ognl/...
Date Sat, 14 May 2011 13:18:36 GMT
Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/OperatorTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/OperatorTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/OperatorTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/OperatorTest.java Sat May 14 13:18:29 2011
@@ -21,43 +21,49 @@ package org.apache.commons.ognl.test;
 
 import junit.framework.TestSuite;
 
-public class OperatorTest extends OgnlTestCase {
-    private static Object[][] TESTS = {
-            {null, "\"one\" > \"two\"", Boolean.FALSE},
-            {null, "\"one\" >= \"two\"", Boolean.FALSE},
-            {null, "\"one\" < \"two\"", Boolean.TRUE},
-            {null, "\"one\" <= \"two\"", Boolean.TRUE},
-            {null, "\"one\" == \"two\"", Boolean.FALSE},
-            {null, "\"o\" > \"o\"", Boolean.FALSE},
-            {null, "\"o\" gt \"o\"", Boolean.FALSE},
-            {null, "\"o\" >= \"o\"", Boolean.TRUE},
-            {null, "\"o\" gte \"o\"", Boolean.TRUE},
-            {null, "\"o\" < \"o\"", Boolean.FALSE},
-            {null, "\"o\" lt \"o\"", Boolean.FALSE},
-            {null, "\"o\" <= \"o\"", Boolean.TRUE},
-            {null, "\"o\" lte \"o\"", Boolean.TRUE},
-            {null, "\"o\" == \"o\"", Boolean.TRUE},
-            {null, "\"o\" eq \"o\"", Boolean.TRUE},
-    };
-
-    /*===================================================================
-        Public static methods
-      ===================================================================*/
+public class OperatorTest
+    extends OgnlTestCase
+{
+    private static Object[][] TESTS = { { null, "\"one\" > \"two\"", Boolean.FALSE },
+        { null, "\"one\" >= \"two\"", Boolean.FALSE }, { null, "\"one\" < \"two\"", Boolean.TRUE },
+        { null, "\"one\" <= \"two\"", Boolean.TRUE }, { null, "\"one\" == \"two\"", Boolean.FALSE },
+        { null, "\"o\" > \"o\"", Boolean.FALSE }, { null, "\"o\" gt \"o\"", Boolean.FALSE },
+        { null, "\"o\" >= \"o\"", Boolean.TRUE }, { null, "\"o\" gte \"o\"", Boolean.TRUE },
+        { null, "\"o\" < \"o\"", Boolean.FALSE }, { null, "\"o\" lt \"o\"", Boolean.FALSE },
+        { null, "\"o\" <= \"o\"", Boolean.TRUE }, { null, "\"o\" lte \"o\"", Boolean.TRUE },
+        { null, "\"o\" == \"o\"", Boolean.TRUE }, { null, "\"o\" eq \"o\"", Boolean.TRUE }, };
+
+    /*
+     * =================================================================== Public static methods
+     * ===================================================================
+     */
     public static TestSuite suite()
     {
         TestSuite result = new TestSuite();
 
-        for (int i = 0; i < TESTS.length; i++) {
-            if (TESTS[i].length == 3) {
-                result.addTest(new OperatorTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1], TESTS[i][2]));
-            } else {
-                if (TESTS[i].length == 4) {
-                    result.addTest(new OperatorTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1], TESTS[i][2], TESTS[i][3]));
-                } else {
-                    if (TESTS[i].length == 5) {
-                        result.addTest(new OperatorTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1], TESTS[i][2], TESTS[i][3], TESTS[i][4]));
-                    } else {
-                        throw new RuntimeException("don't understand TEST format");
+        for ( int i = 0; i < TESTS.length; i++ )
+        {
+            if ( TESTS[i].length == 3 )
+            {
+                result.addTest( new OperatorTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1], TESTS[i][2] ) );
+            }
+            else
+            {
+                if ( TESTS[i].length == 4 )
+                {
+                    result.addTest( new OperatorTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
+                                                      TESTS[i][2], TESTS[i][3] ) );
+                }
+                else
+                {
+                    if ( TESTS[i].length == 5 )
+                    {
+                        result.addTest( new OperatorTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
+                                                          TESTS[i][2], TESTS[i][3], TESTS[i][4] ) );
+                    }
+                    else
+                    {
+                        throw new RuntimeException( "don't understand TEST format" );
                     }
                 }
             }
@@ -65,31 +71,33 @@ public class OperatorTest extends OgnlTe
         return result;
     }
 
-    /*===================================================================
-        Constructors
-      ===================================================================*/
+    /*
+     * =================================================================== Constructors
+     * ===================================================================
+     */
     public OperatorTest()
     {
         super();
     }
 
-    public OperatorTest(String name)
+    public OperatorTest( String name )
     {
-        super(name);
+        super( name );
     }
 
-    public OperatorTest(String name, Object root, String expressionString, Object expectedResult, Object setValue, Object expectedAfterSetResult)
+    public OperatorTest( String name, Object root, String expressionString, Object expectedResult, Object setValue,
+                         Object expectedAfterSetResult )
     {
-        super(name, root, expressionString, expectedResult, setValue, expectedAfterSetResult);
+        super( name, root, expressionString, expectedResult, setValue, expectedAfterSetResult );
     }
 
-    public OperatorTest(String name, Object root, String expressionString, Object expectedResult, Object setValue)
+    public OperatorTest( String name, Object root, String expressionString, Object expectedResult, Object setValue )
     {
-        super(name, root, expressionString, expectedResult, setValue);
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public OperatorTest(String name, Object root, String expressionString, Object expectedResult)
+    public OperatorTest( String name, Object root, String expressionString, Object expectedResult )
     {
-        super(name, root, expressionString, expectedResult);
+        super( name, root, expressionString, expectedResult );
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/Performance.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/Performance.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/Performance.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/Performance.java Sat May 14 13:18:29 2011
@@ -30,40 +30,58 @@ import java.lang.reflect.Method;
 import java.text.DecimalFormat;
 import java.text.NumberFormat;
 
-public class Performance extends Object
+public class Performance
+    extends Object
 {
 
     private static int MAX_ITERATIONS = -1;
+
     private static boolean ITERATIONS_MODE;
+
     private static long MAX_TIME = -1L;
+
     private static boolean TIME_MODE;
-    private static NumberFormat FACTOR_FORMAT = new DecimalFormat("0.000");
+
+    private static NumberFormat FACTOR_FORMAT = new DecimalFormat( "0.000" );
 
     private String _name;
-    private OgnlContext _context = (OgnlContext) Ognl.createDefaultContext(null);
+
+    private OgnlContext _context = (OgnlContext) Ognl.createDefaultContext( null );
+
     private Bean1 _root = new Bean1();
+
     private SimpleNode _expression;
+
     private SimpleNode _compiledExpression;
+
     private Method _method;
+
     private int _iterations;
+
     private Serializable _mvelCompiled;
+
     private String _expressionString;
+
     private boolean _isMvel = false;
+
     private long t0;
+
     private long t1;
 
     /*
-    * =================================================================== Private static classes
-    * ===================================================================
-    */
+     * =================================================================== Private static classes
+     * ===================================================================
+     */
     private static class Results
     {
 
         int iterations;
+
         long time;
+
         boolean mvel;
 
-        public Results(int iterations, long time, boolean mvel)
+        public Results( int iterations, long time, boolean mvel )
         {
             super();
             this.iterations = iterations;
@@ -71,33 +89,42 @@ public class Performance extends Object
             this.mvel = mvel;
         }
 
-        public String getFactor(Results otherResults)
+        public String getFactor( Results otherResults )
         {
             String ret = null;
 
-            if (TIME_MODE) {
+            if ( TIME_MODE )
+            {
                 float factor = 0;
 
-                if (iterations < otherResults.iterations) {
-                    factor = Math.max((float) otherResults.iterations, (float) iterations)
-                             / Math.min((float) otherResults.iterations, (float) iterations);
-                } else {
-                    factor = Math.min((float) otherResults.iterations, (float) iterations)
-                             / Math.max((float) otherResults.iterations, (float) iterations);
+                if ( iterations < otherResults.iterations )
+                {
+                    factor =
+                        Math.max( (float) otherResults.iterations, (float) iterations )
+                            / Math.min( (float) otherResults.iterations, (float) iterations );
+                }
+                else
+                {
+                    factor =
+                        Math.min( (float) otherResults.iterations, (float) iterations )
+                            / Math.max( (float) otherResults.iterations, (float) iterations );
                 }
 
-                ret = FACTOR_FORMAT.format(factor);
-                if (iterations > otherResults.iterations)
+                ret = FACTOR_FORMAT.format( factor );
+                if ( iterations > otherResults.iterations )
                     ret += " times faster than ";
                 else
                     ret += " times slower than ";
 
-            } else {
-                float factor = Math.max((float) otherResults.time, (float) time)
-                               / Math.min((float) otherResults.time, (float) time);
+            }
+            else
+            {
+                float factor =
+                    Math.max( (float) otherResults.time, (float) time )
+                        / Math.min( (float) otherResults.time, (float) time );
 
-                ret = FACTOR_FORMAT.format(factor);
-                if (time < otherResults.time)
+                ret = FACTOR_FORMAT.format( factor );
+                if ( time < otherResults.time )
                     ret += " times faster than ";
                 else
                     ret += " times slower than ";
@@ -111,141 +138,163 @@ public class Performance extends Object
      * =================================================================== Public static methods
      * ===================================================================
      */
-    public static void main(String[] args)
+    public static void main( String[] args )
     {
-        for(int i = 0; i < args.length; i++) {
-            if (args[i].equals("-time")) {
+        for ( int i = 0; i < args.length; i++ )
+        {
+            if ( args[i].equals( "-time" ) )
+            {
                 TIME_MODE = true;
-                MAX_TIME = Long.parseLong(args[++i]);
-            } else if (args[i].equals("-iterations")) {
+                MAX_TIME = Long.parseLong( args[++i] );
+            }
+            else if ( args[i].equals( "-iterations" ) )
+            {
                 ITERATIONS_MODE = true;
-                MAX_ITERATIONS = Integer.parseInt(args[++i]);
+                MAX_ITERATIONS = Integer.parseInt( args[++i] );
             }
         }
-        if (!TIME_MODE && !ITERATIONS_MODE) {
+        if ( !TIME_MODE && !ITERATIONS_MODE )
+        {
             TIME_MODE = true;
             MAX_TIME = 1500;
         }
 
-        try {
-            Performance[] tests = new Performance[] {
-                    new Performance("Constant", "100 + 20 * 5", "testConstantExpression"),
-                    //new Performance("Constant", "100 + 20 * 5", "testConstantExpression", false),
-                    new Performance("Single Property", "bean2", "testSinglePropertyExpression"),
-                    new Performance("Property Navigation", "bean2.bean3.value", "testPropertyNavigationExpression"),
-                    /*new Performance("Property Setting with context key", "bean2.bean3.nullValue", "testPropertyNavigationSetting"),
-                    new Performance("Property Setting with context key", "bean2.bean3.nullValue", "testPropertyNavigationSetting", true), */                    
-                    new Performance("Property Navigation and Comparison", "bean2.bean3.value <= 24",
-                                    "testPropertyNavigationAndComparisonExpression"),
-                    /* new Performance("Property Navigation with Indexed Access", "bean2.bean3.indexedValue[25]",
-                                    "testIndexedPropertyNavigationExpression"),
-                    new Performance("Property Navigation with Indexed Access", "bean2.bean3.indexedValue[25]",
-                                    "testIndexedPropertyNavigationExpression", true), */
-                    new Performance("Property Navigation with Map Access", "bean2.bean3.map['foo']",
-                                    "testPropertyNavigationWithMapExpression"),
-                    /* new Performance("Property Navigation with Map value set", "bean2.bean3.map['foo']",
-                                    "testPropertyNavigationWithMapSetting"),
-                    new Performance("Property Navigation with Map value set", "bean2.bean3.map['foo']",
-                                    "testPropertyNavigationWithMapSetting", true) */
-            };
+        try
+        {
+            Performance[] tests =
+                new Performance[] {
+                    new Performance( "Constant", "100 + 20 * 5", "testConstantExpression" ),
+                    // new Performance("Constant", "100 + 20 * 5", "testConstantExpression", false),
+                    new Performance( "Single Property", "bean2", "testSinglePropertyExpression" ),
+                    new Performance( "Property Navigation", "bean2.bean3.value", "testPropertyNavigationExpression" ),
+                    /*
+                     * new Performance("Property Setting with context key", "bean2.bean3.nullValue",
+                     * "testPropertyNavigationSetting"), new Performance("Property Setting with context key",
+                     * "bean2.bean3.nullValue", "testPropertyNavigationSetting", true),
+                     */
+                    new Performance( "Property Navigation and Comparison", "bean2.bean3.value <= 24",
+                                     "testPropertyNavigationAndComparisonExpression" ),
+                    /*
+                     * new Performance("Property Navigation with Indexed Access", "bean2.bean3.indexedValue[25]",
+                     * "testIndexedPropertyNavigationExpression"), new
+                     * Performance("Property Navigation with Indexed Access", "bean2.bean3.indexedValue[25]",
+                     * "testIndexedPropertyNavigationExpression", true),
+                     */
+                    new Performance( "Property Navigation with Map Access", "bean2.bean3.map['foo']",
+                                     "testPropertyNavigationWithMapExpression" ),
+                /*
+                 * new Performance("Property Navigation with Map value set", "bean2.bean3.map['foo']",
+                 * "testPropertyNavigationWithMapSetting"), new Performance("Property Navigation with Map value set",
+                 * "bean2.bean3.map['foo']", "testPropertyNavigationWithMapSetting", true)
+                 */
+                };
 
             boolean timeMode = TIME_MODE;
             boolean iterMode = ITERATIONS_MODE;
             long maxTime = MAX_TIME;
             int maxIterations = MAX_ITERATIONS;
 
-            //TIME_MODE = false;
-            //ITERATIONS_MODE = true;
-            //maxIterations = 1000;
+            // TIME_MODE = false;
+            // ITERATIONS_MODE = true;
+            // maxIterations = 1000;
 
-            runTests(tests, false);
+            runTests( tests, false );
 
             TIME_MODE = timeMode;
             ITERATIONS_MODE = iterMode;
             MAX_TIME = maxTime;
             MAX_ITERATIONS = maxIterations;
 
-            System.out.println("\n\n============================================================================\n");
+            System.out.println( "\n\n============================================================================\n" );
 
-            Thread.sleep(2500);
-            runTests(tests, true);
+            Thread.sleep( 2500 );
+            runTests( tests, true );
 
-            //Thread.sleep(2000);
+            // Thread.sleep(2000);
 
-            System.out.println("\n\n============================================================================\n");
+            System.out.println( "\n\n============================================================================\n" );
             // runTests(tests);
 
-        } catch (Exception ex) {
+        }
+        catch ( Exception ex )
+        {
             ex.printStackTrace();
         }
     }
 
-    static void runTests(Performance[] tests, boolean output)
-            throws Exception
+    static void runTests( Performance[] tests, boolean output )
+        throws Exception
     {
-        for(int i = 0; i < tests.length; i++) {
+        for ( int i = 0; i < tests.length; i++ )
+        {
             Performance perf = tests[i];
 
-            try {
+            try
+            {
 
-                Results javaResults = perf.testJava(),
-                        interpretedResults = perf.testExpression(false),
-                        compiledResults = perf.testExpression(true);
+                Results javaResults = perf.testJava(), interpretedResults = perf.testExpression( false ), compiledResults =
+                    perf.testExpression( true );
 
-                if (!output)
+                if ( !output )
                     return;
 
-                System.out.println((compiledResults.mvel ? "MVEL" : "OGNL") + " " + perf.getName() + ": " + perf.getExpression().toString());
-                System.out.println("       java: " + javaResults.iterations + " iterations in " + javaResults.time + " ms");
+                System.out.println( ( compiledResults.mvel ? "MVEL" : "OGNL" ) + " " + perf.getName() + ": "
+                    + perf.getExpression().toString() );
+                System.out.println( "       java: " + javaResults.iterations + " iterations in " + javaResults.time
+                    + " ms" );
 
-                System.out.println("   compiled: " + compiledResults.iterations + " iterations in "
-                                   + compiledResults.time + " ms ("
-                                   + compiledResults.getFactor(javaResults) + "java)");
-
-                System.out.println("interpreted: " + interpretedResults.iterations + " iterations in "
-                                   + interpretedResults.time + " ms ("
-                                   + interpretedResults.getFactor(javaResults) + "java)");
+                System.out.println( "   compiled: " + compiledResults.iterations + " iterations in "
+                    + compiledResults.time + " ms (" + compiledResults.getFactor( javaResults ) + "java)" );
+
+                System.out.println( "interpreted: " + interpretedResults.iterations + " iterations in "
+                    + interpretedResults.time + " ms (" + interpretedResults.getFactor( javaResults ) + "java)" );
 
                 System.out.println();
 
-            } catch (OgnlException ex) {
+            }
+            catch ( OgnlException ex )
+            {
                 ex.printStackTrace();
             }
         }
     }
 
     /*
-    * =================================================================== Constructors
-    * ===================================================================
-    */
-    public Performance(String name, String expressionString, String javaMethodName)
-            throws Exception
+     * =================================================================== Constructors
+     * ===================================================================
+     */
+    public Performance( String name, String expressionString, String javaMethodName )
+        throws Exception
     {
-        this(name, expressionString, javaMethodName, false);
+        this( name, expressionString, javaMethodName, false );
     }
 
-    public Performance(String name, String expressionString, String javaMethodName, boolean mvel)
-            throws Exception
+    public Performance( String name, String expressionString, String javaMethodName, boolean mvel )
+        throws Exception
     {
         _name = name;
         _isMvel = mvel;
         _expressionString = expressionString;
 
-        try {
-            _method = getClass().getMethod(javaMethodName, new Class[] {});
-        } catch (Exception ex) {
-            throw new OgnlException("java method not found", ex);
+        try
+        {
+            _method = getClass().getMethod( javaMethodName, new Class[] {} );
+        }
+        catch ( Exception ex )
+        {
+            throw new OgnlException( "java method not found", ex );
         }
 
-        if (!_isMvel)
+        if ( !_isMvel )
         {
-            _expression = (SimpleNode) Ognl.parseExpression(expressionString);
-            _compiledExpression = (SimpleNode) Ognl.compileExpression(_context, _root, expressionString);
-            Ognl.getValue(_expression, _context, _root);
-            _context.put("contextValue", "cvalue");
-        } else
+            _expression = (SimpleNode) Ognl.parseExpression( expressionString );
+            _compiledExpression = (SimpleNode) Ognl.compileExpression( _context, _root, expressionString );
+            Ognl.getValue( _expression, _context, _root );
+            _context.put( "contextValue", "cvalue" );
+        }
+        else
         {
-            //_mvelCompiled = MVEL.compileExpression(expressionString);
+            // _mvelCompiled = MVEL.compileExpression(expressionString);
         }
     }
 
@@ -261,7 +310,7 @@ public class Performance extends Object
 
     protected Results endTest()
     {
-        return new Results(_iterations, t1 - t0, _isMvel);
+        return new Results( _iterations, t1 - t0, _isMvel );
     }
 
     protected boolean done()
@@ -269,13 +318,19 @@ public class Performance extends Object
         _iterations++;
         t1 = System.currentTimeMillis();
 
-        if (TIME_MODE) {
-            return (t1 - t0) >= MAX_TIME;
-        } else {
-            if (ITERATIONS_MODE) {
+        if ( TIME_MODE )
+        {
+            return ( t1 - t0 ) >= MAX_TIME;
+        }
+        else
+        {
+            if ( ITERATIONS_MODE )
+            {
                 return _iterations >= MAX_ITERATIONS;
-            } else {
-                throw new RuntimeException("no maximums specified");
+            }
+            else
+            {
+                throw new RuntimeException( "no maximums specified" );
             }
         }
     }
@@ -294,116 +349,136 @@ public class Performance extends Object
         return _expressionString;
     }
 
-    public Results testExpression(boolean compiled)
-            throws Exception
+    public Results testExpression( boolean compiled )
+        throws Exception
     {
         startTest();
-        do {
-            if (!_isMvel)
+        do
+        {
+            if ( !_isMvel )
             {
-                if (compiled)
-                    Ognl.getValue(_compiledExpression.getAccessor(), _context, _root);
+                if ( compiled )
+                    Ognl.getValue( _compiledExpression.getAccessor(), _context, _root );
                 else
-                    Ognl.getValue(_expression, _context, _root);
-            } else
+                    Ognl.getValue( _expression, _context, _root );
+            }
+            else
             {
                 /*
-                if (compiled)
-                    MVEL.executeExpression(_mvelCompiled, _root);
-                else
-                    MVEL.eval(_expressionString, _root);*/
+                 * if (compiled) MVEL.executeExpression(_mvelCompiled, _root); else MVEL.eval(_expressionString, _root);
+                 */
             }
-        } while(!done());
+        }
+        while ( !done() );
         return endTest();
     }
 
     public Results testJava()
-            throws OgnlException
+        throws OgnlException
     {
-        try {
-            return (Results) _method.invoke(this, new Object[] {});
-        } catch (Exception ex) {
-            throw new OgnlException("invoking java method '" + _method.getName() + "'", ex);
+        try
+        {
+            return (Results) _method.invoke( this, new Object[] {} );
+        }
+        catch ( Exception ex )
+        {
+            throw new OgnlException( "invoking java method '" + _method.getName() + "'", ex );
         }
     }
 
     public Results testConstantExpression()
-            throws OgnlException
+        throws OgnlException
     {
         startTest();
-        do {
+        do
+        {
             int result = 100 + 20 * 5;
-        } while(!done());
+        }
+        while ( !done() );
         return endTest();
     }
 
     public Results testSinglePropertyExpression()
-            throws OgnlException
+        throws OgnlException
     {
         startTest();
-        do {
+        do
+        {
             _root.getBean2();
-        } while(!done());
+        }
+        while ( !done() );
         return endTest();
     }
 
     public Results testPropertyNavigationExpression()
-            throws OgnlException
+        throws OgnlException
     {
         startTest();
-        do {
+        do
+        {
             _root.getBean2().getBean3().getValue();
-        } while(!done());
+        }
+        while ( !done() );
         return endTest();
     }
 
     public Results testPropertyNavigationSetting()
-            throws OgnlException
+        throws OgnlException
     {
         startTest();
-        do {
-            _root.getBean2().getBean3().setNullValue("a value");
-        } while(!done());
+        do
+        {
+            _root.getBean2().getBean3().setNullValue( "a value" );
+        }
+        while ( !done() );
         return endTest();
     }
 
     public Results testPropertyNavigationAndComparisonExpression()
-            throws OgnlException
+        throws OgnlException
     {
         startTest();
-        do {
+        do
+        {
             boolean result = _root.getBean2().getBean3().getValue() < 24;
-        } while(!done());
+        }
+        while ( !done() );
         return endTest();
     }
 
     public Results testIndexedPropertyNavigationExpression()
-            throws OgnlException
+        throws OgnlException
     {
         startTest();
-        do {
-            _root.getBean2().getBean3().getIndexedValue(25);
-        } while(!done());
+        do
+        {
+            _root.getBean2().getBean3().getIndexedValue( 25 );
+        }
+        while ( !done() );
         return endTest();
     }
 
     public Results testPropertyNavigationWithMapSetting()
-            throws OgnlException
+        throws OgnlException
     {
         startTest();
-        do {
-            _root.getBean2().getBean3().getMap().put("bam", "bam");
-        } while(!done());
+        do
+        {
+            _root.getBean2().getBean3().getMap().put( "bam", "bam" );
+        }
+        while ( !done() );
         return endTest();
     }
 
     public Results testPropertyNavigationWithMapExpression()
-            throws OgnlException
+        throws OgnlException
     {
         startTest();
-        do {
-            _root.getBean2().getBean3().getMap().get("foo");
-        } while(!done());
+        do
+        {
+            _root.getBean2().getBean3().getMap().get( "foo" );
+        }
+        while ( !done() );
         return endTest();
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PrimitiveArrayTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PrimitiveArrayTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PrimitiveArrayTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PrimitiveArrayTest.java Sat May 14 13:18:29 2011
@@ -22,46 +22,59 @@ package org.apache.commons.ognl.test;
 import junit.framework.TestSuite;
 import org.apache.commons.ognl.test.objects.Root;
 
-public class PrimitiveArrayTest extends OgnlTestCase {
+public class PrimitiveArrayTest
+    extends OgnlTestCase
+{
     private static Root ROOT = new Root();
 
     private static Object[][] TESTS = {
-            // Primitive array creation
-            {ROOT, "new boolean[5]", new boolean[5]},
-            {ROOT, "new boolean[] { true, false }", new boolean[]{true, false}},
-            {ROOT, "new boolean[] { 0, 1, 5.5 }", new boolean[]{false, true, true}},
-            {ROOT, "new char[] { 'a', 'b' }", new char[]{'a', 'b'}},
-            {ROOT, "new char[] { 10, 11 }", new char[]{(char) 10, (char) 11}},
-            {ROOT, "new byte[] { 1, 2 }", new byte[]{1, 2}},
-            {ROOT, "new short[] { 1, 2 }", new short[]{1, 2}},
-            {ROOT, "new int[six]", new int[ROOT.six]},
-            {ROOT, "new int[#root.six]", new int[ROOT.six]},
-            {ROOT, "new int[6]", new int[6]},
-            {ROOT, "new int[] { 1, 2 }", new int[]{1, 2}},
-            {ROOT, "new long[] { 1, 2 }", new long[]{1, 2}},
-            {ROOT, "new float[] { 1, 2 }", new float[]{1, 2}},
-            {ROOT, "new double[] { 1, 2 }", new double[]{1, 2}},
+        // Primitive array creation
+        { ROOT, "new boolean[5]", new boolean[5] },
+        { ROOT, "new boolean[] { true, false }", new boolean[] { true, false } },
+        { ROOT, "new boolean[] { 0, 1, 5.5 }", new boolean[] { false, true, true } },
+        { ROOT, "new char[] { 'a', 'b' }", new char[] { 'a', 'b' } },
+        { ROOT, "new char[] { 10, 11 }", new char[] { (char) 10, (char) 11 } },
+        { ROOT, "new byte[] { 1, 2 }", new byte[] { 1, 2 } }, { ROOT, "new short[] { 1, 2 }", new short[] { 1, 2 } },
+        { ROOT, "new int[six]", new int[ROOT.six] }, { ROOT, "new int[#root.six]", new int[ROOT.six] },
+        { ROOT, "new int[6]", new int[6] }, { ROOT, "new int[] { 1, 2 }", new int[] { 1, 2 } },
+        { ROOT, "new long[] { 1, 2 }", new long[] { 1, 2 } }, { ROOT, "new float[] { 1, 2 }", new float[] { 1, 2 } },
+        { ROOT, "new double[] { 1, 2 }", new double[] { 1, 2 } },
 
     };
 
-    /*===================================================================
-         Public static methods
-       ===================================================================*/
+    /*
+     * =================================================================== Public static methods
+     * ===================================================================
+     */
     public static TestSuite suite()
     {
         TestSuite result = new TestSuite();
 
-        for (int i = 0; i < TESTS.length; i++) {
-            if (TESTS[i].length == 3) {
-                result.addTest(new PrimitiveArrayTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1], TESTS[i][2]));
-            } else {
-                if (TESTS[i].length == 4) {
-                    result.addTest(new PrimitiveArrayTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1], TESTS[i][2], TESTS[i][3]));
-                } else {
-                    if (TESTS[i].length == 5) {
-                        result.addTest(new PrimitiveArrayTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1], TESTS[i][2], TESTS[i][3], TESTS[i][4]));
-                    } else {
-                        throw new RuntimeException("don't understand TEST format");
+        for ( int i = 0; i < TESTS.length; i++ )
+        {
+            if ( TESTS[i].length == 3 )
+            {
+                result.addTest( new PrimitiveArrayTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
+                                                        TESTS[i][2] ) );
+            }
+            else
+            {
+                if ( TESTS[i].length == 4 )
+                {
+                    result.addTest( new PrimitiveArrayTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
+                                                            TESTS[i][2], TESTS[i][3] ) );
+                }
+                else
+                {
+                    if ( TESTS[i].length == 5 )
+                    {
+                        result.addTest( new PrimitiveArrayTest( (String) TESTS[i][1], TESTS[i][0],
+                                                                (String) TESTS[i][1], TESTS[i][2], TESTS[i][3],
+                                                                TESTS[i][4] ) );
+                    }
+                    else
+                    {
+                        throw new RuntimeException( "don't understand TEST format" );
                     }
                 }
             }
@@ -69,31 +82,33 @@ public class PrimitiveArrayTest extends 
         return result;
     }
 
-    /*===================================================================
-         Constructors
-       ===================================================================*/
+    /*
+     * =================================================================== Constructors
+     * ===================================================================
+     */
     public PrimitiveArrayTest()
     {
         super();
     }
 
-    public PrimitiveArrayTest(String name)
+    public PrimitiveArrayTest( String name )
     {
-        super(name);
+        super( name );
     }
 
-    public PrimitiveArrayTest(String name, Object root, String expressionString, Object expectedResult, Object setValue, Object expectedAfterSetResult)
+    public PrimitiveArrayTest( String name, Object root, String expressionString, Object expectedResult,
+                               Object setValue, Object expectedAfterSetResult )
     {
-        super(name, root, expressionString, expectedResult, setValue, expectedAfterSetResult);
+        super( name, root, expressionString, expectedResult, setValue, expectedAfterSetResult );
     }
 
-    public PrimitiveArrayTest(String name, Object root, String expressionString, Object expectedResult, Object setValue)
+    public PrimitiveArrayTest( String name, Object root, String expressionString, Object expectedResult, Object setValue )
     {
-        super(name, root, expressionString, expectedResult, setValue);
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public PrimitiveArrayTest(String name, Object root, String expressionString, Object expectedResult)
+    public PrimitiveArrayTest( String name, Object root, String expressionString, Object expectedResult )
     {
-        super(name, root, expressionString, expectedResult);
+        super( name, root, expressionString, expectedResult );
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PrimitiveNullHandlingTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PrimitiveNullHandlingTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PrimitiveNullHandlingTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PrimitiveNullHandlingTest.java Sat May 14 13:18:29 2011
@@ -22,31 +22,33 @@ package org.apache.commons.ognl.test;
 import junit.framework.TestSuite;
 import org.apache.commons.ognl.test.objects.Simple;
 
-public class PrimitiveNullHandlingTest extends OgnlTestCase
+public class PrimitiveNullHandlingTest
+    extends OgnlTestCase
 {
 
     private static Simple SIMPLE = new Simple();
 
-    static {
-        SIMPLE.setFloatValue(10.56f);
-        SIMPLE.setIntValue(34);
+    static
+    {
+        SIMPLE.setFloatValue( 10.56f );
+        SIMPLE.setIntValue( 34 );
     }
 
     private static Object[][] TESTS = {
-            // Primitive null handling
-            { SIMPLE, "floatValue", new Float(10.56f), null, new Float(0f) }, // set float to
-            // null, should
-            // yield 0.0f
-            { SIMPLE, "intValue", new Integer(34), null, new Integer(0) },// set int to null,
-            // should yield 0
-            { SIMPLE, "booleanValue", Boolean.FALSE, Boolean.TRUE, Boolean.TRUE },// set boolean
-            // to TRUE,
-            // should yield
-            // true
-            { SIMPLE, "booleanValue", Boolean.TRUE, null, Boolean.FALSE }, // set boolean to null,
-            // should yield false
+        // Primitive null handling
+        { SIMPLE, "floatValue", new Float( 10.56f ), null, new Float( 0f ) }, // set float to
+        // null, should
+        // yield 0.0f
+        { SIMPLE, "intValue", new Integer( 34 ), null, new Integer( 0 ) },// set int to null,
+        // should yield 0
+        { SIMPLE, "booleanValue", Boolean.FALSE, Boolean.TRUE, Boolean.TRUE },// set boolean
+        // to TRUE,
+        // should yield
+        // true
+        { SIMPLE, "booleanValue", Boolean.TRUE, null, Boolean.FALSE }, // set boolean to null,
+    // should yield false
 
-    };
+        };
 
     /*
      * =================================================================== Public static methods
@@ -56,20 +58,31 @@ public class PrimitiveNullHandlingTest e
     {
         TestSuite result = new TestSuite();
 
-        for(int i = 0; i < TESTS.length; i++) {
-            if (TESTS[i].length == 3) {
-                result.addTest(new PrimitiveNullHandlingTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
-                                                             TESTS[i][2]));
-            } else {
-                if (TESTS[i].length == 4) {
-                    result.addTest(new PrimitiveNullHandlingTest((String) TESTS[i][1], TESTS[i][0],
-                                                                 (String) TESTS[i][1], TESTS[i][2], TESTS[i][3]));
-                } else {
-                    if (TESTS[i].length == 5) {
-                        result.addTest(new PrimitiveNullHandlingTest((String) TESTS[i][1], TESTS[i][0],
-                                                                     (String) TESTS[i][1], TESTS[i][2], TESTS[i][3], TESTS[i][4]));
-                    } else {
-                        throw new RuntimeException("don't understand TEST format");
+        for ( int i = 0; i < TESTS.length; i++ )
+        {
+            if ( TESTS[i].length == 3 )
+            {
+                result.addTest( new PrimitiveNullHandlingTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
+                                                               TESTS[i][2] ) );
+            }
+            else
+            {
+                if ( TESTS[i].length == 4 )
+                {
+                    result.addTest( new PrimitiveNullHandlingTest( (String) TESTS[i][1], TESTS[i][0],
+                                                                   (String) TESTS[i][1], TESTS[i][2], TESTS[i][3] ) );
+                }
+                else
+                {
+                    if ( TESTS[i].length == 5 )
+                    {
+                        result.addTest( new PrimitiveNullHandlingTest( (String) TESTS[i][1], TESTS[i][0],
+                                                                       (String) TESTS[i][1], TESTS[i][2], TESTS[i][3],
+                                                                       TESTS[i][4] ) );
+                    }
+                    else
+                    {
+                        throw new RuntimeException( "don't understand TEST format" );
                     }
                 }
             }
@@ -86,25 +99,25 @@ public class PrimitiveNullHandlingTest e
         super();
     }
 
-    public PrimitiveNullHandlingTest(String name)
+    public PrimitiveNullHandlingTest( String name )
     {
-        super(name);
+        super( name );
     }
 
-    public PrimitiveNullHandlingTest(String name, Object root, String expressionString, Object expectedResult,
-                                     Object setValue, Object expectedAfterSetResult)
+    public PrimitiveNullHandlingTest( String name, Object root, String expressionString, Object expectedResult,
+                                      Object setValue, Object expectedAfterSetResult )
     {
-        super(name, root, expressionString, expectedResult, setValue, expectedAfterSetResult);
+        super( name, root, expressionString, expectedResult, setValue, expectedAfterSetResult );
     }
 
-    public PrimitiveNullHandlingTest(String name, Object root, String expressionString, Object expectedResult,
-                                     Object setValue)
+    public PrimitiveNullHandlingTest( String name, Object root, String expressionString, Object expectedResult,
+                                      Object setValue )
     {
-        super(name, root, expressionString, expectedResult, setValue);
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public PrimitiveNullHandlingTest(String name, Object root, String expressionString, Object expectedResult)
+    public PrimitiveNullHandlingTest( String name, Object root, String expressionString, Object expectedResult )
     {
-        super(name, root, expressionString, expectedResult);
+        super( name, root, expressionString, expectedResult );
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PrivateAccessorTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PrivateAccessorTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PrivateAccessorTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PrivateAccessorTest.java Sat May 14 13:18:29 2011
@@ -23,23 +23,23 @@ import junit.framework.TestSuite;
 import org.apache.commons.ognl.DefaultMemberAccess;
 import org.apache.commons.ognl.test.objects.Root;
 
-public class PrivateAccessorTest extends OgnlTestCase
+public class PrivateAccessorTest
+    extends OgnlTestCase
 {
 
     private static Root ROOT = new Root();
 
     private static Object[][] TESTS = {
-            // Using private get/set methods
-            { ROOT, "getPrivateAccessorIntValue()", new Integer(67) },
-            { ROOT, "privateAccessorIntValue", new Integer(67) },
-            { ROOT, "privateAccessorIntValue", new Integer(67), new Integer(100) },
-            { ROOT, "privateAccessorIntValue2", new Integer(67) },
-            { ROOT, "privateAccessorIntValue2", new Integer(67), new Integer(100) },
-            { ROOT, "privateAccessorIntValue3", new Integer(67) },
-            { ROOT, "privateAccessorIntValue3", new Integer(67), new Integer(100) },
-            { ROOT, "privateAccessorBooleanValue", Boolean.TRUE },
-            { ROOT, "privateAccessorBooleanValue", Boolean.TRUE, Boolean.FALSE },
-            };
+        // Using private get/set methods
+        { ROOT, "getPrivateAccessorIntValue()", new Integer( 67 ) },
+        { ROOT, "privateAccessorIntValue", new Integer( 67 ) },
+        { ROOT, "privateAccessorIntValue", new Integer( 67 ), new Integer( 100 ) },
+        { ROOT, "privateAccessorIntValue2", new Integer( 67 ) },
+        { ROOT, "privateAccessorIntValue2", new Integer( 67 ), new Integer( 100 ) },
+        { ROOT, "privateAccessorIntValue3", new Integer( 67 ) },
+        { ROOT, "privateAccessorIntValue3", new Integer( 67 ), new Integer( 100 ) },
+        { ROOT, "privateAccessorBooleanValue", Boolean.TRUE },
+        { ROOT, "privateAccessorBooleanValue", Boolean.TRUE, Boolean.FALSE }, };
 
     /*
      * =================================================================== Public static methods
@@ -49,20 +49,31 @@ public class PrivateAccessorTest extends
     {
         TestSuite result = new TestSuite();
 
-        for(int i = 0; i < TESTS.length; i++) {
-            if (TESTS[i].length == 3) {
-                result.addTest(new PrivateAccessorTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
-                        TESTS[i][2]));
-            } else {
-                if (TESTS[i].length == 4) {
-                    result.addTest(new PrivateAccessorTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
-                            TESTS[i][2], TESTS[i][3]));
-                } else {
-                    if (TESTS[i].length == 5) {
-                        result.addTest(new PrivateAccessorTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
-                                TESTS[i][2], TESTS[i][3], TESTS[i][4]));
-                    } else {
-                        throw new RuntimeException("don't understand TEST format");
+        for ( int i = 0; i < TESTS.length; i++ )
+        {
+            if ( TESTS[i].length == 3 )
+            {
+                result.addTest( new PrivateAccessorTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
+                                                         TESTS[i][2] ) );
+            }
+            else
+            {
+                if ( TESTS[i].length == 4 )
+                {
+                    result.addTest( new PrivateAccessorTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
+                                                             TESTS[i][2], TESTS[i][3] ) );
+                }
+                else
+                {
+                    if ( TESTS[i].length == 5 )
+                    {
+                        result.addTest( new PrivateAccessorTest( (String) TESTS[i][1], TESTS[i][0],
+                                                                 (String) TESTS[i][1], TESTS[i][2], TESTS[i][3],
+                                                                 TESTS[i][4] ) );
+                    }
+                    else
+                    {
+                        throw new RuntimeException( "don't understand TEST format" );
                     }
                 }
             }
@@ -79,25 +90,26 @@ public class PrivateAccessorTest extends
         super();
     }
 
-    public PrivateAccessorTest(String name)
+    public PrivateAccessorTest( String name )
     {
-        super(name);
+        super( name );
     }
 
-    public PrivateAccessorTest(String name, Object root, String expressionString, Object expectedResult,
-            Object setValue, Object expectedAfterSetResult)
+    public PrivateAccessorTest( String name, Object root, String expressionString, Object expectedResult,
+                                Object setValue, Object expectedAfterSetResult )
     {
-        super(name, root, expressionString, expectedResult, setValue, expectedAfterSetResult);
+        super( name, root, expressionString, expectedResult, setValue, expectedAfterSetResult );
     }
 
-    public PrivateAccessorTest(String name, Object root, String expressionString, Object expectedResult, Object setValue)
+    public PrivateAccessorTest( String name, Object root, String expressionString, Object expectedResult,
+                                Object setValue )
     {
-        super(name, root, expressionString, expectedResult, setValue);
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public PrivateAccessorTest(String name, Object root, String expressionString, Object expectedResult)
+    public PrivateAccessorTest( String name, Object root, String expressionString, Object expectedResult )
     {
-        super(name, root, expressionString, expectedResult);
+        super( name, root, expressionString, expectedResult );
     }
 
     /*
@@ -107,7 +119,7 @@ public class PrivateAccessorTest extends
     public void setUp()
     {
         super.setUp();
-        _context.setMemberAccess(new DefaultMemberAccess(true));
+        _context.setMemberAccess( new DefaultMemberAccess( true ) );
         _compileExpressions = false;
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PrivateMemberTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PrivateMemberTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PrivateMemberTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PrivateMemberTest.java Sat May 14 13:18:29 2011
@@ -27,55 +27,61 @@ import org.apache.commons.ognl.OgnlConte
 import org.apache.commons.ognl.OgnlException;
 
 /**
- * This is a test program for private access in OGNL.
- * shows the failures and a summary.
+ * This is a test program for private access in OGNL. shows the failures and a summary.
  */
-public class PrivateMemberTest extends TestCase
+public class PrivateMemberTest
+    extends TestCase
 {
-    private String                  _privateProperty = "private value";
-    protected OgnlContext           context;
+    private String _privateProperty = "private value";
 
+    protected OgnlContext context;
 
-	/*===================================================================
-		Public static methods
-	  ===================================================================*/
+    /*
+     * =================================================================== Public static methods
+     * ===================================================================
+     */
     public static TestSuite suite()
     {
-        return new TestSuite(PrivateMemberTest.class);
+        return new TestSuite( PrivateMemberTest.class );
     }
 
-	/*===================================================================
-		Constructors
-	  ===================================================================*/
-	public PrivateMemberTest(String name)
-	{
-	    super(name);
-	}
-
-	/*===================================================================
-		Public methods
-	  ===================================================================*/
+    /*
+     * =================================================================== Constructors
+     * ===================================================================
+     */
+    public PrivateMemberTest( String name )
+    {
+        super( name );
+    }
+
+    /*
+     * =================================================================== Public methods
+     * ===================================================================
+     */
     private String getPrivateProperty()
     {
         return _privateProperty;
     }
 
-    public void testPrivateAccessor() throws OgnlException
+    public void testPrivateAccessor()
+        throws OgnlException
     {
-        assertEquals(Ognl.getValue("privateProperty", context, this), getPrivateProperty());
+        assertEquals( Ognl.getValue( "privateProperty", context, this ), getPrivateProperty() );
     }
 
-    public void testPrivateField() throws OgnlException
+    public void testPrivateField()
+        throws OgnlException
     {
-        assertEquals(Ognl.getValue("_privateProperty", context, this), _privateProperty);
+        assertEquals( Ognl.getValue( "_privateProperty", context, this ), _privateProperty );
     }
 
-	/*===================================================================
-		Overridden methods
-	  ===================================================================*/
-	public void setUp()
-	{
-        context = (OgnlContext)Ognl.createDefaultContext(null);
-        context.setMemberAccess(new DefaultMemberAccess(true));
-	}
+    /*
+     * =================================================================== Overridden methods
+     * ===================================================================
+     */
+    public void setUp()
+    {
+        context = (OgnlContext) Ognl.createDefaultContext( null );
+        context.setMemberAccess( new DefaultMemberAccess( true ) );
+    }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ProjectionSelectionTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ProjectionSelectionTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ProjectionSelectionTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/ProjectionSelectionTest.java Sat May 14 13:18:29 2011
@@ -25,22 +25,22 @@ import org.apache.commons.ognl.test.obje
 import java.math.BigInteger;
 import java.util.Arrays;
 
-public class ProjectionSelectionTest extends OgnlTestCase
+public class ProjectionSelectionTest
+    extends OgnlTestCase
 {
     private static Root ROOT = new Root();
-    
+
     private static Object[][] TESTS = {
-            // Projection, selection
-             { ROOT, "array.{class}",
-                    Arrays.asList(new Class[] { Integer.class, Integer.class, Integer.class, Integer.class }) },
-            { ROOT, "map.array.{? #this > 2 }", Arrays.asList(new Integer[] { new Integer(3), new Integer(4) }) },
-            { ROOT, "map.array.{^ #this > 2 }", Arrays.asList(new Integer[] { new Integer(3) }) },
-            { ROOT, "map.array.{$ #this > 2 }", Arrays.asList(new Integer[] { new Integer(4) }) }, 
-            { ROOT, "map.array[*].{?true} instanceof java.util.Collection", Boolean.TRUE },
-            { null, "#fact=1, 30H.{? #fact = #fact * (#this+1), false }, #fact",
-                    new BigInteger("265252859812191058636308480000000") },
-            };
-    
+        // Projection, selection
+        { ROOT, "array.{class}",
+            Arrays.asList( new Class[] { Integer.class, Integer.class, Integer.class, Integer.class } ) },
+        { ROOT, "map.array.{? #this > 2 }", Arrays.asList( new Integer[] { new Integer( 3 ), new Integer( 4 ) } ) },
+        { ROOT, "map.array.{^ #this > 2 }", Arrays.asList( new Integer[] { new Integer( 3 ) } ) },
+        { ROOT, "map.array.{$ #this > 2 }", Arrays.asList( new Integer[] { new Integer( 4 ) } ) },
+        { ROOT, "map.array[*].{?true} instanceof java.util.Collection", Boolean.TRUE },
+        { null, "#fact=1, 30H.{? #fact = #fact * (#this+1), false }, #fact",
+            new BigInteger( "265252859812191058636308480000000" ) }, };
+
     /*
      * =================================================================== Public static methods
      * ===================================================================
@@ -48,10 +48,11 @@ public class ProjectionSelectionTest ext
     public static TestSuite suite()
     {
         TestSuite result = new TestSuite();
-        
-        for(int i = 0; i < TESTS.length; i++) {
-            result.addTest(new ProjectionSelectionTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
-                    TESTS[i][2]));
+
+        for ( int i = 0; i < TESTS.length; i++ )
+        {
+            result.addTest( new ProjectionSelectionTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
+                                                         TESTS[i][2] ) );
         }
         return result;
     }
@@ -65,25 +66,25 @@ public class ProjectionSelectionTest ext
         super();
     }
 
-    public ProjectionSelectionTest(String name)
+    public ProjectionSelectionTest( String name )
     {
-        super(name);
+        super( name );
     }
 
-    public ProjectionSelectionTest(String name, Object root, String expressionString, Object expectedResult,
-            Object setValue, Object expectedAfterSetResult)
+    public ProjectionSelectionTest( String name, Object root, String expressionString, Object expectedResult,
+                                    Object setValue, Object expectedAfterSetResult )
     {
-        super(name, root, expressionString, expectedResult, setValue, expectedAfterSetResult);
+        super( name, root, expressionString, expectedResult, setValue, expectedAfterSetResult );
     }
 
-    public ProjectionSelectionTest(String name, Object root, String expressionString, Object expectedResult,
-            Object setValue)
+    public ProjectionSelectionTest( String name, Object root, String expressionString, Object expectedResult,
+                                    Object setValue )
     {
-        super(name, root, expressionString, expectedResult, setValue);
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public ProjectionSelectionTest(String name, Object root, String expressionString, Object expectedResult)
+    public ProjectionSelectionTest( String name, Object root, String expressionString, Object expectedResult )
     {
-        super(name, root, expressionString, expectedResult);
+        super( name, root, expressionString, expectedResult );
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PropertyArithmeticAndLogicalOperatorsTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PropertyArithmeticAndLogicalOperatorsTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PropertyArithmeticAndLogicalOperatorsTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PropertyArithmeticAndLogicalOperatorsTest.java Sat May 14 13:18:29 2011
@@ -29,81 +29,91 @@ import java.util.Arrays;
 /**
  *
  */
-public class PropertyArithmeticAndLogicalOperatorsTest extends OgnlTestCase {
+public class PropertyArithmeticAndLogicalOperatorsTest
+    extends OgnlTestCase
+{
 
     private static Root ROOT = new Root();
+
     private static TestModel MODEL = new TestModel();
+
     private static SimpleNumeric NUMERIC = new SimpleNumeric();
 
     private static Object[][] TESTS = {
-            { ROOT, "objectIndex > 0", Boolean.TRUE},
-            { ROOT, "false", Boolean.FALSE},
-            { ROOT, "!false || true", Boolean.TRUE},
-            { ROOT, "property.bean3.value >= 24", Boolean.TRUE},
-            { ROOT, "genericIndex-1", new Integer(1)},
-            { ROOT, "((renderNavigation ? 0 : 1) + map.size) * theInt", new Integer(((ROOT.getRenderNavigation() ? 0 : 1 ) + ROOT.getMap().size()) * ROOT.getTheInt())},
-            { ROOT, "{theInt + 1}", Arrays.asList(new Integer(ROOT.getTheInt() + 1)) },
-            { MODEL, "(unassignedCopyModel.optionCount > 0 && canApproveCopy) || entry.copy.size() > 0", Boolean.TRUE },
-            { ROOT, " !(printDelivery || @Boolean@FALSE)", Boolean.FALSE},
-            { ROOT, "(getIndexedProperty('nested').size - 1) > genericIndex", Boolean.FALSE},
-            { ROOT, "(getIndexedProperty('nested').size + 1) >= genericIndex", Boolean.TRUE},
-            { ROOT, "(getIndexedProperty('nested').size + 1) == genericIndex", Boolean.TRUE},
-            { ROOT, "(getIndexedProperty('nested').size + 1) < genericIndex", Boolean.FALSE},
-            { ROOT, "map.size * genericIndex", new Integer(ROOT.getMap().size() * ((Integer)ROOT.getGenericIndex()).intValue())},
-            { ROOT, "property == property", Boolean.TRUE},
-            { ROOT, "property.bean3.value % 2 == 0", Boolean.TRUE},
-            { ROOT, "genericIndex % 3 == 0", Boolean.FALSE},
-            { ROOT, "genericIndex % theInt == property.bean3.value", Boolean.FALSE},
-            { ROOT, "theInt / 100.0", ROOT.getTheInt() / 100.0},
-            { ROOT, "@java.lang.Long@valueOf('100') == @java.lang.Long@valueOf('100')", Boolean.TRUE},
-            { NUMERIC, "budget - timeBilled", new Double(NUMERIC.getBudget() - NUMERIC.getTimeBilled())},
-            { NUMERIC, "(budget % tableSize) == 0", Boolean.TRUE}
-    };
+        { ROOT, "objectIndex > 0", Boolean.TRUE },
+        { ROOT, "false", Boolean.FALSE },
+        { ROOT, "!false || true", Boolean.TRUE },
+        { ROOT, "property.bean3.value >= 24", Boolean.TRUE },
+        { ROOT, "genericIndex-1", new Integer( 1 ) },
+        { ROOT, "((renderNavigation ? 0 : 1) + map.size) * theInt",
+            new Integer( ( ( ROOT.getRenderNavigation() ? 0 : 1 ) + ROOT.getMap().size() ) * ROOT.getTheInt() ) },
+        { ROOT, "{theInt + 1}", Arrays.asList( new Integer( ROOT.getTheInt() + 1 ) ) },
+        { MODEL, "(unassignedCopyModel.optionCount > 0 && canApproveCopy) || entry.copy.size() > 0", Boolean.TRUE },
+        { ROOT, " !(printDelivery || @Boolean@FALSE)", Boolean.FALSE },
+        { ROOT, "(getIndexedProperty('nested').size - 1) > genericIndex", Boolean.FALSE },
+        { ROOT, "(getIndexedProperty('nested').size + 1) >= genericIndex", Boolean.TRUE },
+        { ROOT, "(getIndexedProperty('nested').size + 1) == genericIndex", Boolean.TRUE },
+        { ROOT, "(getIndexedProperty('nested').size + 1) < genericIndex", Boolean.FALSE },
+        { ROOT, "map.size * genericIndex",
+            new Integer( ROOT.getMap().size() * ( (Integer) ROOT.getGenericIndex() ).intValue() ) },
+        { ROOT, "property == property", Boolean.TRUE }, { ROOT, "property.bean3.value % 2 == 0", Boolean.TRUE },
+        { ROOT, "genericIndex % 3 == 0", Boolean.FALSE },
+        { ROOT, "genericIndex % theInt == property.bean3.value", Boolean.FALSE },
+        { ROOT, "theInt / 100.0", ROOT.getTheInt() / 100.0 },
+        { ROOT, "@java.lang.Long@valueOf('100') == @java.lang.Long@valueOf('100')", Boolean.TRUE },
+        { NUMERIC, "budget - timeBilled", new Double( NUMERIC.getBudget() - NUMERIC.getTimeBilled() ) },
+        { NUMERIC, "(budget % tableSize) == 0", Boolean.TRUE } };
 
     public static TestSuite suite()
     {
         TestSuite result = new TestSuite();
 
-        for (int i = 0; i < TESTS.length; i++)
+        for ( int i = 0; i < TESTS.length; i++ )
         {
-            if (TESTS[i].length == 5)
+            if ( TESTS[i].length == 5 )
             {
-                result.addTest(new PropertyArithmeticAndLogicalOperatorsTest((String)TESTS[i][1], TESTS[i][0], (String)TESTS[i][1], TESTS[i][2], TESTS[i][3], TESTS[i][4]));
-            } else
-                result.addTest(new PropertyArithmeticAndLogicalOperatorsTest((String)TESTS[i][1], TESTS[i][0], (String)TESTS[i][1], TESTS[i][2]));
+                result.addTest( new PropertyArithmeticAndLogicalOperatorsTest( (String) TESTS[i][1], TESTS[i][0],
+                                                                               (String) TESTS[i][1], TESTS[i][2],
+                                                                               TESTS[i][3], TESTS[i][4] ) );
+            }
+            else
+                result.addTest( new PropertyArithmeticAndLogicalOperatorsTest( (String) TESTS[i][1], TESTS[i][0],
+                                                                               (String) TESTS[i][1], TESTS[i][2] ) );
         }
 
         return result;
     }
 
-    /*===================================================================
-         Constructors
-       ===================================================================*/
+    /*
+     * =================================================================== Constructors
+     * ===================================================================
+     */
     public PropertyArithmeticAndLogicalOperatorsTest()
     {
         super();
     }
 
-    public PropertyArithmeticAndLogicalOperatorsTest(String name)
+    public PropertyArithmeticAndLogicalOperatorsTest( String name )
     {
-        super(name);
+        super( name );
     }
 
-    public PropertyArithmeticAndLogicalOperatorsTest(String name, Object root, String expressionString,
-                                                     Object expectedResult, Object setValue, Object expectedAfterSetResult)
+    public PropertyArithmeticAndLogicalOperatorsTest( String name, Object root, String expressionString,
+                                                      Object expectedResult, Object setValue,
+                                                      Object expectedAfterSetResult )
     {
-        super(name, root, expressionString, expectedResult, setValue, expectedAfterSetResult);
+        super( name, root, expressionString, expectedResult, setValue, expectedAfterSetResult );
     }
 
-    public PropertyArithmeticAndLogicalOperatorsTest(String name, Object root, String expressionString,
-                                                     Object expectedResult, Object setValue)
+    public PropertyArithmeticAndLogicalOperatorsTest( String name, Object root, String expressionString,
+                                                      Object expectedResult, Object setValue )
     {
-        super(name, root, expressionString, expectedResult, setValue);
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public PropertyArithmeticAndLogicalOperatorsTest(String name, Object root,
-                                                     String expressionString, Object expectedResult)
+    public PropertyArithmeticAndLogicalOperatorsTest( String name, Object root, String expressionString,
+                                                      Object expectedResult )
     {
-        super(name, root, expressionString, expectedResult);
+        super( name, root, expressionString, expectedResult );
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PropertyNotFoundTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PropertyNotFoundTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PropertyNotFoundTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PropertyNotFoundTest.java Sat May 14 13:18:29 2011
@@ -27,18 +27,22 @@ import org.apache.commons.ognl.PropertyA
 
 import java.util.Map;
 
-public class PropertyNotFoundTest extends OgnlTestCase {
+public class PropertyNotFoundTest
+    extends OgnlTestCase
+{
     private static final Blah BLAH = new Blah();
 
-    private static Object[][] TESTS = {
-            {BLAH, "webwork.token.name", OgnlException.class, "W value", OgnlException.class},
-    };
-
-    /*===================================================================
-        Public static classes
-      ===================================================================*/
-    public static class Blah {
+    private static Object[][] TESTS = { { BLAH, "webwork.token.name", OgnlException.class, "W value",
+        OgnlException.class }, };
+
+    /*
+     * =================================================================== Public static classes
+     * ===================================================================
+     */
+    public static class Blah
+    {
         String x;
+
         String y;
 
         public String getX()
@@ -46,7 +50,7 @@ public class PropertyNotFoundTest extend
             return x;
         }
 
-        public void setX(String x)
+        public void setX( String x )
         {
             this.x = x;
         }
@@ -56,54 +60,74 @@ public class PropertyNotFoundTest extend
             return y;
         }
 
-        public void setY(String y)
+        public void setY( String y )
         {
             this.y = y;
         }
     }
 
-    public static class BlahPropertyAccessor implements PropertyAccessor {
-        public void setProperty(Map context, Object target, Object name, Object value) throws OgnlException
+    public static class BlahPropertyAccessor
+        implements PropertyAccessor
+    {
+        public void setProperty( Map context, Object target, Object name, Object value )
+            throws OgnlException
         {
         }
 
-        public Object getProperty(Map context, Object target, Object name) throws OgnlException
+        public Object getProperty( Map context, Object target, Object name )
+            throws OgnlException
         {
-            if ("x".equals(name) || "y".equals(name)) {
-                return OgnlRuntime.getProperty((OgnlContext) context, target, name);
+            if ( "x".equals( name ) || "y".equals( name ) )
+            {
+                return OgnlRuntime.getProperty( (OgnlContext) context, target, name );
             }
             return null;
         }
 
-        public String getSourceAccessor(OgnlContext context, Object target, Object index)
+        public String getSourceAccessor( OgnlContext context, Object target, Object index )
         {
             return index.toString();
         }
 
-        public String getSourceSetter(OgnlContext context, Object target, Object index)
+        public String getSourceSetter( OgnlContext context, Object target, Object index )
         {
             return index.toString();
         }
     }
 
-    /*===================================================================
-      Public static methods
-    ===================================================================*/
+    /*
+     * =================================================================== Public static methods
+     * ===================================================================
+     */
     public static TestSuite suite()
     {
         TestSuite result = new TestSuite();
 
-        for (int i = 0; i < TESTS.length; i++) {
-            if (TESTS[i].length == 3) {
-                result.addTest(new PropertyNotFoundTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1], TESTS[i][2]));
-            } else {
-                if (TESTS[i].length == 4) {
-                    result.addTest(new PropertyNotFoundTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1], TESTS[i][2], TESTS[i][3]));
-                } else {
-                    if (TESTS[i].length == 5) {
-                        result.addTest(new PropertyNotFoundTest((String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1], TESTS[i][2], TESTS[i][3], TESTS[i][4]));
-                    } else {
-                        throw new RuntimeException("don't understand TEST format");
+        for ( int i = 0; i < TESTS.length; i++ )
+        {
+            if ( TESTS[i].length == 3 )
+            {
+                result.addTest( new PropertyNotFoundTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
+                                                          TESTS[i][2] ) );
+            }
+            else
+            {
+                if ( TESTS[i].length == 4 )
+                {
+                    result.addTest( new PropertyNotFoundTest( (String) TESTS[i][1], TESTS[i][0], (String) TESTS[i][1],
+                                                              TESTS[i][2], TESTS[i][3] ) );
+                }
+                else
+                {
+                    if ( TESTS[i].length == 5 )
+                    {
+                        result.addTest( new PropertyNotFoundTest( (String) TESTS[i][1], TESTS[i][0],
+                                                                  (String) TESTS[i][1], TESTS[i][2], TESTS[i][3],
+                                                                  TESTS[i][4] ) );
+                    }
+                    else
+                    {
+                        throw new RuntimeException( "don't understand TEST format" );
                     }
                 }
             }
@@ -111,37 +135,40 @@ public class PropertyNotFoundTest extend
         return result;
     }
 
-    /*===================================================================
-        Constructors
-      ===================================================================*/
+    /*
+     * =================================================================== Constructors
+     * ===================================================================
+     */
     public PropertyNotFoundTest()
     {
         super();
     }
 
-    public PropertyNotFoundTest(String name)
+    public PropertyNotFoundTest( String name )
     {
-        super(name);
+        super( name );
     }
 
-    public PropertyNotFoundTest(String name, Object root, String expressionString, Object expectedResult, Object setValue, Object expectedAfterSetResult)
+    public PropertyNotFoundTest( String name, Object root, String expressionString, Object expectedResult,
+                                 Object setValue, Object expectedAfterSetResult )
     {
-        super(name, root, expressionString, expectedResult, setValue, expectedAfterSetResult);
+        super( name, root, expressionString, expectedResult, setValue, expectedAfterSetResult );
     }
 
-    public PropertyNotFoundTest(String name, Object root, String expressionString, Object expectedResult, Object setValue)
+    public PropertyNotFoundTest( String name, Object root, String expressionString, Object expectedResult,
+                                 Object setValue )
     {
-        super(name, root, expressionString, expectedResult, setValue);
+        super( name, root, expressionString, expectedResult, setValue );
     }
 
-    public PropertyNotFoundTest(String name, Object root, String expressionString, Object expectedResult)
+    public PropertyNotFoundTest( String name, Object root, String expressionString, Object expectedResult )
     {
-        super(name, root, expressionString, expectedResult);
+        super( name, root, expressionString, expectedResult );
     }
 
     protected void setUp()
     {
         super.setUp();
-        OgnlRuntime.setPropertyAccessor(Blah.class, new BlahPropertyAccessor());
+        OgnlRuntime.setPropertyAccessor( Blah.class, new BlahPropertyAccessor() );
     }
 }

Modified: incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PropertySetterTest.java
URL: http://svn.apache.org/viewvc/incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PropertySetterTest.java?rev=1103095&r1=1103094&r2=1103095&view=diff
==============================================================================
--- incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PropertySetterTest.java (original)
+++ incubator/ognl/trunk/src/test/java/org/apache/commons/ognl/test/PropertySetterTest.java Sat May 14 13:18:29 2011
@@ -27,72 +27,90 @@ import org.apache.commons.ognl.OgnlConte
 import java.util.Map;
 
 /**
- * Tests being able to set property on object with interface that doesn't define
- * setter.   See OGNL-115.
+ * Tests being able to set property on object with interface that doesn't define setter. See OGNL-115.
  */
-public class PropertySetterTest extends TestCase {
+public class PropertySetterTest
+    extends TestCase
+{
 
     private Map map;
-    private TestObject testObject = new TestObject("propertyValue");
+
+    private TestObject testObject = new TestObject( "propertyValue" );
+
     private String propertyKey = "property";
 
-    public interface TestInterface {
+    public interface TestInterface
+    {
         public String getProperty();
     }
 
-    public class TestObject implements TestInterface {
-        
+    public class TestObject
+        implements TestInterface
+    {
+
         private String property;
+
         private Integer integerProperty = 1;
 
-        public TestObject(String property) {
+        public TestObject( String property )
+        {
             this.property = property;
         }
 
-        public String getProperty() {
+        public String getProperty()
+        {
             return property;
         }
 
-        public void setProperty(String property) {
+        public void setProperty( String property )
+        {
             this.property = property;
         }
 
-        public Integer getIntegerProperty() {
+        public Integer getIntegerProperty()
+        {
             return integerProperty;
         }
     }
 
-
-    public Map getMap() {
+    public Map getMap()
+    {
         return map;
     }
-    public String getKey() {
+
+    public String getKey()
+    {
         return "key";
     }
 
-    public TestObject getObject() {
+    public TestObject getObject()
+    {
         return testObject;
     }
 
-    public TestInterface getInterfaceObject() {
+    public TestInterface getInterfaceObject()
+    {
         return testObject;
     }
 
-    public String getPropertyKey() {
+    public String getPropertyKey()
+    {
         return propertyKey;
     }
 
-    public void testEnhancedOgnl() throws Exception {
-        OgnlContext context = (OgnlContext)Ognl.createDefaultContext(null);
-        Node expression = Ognl.compileExpression(context, this, "interfaceObject.property");
-        Ognl.setValue(expression, context, this, "hello");
-        assertEquals("hello", getObject().getProperty() );
+    public void testEnhancedOgnl()
+        throws Exception
+    {
+        OgnlContext context = (OgnlContext) Ognl.createDefaultContext( null );
+        Node expression = Ognl.compileExpression( context, this, "interfaceObject.property" );
+        Ognl.setValue( expression, context, this, "hello" );
+        assertEquals( "hello", getObject().getProperty() );
 
         // Fails if an interface is defined, but succeeds if not
         context.clear();
 
-        expression = Ognl.compileExpression(context, this.getObject(), "property");
-        Ognl.setValue(expression, context, this.getObject(), "hello");
-        assertEquals("hello", getObject().getProperty() );
+        expression = Ognl.compileExpression( context, this.getObject(), "property" );
+        Ognl.setValue( expression, context, this.getObject(), "hello" );
+        assertEquals( "hello", getObject().getProperty() );
     }
 }



Mime
View raw message