You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by to...@apache.org on 2004/01/21 01:01:22 UTC

cvs commit: db-ojb/src/xdoclet/test/xdoclet/junit XDocletRunner.java

tomdz       2004/01/20 16:01:22

  Modified:    src/xdoclet/test/xdoclet/modules/ojb/tests
                        ClassTagRowReaderAttributeTests.java
                        ModifyInheritedTagElementClassRefAttributeTests.java
                        CollectionTagForeignkeyAttributeTests.java
                        RunAllTests.java
                        ClassTagInitializationMethodAttributeTests.java
                        CollectionTagCollectionClassAttributeTests.java
                        CollectionTagElementClassRefAttributeTests.java
                        ModifyInheritedTagCollectionClassAttributeTests.java
                        OjbTestBase.java
                        ReferenceTagForeignkeyAttributeTests.java
                        ClassTagFactoryClassAndMethodAttributeTests.java
               src/xdoclet/java/src/xdoclet/modules/ojb/resources
                        torque_xml.xdt
               src/xdoclet/java/src/xdoclet/modules/ojb OjbSubTask.java
                        TorqueSubTask.java
               src/xdoclet/test/xdoclet/junit XDocletRunner.java
  Log:
  Fixed bug in CollectionTagForeignkeyAttributeTests
  Added new attribute for torque sub task that controls generation of foreignkey tags in torque database schema
  
  Revision  Changes    Path
  1.4       +6 -6      db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagRowReaderAttributeTests.java
  
  Index: ClassTagRowReaderAttributeTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagRowReaderAttributeTests.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ClassTagRowReaderAttributeTests.java	18 Jan 2004 18:24:49 -0000	1.3
  +++ ClassTagRowReaderAttributeTests.java	21 Jan 2004 00:01:21 -0000	1.4
  @@ -1,7 +1,5 @@
   package xdoclet.modules.ojb.tests;
   
  -import java.util.Properties;
  -
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  @@ -56,6 +54,8 @@
    * <http://www.apache.org/>.
    */
   
  +import java.util.HashMap;
  +
   /**
    * Tests for the ojb.class tag with the row-reader attribute.
    *
  @@ -177,11 +177,11 @@
               "/** @ojb.class row-reader=\"SomeClass\" */\n"+
               "public class A {}\n");
   
  -        Properties taskProps          = new Properties();
  -        Properties torqueSubTaskProps = new Properties();
  +        HashMap taskProps          = new HashMap();
  +        HashMap torqueSubTaskProps = new HashMap();
           
  -        taskProps.setProperty(PROPERTY_CHECKS, "basic");
  -        torqueSubTaskProps.setProperty(PROPERTY_DATABASENAME, "ojbtest");
  +        taskProps.put(PROPERTY_CHECKS, "basic");
  +        torqueSubTaskProps.put(PROPERTY_DATABASENAME, "ojbtest");
   
           assertEqualsOjbDescriptorFile(
               "<class-descriptor\n"+
  
  
  
  1.3       +6 -6      db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/ModifyInheritedTagElementClassRefAttributeTests.java
  
  Index: ModifyInheritedTagElementClassRefAttributeTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/ModifyInheritedTagElementClassRefAttributeTests.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ModifyInheritedTagElementClassRefAttributeTests.java	18 Jan 2004 18:24:49 -0000	1.2
  +++ ModifyInheritedTagElementClassRefAttributeTests.java	21 Jan 2004 00:01:21 -0000	1.3
  @@ -1,7 +1,5 @@
   package xdoclet.modules.ojb.tests;
   
  -import java.util.Properties;
  -
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  @@ -56,6 +54,8 @@
    * <http://www.apache.org/>.
    */
   
  +import java.util.HashMap;
  +
   /**
    * Tests for the ojb.collection tag with the element-class-ref attribute.
    *
  @@ -1158,11 +1158,11 @@
               "  private int aid;\n"+
               "}\n");
           
  -        Properties taskProps          = new Properties();
  -        Properties torqueSubTaskProps = new Properties();
  +        HashMap taskProps          = new HashMap();
  +        HashMap torqueSubTaskProps = new HashMap();
           
  -        taskProps.setProperty(PROPERTY_CHECKS, "basic");
  -        torqueSubTaskProps.setProperty(PROPERTY_DATABASENAME, "ojbtest");
  +        taskProps.put(PROPERTY_CHECKS, "basic");
  +        torqueSubTaskProps.put(PROPERTY_DATABASENAME, "ojbtest");
   
           assertEqualsOjbDescriptorFile(
               "<class-descriptor\n"+
  
  
  
  1.3       +934 -0    db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagForeignkeyAttributeTests.java
  
  Index: CollectionTagForeignkeyAttributeTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagForeignkeyAttributeTests.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CollectionTagForeignkeyAttributeTests.java	18 Jan 2004 18:24:49 -0000	1.2
  +++ CollectionTagForeignkeyAttributeTests.java	21 Jan 2004 00:01:21 -0000	1.3
  @@ -66,6 +66,907 @@
           super(name);
       }
   
  +    // Test: no foreignkey specified
  +    public void testForeignkey1()
  +    {
  +        addClass(
  +            "test.A",
  +            "package test;\n"+
  +            "/** @ojb.class */\n" +
  +            "public class A {\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private int id;\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.B\" */\n"+
  +            "  private java.util.List attr;\n"+
  +            "}");
  +        addClass(
  +            "test.B",
  +            "package test;\n"+
  +            "/** @ojb.class */\n"+
  +            "public class B {\n"+
  +            "  /** @ojb.field */\n"+
  +            "  private int aid;\n"+
  +            "}\n");
  +
  +        assertNull(runOjbXDoclet(OJB_DEST_FILE));
  +        assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  +    }
  +
  +    // Test: foreignkey has empty value
  +    public void testForeignkey2()
  +    {
  +        addClass(
  +            "test.A",
  +            "package test;\n"+
  +            "/** @ojb.class */\n" +
  +            "public class A {\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private int id;\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
  +            "    *                 foreignkey=\"\"\n"+
  +            "    */\n"+
  +            "  private java.util.List attr;\n"+
  +            "}");
  +        addClass(
  +            "test.B",
  +            "package test;\n"+
  +            "/** @ojb.class */\n"+
  +            "public class B {\n"+
  +            "  /** @ojb.field */\n"+
  +            "  private int aid;\n"+
  +            "}\n");
  +
  +        assertNull(runOjbXDoclet(OJB_DEST_FILE));
  +        assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  +    }
  +
  +    // Test: foreignkey specifies unknown field
  +    public void testForeignkey3()
  +    {
  +        addClass(
  +            "test.A",
  +            "package test;\n"+
  +            "/** @ojb.class */\n" +
  +            "public class A {\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private int id;\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
  +            "    *                 foreignkey=\"aid\"\n"+
  +            "    */\n"+
  +            "  private java.util.List attr;\n"+
  +            "}");
  +        addClass(
  +            "test.B",
  +            "package test;\n"+
  +            "/** @ojb.class */\n"+
  +            "public class B {\n"+
  +            "  /** @ojb.field */\n"+
  +            "  private int id;\n"+
  +            "}\n");
  +
  +        assertNull(runOjbXDoclet(OJB_DEST_FILE));
  +        assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  +    }
  +
  +    // Test: foreignkey specifies not-persistent field
  +    public void testForeignkey4()
  +    {
  +        addClass(
  +            "test.A",
  +            "package test;\n"+
  +            "/** @ojb.class */\n" +
  +            "public class A {\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private int id;\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
  +            "    *                 foreignkey=\"aid\"\n"+
  +            "    */\n"+
  +            "  private java.util.List attr;\n"+
  +            "}");
  +        addClass(
  +            "test.B",
  +            "package test;\n"+
  +            "/** @ojb.class */\n"+
  +            "public class B {\n"+
  +            "  private int aid;\n"+
  +            "}\n");
  +
  +        assertNull(runOjbXDoclet(OJB_DEST_FILE));
  +        assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  +    }
  +
  +    // Test: foreignkey specifies field that exists only in a sub-type
  +    public void testForeignkey5()
  +    {
  +        addClass(
  +            "test.A",
  +            "package test;\n"+
  +            "/** @ojb.class */\n" +
  +            "public class A {\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private int id;\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
  +            "    *                 foreignkey=\"aid\"\n"+
  +            "    */\n"+
  +            "  private java.util.List attr;\n"+
  +            "}");
  +        addClass(
  +            "test.B",
  +            "package test;\n"+
  +            "/** @ojb.class */\n"+
  +            "public class B {}\n");
  +        addClass(
  +            "test.C",
  +            "package test;\n"+
  +            "/** @ojb.class */\n"+
  +            "public class C extends B {\n"+
  +            "  /** @ojb.field */\n"+
  +            "  private int aid;\n"+
  +            "}\n");
  +
  +        assertNull(runOjbXDoclet(OJB_DEST_FILE));
  +        assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  +    }
  +
  +    // Test: normal use, foreignkey and primary key have same type
  +    public void testForeignkey6()
  +    {
  +        addClass(
  +            "test.A",
  +            "package test;\n"+
  +            "/** @ojb.class */\n" +
  +            "public class A {\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private int id;\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
  +            "    *                 foreignkey=\"aid\"\n"+
  +            "    */\n"+
  +            "  private java.util.List attr;\n"+
  +            "}");
  +        addClass(
  +            "test.B",
  +            "package test;\n"+
  +            "/** @ojb.class */\n"+
  +            "public class B {\n"+
  +            "  /** @ojb.field */\n"+
  +            "  private int aid;\n"+
  +            "}\n");
  +
  +        assertEqualsOjbDescriptorFile(
  +            "<class-descriptor\n"+
  +            "    class=\"test.A\"\n"+
  +            "    table=\"A\"\n"+
  +            ">\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"id\"\n"+
  +            "        column=\"id\"\n"+
  +            "        jdbc-type=\"INTEGER\"\n"+
  +            "        primarykey=\"true\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "    <collection-descriptor\n"+
  +            "        name=\"attr\"\n"+
  +            "        element-class-ref=\"test.B\"\n"+
  +            "    >\n"+
  +            "        <inverse-foreignkey field-ref=\"aid\"/>\n"+
  +            "    </collection-descriptor>\n"+
  +            "</class-descriptor>\n"+
  +            "<class-descriptor\n"+
  +            "    class=\"test.B\"\n"+
  +            "    table=\"B\"\n"+
  +            ">\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"aid\"\n"+
  +            "        column=\"aid\"\n"+
  +            "        jdbc-type=\"INTEGER\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "</class-descriptor>",
  +            runOjbXDoclet(OJB_DEST_FILE));
  +        assertEqualsTorqueSchemaFile(
  +            "<database name=\"ojbtest\">\n"+
  +            "    <table name=\"A\">\n"+
  +            "        <column name=\"id\"\n"+
  +            "                javaName=\"id\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "                primaryKey=\"true\"\n"+
  +            "                required=\"true\"\n"+
  +            "        />\n"+
  +            "    </table>\n"+
  +            "    <table name=\"B\">\n"+
  +            "        <column name=\"aid\"\n"+
  +            "                javaName=\"aid\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "        />\n"+
  +            "    </table>\n"+
  +            "</database>",
  +            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  +    }
  +
  +    // Test: normal use, foreignkey and primary key have different types
  +    public void testForeignkey7()
  +    {
  +        addClass(
  +            "test.A",
  +            "package test;\n"+
  +            "/** @ojb.class */\n" +
  +            "public class A {\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private String id;\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
  +            "    *                 foreignkey=\"aid\"\n"+
  +            "    */\n"+
  +            "  private java.util.List attr;\n"+
  +            "}");
  +        addClass(
  +            "test.B",
  +            "package test;\n"+
  +            "/** @ojb.class */\n"+
  +            "public class B {\n"+
  +            "  /** @ojb.field */\n"+
  +            "  private int aid;\n"+
  +            "}\n");
  +
  +        assertNull(runOjbXDoclet(OJB_DEST_FILE));
  +        assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  +    }
  +
  +    // Test: normal use, foreignkey is anonymous
  +    public void testForeignkey8()
  +    {
  +        addClass(
  +            "test.A",
  +            "package test;\n"+
  +            "/** @ojb.class */\n" +
  +            "public class A {\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private int id;\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
  +            "    *                 foreignkey=\"aid\"\n"+
  +            "    */\n"+
  +            "  private java.util.List attr;\n"+
  +            "}");
  +        addClass(
  +            "test.B",
  +            "package test;\n"+
  +            "/** @ojb.class\n"+
  +            "  * @ojb.field name=\"aid\"\n"+
  +            "  *            jdbc-type=\"INTEGER\"\n"+
  +            "  */\n"+
  +            "public class B {}\n");
  +
  +        assertEqualsOjbDescriptorFile(
  +            "<class-descriptor\n"+
  +            "    class=\"test.A\"\n"+
  +            "    table=\"A\"\n"+
  +            ">\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"id\"\n"+
  +            "        column=\"id\"\n"+
  +            "        jdbc-type=\"INTEGER\"\n"+
  +            "        primarykey=\"true\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "    <collection-descriptor\n"+
  +            "        name=\"attr\"\n"+
  +            "        element-class-ref=\"test.B\"\n"+
  +            "    >\n"+
  +            "        <inverse-foreignkey field-ref=\"aid\"/>\n"+
  +            "    </collection-descriptor>\n"+
  +            "</class-descriptor>\n"+
  +            "<class-descriptor\n"+
  +            "    class=\"test.B\"\n"+
  +            "    table=\"B\"\n"+
  +            ">\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"aid\"\n"+
  +            "        column=\"aid\"\n"+
  +            "        jdbc-type=\"INTEGER\"\n"+
  +            "        access=\"anonymous\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "</class-descriptor>",
  +            runOjbXDoclet(OJB_DEST_FILE));
  +        assertEqualsTorqueSchemaFile(
  +            "<database name=\"ojbtest\">\n"+
  +            "    <table name=\"A\">\n"+
  +            "        <column name=\"id\"\n"+
  +            "                javaName=\"id\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "                primaryKey=\"true\"\n"+
  +            "                required=\"true\"\n"+
  +            "        />\n"+
  +            "    </table>\n"+
  +            "    <table name=\"B\">\n"+
  +            "        <column name=\"aid\"\n"+
  +            "                javaName=\"aid\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "        />\n"+
  +            "    </table>\n"+
  +            "</database>",
  +            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  +    }
  +
  +    // Test: normal use, primary key is anonymous
  +    public void testForeignkey9()
  +    {
  +        addClass(
  +            "test.A",
  +            "package test;\n"+
  +            "/** @ojb.class\n"+
  +            "  * @ojb.field name=\"id\"\n"+
  +            "  *            jdbc-type=\"INTEGER\"\n"+
  +            "  *            primarykey=\"true\"\n"+
  +            "  */\n" +
  +            "public class A {\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
  +            "    *                 foreignkey=\"aid\"\n"+
  +            "    */\n"+
  +            "  private java.util.List attr;\n"+
  +            "}");
  +        addClass(
  +            "test.B",
  +            "package test;\n"+
  +            "/** @ojb.class */\n"+
  +            "public class B {\n"+
  +            "  /** @ojb.field */\n"+
  +            "  private int aid;\n"+
  +            "}\n");
  +
  +        assertEqualsOjbDescriptorFile(
  +            "<class-descriptor\n"+
  +            "    class=\"test.A\"\n"+
  +            "    table=\"A\"\n"+
  +            ">\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"id\"\n"+
  +            "        column=\"id\"\n"+
  +            "        jdbc-type=\"INTEGER\"\n"+
  +            "        primarykey=\"true\"\n"+
  +            "        access=\"anonymous\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "    <collection-descriptor\n"+
  +            "        name=\"attr\"\n"+
  +            "        element-class-ref=\"test.B\"\n"+
  +            "    >\n"+
  +            "        <inverse-foreignkey field-ref=\"aid\"/>\n"+
  +            "    </collection-descriptor>\n"+
  +            "</class-descriptor>\n"+
  +            "<class-descriptor\n"+
  +            "    class=\"test.B\"\n"+
  +            "    table=\"B\"\n"+
  +            ">\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"aid\"\n"+
  +            "        column=\"aid\"\n"+
  +            "        jdbc-type=\"INTEGER\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "</class-descriptor>",
  +            runOjbXDoclet(OJB_DEST_FILE));
  +        assertEqualsTorqueSchemaFile(
  +            "<database name=\"ojbtest\">\n"+
  +            "    <table name=\"A\">\n"+
  +            "        <column name=\"id\"\n"+
  +            "                javaName=\"id\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "                primaryKey=\"true\"\n"+
  +            "                required=\"true\"\n"+
  +            "        />\n"+
  +            "    </table>\n"+
  +            "    <table name=\"B\">\n"+
  +            "        <column name=\"aid\"\n"+
  +            "                javaName=\"aid\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "        />\n"+
  +            "    </table>\n"+
  +            "</database>",
  +            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  +    }
  +
  +    // Test: normal use, multiple foreignkeys and primarykeys with same types
  +    public void testForeignkey10()
  +    {
  +        addClass(
  +            "test.A",
  +            "package test;\n"+
  +            "/** @ojb.class */\n" +
  +            "public class A {\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private int id1;\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private String id2;\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
  +            "    *                 foreignkey=\"aid1,aid2\"\n"+
  +            "    */\n"+
  +            "  private java.util.List attr;\n"+
  +            "}");
  +        addClass(
  +            "test.B",
  +            "package test;\n"+
  +            "/** @ojb.class */\n"+
  +            "public class B {\n"+
  +            "  /** @ojb.field */\n"+
  +            "  private int aid1;\n"+
  +            "  /** @ojb.field */\n"+
  +            "  private String aid2;\n"+
  +            "}\n");
  +
  +        assertEqualsOjbDescriptorFile(
  +            "<class-descriptor\n"+
  +            "    class=\"test.A\"\n"+
  +            "    table=\"A\"\n"+
  +            ">\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"id1\"\n"+
  +            "        column=\"id1\"\n"+
  +            "        jdbc-type=\"INTEGER\"\n"+
  +            "        primarykey=\"true\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"id2\"\n"+
  +            "        column=\"id2\"\n"+
  +            "        jdbc-type=\"VARCHAR\"\n"+
  +            "        primarykey=\"true\"\n"+
  +            "        length=\"24\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "    <collection-descriptor\n"+
  +            "        name=\"attr\"\n"+
  +            "        element-class-ref=\"test.B\"\n"+
  +            "    >\n"+
  +            "        <inverse-foreignkey field-ref=\"aid1\"/>\n"+
  +            "        <inverse-foreignkey field-ref=\"aid2\"/>\n"+
  +            "    </collection-descriptor>\n"+
  +            "</class-descriptor>\n"+
  +            "<class-descriptor\n"+
  +            "    class=\"test.B\"\n"+
  +            "    table=\"B\"\n"+
  +            ">\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"aid1\"\n"+
  +            "        column=\"aid1\"\n"+
  +            "        jdbc-type=\"INTEGER\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"aid2\"\n"+
  +            "        column=\"aid2\"\n"+
  +            "        jdbc-type=\"VARCHAR\"\n"+
  +            "        length=\"24\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "</class-descriptor>",
  +            runOjbXDoclet(OJB_DEST_FILE));
  +        assertEqualsTorqueSchemaFile(
  +            "<database name=\"ojbtest\">\n"+
  +            "    <table name=\"A\">\n"+
  +            "        <column name=\"id1\"\n"+
  +            "                javaName=\"id1\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "                primaryKey=\"true\"\n"+
  +            "                required=\"true\"\n"+
  +            "        />\n"+
  +            "        <column name=\"id2\"\n"+
  +            "                javaName=\"id2\"\n"+
  +            "                type=\"VARCHAR\"\n"+
  +            "                primaryKey=\"true\"\n"+
  +            "                required=\"true\"\n"+
  +            "                size=\"24\"\n"+
  +            "        />\n"+
  +            "    </table>\n"+
  +            "    <table name=\"B\">\n"+
  +            "        <column name=\"aid1\"\n"+
  +            "                javaName=\"aid1\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "        />\n"+
  +            "        <column name=\"aid2\"\n"+
  +            "                javaName=\"aid2\"\n"+
  +            "                type=\"VARCHAR\"\n"+
  +            "                size=\"24\"\n"+
  +            "        />\n"+
  +            "    </table>\n"+
  +            "</database>",
  +            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  +    }
  +
  +    // Test: normal use, multiple foreignkeys and primarykeys with different types
  +    public void testForeignkey11()
  +    {
  +        addClass(
  +            "test.A",
  +            "package test;\n"+
  +            "/** @ojb.class */\n" +
  +            "public class A {\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private int id1;\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private String id2;\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
  +            "    *                 foreignkey=\"aid2,aid1\"\n"+
  +            "    */\n"+
  +            "  private java.util.List attr;\n"+
  +            "}");
  +        addClass(
  +            "test.B",
  +            "package test;\n"+
  +            "/** @ojb.class */\n"+
  +            "public class B {\n"+
  +            "  /** @ojb.field */\n"+
  +            "  private int aid1;\n"+
  +            "  /** @ojb.field */\n"+
  +            "  private String aid2;\n"+
  +            "}\n");
  +
  +        assertNull(runOjbXDoclet(OJB_DEST_FILE));
  +        assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  +    }
  +
  +    // Test: normal use, different number of foreignkeys and primarykeys
  +    public void testForeignkey12()
  +    {
  +        addClass(
  +            "test.A",
  +            "package test;\n"+
  +            "/** @ojb.class */\n" +
  +            "public class A {\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private int id;\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
  +            "    *                 foreignkey=\"aid1,aid2\"\n"+
  +            "    */\n"+
  +            "  private java.util.List attr;\n"+
  +            "}");
  +        addClass(
  +            "test.B",
  +            "package test;\n"+
  +            "/** @ojb.class */\n"+
  +            "public class B {\n"+
  +            "  /** @ojb.field */\n"+
  +            "  private int aid1;\n"+
  +            "  /** @ojb.field */\n"+
  +            "  private String aid2;\n"+
  +            "}\n");
  +
  +        assertNull(runOjbXDoclet(OJB_DEST_FILE));
  +        assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  +    }
  +
  +    // Test: normal use, multiple foreignkeys and primarykeys with same types, one foreignkey is anonymous
  +    public void testForeignkey13()
  +    {
  +        addClass(
  +            "test.A",
  +            "package test;\n"+
  +            "/** @ojb.class */\n" +
  +            "public class A {\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private int id1;\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private String id2;\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
  +            "    *                 foreignkey=\"aid1,aid2\"\n"+
  +            "    */\n"+
  +            "  private java.util.List attr;\n"+
  +            "}");
  +        addClass(
  +            "test.B",
  +            "package test;\n"+
  +            "/** @ojb.class\n"+
  +            "  * @ojb.field name=\"aid2\"\n"+
  +            "  *            jdbc-type=\"VARCHAR\"\n"+
  +            "  */\n"+
  +            "public class B {\n"+
  +            "  /** @ojb.field id=\"1\" */\n"+
  +            "  private int aid1;\n"+
  +            "}\n");
  +
  +        assertEqualsOjbDescriptorFile(
  +            "<class-descriptor\n"+
  +            "    class=\"test.A\"\n"+
  +            "    table=\"A\"\n"+
  +            ">\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"id1\"\n"+
  +            "        column=\"id1\"\n"+
  +            "        jdbc-type=\"INTEGER\"\n"+
  +            "        primarykey=\"true\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"id2\"\n"+
  +            "        column=\"id2\"\n"+
  +            "        jdbc-type=\"VARCHAR\"\n"+
  +            "        primarykey=\"true\"\n"+
  +            "        length=\"24\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "    <collection-descriptor\n"+
  +            "        name=\"attr\"\n"+
  +            "        element-class-ref=\"test.B\"\n"+
  +            "    >\n"+
  +            "        <inverse-foreignkey field-ref=\"aid1\"/>\n"+
  +            "        <inverse-foreignkey field-ref=\"aid2\"/>\n"+
  +            "    </collection-descriptor>\n"+
  +            "</class-descriptor>\n"+
  +            "<class-descriptor\n"+
  +            "    class=\"test.B\"\n"+
  +            "    table=\"B\"\n"+
  +            ">\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"aid1\"\n"+
  +            "        column=\"aid1\"\n"+
  +            "        jdbc-type=\"INTEGER\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"aid2\"\n"+
  +            "        column=\"aid2\"\n"+
  +            "        jdbc-type=\"VARCHAR\"\n"+
  +            "        length=\"24\"\n"+
  +            "        access=\"anonymous\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "</class-descriptor>",
  +            runOjbXDoclet(OJB_DEST_FILE));
  +        assertEqualsTorqueSchemaFile(
  +            "<database name=\"ojbtest\">\n"+
  +            "    <table name=\"A\">\n"+
  +            "        <column name=\"id1\"\n"+
  +            "                javaName=\"id1\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "                primaryKey=\"true\"\n"+
  +            "                required=\"true\"\n"+
  +            "        />\n"+
  +            "        <column name=\"id2\"\n"+
  +            "                javaName=\"id2\"\n"+
  +            "                type=\"VARCHAR\"\n"+
  +            "                primaryKey=\"true\"\n"+
  +            "                required=\"true\"\n"+
  +            "                size=\"24\"\n"+
  +            "        />\n"+
  +            "    </table>\n"+
  +            "    <table name=\"B\">\n"+
  +            "        <column name=\"aid1\"\n"+
  +            "                javaName=\"aid1\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "        />\n"+
  +            "        <column name=\"aid2\"\n"+
  +            "                javaName=\"aid2\"\n"+
  +            "                type=\"VARCHAR\"\n"+
  +            "                size=\"24\"\n"+
  +            "        />\n"+
  +            "    </table>\n"+
  +            "</database>",
  +            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  +    }
  +
  +    // Test: inherited
  +    public void testForeignkey14()
  +    {
  +        addClass(
  +            "test.A",
  +            "package test;\n"+
  +            "/** @ojb.class */\n" +
  +            "public class A {\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private int id;\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
  +            "    *                 foreignkey=\"aid\"\n"+
  +            "    */\n"+
  +            "  private java.util.List attr;\n"+
  +            "}");
  +        addClass(
  +            "test.B",
  +            "package test;\n"+
  +            "/** @ojb.class */\n"+
  +            "public class B {\n"+
  +            "  /** @ojb.field */\n"+
  +            "  private int aid;\n"+
  +            "}\n");
  +        addClass(
  +            "test.C",
  +            "package test;\n"+
  +            "/** @ojb.class */\n"+
  +            "public class C extends A {}\n");
  +
  +        assertEqualsOjbDescriptorFile(
  +            "<class-descriptor\n"+
  +            "    class=\"test.A\"\n"+
  +            "    table=\"A\"\n"+
  +            ">\n"+
  +            "    <extent-class class-ref=\"test.C\"/>\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"id\"\n"+
  +            "        column=\"id\"\n"+
  +            "        jdbc-type=\"INTEGER\"\n"+
  +            "        primarykey=\"true\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "    <collection-descriptor\n"+
  +            "        name=\"attr\"\n"+
  +            "        element-class-ref=\"test.B\"\n"+
  +            "    >\n"+
  +            "        <inverse-foreignkey field-ref=\"aid\"/>\n"+
  +            "    </collection-descriptor>\n"+
  +            "</class-descriptor>\n"+
  +            "<class-descriptor\n"+
  +            "    class=\"test.B\"\n"+
  +            "    table=\"B\"\n"+
  +            ">\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"aid\"\n"+
  +            "        column=\"aid\"\n"+
  +            "        jdbc-type=\"INTEGER\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "</class-descriptor>\n"+
  +            "<class-descriptor\n"+
  +            "    class=\"test.C\"\n"+
  +            "    table=\"C\"\n"+
  +            ">\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"id\"\n"+
  +            "        column=\"id\"\n"+
  +            "        jdbc-type=\"INTEGER\"\n"+
  +            "        primarykey=\"true\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "    <collection-descriptor\n"+
  +            "        name=\"attr\"\n"+
  +            "        element-class-ref=\"test.B\"\n"+
  +            "    >\n"+
  +            "        <inverse-foreignkey field-ref=\"aid\"/>\n"+
  +            "    </collection-descriptor>\n"+
  +            "</class-descriptor>",
  +            runOjbXDoclet(OJB_DEST_FILE));
  +        assertEqualsTorqueSchemaFile(
  +            "<database name=\"ojbtest\">\n"+
  +            "    <table name=\"A\">\n"+
  +            "        <column name=\"id\"\n"+
  +            "                javaName=\"id\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "                primaryKey=\"true\"\n"+
  +            "                required=\"true\"\n"+
  +            "        />\n"+
  +            "    </table>\n"+
  +            "    <table name=\"B\">\n"+
  +            "        <column name=\"aid\"\n"+
  +            "                javaName=\"aid\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "        />\n"+
  +            "    </table>\n"+
  +            "    <table name=\"C\">\n"+
  +            "        <column name=\"id\"\n"+
  +            "                javaName=\"id\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "                primaryKey=\"true\"\n"+
  +            "                required=\"true\"\n"+
  +            "        />\n"+
  +            "    </table>\n"+
  +            "</database>",
  +            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  +    }
  +
  +    // Test: normal use, multiple foreignkeys and primarykeys with same types in subtype of element type which is an interface
  +    public void testForeignkey15()
  +    {
  +        addClass(
  +            "test.A",
  +            "package test;\n"+
  +            "/** @ojb.class */\n" +
  +            "public class A {\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private int id1;\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private String id2;\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
  +            "    *                 foreignkey=\"aid1,aid2\"\n"+
  +            "    */\n"+
  +            "  private java.util.List attr;\n"+
  +            "}");
  +        addClass(
  +            "test.B",
  +            "package test;\n"+
  +            "/** @ojb.class generate-table-info=\"false\" */\n"+
  +            "public interface B {}\n");
  +        addClass(
  +            "test.C",
  +            "package test;\n"+
  +            "/** @ojb.class */\n"+
  +            "public class C implements B {\n"+
  +            "  /** @ojb.field */\n"+
  +            "  private int aid1;\n"+
  +            "  /** @ojb.field */\n"+
  +            "  private String aid2;\n"+
  +            "}\n");
  +        
  +        assertEqualsOjbDescriptorFile(
  +            "<class-descriptor\n"+
  +            "    class=\"test.A\"\n"+
  +            "    table=\"A\"\n"+
  +            ">\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"id1\"\n"+
  +            "        column=\"id1\"\n"+
  +            "        jdbc-type=\"INTEGER\"\n"+
  +            "        primarykey=\"true\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"id2\"\n"+
  +            "        column=\"id2\"\n"+
  +            "        jdbc-type=\"VARCHAR\"\n"+
  +            "        primarykey=\"true\"\n"+
  +            "        length=\"24\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "    <collection-descriptor\n"+
  +            "        name=\"attr\"\n"+
  +            "        element-class-ref=\"test.B\"\n"+
  +            "    >\n"+
  +            "        <inverse-foreignkey field-ref=\"aid1\"/>\n"+
  +            "        <inverse-foreignkey field-ref=\"aid2\"/>\n"+
  +            "    </collection-descriptor>\n"+
  +            "</class-descriptor>\n"+
  +            "<class-descriptor\n"+
  +            "    class=\"test.B\"\n"+
  +            ">\n"+
  +            "    <extent-class class-ref=\"test.C\"/>\n"+
  +            "</class-descriptor>\n"+
  +            "<class-descriptor\n"+
  +            "    class=\"test.C\"\n"+
  +            "    table=\"C\"\n"+
  +            ">\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"aid1\"\n"+
  +            "        column=\"aid1\"\n"+
  +            "        jdbc-type=\"INTEGER\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"aid2\"\n"+
  +            "        column=\"aid2\"\n"+
  +            "        jdbc-type=\"VARCHAR\"\n"+
  +            "        length=\"24\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "</class-descriptor>",
  +            runOjbXDoclet(OJB_DEST_FILE));
  +        assertEqualsTorqueSchemaFile(
  +            "<database name=\"ojbtest\">\n"+
  +            "    <table name=\"A\">\n"+
  +            "        <column name=\"id1\"\n"+
  +            "                javaName=\"id1\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "                primaryKey=\"true\"\n"+
  +            "                required=\"true\"\n"+
  +            "        />\n"+
  +            "        <column name=\"id2\"\n"+
  +            "                javaName=\"id2\"\n"+
  +            "                type=\"VARCHAR\"\n"+
  +            "                primaryKey=\"true\"\n"+
  +            "                required=\"true\"\n"+
  +            "                size=\"24\"\n"+
  +            "        />\n"+
  +            "    </table>\n"+
  +            "    <table name=\"C\">\n"+
  +            "        <column name=\"aid1\"\n"+
  +            "                javaName=\"aid1\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "        />\n"+
  +            "        <column name=\"aid2\"\n"+
  +            "                javaName=\"aid2\"\n"+
  +            "                type=\"VARCHAR\"\n"+
  +            "                size=\"24\"\n"+
  +            "        />\n"+
  +            "    </table>\n"+
  +            "</database>",
  +            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  +    }
  +
       // Test: different types of foreignkeys and primarykeys
       public void testForeignkey16()
       {
  @@ -101,6 +1002,39 @@
               "public class D implements B {\n"+
               "  /** @ojb.field */\n"+
               "  private String aid;\n"+
  +            "}\n");
  +        
  +        assertNull(runOjbXDoclet(OJB_DEST_FILE));
  +        assertNull(runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  +    }
  +
  +    // Test: unknown foreignkey in subclass
  +    public void testForeignkey17()
  +    {
  +        addClass(
  +            "test.A",
  +            "package test;\n"+
  +            "/** @ojb.class */\n" +
  +            "public class A {\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private int id;\n"+
  +            "  /** @ojb.collection element-class-ref=\"test.B\"\n"+
  +            "    *                 foreignkey=\"aid\"\n"+
  +            "    */\n"+
  +            "  private java.util.List attr;\n"+
  +            "}");
  +        addClass(
  +            "test.B",
  +            "package test;\n"+
  +            "/** @ojb.class generate-table-info=\"false\" */\n"+
  +            "public interface B {}\n");
  +        addClass(
  +            "test.C",
  +            "package test;\n"+
  +            "/** @ojb.class */\n"+
  +            "public class C implements B {\n"+
  +            "  /** @ojb.field */\n"+
  +            "  private int bid;\n"+
               "}\n");
           
           assertNull(runOjbXDoclet(OJB_DEST_FILE));
  
  
  
  1.7       +2 -2      db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/RunAllTests.java
  
  Index: RunAllTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/RunAllTests.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- RunAllTests.java	19 Jan 2004 08:39:46 -0000	1.6
  +++ RunAllTests.java	21 Jan 2004 00:01:21 -0000	1.7
  @@ -139,8 +139,8 @@
           suite.addTest(new TestSuite(CollectionTagAutoUpdateAttributeTests.class));
           suite.addTest(new TestSuite(CollectionTagCollectionClassAttributeTests.class));
           suite.addTest(new TestSuite(CollectionTagDocumentationAttributeTests.class));
  -        suite.addTest(new TestSuite(CollectionTagElementClassRefAttributeTests.class));
  -        suite.addTest(new TestSuite(CollectionTagForeignkeyAttributeTests.class));
  +        suite.addTest(new TestSuite(CollectionTagElementClassRefAttributeTests.class));*/
  +        suite.addTest(new TestSuite(CollectionTagForeignkeyAttributeTests.class));/*
           suite.addTest(new TestSuite(CollectionTagIndirectionTableAttributeTests.class));
           suite.addTest(new TestSuite(CollectionTagOrderbyAttributeTests.class));
           suite.addTest(new TestSuite(CollectionTagOtmDependentAttributeTests.class));
  
  
  
  1.4       +6 -6      db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagInitializationMethodAttributeTests.java
  
  Index: ClassTagInitializationMethodAttributeTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagInitializationMethodAttributeTests.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ClassTagInitializationMethodAttributeTests.java	18 Jan 2004 18:24:49 -0000	1.3
  +++ ClassTagInitializationMethodAttributeTests.java	21 Jan 2004 00:01:21 -0000	1.4
  @@ -1,7 +1,5 @@
   package xdoclet.modules.ojb.tests;
   
  -import java.util.Properties;
  -
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  @@ -56,6 +54,8 @@
    * <http://www.apache.org/>.
    */
   
  +import java.util.HashMap;
  +
   /**
    * Tests for the ojb.class tag with the initialization-method attribute.
    *
  @@ -173,11 +173,11 @@
               "/** @ojb.class initialization-method=\"someMethod\" */\n"+
               "public class A {}\n");
   
  -        Properties taskProps          = new Properties();
  -        Properties torqueSubTaskProps = new Properties();
  +        HashMap taskProps          = new HashMap();
  +        HashMap torqueSubTaskProps = new HashMap();
           
  -        taskProps.setProperty(PROPERTY_CHECKS, "basic");
  -        torqueSubTaskProps.setProperty(PROPERTY_DATABASENAME, "ojbtest");
  +        taskProps.put(PROPERTY_CHECKS, "basic");
  +        torqueSubTaskProps.put(PROPERTY_DATABASENAME, "ojbtest");
   
           assertEqualsOjbDescriptorFile(
               "<class-descriptor\n"+
  
  
  
  1.4       +6 -6      db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagCollectionClassAttributeTests.java
  
  Index: CollectionTagCollectionClassAttributeTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagCollectionClassAttributeTests.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CollectionTagCollectionClassAttributeTests.java	18 Jan 2004 18:24:49 -0000	1.3
  +++ CollectionTagCollectionClassAttributeTests.java	21 Jan 2004 00:01:21 -0000	1.4
  @@ -1,7 +1,5 @@
   package xdoclet.modules.ojb.tests;
   
  -import java.util.Properties;
  -
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  @@ -56,6 +54,8 @@
    * <http://www.apache.org/>.
    */
   
  +import java.util.HashMap;
  +
   /**
    * Tests for the ojb.collection tag with the collection-class attribute.
    *
  @@ -1023,11 +1023,11 @@
               "  private int aid;\n"+
               "}\n");
   
  -        Properties taskProps          = new Properties();
  -        Properties torqueSubTaskProps = new Properties();
  +        HashMap taskProps          = new HashMap();
  +        HashMap torqueSubTaskProps = new HashMap();
           
  -        taskProps.setProperty(PROPERTY_CHECKS, "basic");
  -        torqueSubTaskProps.setProperty(PROPERTY_DATABASENAME, "ojbtest");
  +        taskProps.put(PROPERTY_CHECKS, "basic");
  +        torqueSubTaskProps.put(PROPERTY_DATABASENAME, "ojbtest");
           
           assertEqualsOjbDescriptorFile(
               "<class-descriptor\n"+
  
  
  
  1.4       +6 -6      db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagElementClassRefAttributeTests.java
  
  Index: CollectionTagElementClassRefAttributeTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagElementClassRefAttributeTests.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- CollectionTagElementClassRefAttributeTests.java	18 Jan 2004 18:24:49 -0000	1.3
  +++ CollectionTagElementClassRefAttributeTests.java	21 Jan 2004 00:01:21 -0000	1.4
  @@ -1,7 +1,5 @@
   package xdoclet.modules.ojb.tests;
   
  -import java.util.Properties;
  -
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  @@ -56,6 +54,8 @@
    * <http://www.apache.org/>.
    */
   
  +import java.util.HashMap;
  +
   /**
    * Tests for the ojb.collection tag with the element-class-ref attribute.
    *
  @@ -729,11 +729,11 @@
               "  private int aid;\n"+
               "}\n");
   
  -        Properties taskProps          = new Properties();
  -        Properties torqueSubTaskProps = new Properties();
  +        HashMap taskProps          = new HashMap();
  +        HashMap torqueSubTaskProps = new HashMap();
           
  -        taskProps.setProperty(PROPERTY_CHECKS, "basic");
  -        torqueSubTaskProps.setProperty(PROPERTY_DATABASENAME, "ojbtest");
  +        taskProps.put(PROPERTY_CHECKS, "basic");
  +        torqueSubTaskProps.put(PROPERTY_DATABASENAME, "ojbtest");
   
           assertEqualsOjbDescriptorFile(
               "<class-descriptor\n"+
  
  
  
  1.3       +6 -6      db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/ModifyInheritedTagCollectionClassAttributeTests.java
  
  Index: ModifyInheritedTagCollectionClassAttributeTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/ModifyInheritedTagCollectionClassAttributeTests.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ModifyInheritedTagCollectionClassAttributeTests.java	18 Jan 2004 18:24:49 -0000	1.2
  +++ ModifyInheritedTagCollectionClassAttributeTests.java	21 Jan 2004 00:01:21 -0000	1.3
  @@ -1,7 +1,5 @@
   package xdoclet.modules.ojb.tests;
   
  -import java.util.Properties;
  -
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  @@ -56,6 +54,8 @@
    * <http://www.apache.org/>.
    */
   
  +import java.util.HashMap;
  +
   /**
    * Tests for the ojb.modify-inherited tag with the collection-class attribute.
    *
  @@ -766,11 +766,11 @@
               "  private int aid;\n"+
               "}\n");
   
  -        Properties taskProps          = new Properties();
  -        Properties torqueSubTaskProps = new Properties();
  +        HashMap taskProps          = new HashMap();
  +        HashMap torqueSubTaskProps = new HashMap();
           
  -        taskProps.setProperty(PROPERTY_CHECKS, "basic");
  -        torqueSubTaskProps.setProperty(PROPERTY_DATABASENAME, "ojbtest");
  +        taskProps.put(PROPERTY_CHECKS, "basic");
  +        torqueSubTaskProps.put(PROPERTY_DATABASENAME, "ojbtest");
   
           assertEqualsOjbDescriptorFile(
               "<class-descriptor\n"+
  
  
  
  1.3       +14 -13    db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/OjbTestBase.java
  
  Index: OjbTestBase.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/OjbTestBase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- OjbTestBase.java	18 Jan 2004 18:24:49 -0000	1.2
  +++ OjbTestBase.java	21 Jan 2004 00:01:21 -0000	1.3
  @@ -54,8 +54,8 @@
    * <http://www.apache.org/>.
    */
   
  +import java.util.HashMap;
   import java.util.Iterator;
  -import java.util.Properties;
   
   import xdoclet.junit.*;
   
  @@ -66,11 +66,12 @@
    */
   public class OjbTestBase extends XDocletTestBase
   {
  -    protected static final String OJB_DEST_FILE         = "repository_user.xml";
  -    protected static final String TORQUE_DEST_FILE      = "project_schema.xml";
  -    protected static final String PROPERTY_CHECKS       = "checks";
  -    protected static final String PROPERTY_DATABASENAME = "databaseName";
  -    
  +    protected static final String OJB_DEST_FILE                 = "repository_user.xml";
  +    protected static final String TORQUE_DEST_FILE              = "project_schema.xml";
  +    protected static final String PROPERTY_CHECKS               = "checks";
  +    protected static final String PROPERTY_DATABASENAME         = "databaseName";
  +    protected static final String PROPERTY_GENERATE_FOREIGNKEYS = "generateForeignkeys";
  +
       public OjbTestBase(String name)
       {
           super(name);
  @@ -81,7 +82,7 @@
           return runOjbXDoclet(destFile, null, null);
       }
   
  -    protected String runOjbXDoclet(String destFile, Properties taskProps, Properties subTaskProps)
  +    protected String runOjbXDoclet(String destFile, HashMap taskProps, HashMap subTaskProps)
       {
           clearTaskProperties();
           clearSubTaskProperties();
  @@ -95,14 +96,14 @@
       
       protected String runTorqueXDoclet(String destFile, String dbName)
       {
  -        Properties props = new Properties();
  +        HashMap props = new HashMap();
   
  -        props.setProperty(PROPERTY_DATABASENAME, dbName);
  +        props.put(PROPERTY_DATABASENAME, dbName);
   
           return runTorqueXDoclet(destFile, null, props);
       }
   
  -    protected String runTorqueXDoclet(String destFile, Properties taskProps, Properties subTaskProps)
  +    protected String runTorqueXDoclet(String destFile, HashMap taskProps, HashMap subTaskProps)
       {
           clearTaskProperties();
           clearSubTaskProperties();
  @@ -114,7 +115,7 @@
           return runXDoclet();
       }
       
  -    private void setProperties(Properties taskProps, Properties subTaskProps)
  +    private void setProperties(HashMap taskProps, HashMap subTaskProps)
       {
           String key;
   
  @@ -123,7 +124,7 @@
               for (Iterator it = taskProps.keySet().iterator(); it.hasNext();)
               {
                   key = (String)it.next();
  -                setTaskProperty(key, taskProps.getProperty(key));
  +                setTaskProperty(key, taskProps.get(key));
               }
           }
           if (subTaskProps != null)
  @@ -131,7 +132,7 @@
               for (Iterator it = subTaskProps.keySet().iterator(); it.hasNext();)
               {
                   key = (String)it.next();
  -                setSubTaskProperty(key, subTaskProps.getProperty(key));
  +                setSubTaskProperty(key, subTaskProps.get(key));
               }
           }
       }
  
  
  
  1.4       +80 -0     db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/ReferenceTagForeignkeyAttributeTests.java
  
  Index: ReferenceTagForeignkeyAttributeTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/ReferenceTagForeignkeyAttributeTests.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ReferenceTagForeignkeyAttributeTests.java	18 Jan 2004 18:24:49 -0000	1.3
  +++ ReferenceTagForeignkeyAttributeTests.java	21 Jan 2004 00:01:21 -0000	1.4
  @@ -54,6 +54,8 @@
    * <http://www.apache.org/>.
    */
   
  +import java.util.HashMap;
  +
   /**
    * Tests for the ojb.reference tag with the foreignkey attribute
    * Note: For normal use tests see the tests for class-ref
  @@ -589,5 +591,83 @@
               "    </table>\n"+
               "</database>",
               runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  +    }
  +
  +    // Test: one foreignkey attribute specified, no foreignkey generation for torque
  +    public void testForeignkey12()
  +    {
  +        addClass(
  +            "test.A",
  +            "package test;\n"+
  +            "/** @ojb.class */\n"+
  +            "public class A {\n"+
  +            "  /** @ojb.field */\n"+
  +            "  private int attrKey;\n"+
  +            "  /** @ojb.reference foreignkey=\"attrKey\" */\n"+
  +            "  private test.B attr;\n"+
  +            "}\n");
  +        addClass(
  +            "test.B",
  +            "package test;\n"+
  +            "/** @ojb.class */\n"+
  +            "public class B {\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private int id;\n"+
  +            "}\n");
  +
  +        HashMap torqueSubTaskProps = new HashMap();
  +        
  +        torqueSubTaskProps.put(PROPERTY_DATABASENAME, "ojbtest");
  +        torqueSubTaskProps.put(PROPERTY_GENERATE_FOREIGNKEYS, Boolean.FALSE);
  +
  +        assertEqualsOjbDescriptorFile(
  +            "<class-descriptor\n"+
  +            "    class=\"test.A\"\n"+
  +            "    table=\"A\"\n"+
  +            ">\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"attrKey\"\n"+
  +            "        column=\"attrKey\"\n"+
  +            "        jdbc-type=\"INTEGER\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "    <reference-descriptor\n"+
  +            "        name=\"attr\"\n"+
  +            "        class-ref=\"test.B\"\n"+
  +            "    >\n"+
  +            "        <foreignkey field-ref=\"attrKey\"/>\n"+
  +            "    </reference-descriptor>\n"+
  +            "</class-descriptor>\n"+
  +            "<class-descriptor\n"+
  +            "    class=\"test.B\"\n"+
  +            "    table=\"B\"\n"+
  +            ">\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"id\"\n"+
  +            "        column=\"id\"\n"+
  +            "        jdbc-type=\"INTEGER\"\n"+
  +            "        primarykey=\"true\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "</class-descriptor>",
  +            runOjbXDoclet(OJB_DEST_FILE));
  +        assertEqualsTorqueSchemaFile(
  +            "<database name=\"ojbtest\">\n"+
  +            "    <table name=\"A\">\n"+
  +            "        <column name=\"attrKey\"\n"+
  +            "                javaName=\"attrKey\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "        />\n"+
  +            "    </table>\n"+
  +            "    <table name=\"B\">\n"+
  +            "        <column name=\"id\"\n"+
  +            "                javaName=\"id\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "                primaryKey=\"true\"\n"+
  +            "                required=\"true\"\n"+
  +            "        />\n"+
  +            "    </table>\n"+
  +            "</database>",
  +            runTorqueXDoclet(TORQUE_DEST_FILE, null, torqueSubTaskProps));
       }
   }
  
  
  
  1.4       +6 -6      db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagFactoryClassAndMethodAttributeTests.java
  
  Index: ClassTagFactoryClassAndMethodAttributeTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagFactoryClassAndMethodAttributeTests.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ClassTagFactoryClassAndMethodAttributeTests.java	18 Jan 2004 18:24:49 -0000	1.3
  +++ ClassTagFactoryClassAndMethodAttributeTests.java	21 Jan 2004 00:01:21 -0000	1.4
  @@ -1,7 +1,5 @@
   package xdoclet.modules.ojb.tests;
   
  -import java.util.Properties;
  -
   /* ====================================================================
    * The Apache Software License, Version 1.1
    *
  @@ -56,6 +54,8 @@
    * <http://www.apache.org/>.
    */
   
  +import java.util.HashMap;
  +
   /**
    * Tests for the ojb.class tag with the factory-class and factory-method attributes.
    *
  @@ -233,11 +233,11 @@
               "  */\n"+
               "public class A {}\n");
   
  -        Properties taskProps          = new Properties();
  -        Properties torqueSubTaskProps = new Properties();
  +        HashMap taskProps          = new HashMap();
  +        HashMap torqueSubTaskProps = new HashMap();
           
  -        taskProps.setProperty(PROPERTY_CHECKS, "basic");
  -        torqueSubTaskProps.setProperty(PROPERTY_DATABASENAME, "ojbtest");
  +        taskProps.put(PROPERTY_CHECKS, "basic");
  +        torqueSubTaskProps.put(PROPERTY_DATABASENAME, "ojbtest");
   
           assertEqualsOjbDescriptorFile(
               "<class-descriptor\n"+
  
  
  
  1.3       +6 -4      db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/resources/torque_xml.xdt
  
  Index: torque_xml.xdt
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/resources/torque_xml.xdt,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- torque_xml.xdt	26 Dec 2003 20:17:52 -0000	1.2
  +++ torque_xml.xdt	21 Jan 2004 00:01:21 -0000	1.3
  @@ -100,13 +100,15 @@
                   </XDtOjbTorque:ifColumnHasProperty>
           />
           </XDtOjbTorque:forAllColumns>
  -        <XDtOjbTorque:forAllReferences>
  +        <XDtConfig:ifConfigParamEquals paramName="generateForeignkeys" value="true">
  +	        <XDtOjbTorque:forAllReferences>
           <foreign-key foreignTable="<XDtOjbTorque:referenceTable/>">
  -            <XDtOjbTorque:forAllForeignKeys>
  +	            <XDtOjbTorque:forAllForeignKeys>
               <reference local="<XDtOjbTorque:foreignKeyName remote='false'/>" foreign="<XDtOjbTorque:foreignKeyName remote='true'/>"/>
  -            </XDtOjbTorque:forAllForeignKeys>
  +	            </XDtOjbTorque:forAllForeignKeys>
           </foreign-key>
  -        </XDtOjbTorque:forAllReferences>
  +	        </XDtOjbTorque:forAllReferences>
  +        </XDtConfig:ifConfigParamEquals>
           <XDtOjbTorque:forAllIndices unique="false">
           <index<XDtOjbTorque:ifIndexHasName> name="<XDtOjbTorque:indexName/>"</XDtOjbTorque:ifIndexHasName>>
               <XDtOjbTorque:forAllIndexColumns>
  
  
  
  1.2       +1 -5      db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/OjbSubTask.java
  
  Index: OjbSubTask.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/OjbSubTask.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- OjbSubTask.java	15 Dec 2003 20:09:13 -0000	1.1
  +++ OjbSubTask.java	21 Jan 2004 00:01:22 -0000	1.2
  @@ -56,10 +56,8 @@
   
   import org.apache.commons.logging.Log;
   import xdoclet.XDocletException;
  -import xdoclet.XDocletMessages;
   import xdoclet.XmlSubTask;
   import xdoclet.util.LogUtil;
  -import xdoclet.util.Translator;
   
   /**
    * Generates the XML metadata for OJB-persistent classes and the descriptions of the associated database tables.
  @@ -149,8 +147,6 @@
        */
       protected void engineStarted() throws XDocletException
       {
  -        String generatedFileName = getDestinationFile();
  -
  -        System.out.println(Translator.getString(XDocletMessages.class, XDocletMessages.GENERATING_SOMETHING, new String[]{generatedFileName}));
  +        System.out.println("Generating ojb repository descriptor ("+getDestinationFile()+")");
       }
   }
  
  
  
  1.2       +41 -27    db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/TorqueSubTask.java
  
  Index: TorqueSubTask.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/java/src/xdoclet/modules/ojb/TorqueSubTask.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TorqueSubTask.java	15 Dec 2003 20:09:13 -0000	1.1
  +++ TorqueSubTask.java	21 Jan 2004 00:01:22 -0000	1.2
  @@ -56,7 +56,6 @@
   
   import org.apache.commons.logging.Log;
   import xdoclet.XDocletException;
  -import xdoclet.XDocletMessages;
   import xdoclet.XmlSubTask;
   import xdoclet.util.LogUtil;
   import xdoclet.util.Translator;
  @@ -73,19 +72,16 @@
       private static String TORQUE_TEMPLATE_FILE = "resources/torque_xml.xdt";
       private static String TORQUE_DEFAULT_FILE_NAME = "project-schema.xml";
   
  -    /**
  -     * The database name
  -     */
  +    /** Whether to generate verbose output */
  +    private boolean _isVerbose = false;
  +    /** The database name */
       private String  _databaseName;
  -    /**
  -     * Whether to generate verbose output
  -     */
  -    private boolean _verbose;
  -    /**
  -     * The torque dtd url.
  -     */
  +    /** The torque dtd url */
       private String  _dtdUrl = "http://jakarta.apache.org/turbine/dtd/database.dtd";
  -
  +    /** Whether to generate foreignkey tags in the torque schema */
  +    private boolean _isGeneratingForeignkeys = true;
  +    
  +    
       /**
        * Creates a new object.
        */
  @@ -102,7 +98,7 @@
        */
       public boolean getVerbose()
       {
  -        return _verbose;
  +        return _isVerbose;
       }
   
       /**
  @@ -112,17 +108,7 @@
        */
       public void setVerbose(boolean beVerbose)
       {
  -        _verbose = beVerbose;
  -    }
  -
  -    /**
  -     * Returns the database name.
  -     *
  -     * @return   The database name
  -     */
  -    public String getDatabaseName()
  -    {
  -        return _databaseName;
  +        _isVerbose = beVerbose;
       }
   
       /**
  @@ -146,6 +132,16 @@
       }
   
       /**
  +     * Returns the database name.
  +     *
  +     * @return   The database name
  +     */
  +    public String getDatabaseName()
  +    {
  +        return _databaseName;
  +    }
  +
  +    /**
        * Sets the databaseName used for the torque schema.
        *
        * @param databaseName  The database name
  @@ -156,6 +152,26 @@
       }
   
       /**
  +     * Specifies whether we should generate foreignkey tags.
  +     * 
  +     * @param generateForeignkeys <code>true</code> if we will generate foreignkey tags
  +     */
  +    public void setGenerateForeignkeys(boolean generateForeignkeys)
  +    {
  +        _isGeneratingForeignkeys = generateForeignkeys;
  +    }
  +
  +    /**
  +     * Returns whether we generate foreignkey tags.
  +     * 
  +     * @return <code>true</code> if we generate foreignkey tags
  +     */
  +    public boolean getGenerateForeignkeys()
  +    {
  +        return _isGeneratingForeignkeys;
  +    }
  +    
  +    /**
        * Called to validate configuration parameters.
        *
        * @exception XDocletException  Is not thrown
  @@ -201,8 +217,6 @@
        */
       protected void engineStarted() throws XDocletException
       {
  -        String generatedFileName = getDestinationFile();
  -
  -        System.out.println(Translator.getString(XDocletMessages.class, XDocletMessages.GENERATING_SOMETHING, new String[]{generatedFileName}));
  +        System.out.println("Generating torque schema ("+getDestinationFile()+")");
       }
   }
  
  
  
  1.2       +28 -3     db-ojb/src/xdoclet/test/xdoclet/junit/XDocletRunner.java
  
  Index: XDocletRunner.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/test/xdoclet/junit/XDocletRunner.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XDocletRunner.java	15 Dec 2003 20:09:10 -0000	1.1
  +++ XDocletRunner.java	21 Jan 2004 00:01:22 -0000	1.2
  @@ -55,6 +55,7 @@
    */
   
   import java.io.*;
  +import java.lang.reflect.Method;
   import java.util.ArrayList;
   import java.util.HashMap;
   import java.util.Iterator;
  @@ -214,7 +215,7 @@
           for (Iterator it = _taskProperties.keySet().iterator(); it.hasNext();)
           {
               name = (String)it.next();
  -            setProperty(task, name, (String)_taskProperties.get(name));
  +            setProperty(task, name, _taskProperties.get(name));
           }
   
           return task;
  @@ -235,7 +236,7 @@
           for (Iterator it = _subTaskProperties.keySet().iterator(); it.hasNext();)
           {
               name = (String)it.next();
  -            setProperty(subTask, name, (String)_subTaskProperties.get(name));
  +            setProperty(subTask, name, _subTaskProperties.get(name));
           }
   
           return subTask;
  @@ -250,7 +251,31 @@
               methodName += propertyName.substring(1);
           }
   
  -        obj.getClass().getMethod(methodName, new Class[]{propertyValue.getClass()}).invoke(obj, new Object[]{propertyValue});
  +        Method method = null;
  +
  +        try
  +        {
  +            method = obj.getClass().getMethod(methodName, new Class[]{propertyValue.getClass()});
  +        }
  +        catch (NoSuchMethodException ex)
  +        {
  +            // we trying any method with that name then
  +            Method[] methods = obj.getClass().getMethods();
  +
  +            for (int idx = 0; idx < methods.length; idx++)
  +            {
  +                if (methodName.equals(methods[idx].getName()))
  +                {
  +                    method = methods[idx];
  +                    break;
  +                }
  +            }
  +            if (method == null)
  +            {
  +                throw ex;
  +            }
  +        }
  +        method.invoke(obj, new Object[]{propertyValue});
       }
   
       private String getDestFileContents(String filename) throws IOException
  
  
  

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