db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r383358 [2/5] - in /db/ojb/trunk: lib/ src/doc/forrest/src/documentation/content/xdocs/docu/guides/ src/xdoclet/java/src/xdoclet/modules/ojb/ src/xdoclet/java/src/xdoclet/modules/ojb/constraints/ src/xdoclet/java/src/xdoclet/modules/ojb/mod...
Date Sun, 05 Mar 2006 17:31:12 GMT
Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagGenerateRepositoryInfoAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagGenerateRepositoryInfoAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagGenerateRepositoryInfoAttributeTests.java
(original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagGenerateRepositoryInfoAttributeTests.java
Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagGenerateTableInfoAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagGenerateTableInfoAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagGenerateTableInfoAttributeTests.java
(original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagGenerateTableInfoAttributeTests.java
Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagIncludeInheritedAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagIncludeInheritedAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagIncludeInheritedAttributeTests.java
(original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagIncludeInheritedAttributeTests.java
Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagInitializationMethodAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagInitializationMethodAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagInitializationMethodAttributeTests.java
(original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagInitializationMethodAttributeTests.java
Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagIsolationLevelAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagIsolationLevelAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagIsolationLevelAttributeTests.java
(original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagIsolationLevelAttributeTests.java
Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagProxyAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagProxyAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagProxyAttributeTests.java
(original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagProxyAttributeTests.java
Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagRefreshAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagRefreshAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagRefreshAttributeTests.java
(original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagRefreshAttributeTests.java
Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagRowReaderAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagRowReaderAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagRowReaderAttributeTests.java
(original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagRowReaderAttributeTests.java
Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagSimpleTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagSimpleTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagSimpleTests.java (original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagSimpleTests.java Sun Mar
 5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagTableAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagTableAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagTableAttributeTests.java
(original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagTableAttributeTests.java
Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagTableDocumentationAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagTableDocumentationAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagTableDocumentationAttributeTests.java
(original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/ClassTagTableDocumentationAttributeTests.java
Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagAttributesAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagAttributesAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagAttributesAttributeTests.java
(original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagAttributesAttributeTests.java
Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagAutoDeleteAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagAutoDeleteAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagAutoDeleteAttributeTests.java
(original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagAutoDeleteAttributeTests.java
Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagAutoRetrieveAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagAutoRetrieveAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagAutoRetrieveAttributeTests.java
(original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagAutoRetrieveAttributeTests.java
Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagAutoUpdateAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagAutoUpdateAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagAutoUpdateAttributeTests.java
(original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagAutoUpdateAttributeTests.java
Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagCollectionClassAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagCollectionClassAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagCollectionClassAttributeTests.java
(original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagCollectionClassAttributeTests.java
Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagDocumentationAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagDocumentationAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagDocumentationAttributeTests.java
(original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagDocumentationAttributeTests.java
Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagElementClassRefAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagElementClassRefAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagElementClassRefAttributeTests.java
(original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagElementClassRefAttributeTests.java
Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2005 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.

Modified: db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagForeignkeyAttributeTests.java
URL: http://svn.apache.org/viewcvs/db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagForeignkeyAttributeTests.java?rev=383358&r1=383357&r2=383358&view=diff
==============================================================================
--- db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagForeignkeyAttributeTests.java
(original)
+++ db/ojb/trunk/src/xdoclet/test/xdoclet/modules/ojb/tests/CollectionTagForeignkeyAttributeTests.java
Sun Mar  5 09:31:00 2006
@@ -1,6 +1,6 @@
 package xdoclet.modules.ojb.tests;
 
-/* Copyright 2003-2004 The Apache Software Foundation
+/* Copyright 2003-2006 The Apache Software Foundation
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@
 /**
  * Tests for the ojb.collection tag with the foreignkey attribute.
  *
- * @author <a href="mailto:tomdz@users.sourceforge.net">Thomas Dudziak (tomdz@users.sourceforge.net)</a>
+ * @author Thomas Dudziak
  */
 public class CollectionTagForeignkeyAttributeTests extends OjbTestBase
 {
@@ -1589,6 +1589,518 @@
             "                javaName=\"aid\"\n"+
             "                type=\"INTEGER\"\n"+
             "        />\n"+
+            "    </table>\n"+
+            "</database>",
+            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: foreignkey name specified
+    public void testForeignkeyName1()
+    {
+        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"+
+            "    *                 foreignkey-name=\"FKToB\"\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"+
+            "        <foreign-key name=\"FKToB\" foreignTable=\"A\">\n"+
+            "            <reference local=\"aid\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "    </table>\n"+
+            "</database>",
+            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: foreignkey name attribute is empty
+    public void testForeignkeyName2()
+    {
+        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"+
+            "    *                 foreignkey-name=\"\"\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"+
+            "        <foreign-key foreignTable=\"A\">\n"+
+            "            <reference local=\"aid\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "    </table>\n"+
+            "</database>",
+            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: foreignkey-on-delete specified
+    public void testForeignkeyOnDelete1()
+    {
+        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"+
+            "    *                 foreignkey-on-delete=\"restrict\"\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"+
+            "        <foreign-key foreignTable=\"A\" onDelete=\"restrict\">\n"+
+            "            <reference local=\"aid\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "    </table>\n"+
+            "</database>",
+            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: foreignkey-on-delete specified with empty value
+    public void testForeignkeyOnDelete2()
+    {
+        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"+
+            "    *                 foreignkey-on-delete=\"\"\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-on-delete specified with illegal value
+    public void testForeignkeyOnDelete3()
+    {
+        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"+
+            "    *                 foreignkey-on-delete=\"no cascade\"\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-on-update specified
+    public void testForeignkeyOnUpdate1()
+    {
+        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"+
+            "    *                 foreignkey-on-update=\"none\"\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"+
+            "        <foreign-key foreignTable=\"A\" onUpdate=\"none\">\n"+
+            "            <reference local=\"aid\" foreign=\"id\"/>\n"+
+            "        </foreign-key>\n"+
+            "    </table>\n"+
+            "</database>",
+            runTorqueXDoclet(TORQUE_DEST_FILE, "ojbtest"));
+    }
+
+    // Test: foreignkey-on-update specified with empty value
+    public void testForeignkeyOnUpdate2()
+    {
+        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"+
+            "    *                 foreignkey-on-update=\"\"\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-on-update specified with illegal value
+    public void testForeignkeyOnUpdate3()
+    {
+        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"+
+            "    *                 foreignkey-on-update=\"nothing\"\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-on-delete and foreignkey-on-update specified
+    public void testForeignkeyOnDeleteAndOnUpdate()
+    {
+        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"+
+            "    *                 foreignkey-on-delete=\"cascade\"\n"+
+            "    *                 foreignkey-on-update=\"cascade\"\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"+
+            "        <foreign-key foreignTable=\"A\" onDelete=\"cascade\" onUpdate=\"cascade\">\n"+
+            "            <reference local=\"aid\" 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