mkalen 2005/03/14 19:01:58 Modified: src/test/org/apache/ojb/broker BlobTest.java Log: Merge with OJB_1_0_RELEASE branch: Avoid NPE on read failures. Revision Changes Path 1.11 +44 -14 db-ojb/src/test/org/apache/ojb/broker/BlobTest.java Index: BlobTest.java =================================================================== RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/BlobTest.java,v retrieving revision 1.10 retrieving revision 1.11 diff -u -r1.10 -r1.11 --- BlobTest.java 14 Sep 2004 16:46:08 -0000 1.10 +++ BlobTest.java 15 Mar 2005 03:01:58 -0000 1.11 @@ -1,19 +1,40 @@ package org.apache.ojb.broker; -import java.io.Serializable; +/* Copyright 2002-2004 The Apache Software Foundation + * + * 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. + */ -import org.apache.ojb.broker.platforms.Platform; -import org.apache.ojb.broker.platforms.PlatformHsqldbImpl; import org.apache.ojb.junit.PBTestCase; +import org.apache.ojb.broker.platforms.PlatformHsqldbImpl; + +import java.io.Serializable; /** - * This TestClass tests storimg and retrieving Objects with BLOB/CLOB Attributes. - * Does currently not work with HSQLDB, as it doen't support Blobs/Clobs. + * This TestClass tests storing and retrieving Objects with BLOB/CLOB Attributes. + * @version $Id$ */ public class BlobTest extends PBTestCase { - boolean skipTest; - private static final String msg = "# Skip "+BlobTest.class.getName()+", DB does not support Blob/Clob #"; + private static final String SKIP_MESSAGE = + "# Skip "+BlobTest.class.getName()+", DB does not support Blob/Clob #"; + + /** + * Known issue (to be fixed, warn in setup) + * or DB lack of features (will never be fixed)? + */ + private boolean knownIssue; + private boolean skipTest; public BlobTest(String name) { @@ -30,11 +51,12 @@ { super.setUp(); - Platform platform = broker.serviceConnectionManager().getSupportedPlatform(); + String platformClass = getPlatformClass(); /* hsqldb does not support Blob/Clob, so we skip test for this DB */ - if(platform.getClass().equals(PlatformHsqldbImpl.class)) + knownIssue = false; + if (platformClass.equals(PlatformHsqldbImpl.class.getName())) { skipTest = true; } @@ -42,9 +64,12 @@ public void testBlobInsertion() throws Exception { - if(skipTest) + if (skipTest) { - System.out.println(msg); + if (!knownIssue) + { + System.out.println(SKIP_MESSAGE); + } return; } @@ -70,7 +95,8 @@ Identity oid = new Identity(obj, broker); ObjectWithBlob obj1 = (ObjectWithBlob) broker.getObjectByIdentity(oid); - + assertNotNull("BLOB was not stored", obj1.getBlob()); + assertNotNull("CLOB was not stored", obj1.getClob()); assertEquals(obj.getBlob().length, obj1.getBlob().length); assertEquals(obj.getClob().length(), obj1.getClob().length()); @@ -78,9 +104,12 @@ public void testReadNullBlob() { - if(skipTest) + if (skipTest) { - System.out.println(msg); + if (!knownIssue) + { + System.out.println(SKIP_MESSAGE); + } return; } @@ -168,4 +197,5 @@ this.id = id; } } + }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]