db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From olegn...@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb/otm OtmExamples.java
Date Thu, 12 Jun 2003 23:42:34 GMT
olegnitz    2003/06/12 16:42:34

  Modified:    src/test/org/apache/ojb/otm OtmExamples.java
  Log:
  Added CopySwizzling test
  
  Revision  Changes    Path
  1.10      +47 -1     db-ojb/src/test/org/apache/ojb/otm/OtmExamples.java
  
  Index: OtmExamples.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/otm/OtmExamples.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- OtmExamples.java	9 Jun 2003 18:58:31 -0000	1.9
  +++ OtmExamples.java	12 Jun 2003 23:42:34 -0000	1.10
  @@ -470,7 +470,8 @@
           }
           finally
           {
  -            try {
  +            try 
  +            {
                   tx = _kit.getTransaction(_conn);
                   tx.begin();
                   if (aOid != null)
  @@ -503,6 +504,51 @@
               {
                   ex.printStackTrace();
                   tx.rollback();
  +            }
  +        }
  +    }
  +
  +    public void testSwizzling() throws Throwable
  +    {
  +        Transaction tx = null;
  +        ProductGroup pg;
  +        Article article;
  +        Article article2;
  +
  +        try
  +        {
  +            tx = _kit.getTransaction(_conn);
  +            tx.begin();
  +
  +            pg = new ProductGroup();
  +            pg.setId(77777);
  +            article = Article.createInstance();
  +            article.setArticleId(77777);
  +            article.setStock(333);
  +            pg.add(article);
  +            article.setProductGroup(pg);
  +            _conn.makePersistent(pg);
  +            _conn.makePersistent(article);
  +            article2 = Article.createInstance();
  +            article2.setArticleId(article.getArticleId());
  +            article2.setStock(334);
  +            article2.setProductGroup(pg);
  +            _conn.makePersistent(article2);
  +            article = (Article) pg.getAllArticles().get(0);
  +            assertEquals("should be equal", 334, article.getStock());
  +        }
  +        finally
  +        {
  +            if (tx != null)
  +            {
  +                try
  +                {
  +                    tx.rollback();
  +                }
  +                catch (Throwable ex)
  +                {
  +                    ex.printStackTrace();
  +                }
               }
           }
       }
  
  
  

Mime
View raw message