gdamour     2004/11/11 08:27:45

  Modified:    
modules/openejb-builder/src/test/org/openejb/deployment/entity/cmp/cmr/onetoone
                        OneToOneCompoundPKTest.java OneToOneTest.java
  Log:

  GERONIMO-467: ejbRemove does not work for CMP with MTM relationship
  GERONIMO-468: CMP - cascade delete is not supported
  
  o update CMPRemoveMethod such that relationships are reset and EJB in
  cascade-delete relationships are also removed; and
  o update the way the various TranQL schema are built in order to retrieve
  the EJB defining a cascade-delete relationship.
  
  Revision  Changes    Path
  1.2       +41 -1     
openejb/modules/openejb-builder/src/test/org/openejb/deployment/entity/cmp/cmr/onetoone/OneToOneCompoundPKTest.java
  
  Index: OneToOneCompoundPKTest.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/openejb-builder/src/test/org/openejb/deployment/entity/cmp/cmr/onetoone/OneToOneCompoundPKTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- OneToOneCompoundPKTest.java       10 Nov 2004 01:35:12 -0000      1.1
  +++ OneToOneCompoundPKTest.java       11 Nov 2004 13:27:45 -0000      1.2
  @@ -262,6 +262,46 @@
           assertStateExistingANewB();

       }

       

  +    /**

  +     * TODO Disabled due to an Axion bug. It has been tested with another

  +     * DB DataSource successfully.

  +     */

  +    public void XtestRemoveRelationships() throws Exception {

  +        ContainerTransactionContext ctx = newTransactionContext();

  +        ALocal a = ahome.findByPrimaryKey(new CompoundPK(new Integer(1), 
"value1"));

  +        a.remove();

  +        ctx.commit();

  +

  +        Connection c = ds.getConnection();

  +        Statement s = c.createStatement();

  +        ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM B");

  +        assertTrue(rs.next());

  +        assertEquals(1, rs.getInt(1));

  +        rs.close();

  +        rs = s.executeQuery("SELECT COUNT(*) FROM B WHERE fka1 = 1 AND fka2 
= 'value1'");

  +        assertTrue(rs.next());

  +        assertEquals(0, rs.getInt(1));

  +        rs.close();

  +        s.close();

  +        c.close();

  +    }

  +

  +    public void testCascadeDelete() throws Exception {

  +        ContainerTransactionContext ctx = newTransactionContext();

  +        BLocal b = bhome.findByPrimaryKey(new Integer(11));

  +        b.remove();

  +        ctx.commit();

  +

  +        Connection c = ds.getConnection();

  +        Statement s = c.createStatement();

  +        ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM A");

  +        assertTrue(rs.next());

  +        assertEquals(0, rs.getInt(1));

  +        rs.close();

  +        s.close();

  +        c.close();

  +    }

  +    

       protected void setUp() throws Exception {

           super.setUp();

           

  
  
  
  1.2       +42 -2     
openejb/modules/openejb-builder/src/test/org/openejb/deployment/entity/cmp/cmr/onetoone/OneToOneTest.java
  
  Index: OneToOneTest.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/openejb-builder/src/test/org/openejb/deployment/entity/cmp/cmr/onetoone/OneToOneTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- OneToOneTest.java 10 Nov 2004 01:35:12 -0000      1.1
  +++ OneToOneTest.java 11 Nov 2004 13:27:45 -0000      1.2
  @@ -264,7 +264,47 @@
           

           assertStateExistingANewB();

       }

  -    

  +

  +    /**

  +     * TODO Disabled due to an Axion bug. It has been tested with another

  +     * DB DataSource successfully.

  +     */

  +    public void XtestRemoveRelationships() throws Exception {

  +        ContainerTransactionContext ctx = newTransactionContext();

  +        ALocal a = ahome.findByPrimaryKey(new Integer(1));

  +        a.remove();

  +        ctx.commit();

  +

  +        Connection c = ds.getConnection();

  +        Statement s = c.createStatement();

  +        ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM B");

  +        assertTrue(rs.next());

  +        assertEquals(1, rs.getInt(1));

  +        rs.close();

  +        rs = s.executeQuery("SELECT COUNT(*) FROM B WHERE fka1 = 1");

  +        assertTrue(rs.next());

  +        assertEquals(0, rs.getInt(1));

  +        rs.close();

  +        s.close();

  +        c.close();

  +    }

  +

  +    public void testCascadeDelete() throws Exception {

  +        ContainerTransactionContext ctx = newTransactionContext();

  +        BLocal b = bhome.findByPrimaryKey(new Integer(11));

  +        b.remove();

  +        ctx.commit();

  +

  +        Connection c = ds.getConnection();

  +        Statement s = c.createStatement();

  +        ResultSet rs = s.executeQuery("SELECT COUNT(*) FROM A");

  +        assertTrue(rs.next());

  +        assertEquals(0, rs.getInt(1));

  +        rs.close();

  +        s.close();

  +        c.close();

  +    }

  +

       protected void setUp() throws Exception {

           super.setUp();

           

  
  
  

Reply via email to