db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r452686 - in /db/ojb/trunk/src/test/org/apache/ojb/broker: TreeExtentedTest.java TreeTest.java
Date Wed, 04 Oct 2006 00:35:44 GMT
Author: arminw
Date: Tue Oct  3 17:35:43 2006
New Revision: 452686

URL: http://svn.apache.org/viewvc?view=rev&rev=452686
Log:
use IdentityFactory

Modified:
    db/ojb/trunk/src/test/org/apache/ojb/broker/TreeExtentedTest.java
    db/ojb/trunk/src/test/org/apache/ojb/broker/TreeTest.java

Modified: db/ojb/trunk/src/test/org/apache/ojb/broker/TreeExtentedTest.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/test/org/apache/ojb/broker/TreeExtentedTest.java?view=diff&rev=452686&r1=452685&r2=452686
==============================================================================
--- db/ojb/trunk/src/test/org/apache/ojb/broker/TreeExtentedTest.java (original)
+++ db/ojb/trunk/src/test/org/apache/ojb/broker/TreeExtentedTest.java Tue Oct  3 17:35:43
2006
@@ -61,8 +61,8 @@
         broker.store(cat);
         broker.commitTransaction();
 
-        Identity oidCat = new Identity(cat, broker);
-        Identity oidSticker = new Identity(sticker, broker);
+        Identity oidCat = broker.serviceIdentity().buildIdentity(cat);
+        Identity oidSticker = broker.serviceIdentity().buildIdentity(sticker);
         broker.clearCache();
 
         Node newSticker = (Node) broker.getObjectByIdentity(oidSticker);

Modified: db/ojb/trunk/src/test/org/apache/ojb/broker/TreeTest.java
URL: http://svn.apache.org/viewvc/db/ojb/trunk/src/test/org/apache/ojb/broker/TreeTest.java?view=diff&rev=452686&r1=452685&r2=452686
==============================================================================
--- db/ojb/trunk/src/test/org/apache/ojb/broker/TreeTest.java (original)
+++ db/ojb/trunk/src/test/org/apache/ojb/broker/TreeTest.java Tue Oct  3 17:35:43 2006
@@ -72,65 +72,56 @@
 
 	/**
 	 */
-	public void testCreate()
+	public void testCreate() throws Exception
 	{
-		try
-		{
+        Tree root = new Tree();
+        try
+        {
+            FieldDescriptor idFld = broker.getClassDescriptor(Tree.class).getFieldDescriptorByName("id");
+            Integer idVal = (Integer) broker.serviceSequenceManager().getUniqueValue(idFld);
+
+            root.setId(idVal.intValue());
+        }
+        catch (PersistenceBrokerException e)
+
+            {
+        }
+        root.setData("a brand new root: " + root.getId());
+
+        root.addChild(createTreeNodeWithParent(root));
+        root.addChild(createTreeNodeWithParent(root));
+        root.addChild(createTreeNodeWithParent(root));
+        root.addChild(createTreeNodeWithParent(root));
+        root.addChild(createTreeNodeWithParent(root));
+
+        Tree child = root.getChild(0);
+        child.addChild(createTreeNodeWithParent(child));
+        child.addChild(createTreeNodeWithParent(child));
+        child.addChild(createTreeNodeWithParent(child));
+
+        child = child.getChild(1);
+        child.addChild(createTreeNodeWithParent(child));
+        child.addChild(createTreeNodeWithParent(child));
+
+        //System.out.println("original tree:");
+        //System.out.println(root);
+        broker.beginTransaction();
+        broker.store(root);
+        broker.commitTransaction();
+
+        Identity oid = broker.serviceIdentity().buildIdentity(root);
+
+        broker.clearCache();
+
+        Tree retrieved = (Tree) broker.getObjectByIdentity(oid);
 
-			Tree root = new Tree();
-			try
-			{
-				FieldDescriptor idFld = broker.getClassDescriptor(Tree.class).getFieldDescriptorByName("id");
-				Integer idVal = (Integer) broker.serviceSequenceManager().getUniqueValue(idFld);
-
-				root.setId(idVal.intValue());
-			}
-			catch (PersistenceBrokerException e)
-
-				{
-			}
-			root.setData("a brand new root: " + root.getId());
-
-			root.addChild(createTreeNodeWithParent(root));
-			root.addChild(createTreeNodeWithParent(root));
-			root.addChild(createTreeNodeWithParent(root));
-			root.addChild(createTreeNodeWithParent(root));
-			root.addChild(createTreeNodeWithParent(root));
-
-			Tree child = root.getChild(0);
-			child.addChild(createTreeNodeWithParent(child));
-			child.addChild(createTreeNodeWithParent(child));
-			child.addChild(createTreeNodeWithParent(child));
-
-			child = child.getChild(1);
-			child.addChild(createTreeNodeWithParent(child));
-			child.addChild(createTreeNodeWithParent(child));
-
-			//System.out.println("original tree:");
-			//System.out.println(root);
-            broker.beginTransaction();
-			broker.store(root);
-            broker.commitTransaction();
-
-			Identity oid = new Identity(root, broker);
-
-			broker.clearCache();
-
-			Tree retrieved = (Tree) broker.getObjectByIdentity(oid);
-
-			//System.out.println("tree after reading from db:");
-			//System.out.println(retrieved);
-
-			assertEquals(
-				"tree should have same size after retrival",
-				root.size(),
-				retrieved.size());
-
-		}
-		catch (Throwable t)
-		{
-			fail(t.getMessage());
-		}
+        //System.out.println("tree after reading from db:");
+        //System.out.println(retrieved);
+
+        assertEquals(
+            "tree should have same size after retrival",
+            root.size(),
+            retrieved.size());
 	}
 
 	/**
@@ -174,7 +165,7 @@
         broker.store(red);
         broker.commitTransaction();
 
-        Identity oid = new Identity(root, broker);
+        Identity oid = broker.serviceIdentity().buildIdentity(root);
 
         broker.clearCache();
 
@@ -187,7 +178,7 @@
             root.size(),
             root_r.size());
 
-        oid = new Identity(green, broker);
+        oid = broker.serviceIdentity().buildIdentity(green);
         TreeGroup green_r = (TreeGroup) broker.getObjectByIdentity(oid);
         //System.out.println("tree after reading from db:");
         //System.out.println(green_r);
@@ -196,7 +187,7 @@
             green.size(),
             green_r.size());
 
-        oid = new Identity(red, broker);
+        oid = broker.serviceIdentity().buildIdentity(red);
         TreeGroup red_r = (TreeGroup) broker.getObjectByIdentity(oid);
         //System.out.println("tree after reading from db:");
         //System.out.println(red_r);



---------------------------------------------------------------------
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