db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpoes...@apache.org
Subject cvs commit: db-torque/src/generator/src/test/org/apache/torque/engine/database/model NameFactoryTest.java tabletest-schema.xml TableTest.java
Date Sat, 17 Jan 2004 12:53:05 GMT
mpoeschl    2004/01/17 04:53:05

  Modified:    src/generator/src/test/org/apache/torque/engine/database/model
                        NameFactoryTest.java tabletest-schema.xml
                        TableTest.java
  Log:
  some tests
  
  Revision  Changes    Path
  1.4       +20 -2     db-torque/src/generator/src/test/org/apache/torque/engine/database/model/NameFactoryTest.java
  
  Index: NameFactoryTest.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/test/org/apache/torque/engine/database/model/NameFactoryTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NameFactoryTest.java	5 Oct 2003 14:14:03 -0000	1.3
  +++ NameFactoryTest.java	17 Jan 2004 12:53:05 -0000	1.4
  @@ -3,7 +3,7 @@
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * Copyright (c) 2001-2004 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -57,6 +57,9 @@
   import java.util.ArrayList;
   import java.util.Arrays;
   import java.util.List;
  +
  +import org.apache.torque.engine.EngineException;
  +
   import junit.framework.TestCase;
   
   /**
  @@ -183,6 +186,21 @@
                       generated,
                       expected);
               }
  +        }
  +    }
  +    
  +    /**
  +     * @throws Exception on fail
  +     */
  +    public void testException() throws Exception
  +    {
  +        try
  +        {
  +            NameFactory.generateName("non.existing.class", new ArrayList());
  +            assertTrue("Expected an EngineException", false);           
  +        }
  +        catch (EngineException ex)
  +        {
           }
       }
   
  
  
  
  1.5       +9 -0      db-torque/src/generator/src/test/org/apache/torque/engine/database/model/tabletest-schema.xml
  
  Index: tabletest-schema.xml
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/test/org/apache/torque/engine/database/model/tabletest-schema.xml,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- tabletest-schema.xml	31 Oct 2003 20:48:42 -0000	1.4
  +++ tabletest-schema.xml	17 Jan 2004 12:53:05 -0000	1.5
  @@ -37,6 +37,15 @@
         <reference local="singlepk_id" foreign="singlepk_id"/>
       </foreign-key>
     </table>
  +
  +  <table name="singlefk1">
  +    <column name="id" required="true" primaryKey="true" type="INTEGER" />
  +    <column name="singlepk_id" required="true" type="INTEGER" />
  +    <column name="col_a" type="CHAR" size="5" />
  +    <foreign-key foreignTable="singlefk" onUpdate="cascade" onDelete="setnull">
  +      <reference local="singlepk_id" foreign="id"/>
  +    </foreign-key>
  +  </table>
     
     <table name="multifk">
       <column name="id" required="true" primaryKey="true" type="INTEGER" />
  
  
  
  1.8       +16 -2     db-torque/src/generator/src/test/org/apache/torque/engine/database/model/TableTest.java
  
  Index: TableTest.java
  ===================================================================
  RCS file: /home/cvs/db-torque/src/generator/src/test/org/apache/torque/engine/database/model/TableTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- TableTest.java	1 Dec 2003 16:56:30 -0000	1.7
  +++ TableTest.java	17 Jan 2004 12:53:05 -0000	1.8
  @@ -3,7 +3,7 @@
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  - * Copyright (c) 2003 The Apache Software Foundation.  All rights
  + * Copyright (c) 2003-2004 The Apache Software Foundation.  All rights
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -141,6 +141,20 @@
           ForeignKey fk = (ForeignKey) fks.get(0);
           assertEquals(fk.getForeignTableName(), "singlepk");
           assertTrue(fk.getForeignColumns().size() == 1);
  +        assertFalse(fk.hasOnDelete());
  +        assertFalse(fk.hasOnUpdate());
  +    }
  +
  +    public void testOnUpdateOnDelete() throws Exception
  +    {
  +        Table table = db.getTable("singlefk1");
  +        List fks = table.getForeignKeys();
  +        assertTrue(fks.size() == 1);
  +        ForeignKey fk = (ForeignKey) fks.get(0);
  +        assertTrue(fk.hasOnUpdate());
  +        assertEquals("CASCADE", fk.getOnUpdate());
  +        assertTrue(fk.hasOnDelete());
  +        assertEquals("SET NULL", fk.getOnDelete());
       }
   
       public void testMultiFk() throws Exception
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: torque-dev-unsubscribe@db.apache.org
For additional commands, e-mail: torque-dev-help@db.apache.org


Mime
View raw message