db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r366955 - /db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/NativeIdentifierTest.java
Date Sun, 08 Jan 2006 00:30:57 GMT
Author: arminw
Date: Sat Jan  7 16:30:52 2006
New Revision: 366955

URL: http://svn.apache.org/viewcvs?rev=366955&view=rev
Log:
fix NPE in test object toString method, use IdentityFactory

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/NativeIdentifierTest.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/NativeIdentifierTest.java
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/NativeIdentifierTest.java?rev=366955&r1=366954&r2=366955&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/NativeIdentifierTest.java
(original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/sequence/NativeIdentifierTest.java
Sat Jan  7 16:30:52 2006
@@ -452,8 +452,8 @@
         assertTrue(ref_3.getRefIdentifier().longValue() > 0);
 
         // get Identity objects
-        Identity oid_1 = new Identity(obj_1, broker);
-        Identity oid_2 = new Identity(obj_2, broker);
+        Identity oid_1 = broker.serviceIdentity().buildIdentity(obj_1);
+        Identity oid_2 = broker.serviceIdentity().buildIdentity(obj_2);
         // get identifier (PK) values
         Long id_1 = obj_1.getIdentifier();
         Long id_2 = obj_2.getIdentifier();
@@ -806,8 +806,8 @@
         assertTrue("The assigned FK should be > 0 after store of main object, but was
" + fk.longValue(), fk.longValue() > 0);
 
         // get Identity objects
-        Identity oid_1 = new Identity(obj_1, broker);
-        Identity oid_2 = new Identity(obj_2, broker);
+        Identity oid_1 = broker.serviceIdentity().buildIdentity(obj_1);
+        Identity oid_2 = broker.serviceIdentity().buildIdentity(obj_2);
         // get identifier (PK) values
         Long id_1 = obj_1.getIdentifier();
         Long id_2 = obj_2.getIdentifier();
@@ -986,7 +986,7 @@
         broker.beginTransaction();
         broker.store(obj_1);
         broker.commitTransaction();
-        Identity oid_1 = new Identity(obj_1, broker);
+        Identity oid_1 = broker.serviceIdentity().buildIdentity(obj_1);
 
         MainObject result = (MainObject) broker.getObjectByIdentity(oid_1);
         assertNotNull(result);
@@ -1062,7 +1062,8 @@
         broker.store(obj_1);
         // System.out.println("8. "+obj_1);
         broker.commitTransaction();
-        Identity oid_1 = new Identity(obj_1, broker);
+        Identity oid_1 = broker.serviceIdentity().buildIdentity(obj_1);
+        //Identity oid_1 = new Identity(obj_1, broker);
 
         MainObject result = (MainObject) broker.getObjectByIdentity(oid_1);
         assertNotNull(result);
@@ -1222,8 +1223,9 @@
         public String toString()
         {
             return new ToStringBuilder(this).append("identifier", identifier).append("name",
name)
-                    .append("allReferences", allReferences != null ? allReferences.toString()
: "null")
-                    .append("singleReference", singleReference.getClass().toString()).toString();
+                    .append("allReferences", (allReferences != null ? allReferences.toString()
: "null"))
+                    .append("singleReference", (singleReference != null ? singleReference.getClass().toString():
"null"))
+                    .toString();
         }
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message