db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t...@apache.org
Subject cvs commit: db-ojb/src/test/org/apache/ojb/broker MtoNTest.java BaseContentImpl.java AllTests.java
Date Thu, 19 Jun 2003 20:02:14 GMT
thma        2003/06/19 13:02:14

  Modified:    src/test/org/apache/ojb/broker BaseContentImpl.java
                        AllTests.java
  Added:       src/test/org/apache/ojb/broker MtoNTest.java
  Log:
  add test case for Ollis M:N patch
  
  Revision  Changes    Path
  1.2       +9 -0      db-ojb/src/test/org/apache/ojb/broker/BaseContentImpl.java
  
  Index: BaseContentImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/BaseContentImpl.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BaseContentImpl.java	9 Apr 2003 13:33:31 -0000	1.1
  +++ BaseContentImpl.java	19 Jun 2003 20:02:14 -0000	1.2
  @@ -32,4 +32,13 @@
           this.id = id;
       }
   
  +     public List getQualifiers()
  +     {
  +       return qualifiers;
  +     }
  +
  +     public void setQualifiers(List qualifiers)
  +     {
  +       this.qualifiers = qualifiers;
  +     }
   }
  
  
  
  1.32      +1 -0      db-ojb/src/test/org/apache/ojb/broker/AllTests.java
  
  Index: AllTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/test/org/apache/ojb/broker/AllTests.java,v
  retrieving revision 1.31
  retrieving revision 1.32
  diff -u -r1.31 -r1.32
  --- AllTests.java	13 Jun 2003 13:00:37 -0000	1.31
  +++ AllTests.java	19 Jun 2003 20:02:14 -0000	1.32
  @@ -81,6 +81,7 @@
           suite.addTest(new TestSuite(NativeIdentifierTest.class));
           suite.addTest(new TestSuite(AnonymousFieldsTest.class));
           suite.addTest(new TestSuite(AbstractExtentClassTest.class));
  +        suite.addTest(new TestSuite(MtoNTest.class));
           return suite;
       }
   
  
  
  
  1.1                  db-ojb/src/test/org/apache/ojb/broker/MtoNTest.java
  
  Index: MtoNTest.java
  ===================================================================
  /**
   * User: om
   */
  
  package org.apache.ojb.broker;
  
  import junit.framework.TestCase;
  
  import java.util.Date;
  import java.util.Arrays;
  import java.util.List;
  
  /**
   * @author <a href="mailto:om@ppi.de">Oliver Matz</a>
   * @version $Id$
   */
  public class MtoNTest extends TestCase
  {
    private PersistenceBroker broker;
  
    public void setUp()
    {
        try
        {
            broker = PersistenceBrokerFactory.defaultPersistenceBroker();
        }
        catch (PBFactoryException e)
        {
        }
    }
  
    public void tearDown()
    {
  
        try
        {
            broker.clearCache();
            broker.close();
        }
        catch (PersistenceBrokerException e)
        {
        }
  
    }
  
  
    public void testStorePaper()
    {
      String now = new Date().toString();
      Paper paper = new Paper();
      paper.setAuthor("Jonny Myers");
      paper.setDate(now);
      Qualifier qual = new Topic();
      qual.setName("qual " + now);
      paper.setQualifiers(Arrays.asList(new Qualifier[] {qual}));
      broker.beginTransaction();
      broker.store(paper);
      broker.store(qual);
      Identity paperId = new Identity(paper, broker);
      broker.commitTransaction();
  
      broker.clearCache();
      broker.beginTransaction();
      Paper retPaper = (Paper)broker.getObjectByIdentity(paperId);
      System.out.println("retrieved: " + retPaper);
      List qualifiers = retPaper.getQualifiers();
      System.out.println("ret qualifiers: " + qualifiers);
      assertEquals(1, qualifiers.size());
      System.out.println("ret qual: " + ((Qualifier)qualifiers.get(0)).getName());
      broker.commitTransaction();
    }
  }
  
  
  

Mime
View raw message