db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject cvs commit: db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests ReferenceTagClassRefAttributeTests.java
Date Fri, 25 Jun 2004 13:36:49 GMT
tomdz       2004/06/25 06:36:49

  Modified:    src/xdoclet/test/xdoclet/modules/ojb/tests
                        ReferenceTagClassRefAttributeTests.java
  Log:
  Added testcase for self-reference with anonymous foreignkey
  
  Revision  Changes    Path
  1.4       +65 -0     db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/ReferenceTagClassRefAttributeTests.java
  
  Index: ReferenceTagClassRefAttributeTests.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/xdoclet/test/xdoclet/modules/ojb/tests/ReferenceTagClassRefAttributeTests.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ReferenceTagClassRefAttributeTests.java	5 Apr 2004 12:16:17 -0000	1.3
  +++ ReferenceTagClassRefAttributeTests.java	25 Jun 2004 13:36:49 -0000	1.4
  @@ -811,4 +811,69 @@
               "</database>",
               runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
       }
  +
  +    // Test: no class-ref attribute specified, self-reference with anonymous foreignkey
  +    public void testClassRef17()
  +    {
  +        addClass(
  +            "test.A",
  +            "package test;\n"+
  +            "/** @ojb.class\n"+
  +            "  * @ojb.field name=\"attrKey\"\n"+
  +            "  *            jdbc-type=\"INTEGER\"\n"+
  +            "  */\n"+
  +            "public class A {\n"+
  +            "  /** @ojb.field primarykey=\"true\" */\n"+
  +            "  private int id;\n"+
  +            "  /** @ojb.reference foreignkey=\"attrKey\" */\n"+
  +            "  private test.A attr;\n"+
  +            "}\n");
  +
  +        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"+
  +            "        access=\"anonymous\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "    <field-descriptor\n"+
  +            "        name=\"id\"\n"+
  +            "        column=\"id\"\n"+
  +            "        jdbc-type=\"INTEGER\"\n"+
  +            "        primarykey=\"true\"\n"+
  +            "    >\n"+
  +            "    </field-descriptor>\n"+
  +            "    <reference-descriptor\n"+
  +            "        name=\"attr\"\n"+
  +            "        class-ref=\"test.A\"\n"+
  +            "    >\n"+
  +            "        <foreignkey field-ref=\"attrKey\"/>\n"+
  +            "    </reference-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"+
  +            "        <column name=\"id\"\n"+
  +            "                javaName=\"id\"\n"+
  +            "                type=\"INTEGER\"\n"+
  +            "                primaryKey=\"true\"\n"+
  +            "                required=\"true\"\n"+
  +            "        />\n"+
  +            "        <foreign-key foreignTable=\"A\">\n"+
  +            "            <reference local=\"attrKey\" foreign=\"id\"/>\n"+
  +            "        </foreign-key>\n"+
  +            "    </table>\n"+
  +            "</database>",
  +            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
  +    }
   }
  
  
  

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


Mime
View raw message