You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2006/09/26 13:25:16 UTC
svn commit: r449991 -
/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/TreeTest.java
Author: arminw
Date: Tue Sep 26 04:25:15 2006
New Revision: 449991
URL: http://svn.apache.org/viewvc?view=rev&rev=449991
Log:
fix test
Modified:
db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/TreeTest.java
Modified: db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/TreeTest.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/TreeTest.java?view=diff&rev=449991&r1=449990&r2=449991
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/TreeTest.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/test/org/apache/ojb/broker/TreeTest.java Tue Sep 26 04:25:15 2006
@@ -71,65 +71,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());
}
/**
@@ -173,7 +164,7 @@
broker.store(red);
broker.commitTransaction();
- Identity oid = new Identity(root, broker);
+ Identity oid = broker.serviceIdentity().buildIdentity(root);
broker.clearCache();
@@ -186,7 +177,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);
@@ -195,7 +186,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);
@@ -264,7 +255,7 @@
* Creation date: (13.02.2001 18:33:02)
* @return java.util.Vector
*/
- public java.util.Vector getChilds()
+ public Vector getChilds()
{
return childs;
}
@@ -304,7 +295,7 @@
* Creation date: (13.02.2001 18:33:02)
* @param newChilds java.util.Vector
*/
- public void setChilds(java.util.Vector newChilds)
+ public void setChilds(Vector newChilds)
{
childs = newChilds;
}
@@ -501,7 +492,7 @@
* Creation date: (13.02.2001 18:33:02)
* @param newChilds java.util.Vector
*/
- public void setChilds(java.util.Vector newChilds)
+ public void setChilds(Vector newChilds)
{
children = newChilds;
}
@@ -538,7 +529,7 @@
* Creation date: (13.02.2001 18:33:02)
* @param newMembers java.util.Vector
*/
- public void setMembers(java.util.Vector newMembers)
+ public void setMembers(Vector newMembers)
{
groupMembers = newMembers;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org