db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: jakarta-ojb/src/test/org/apache/ojb/broker MtoNMapping.java PerformanceJdbcReferenceTest.java PerformanceTest2.java TestHelper.java
Date Thu, 09 Jan 2003 17:21:15 GMT
arminw      2003/01/09 09:21:15

  Modified:    src/test/org/apache/ojb/broker MtoNMapping.java
                        PerformanceJdbcReferenceTest.java
                        PerformanceTest2.java TestHelper.java
  Log:
  - update test cases after kernel changes
  
  Revision  Changes    Path
  1.9       +11 -11    jakarta-ojb/src/test/org/apache/ojb/broker/MtoNMapping.java
  
  Index: MtoNMapping.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/test/org/apache/ojb/broker/MtoNMapping.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- MtoNMapping.java	9 Dec 2002 19:27:38 -0000	1.8
  +++ MtoNMapping.java	9 Jan 2003 17:21:14 -0000	1.9
  @@ -24,9 +24,9 @@
       public void testPolymorphMToN()
       {
           Gourmet james = new Gourmet("james");
  -        Identity jamesId = new Identity(james);
  +        Identity jamesId = new Identity(james, broker);
           Gourmet doris = new Gourmet("doris");
  -        Identity dorisId = new Identity(doris);
  +        Identity dorisId = new Identity(doris, broker);
   
           Fish tuna = new Fish("tuna", 242, "salt");
           Fish trout = new Fish("trout", 52, "fresh water");
  @@ -166,8 +166,6 @@
               Project proj = (Project) iter.next();
               //System.out.println(proj.getRoles());
           }
  -
  -
       }
   
       /** test inserting new objects to m:n association*/
  @@ -177,9 +175,10 @@
           p.setId(1);
           Query q = QueryFactory.newQuery(p);
           p = (Person) broker.getObjectByQuery(q);
  +        assertNotNull("We should found a 'person' for id 1 - check db script", p);
           Collection projects = p.getProjects();
           Project[] projectArray = (Project[]) projects.toArray(new Project[0]); // load
