Return-Path: Delivered-To: apmail-velocity-commits-archive@locus.apache.org Received: (qmail 24209 invoked from network); 6 Aug 2007 22:19:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Aug 2007 22:19:28 -0000 Received: (qmail 27932 invoked by uid 500); 6 Aug 2007 22:19:23 -0000 Delivered-To: apmail-velocity-commits-archive@velocity.apache.org Received: (qmail 27911 invoked by uid 500); 6 Aug 2007 22:19:23 -0000 Mailing-List: contact commits-help@velocity.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@velocity.apache.org Delivered-To: mailing list commits@velocity.apache.org Received: (qmail 27902 invoked by uid 99); 6 Aug 2007 22:19:23 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Aug 2007 15:19:23 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Aug 2007 22:19:14 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A2A8F1A981A; Mon, 6 Aug 2007 15:19:00 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@velocity.apache.org From: nbubna@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20070806221900.A2A8F1A981A@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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 @@ + + + + + + + + + + + + + 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