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 2003/08/08 12:26:50 UTC
cvs commit: db-ojb/src/test/org/apache/ojb/broker Reptile.java OneToManyTest.java Mammal.java
arminw 2003/08/08 03:26:50
Modified: src/test/org/apache/ojb/broker Reptile.java
OneToManyTest.java Mammal.java
Log:
- remove empty test methods
- add more logging info
Revision Changes Path
1.4 +6 -5 db-ojb/src/test/org/apache/ojb/broker/Reptile.java
Index: Reptile.java
===================================================================
RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/Reptile.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Reptile.java 1 Aug 2002 18:13:15 -0000 1.3
+++ Reptile.java 8 Aug 2003 10:26:50 -0000 1.4
@@ -20,14 +20,14 @@
{
super();
}
-
+
public Reptile(int age, String name, String color)
{
this.age = age;
this.name = name;
- this.color = color;
+ this.color = color;
}
-
+
public int getAge()
{
return age;
@@ -42,12 +42,13 @@
{
return color;
}
-
+
public String toString()
{
return "Reptile: id = " + animalId + "\n name = " + name +
"\n age = " + age +
- "\n color = " + color;
+ "\n color = " + color +
+ "\n zooId = " + zooId;
}
/**
1.7 +16 -32 db-ojb/src/test/org/apache/ojb/broker/OneToManyTest.java
Index: OneToManyTest.java
===================================================================
RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/OneToManyTest.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- OneToManyTest.java 6 Apr 2003 14:54:59 -0000 1.6
+++ OneToManyTest.java 8 Aug 2003 10:26:50 -0000 1.7
@@ -27,18 +27,6 @@
junit.textui.TestRunner.main(arr);
}
- public void testCreate()
- {
- }
-
- public void testUpdate()
- {
- }
-
- public void testDelete()
- {
- }
-
/**
* test the removal aware functionality.
*/
@@ -46,40 +34,36 @@
{
ProductGroupWithRemovalAwareCollection pg = new ProductGroupWithRemovalAwareCollection();
pg.setGroupName("nice group");
-
+
Identity pgId = new Identity(pg, broker);
-
+
Article a = new Article();
a.setArticleName("a");
Article b = new Article();
b.setArticleName("b");
Article c = new Article();
c.setArticleName("c");
-
+
pg.add(a);
pg.add(b);
pg.add(c);
-
+
broker.store(pg);
broker.clearCache();
pg = (ProductGroupWithRemovalAwareCollection) broker.getObjectByIdentity(pgId);
- assertEquals(3,pg.getAllArticles().size());
-
+ assertEquals(3,pg.getAllArticles().size());
+
pg.getAllArticles().remove(c);
pg.getAllArticles().remove(0);
broker.store(pg);
-
+
broker.clearCache();
pg = (ProductGroupWithRemovalAwareCollection) broker.getObjectByIdentity(pgId);
- assertEquals(1,pg.getAllArticles().size());
-
-
- }
+ assertEquals(1,pg.getAllArticles().size());
+
- public void testRead()
- {
}
-
+
/**
* this tests if polymorph collections (i.e. collections of objects
* implementing a common interface) are treated correctly
@@ -88,24 +72,24 @@
{
Zoo myZoo = new Zoo("London");
Identity id = new Identity(myZoo, broker);
-
+
Mammal elephant = new Mammal(37,"Jumbo",4);
Mammal cat = new Mammal(11,"Silvester",4);
Reptile snake = new Reptile(3,"Kaa","green");
-
+
myZoo.addAnimal(snake);
myZoo.addAnimal(elephant);
myZoo.addAnimal(cat);
-
+// System.out.println("## "+myZoo);
broker.store(myZoo);
-
+// System.out.println("## "+myZoo);
broker.clearCache();
-
+
Zoo loadedZoo = (Zoo) broker.getObjectByIdentity(id);
List animals = loadedZoo.getAnimals();
assertEquals(3, animals.size());
-
+
}
1.4 +9 -8 db-ojb/src/test/org/apache/ojb/broker/Mammal.java
Index: Mammal.java
===================================================================
RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/Mammal.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- Mammal.java 1 Aug 2002 18:13:15 -0000 1.3
+++ Mammal.java 8 Aug 2003 10:26:50 -0000 1.4
@@ -13,8 +13,8 @@
private String name;
private int numLegs;
private int zooId;
-
-
+
+
/**
* Constructor for Animal.
*/
@@ -22,35 +22,36 @@
{
super();
}
-
+
public Mammal(int age, String name, int numLegs)
{
this.age = age;
this.name = name;
this.numLegs = numLegs;
}
-
+
public int getAge()
{
return age;
}
-
+
public String getName()
{
return name;
}
-
+
public int getNumLegs()
{
return numLegs;
}
-
+
public String toString()
{
return "Mammal: id = " + animalId + "\n name = " + name +
"\n age = " + age +
- "\n Number of legs = " + numLegs;
+ "\n Number of legs = " + numLegs +
+ "\n zooId = " + zooId;
}
/**
* Returns the animalId.
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org