Return-Path: Delivered-To: apmail-db-derby-commits-archive@www.apache.org Received: (qmail 40604 invoked from network); 1 Nov 2005 18:18:31 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 1 Nov 2005 18:18:31 -0000 Received: (qmail 38633 invoked by uid 500); 1 Nov 2005 18:11:51 -0000 Delivered-To: apmail-db-derby-commits-archive@db.apache.org Received: (qmail 38607 invoked by uid 500); 1 Nov 2005 18:11:51 -0000 Mailing-List: contact derby-commits-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: "Derby Development" List-Id: Delivered-To: mailing list derby-commits@db.apache.org Received: (qmail 38595 invoked by uid 99); 1 Nov 2005 18:11:50 -0000 X-ASF-Spam-Status: No, hits=-9.4 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; Tue, 01 Nov 2005 10:11:50 -0800 Received: (qmail 36266 invoked by uid 65534); 1 Nov 2005 18:11:30 -0000 Message-ID: <20051101181130.36264.qmail@minotaur.apache.org> Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r330103 [2/2] - in /db/derby/code/trunk: ./ java/build/org/apache/derbyBuild/ java/testing/ java/testing/org/apache/derbyTesting/functionTests/harness/ java/testing/org/apache/derbyTesting/functionTests/master/ java/testing/org/apache/derby... Date: Tue, 01 Nov 2005 18:11:23 -0000 To: derby-commits@db.apache.org From: davidvc@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 Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/DerbyJUnitTest.java URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/DerbyJUnitTest.java?rev=330103&view=auto ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/DerbyJUnitTest.java (added) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/DerbyJUnitTest.java Tue Nov 1 10:10:31 2005 @@ -0,0 +1,128 @@ +/* + +Derby - Class org.apache.derbyTesting.functionTests.util + +Copyright 2005 The Apache Software Foundation or its licensors, as applicable. + +Licensed 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. + +*/ + +/** + *

+ * This class factors out utility methods (including assertion machinery) + * for re-use by Derby JUnit tests. + *

+ * + * @author Rick + */ + +package org.apache.derbyTesting.functionTests.util; + +import junit.framework.*; + +public class DerbyJUnitTest extends TestCase +{ + ///////////////////////////////////////////////////////////// + // + // CONSTANTS + // + ///////////////////////////////////////////////////////////// + + ///////////////////////////////////////////////////////////// + // + // STATE + // + ///////////////////////////////////////////////////////////// + + ///////////////////////////////////////////////////////////// + // + // CONSTRUCTOR + // + ///////////////////////////////////////////////////////////// + + public DerbyJUnitTest() {} + + ///////////////////////////////////////////////////////////// + // + // EXTRA ASSERTIONS + // + ///////////////////////////////////////////////////////////// + + /** + *

+ * Compare two objects, allowing nulls to be equal. + *

+ */ + public void compareObjects( String message, Object left, Object right ) + throws Exception + { + if ( left == null ) + { + assertNull( message, right ); + } + else + { + assertNotNull( right ); + + if ( left instanceof byte[] ) { compareBytes( message, left, right ); } + else if ( left instanceof java.util.Date ) { compareDates( message, left, right ); } + else { assertTrue( message, left.equals( right ) ); } + } + } + + /** + *

+ * Compare two byte arrays, allowing nulls to be equal. + *

+ */ + public void compareBytes( String message, Object left, Object right ) + throws Exception + { + if ( left == null ) { assertNull( message, right ); } + else { assertNotNull( right ); } + + if ( !(left instanceof byte[] ) ) { fail( message ); } + if ( !(right instanceof byte[] ) ) { fail( message ); } + + byte[] leftBytes = (byte[]) left; + byte[] rightBytes = (byte[]) right; + int count = leftBytes.length; + + assertEquals( message, count, rightBytes.length ); + + for ( int i = 0; i < count; i++ ) + { + assertEquals( message + "[ " + i + " ]", leftBytes[ i ], rightBytes[ i ] ); + } + } + + /** + *

+ * Compare two Dates, allowing nulls to be equal. + *

+ */ + public void compareDates( String message, Object left, Object right ) + throws Exception + { + if ( left == null ) { assertNull( message, right ); } + else { assertNotNull( right ); } + + if ( !(left instanceof java.util.Date ) ) { fail( message ); } + if ( !(right instanceof java.util.Date ) ) { fail( message ); } + + assertEquals( message, left.toString(), right.toString() ); + } + +} + Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/DerbyJUnitTest.java ------------------------------------------------------------------------------ svn:eol-style = native Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/build.xml URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/build.xml?rev=330103&r1=330102&r2=330103&view=diff ============================================================================== --- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/build.xml (original) +++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/build.xml Tue Nov 1 10:10:31 2005 @@ -39,6 +39,7 @@ destdir="${out.dir}"> + @@ -56,6 +57,7 @@ + Modified: db/derby/code/trunk/tools/ant/properties/extrapath.properties URL: http://svn.apache.org/viewcvs/db/derby/code/trunk/tools/ant/properties/extrapath.properties?rev=330103&r1=330102&r2=330103&view=diff ============================================================================== --- db/derby/code/trunk/tools/ant/properties/extrapath.properties (original) +++ db/derby/code/trunk/tools/ant/properties/extrapath.properties Tue Nov 1 10:10:31 2005 @@ -11,6 +11,7 @@ xml-apis=${javatools.dir}/xslt4j-2_5_0/xml-apis.jar xalan=${javatools.dir}/xslt4j-2_5_0/xalan.jar javacc=${javatools.dir}/javacc.jar +junit=${javatools.dir}/junit.jar # # Compile-time extras