@@ -0,0 +1,2817 @@
+/**%0A *  Licensed to the Apache Software Foundation (ASF) under one or more%0A *  contributor license agreements.  See the NOTICE file distributed with%0A *  this work for additional information regarding copyright ownership.%0A *  The ASF licenses this file to You under the Apache License, Version 2.0%0A *  (the %22License%22); you may not use this file except in compliance with%0A *  the License.  You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A *  Unless required by applicable law or agreed to in writing, software%0A *  distributed under the License is distributed on an %22AS IS%22 BASIS,%0A *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A *  See the License for the specific language governing permissions and%0A *  limitations under the License.%0A */%0Apackage org.apache.geronimo.system.configuration.condition;%0A%0Aimport org.apache.geronimo.testsupport.TestSupport;%0A%0Aimport junit.framework.TestCase;%0A%0A/**%0A * Unit tests for the %7B@link ExpressionParser%7D class.%0A *%0A * @version $Rev$ $Date$%0A */%0Apublic class ExpressionParserTest%0A    extends TestCase%0A%7B%0A    protected ExpressionParser parser;%0A    %0A    /**%0A     * Set up instance variables required by this test case.%0A     */%0A    protected void setUp() %7B%0A        parser = new ExpressionParser();%0A    %7D%0A    %0A    /**%0A     * Tear down instance variables required by this test case.%0A     */%0A    protected void tearDown() %7B%0A        parser = null;%0A    %7D%0A    %0A    %0A    public void testDefault() throws Exception %7B%0A        String value = %22$%7Bjava.home%7D%22;%0A        String result = parser.parse(value);%0A        assertEquals(result, System.getProperty(%22java.home%22));%0A    %7D%0A    %0A    public void testSubst() throws Exception %7B%0A        String value = %22BEFORE$%7Bjava.home%7DAFTER%22;%0A        String result = parser.parse(value);%0A        assertEquals(result, %22BEFORE%22 + System.getProperty(%22java.home%22) + %22AFTER%22);%0A    %7D%0A    %0A    public void testVariable() throws Exception %7B%0A        String myvar = %22this is my variable%22;%0A        parser.getVariables().put(%22my.var%22, myvar);%0A        %0A        String value = %22$%7Bmy.var%7D%22;%0A        String result = parser.parse(value);%0A        assertEquals(result, myvar);%0A    %7D%0A    %0A    public void testFlatVariable() throws Exception %7B%0A        String myvar = %22this is my variable%22;%0A        parser.getVariables().put(%22my.var%22, myvar);%0A        parser.getVariables().put(%22my%22, %22not used%22);%0A        %0A        String value = %22$%7Bmy.var%7D%22;%0A        String result = parser.parse(value);%0A        assertEquals(result, myvar);%0A    %7D%0A    %0A    public void testSyntax() throws Exception %7B%0A        String value = %22$%7Bjava.home%22;%0A            %0A        try %7B%0A            String result = parser.parse(value);%0A            assertTrue(%22Should have thrown an exception%22, false);%0A        %7D%0A        catch (Exception ignore) %7B%7D%0A    %7D%0A%7D%0A

Add tests for ExpressionParser (resurrected from ancient cvs incubator-geronimo/modules/common/src/test/org/apache/geronimo/common/Attic/StringValueParserTest.java,v)