it
  -        assertNotNull(projects);
  +        assertNotNull("Person should have some projects - check db script", projects);
           int count = projects.size();
   
           Project proj = new Project();
  @@ -187,6 +186,8 @@
           proj.setDescription("colonization of planet Mars");
   
           p.getProjects().add(proj);
  +        assertEquals(count + 1, p.getProjects().size());
  +
           broker.beginTransaction();
           broker.store(p);
           broker.commitTransaction();
  @@ -195,7 +196,6 @@
   
           p = (Person) broker.getObjectByQuery(q);
           assertEquals(count + 1, p.getProjects().size());
  -
       }
   
       /** Add a new Project, delete an existing Project */
  @@ -207,12 +207,12 @@
           pers = (Person) broker.getObjectByQuery(query);
           Collection projects = pers.getProjects();
           Project[] projectArray = (Project[]) projects.toArray(new Project[0]);
  -        Project oldProj, newProj; 
  +        Project oldProj, newProj;
           int count = projects.size();
  -         
  +
           oldProj = projectArray[0];
           projects.remove(oldProj);
  -        
  +
           newProj = new Project();
           newProj.setTitle("Test Project1 for Person 7");
           newProj.setDescription("This is a Test Project1 for Person 7");
  @@ -222,7 +222,7 @@
           newProj.setTitle("Test Project2 for Person 7");
           newProj.setDescription("This is a Test Project2 for Person 7");
           projects.add(newProj);
  -        
  +
           broker.beginTransaction();
           broker.store(pers);
           broker.commitTransaction();
  @@ -233,7 +233,7 @@
           assertEquals(count + 1 , pers.getProjects().size());
   
       }
  -        
  +
       /** test deleting objects from an m:n association*/
       public void testDeletion() throws Exception
       {
  
  
  
  1.8       +1 -1      jakarta-ojb/src/test/org/apache/ojb/broker/PerformanceJdbcReferenceTest.java
  
  Index: PerformanceJdbcReferenceTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/test/org/apache/ojb/broker/PerformanceJdbcReferenceTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- PerformanceJdbcReferenceTest.java	24 Dec 2002 14:06:45 -0000	1.7
  +++ PerformanceJdbcReferenceTest.java	9 Jan 2003 17:21:14 -0000	1.8
  @@ -134,7 +134,7 @@
           // the repository.xml file.
           ClassDescriptor cld = broker.getClassDescriptor(PerformanceArticle.class);
           JdbcConnectionDescriptor jcd = MetadataManager.getInstance().connectionRepository()
  -                                        .getDescriptor("default");
  +                                        .getDescriptor(TestHelper.DEF_KEY);
           ConnectionFactory cf = ConnectionFactoryFactory.getInstance();
           Connection conn = cf.lookupConnection(jcd);
           return conn;
  
  
  
  1.12      +5 -5      jakarta-ojb/src/test/org/apache/ojb/broker/PerformanceTest2.java
  
  Index: PerformanceTest2.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/test/org/apache/ojb/broker/PerformanceTest2.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- PerformanceTest2.java	24 Dec 2002 14:06:45 -0000	1.11
  +++ PerformanceTest2.java	9 Jan 2003 17:21:14 -0000	1.12
  @@ -41,7 +41,7 @@
       private int threadCount;
       private Logger log = LoggerFactory.getLogger(PerformanceTest2.class);
       public ThreadGroup threadGroup = new ThreadGroup("PerfTest");
  -    private String jcdAlias = TestHelper.DEF_JCD_ALIAS;
  +    private String databaseName = TestHelper.DEF_DATABASE_NAME;
   
       public PerformanceTest2()
       {
  @@ -135,7 +135,7 @@
               PerformanceArticle art2 = createArticle(1001);
               Implementation ojb = OJB.getInstance();
               Database db = ojb.newDatabase();
  -            db.open(jcdAlias, Database.OPEN_READ_WRITE);
  +            db.open(databaseName, Database.OPEN_READ_WRITE);
               Transaction tx = ojb.newTransaction();
               tx.begin();
               tx.lock(art2, Transaction.WRITE);
  @@ -401,7 +401,7 @@
           {
               long start = System.currentTimeMillis();
               Database db = odmg.newDatabase();
  -            db.open(jcdAlias, Database.OPEN_READ_WRITE);
  +            db.open(databaseName, Database.OPEN_READ_WRITE);
               Transaction tx = odmg.newTransaction();
               tx.begin();
               for (int i = 0; i < arr.length; i++)
  @@ -418,7 +418,7 @@
           {
               long start = System.currentTimeMillis();
               Database db = odmg.newDatabase();
  -            db.open(jcdAlias, Database.OPEN_READ_WRITE);
  +            db.open(databaseName, Database.OPEN_READ_WRITE);
               Transaction tx = odmg.newTransaction();
               tx.begin();
               for (int i = 0; i < arr.length; i++)
  @@ -437,7 +437,7 @@
               int artId = arr[0].articleId;
   
               Database db = odmg.newDatabase();
  -            db.open(jcdAlias, Database.OPEN_READ_WRITE);
  +            db.open(databaseName, Database.OPEN_READ_WRITE);
   // for better performance we could read without a tx
   //            Transaction tx = ojb.newTransaction();
   //            tx.begin();
  
  
  
  1.2       +5 -2      jakarta-ojb/src/test/org/apache/ojb/broker/TestHelper.java
  
  Index: TestHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-ojb/src/test/org/apache/ojb/broker/TestHelper.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestHelper.java	24 Dec 2002 14:06:45 -0000	1.1
  +++ TestHelper.java	9 Jan 2003 17:21:14 -0000	1.2
  @@ -9,6 +9,8 @@
   public class TestHelper
   {
       public static final String DEF_JCD_ALIAS = "default";
  +    public static final String DEF_DATABASE_NAME = "default#sa";
  +
       public static final String DEF_REPOSITORY = "repository.xml";
       public static final String DEF_USER = "sa";
       public static final String DEF_PASSWORD = null;
  @@ -16,7 +18,8 @@
   
   
       public static final String FAR_AWAY_JCD_ALIAS = "farAway";
  -    public static final PBKey FAR_AWAY_KEY = new PBKey(FAR_AWAY_JCD_ALIAS);
  +    public static final String FAR_AWAY_DATABASE_NAME = "farAway#sa#";
  +    public static final PBKey FAR_AWAY_KEY = new PBKey(FAR_AWAY_JCD_ALIAS, "sa", "");
   
       public static final String DATABASE_REPOSITORY = "repository_database.xml";
   }
  
  
  

Mime
View raw message