velocity-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nbu...@apache.org
Subject svn commit: r563306 - in /velocity/tools/branches/2.x/src/test/java: org/apache/velocity/tools/test/whitebox/ConfigTests.java tools.properties tools.xml
Date Mon, 06 Aug 2007 22:19:00 GMT
Author: nbubna
Date: Mon Aug  6 15:18:59 2007
New Revision: 563306

URL: http://svn.apache.org/viewvc?view=rev&rev=563306
Log:
more configuration testing

Added:
    velocity/tools/branches/2.x/src/test/java/tools.properties   (with props)
    velocity/tools/branches/2.x/src/test/java/tools.xml   (with props)
Modified:
    velocity/tools/branches/2.x/src/test/java/org/apache/velocity/tools/test/whitebox/ConfigTests.java

Modified: velocity/tools/branches/2.x/src/test/java/org/apache/velocity/tools/test/whitebox/ConfigTests.java
URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/test/java/org/apache/velocity/tools/test/whitebox/ConfigTests.java?view=diff&rev=563306&r1=563305&r2=563306
==============================================================================
--- velocity/tools/branches/2.x/src/test/java/org/apache/velocity/tools/test/whitebox/ConfigTests.java
(original)
+++ velocity/tools/branches/2.x/src/test/java/org/apache/velocity/tools/test/whitebox/ConfigTests.java
Mon Aug  6 15:18:59 2007
@@ -123,6 +123,25 @@
         assertConfigEquals(getBaseConfig(), props);
     }
 
+    /**
+     * Tests that adding two equal configs produces one that is equal
+     * to the originals.
+     */
+    public @Test void testPropsPlusXmlConfig()
+    {
+        FileFactoryConfiguration props = new PropertiesFactoryConfiguration();
+        props.read(PROPS_PATH);
+
+        FileFactoryConfiguration xml = new XmlFactoryConfiguration();
+        xml.read(XML_PATH);
+        // make sure they're equal
+        assertConfigEquals(props, xml);
+        // now add them and make sure the result is equal to the original
+        xml.addConfiguration(props);
+        assertValid(xml);
+        assertConfigEquals(xml, props);
+    }
+
     public @Test void testEasyConfig()
     {
         EasyFactoryConfiguration easy = new EasyFactoryConfiguration();
@@ -141,8 +160,28 @@
 
     public @Test void testDefaultConfig()
     {
-        FactoryConfiguration def = FactoryConfiguration.getDefault();
+        FactoryConfiguration def = ConfigurationUtils.getDefaultTools();
+        assertValid(def);
+    }
+
+    public @Test void testAutoConfig()
+    {
+        FactoryConfiguration autoMinusDef = ConfigurationUtils.getAutoLoaded(false);
+        assertValid(autoMinusDef);
+
+        assertValid(autoMinusDef);
+        assertConfigEquals(getBaseConfig(), autoMinusDef);
+
+        FactoryConfiguration auto = ConfigurationUtils.getAutoLoaded();
+        assertValid(auto);
+
+        // get the default tools
+        FactoryConfiguration def = ConfigurationUtils.getDefaultTools();
         assertValid(def);
+        // add the autoloaded ones (sans defaults) onto the default
+        def.addConfiguration(autoMinusDef);
+        // and see that it comes out the same
+        assertConfigEquals(auto, def);
     }
 
     public @Test void testBadData()

Added: velocity/tools/branches/2.x/src/test/java/tools.properties
URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/test/java/tools.properties?view=auto&rev=563306
==============================================================================
--- velocity/tools/branches/2.x/src/test/java/tools.properties (added)
+++ velocity/tools/branches/2.x/src/test/java/tools.properties Mon Aug  6 15:18:59 2007
@@ -0,0 +1,25 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements.  See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership.  The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License.  You may obtain a copy of the License at
+##
+##   http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied.  See the License for the
+## specific language governing permissions and limitations
+## under the License.
+
+tools.toolbox = request,application
+tools.data.version = 2.0
+tools.data.version.type = number
+tools.request.property.locale = en_US
+tools.request.render = org.apache.velocity.tools.view.ViewRenderTool
+tools.application.calc = org.apache.velocity.tools.generic.MathTool
+tools.application.number = org.apache.velocity.tools.generic.NumberTool
+tools.application.number.locale = fr

Propchange: velocity/tools/branches/2.x/src/test/java/tools.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: velocity/tools/branches/2.x/src/test/java/tools.properties
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: velocity/tools/branches/2.x/src/test/java/tools.xml
URL: http://svn.apache.org/viewvc/velocity/tools/branches/2.x/src/test/java/tools.xml?view=auto&rev=563306
==============================================================================
--- velocity/tools/branches/2.x/src/test/java/tools.xml (added)
+++ velocity/tools/branches/2.x/src/test/java/tools.xml Mon Aug  6 15:18:59 2007
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+<tools>
+    <data key="version" type="number" value="2.0"/>
+    <toolbox scope="request" locale="en_US">
+        <tool class="org.apache.velocity.tools.view.ViewRenderTool"/>
+    </toolbox>
+    <toolbox scope="application">
+        <tool key="calc" class="org.apache.velocity.tools.generic.MathTool"/>
+        <tool class="org.apache.velocity.tools.generic.NumberTool" locale="fr"/>
+    </toolbox>
+</tools>

Propchange: velocity/tools/branches/2.x/src/test/java/tools.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: velocity/tools/branches/2.x/src/test/java/tools.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message