Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 64249 invoked from network); 4 Oct 2005 03:16:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 4 Oct 2005 03:16:31 -0000 Received: (qmail 94157 invoked by uid 500); 4 Oct 2005 03:16:30 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 93793 invoked by uid 500); 4 Oct 2005 03:16:28 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 93782 invoked by uid 500); 4 Oct 2005 03:16:28 -0000 Received: (qmail 93779 invoked by uid 99); 4 Oct 2005 03:16:28 -0000 X-ASF-Spam-Status: No, hits=-9.8 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [209.237.227.194] (HELO minotaur.apache.org) (209.237.227.194) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 03 Oct 2005 20:16:27 -0700 Received: (qmail 64042 invoked by uid 65534); 4 Oct 2005 03:16:07 -0000 Message-ID: <20051004031607.64041.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r293502 - in /jakarta/commons/proper/validator/trunk/src/test/org/apache/commons/validator: MultipleConfigFilesTest.java validator-multiple-config-1.xml validator-multiple-config-2.xml Date: Tue, 04 Oct 2005 03:16:07 -0000 To: commons-cvs@jakarta.apache.org From: niallp@apache.org X-Mailer: svnmailer-1.0.5 X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Author: niallp Date: Mon Oct 3 20:15:56 2005 New Revision: 293502 URL: http://svn.apache.org/viewcvs?rev=293502&view=rev Log: Test that multiple config files are merged correctly. Modified: jakarta/commons/proper/validator/trunk/src/test/org/apache/commons/validator/MultipleConfigFilesTest.java jakarta/commons/proper/validator/trunk/src/test/org/apache/commons/validator/validator-multiple-config-1.xml jakarta/commons/proper/validator/trunk/src/test/org/apache/commons/validator/validator-multiple-config-2.xml Modified: jakarta/commons/proper/validator/trunk/src/test/org/apache/commons/validator/MultipleConfigFilesTest.java URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/test/org/apache/commons/validator/MultipleConfigFilesTest.java?rev=293502&r1=293501&r2=293502&view=diff ============================================================================== --- jakarta/commons/proper/validator/trunk/src/test/org/apache/commons/validator/MultipleConfigFilesTest.java (original) +++ jakarta/commons/proper/validator/trunk/src/test/org/apache/commons/validator/MultipleConfigFilesTest.java Mon Oct 3 20:15:56 2005 @@ -76,6 +76,53 @@ } } + /** + * Check the forms and constants from different config files have + * been merged into the same FormSet. + */ + public void testMergedConfig() throws ValidatorException { + + // *********** Default Locale ******************* + + // Check the form from the first config file exists + Form form1 = resources.getForm("", "", "", "testForm1"); + assertNotNull("Form 'testForm1' not found", form1); + + // Check the form from the second config file exists + Form form2 = resources.getForm("", "", "", "testForm2"); + assertNotNull("Form 'testForm2' not found", form2); + + // Check the Constants for the form from the first config file + Field field1 = form1.getField("testProperty1"); + assertEquals("testProperty1 - const 1", "testConstValue1", field1.getVarValue("var11")); + assertEquals("testProperty1 - const 2", "testConstValue2", field1.getVarValue("var12")); + + // Check the Constants for the form from the second config file + Field field2 = form2.getField("testProperty2"); + assertEquals("testProperty2 - const 1", "testConstValue1", field2.getVarValue("var21")); + assertEquals("testProperty2 - const 2", "testConstValue2", field2.getVarValue("var22")); + + // *********** 'fr' locale ******************* + + // Check the form from the first config file exists + Form form1_fr = resources.getForm("fr", "", "", "testForm1_fr"); + assertNotNull("Form 'testForm1_fr' not found", form1_fr); + + // Check the form from the second config file exists + Form form2_fr = resources.getForm("fr", "", "", "testForm2_fr"); + assertNotNull("Form 'testForm2_fr' not found", form2_fr); + + // Check the Constants for the form from the first config file + Field field1_fr = form1_fr.getField("testProperty1_fr"); + assertEquals("testProperty1_fr - const 1", "testConstValue1_fr", field1_fr.getVarValue("var11_fr")); + assertEquals("testProperty1_fr - const 2", "testConstValue2_fr", field1_fr.getVarValue("var12_fr")); + + // Check the Constants for the form from the second config file + Field field2_fr = form2_fr.getField("testProperty2_fr"); + assertEquals("testProperty2_fr - const 1", "testConstValue1_fr", field2_fr.getVarValue("var21_fr")); + assertEquals("testProperty2_fr - const 2", "testConstValue2_fr", field2_fr.getVarValue("var22_fr")); + } + /** * With nothing provided, we should fail both because both are required. */ Modified: jakarta/commons/proper/validator/trunk/src/test/org/apache/commons/validator/validator-multiple-config-1.xml URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/test/org/apache/commons/validator/validator-multiple-config-1.xml?rev=293502&r1=293501&r2=293502&view=diff ============================================================================== --- jakarta/commons/proper/validator/trunk/src/test/org/apache/commons/validator/validator-multiple-config-1.xml (original) +++ jakarta/commons/proper/validator/trunk/src/test/org/apache/commons/validator/validator-multiple-config-1.xml Mon Oct 3 20:15:56 2005 @@ -20,4 +20,49 @@ methodParams="java.lang.Object,org.apache.commons.validator.Field" msg=""/> + + + + + testConstName1 + testConstValue1 + + +
+ + + var11 + ${testConstName1} + + + var12 + ${testConstName2} + + +
+ +
+ + + + + testConstName1_fr + testConstValue1_fr + + +
+ + + var11_fr + ${testConstName1_fr} + + + var12_fr + ${testConstName2_fr} + + +
+ +
+ Modified: jakarta/commons/proper/validator/trunk/src/test/org/apache/commons/validator/validator-multiple-config-2.xml URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/validator/trunk/src/test/org/apache/commons/validator/validator-multiple-config-2.xml?rev=293502&r1=293501&r2=293502&view=diff ============================================================================== --- jakarta/commons/proper/validator/trunk/src/test/org/apache/commons/validator/validator-multiple-config-2.xml (original) +++ jakarta/commons/proper/validator/trunk/src/test/org/apache/commons/validator/validator-multiple-config-2.xml Mon Oct 3 20:15:56 2005 @@ -7,6 +7,12 @@ --> + + + testConstName2 + testConstValue2 + +
@@ -15,5 +21,42 @@
+ +
+ + + var21 + ${testConstName1} + + + var22 + ${testConstName2} + + +
+ +
+ + + + + testConstName2_fr + testConstValue2_fr + + +
+ + + var21_fr + ${testConstName1_fr} + + + var22_fr + ${testConstName2_fr} + + +
+
+
--------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org