db-torque-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t.@apache.org
Subject svn commit: r503310 - in /db/torque: generator/trunk/xdocs/ site/trunk/xdocs/ templates/trunk/src/templates/om/ test/trunk/test-project/src/java/org/apache/torque/ test/trunk/test-project/src/schema/
Date Sat, 03 Feb 2007 21:05:46 GMT
Author: tv
Date: Sat Feb  3 13:05:45 2007
New Revision: 503310

URL: http://svn.apache.org/viewvc?view=rev&rev=503310
Log:
Fix the handling of interfaces while re-introducing 
backward compatibility. Add documentation and test cases.
Fixes TORQUE-76.

Modified:
    db/torque/generator/trunk/xdocs/schema-reference.xml
    db/torque/site/trunk/xdocs/changes.xml
    db/torque/templates/trunk/src/templates/om/BaseManager.vm
    db/torque/templates/trunk/src/templates/om/Control.vm
    db/torque/templates/trunk/src/templates/om/ControlBase.vm
    db/torque/templates/trunk/src/templates/om/ExtensionManager.vm
    db/torque/templates/trunk/src/templates/om/MapBuilder.vm
    db/torque/templates/trunk/src/templates/om/Object.vm
    db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm
    db/torque/templates/trunk/src/templates/om/Peer.vm
    db/torque/test/trunk/test-project/src/java/org/apache/torque/DataTest.java
    db/torque/test/trunk/test-project/src/java/org/apache/torque/ManagerTestConditional.java
    db/torque/test/trunk/test-project/src/schema/bookstore-schema.xml

Modified: db/torque/generator/trunk/xdocs/schema-reference.xml
URL: http://svn.apache.org/viewvc/db/torque/generator/trunk/xdocs/schema-reference.xml?view=diff&rev=503310&r1=503309&r2=503310
==============================================================================
--- db/torque/generator/trunk/xdocs/schema-reference.xml (original)
+++ db/torque/generator/trunk/xdocs/schema-reference.xml Sat Feb  3 13:05:45 2007
@@ -302,10 +302,16 @@
              <td>interface</td>
              <td>The interface attribute specifies an interface that should
                  be referenced in the <code>implements</code> section of the

-                 generated extension class. This must be the fully qualified 
-                 class name of the interface to be implemented. This feature 
-                 allows to use Torque generated classes in the context of other 
-                 applications or APIs.</td>
+                 generated extension class. If this is a fully qualified 
+                 class name (i. e. the string contains dots), the interface 
+                 will simply be implemented by the extension object. If the 
+                 interface is a simple class name (without dots), an empty 
+                 interface file  will be generated in the extension object 
+                 package.
+                 When this attribute is used, all methods that normally
+                 would return the extension object type will now return the
+                 interface type. This feature allows to use Torque generated 
+                 classes in the context of other applications or APIs.</td>
            </tr>
            <tr>
              <td>javaNamingMethod</td>

Modified: db/torque/site/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/db/torque/site/trunk/xdocs/changes.xml?view=diff&rev=503310&r1=503309&r2=503310
==============================================================================
--- db/torque/site/trunk/xdocs/changes.xml (original)
+++ db/torque/site/trunk/xdocs/changes.xml Sat Feb  3 13:05:45 2007
@@ -32,9 +32,13 @@
   <body>
 
   <release version="3.3" date="in SVN">
+    <action type="fix" dev="tv" issue="TORQUE-76" due-to="Ronny Völker">
+      Fix the handling of interfaces while keeping backward compatibility.
+      Add documentation and test cases.
+    </action>
     <action type="fix" dev="tfischer" issue="TORQUE-80" due-to="Brian Telintelo">
       In the JdbcTransformTask of the generator, the attribute 
-      &quot;default&qout; is only aded to the generated schema if its value
+      &quot;default&quot; is only added to the generated schema if its value
       is not empty.
     </action>
     <action type="add" dev="tfischer" issue="TORQUE-79">

Modified: db/torque/templates/trunk/src/templates/om/BaseManager.vm
URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/BaseManager.vm?view=diff&rev=503310&r1=503309&r2=503310
==============================================================================
--- db/torque/templates/trunk/src/templates/om/BaseManager.vm (original)
+++ db/torque/templates/trunk/src/templates/om/BaseManager.vm Sat Feb  3 13:05:45 2007
@@ -21,9 +21,14 @@
  *#
 #set ($interfaceName = $table.JavaName)
 #if ($table.Interface)
-  #set ($interfaceName = $table.Interface)
+  #set($lastdotpos = $table.Interface.lastIndexOf('.'))
+  #if($lastdotpos != -1)
+    #set ($lastdotpos = $lastdotpos + 1)
+    #set ($interfaceName = $table.Interface.substring($lastdotpos))
+  #else
+    #set ($interfaceName = $table.Interface)
+  #end
 #end
-
 package ${packageBaseManager};
 
 import java.math.BigDecimal;
@@ -52,6 +57,13 @@
 import ${packageObject}.*;
 #end
 
+#if ($table.Interface)
+  #set($lastdotpos = $table.Interface.lastIndexOf('.'))
+  #if($lastdotpos != -1)
+import ${table.Interface};
+  #end
+#end
+
 /**
  * This class manages $interfaceName objects.
 #if ($table.description)
@@ -77,8 +89,8 @@
 
 #end
     /** The name of the manager */
-    protected static final String MANAGED_CLASS = "${packageObject}.${interfaceName}";
-
+    protected static final String MANAGED_CLASS = "${packageObject}.${table.JavaName}";
+   
     /** The name of our class to pass to Torque as the default manager. */
     protected static final String DEFAULT_MANAGER_CLASS
         = "${packageManager}.${interfaceName}Manager";
@@ -247,7 +259,7 @@
     public $basePrefix${interfaceName}Manager()
         throws TorqueException
     {
-        setClassName("${packageObject}.${interfaceName}");
+        setClassName($basePrefix${interfaceName}Manager.MANAGED_CLASS);
     }
 
     /**

Modified: db/torque/templates/trunk/src/templates/om/Control.vm
URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/Control.vm?view=diff&rev=503310&r1=503309&r2=503310
==============================================================================
--- db/torque/templates/trunk/src/templates/om/Control.vm (original)
+++ db/torque/templates/trunk/src/templates/om/Control.vm Sat Feb  3 13:05:45 2007
@@ -116,7 +116,13 @@
         #if ($useManagers && $tbl.PrimaryKey.size() > 0)
           #set ($interfaceName = $tbl.JavaName)
           #if ($tbl.Interface)
-            #set ($interfaceName = $tbl.Interface)
+            #set($lastdotpos = $tbl.Interface.lastIndexOf('.'))
+            #if($lastdotpos != -1)
+              #set ($lastdotpos = $lastdotpos + 1)
+              #set ($interfaceName = $tbl.Interface.substring($lastdotpos))
+            #else
+              #set ($interfaceName = $tbl.Interface)
+            #end
           #end
 
           #set ( $fname = "${interfaceName}Manager.java" )
@@ -136,6 +142,14 @@
         #set ( $path = "${strings.getPackageAsPath($packagePeer)}$fname" )
         #if (!$files.file($basePath,$path).exists())
           $generator.parse("om/ExtensionPeer.vm",$path,"table",$tbl)
+        #end
+
+        #if ($tbl.Interface && $tbl.Interface.indexOf('.') == -1)
+          #set ( $fname = "${tbl.Interface}.java" )
+          #set ( $path = "${strings.getPackageAsPath($packageObject)}$fname" )
+          #if (!$files.file($basePath,$path).exists())
+            $generator.parse("om/Interface.vm",$path,"table",$tbl)
+          #end
         #end
 
         #if ($generateBeans)

Modified: db/torque/templates/trunk/src/templates/om/ControlBase.vm
URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/ControlBase.vm?view=diff&rev=503310&r1=503309&r2=503310
==============================================================================
--- db/torque/templates/trunk/src/templates/om/ControlBase.vm (original)
+++ db/torque/templates/trunk/src/templates/om/ControlBase.vm Sat Feb  3 13:05:45 2007
@@ -142,7 +142,13 @@
         #if ($useManagers && $tbl.PrimaryKey.size() > 0)
           #set ($interfaceName = $tbl.JavaName)
           #if ($tbl.Interface)
-            #set ($interfaceName = $tbl.Interface)
+            #set($lastdotpos = $tbl.Interface.lastIndexOf('.'))
+            #if($lastdotpos != -1)
+              #set ($lastdotpos = $lastdotpos + 1)
+              #set ($interfaceName = $tbl.Interface.substring($lastdotpos))
+            #else
+              #set ($interfaceName = $tbl.Interface)
+            #end
           #end
 
           #set ( $fname = "${basePrefix}${interfaceName}Manager.java" )

Modified: db/torque/templates/trunk/src/templates/om/ExtensionManager.vm
URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/ExtensionManager.vm?view=diff&rev=503310&r1=503309&r2=503310
==============================================================================
--- db/torque/templates/trunk/src/templates/om/ExtensionManager.vm (original)
+++ db/torque/templates/trunk/src/templates/om/ExtensionManager.vm Sat Feb  3 13:05:45 2007
@@ -20,9 +20,14 @@
  *#
 #set ($interfaceName = $table.JavaName)
 #if ($table.Interface)
-  #set ($interfaceName = $table.Interface)
+  #set($lastdotpos = $table.Interface.lastIndexOf('.'))
+  #if($lastdotpos != -1)
+    #set ($lastdotpos = $lastdotpos + 1)
+    #set ($interfaceName = $table.Interface.substring($lastdotpos))
+  #else
+    #set ($interfaceName = $table.Interface)
+  #end
 #end
-
 package $packageManager;
 
 import org.apache.torque.TorqueException;

Modified: db/torque/templates/trunk/src/templates/om/MapBuilder.vm
URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/MapBuilder.vm?view=diff&rev=503310&r1=503309&r2=503310
==============================================================================
--- db/torque/templates/trunk/src/templates/om/MapBuilder.vm (original)
+++ db/torque/templates/trunk/src/templates/om/MapBuilder.vm Sat Feb  3 13:05:45 2007
@@ -115,7 +115,13 @@
 #if ($useManagers && $table.PrimaryKey.size() > 0)
   #set ($interfaceName = $table.JavaName)
   #if ($table.Interface)
-    #set ($interfaceName = $table.Interface)
+    #set($lastdotpos = $table.Interface.lastIndexOf('.'))
+    #if($lastdotpos != -1)
+      #set ($lastdotpos = $lastdotpos + 1)
+      #set ($interfaceName = $table.Interface.substring($lastdotpos))
+    #else
+      #set ($interfaceName = $table.Interface)
+    #end
   #end
         tMap.setUseManager(true);
         tMap.setManagerClass( ${packageManager}.${interfaceName}Manager.class );

Modified: db/torque/templates/trunk/src/templates/om/Object.vm
URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/Object.vm?view=diff&rev=503310&r1=503309&r2=503310
==============================================================================
--- db/torque/templates/trunk/src/templates/om/Object.vm (original)
+++ db/torque/templates/trunk/src/templates/om/Object.vm Sat Feb  3 13:05:45 2007
@@ -82,6 +82,16 @@
   #end
 #end
 
+#if ($complexObjectModel)
+#foreach ($col in $table.Columns)
+ #if ($col.isForeignKey())
+  #set ( $tblFK = $table.Database.getTable($col.RelatedTableName) )
+  #if ($tblFK.Interface && $tblFK.Interface.indexOf('.') != -1)
+import $tblFK.Interface;
+  #end
+ #end
+#end
+#end
 #if ($generateBeans)
   $generator.parse("om/bean/ObjectBeanImports.vm",$path,"child",$child)
 #end
@@ -230,7 +240,13 @@
         #set ( $tblFK = $table.Database.getTable($col.RelatedTableName) )
         #set ($interfaceName = $tblFK.JavaName)
         #if ($tblFK.Interface)
-          #set ($interfaceName = $tblFK.Interface)
+          #set($lastdotpos = $tblFK.Interface.lastIndexOf('.'))
+          #if($lastdotpos != -1)
+            #set ($lastdotpos = $lastdotpos + 1)
+            #set ($interfaceName = $tblFK.Interface.substring($lastdotpos))
+          #else
+            #set ($interfaceName = $tblFK.Interface)
+          #end
         #end
         #set ( $colFK = $tblFK.getColumn($col.RelatedColumnName) )
         #if ($col.isMultipleFK() || $col.RelatedTableName.equals($table.Name))
@@ -296,7 +312,13 @@
     #set ( $className = $tblFK.JavaName )
     #set ($interfaceName = $tblFK.JavaName)
     #if ($tblFK.Interface)
-      #set ($interfaceName = $tblFK.Interface)
+      #set($lastdotpos = $tblFK.Interface.lastIndexOf('.'))
+      #if($lastdotpos != -1)
+        #set ($lastdotpos = $lastdotpos + 1)
+        #set ($interfaceName = $tblFK.Interface.substring($lastdotpos))
+      #else
+        #set ($interfaceName = $tblFK.Interface)
+      #end
     #end
 
     #set ( $relCol = "" )
@@ -606,7 +628,13 @@
 
     #set ($interfaceName = $table.JavaName)
     #if ($table.Interface)
-      #set ($interfaceName = $table.Interface)
+      #set($lastdotpos = $table.Interface.lastIndexOf('.'))
+      #if($lastdotpos != -1)
+        #set ($lastdotpos = $lastdotpos + 1)
+        #set ($interfaceName = $table.Interface.substring($lastdotpos))
+      #else
+        #set ($interfaceName = $table.Interface)
+      #end
     #end
 
     /**

Modified: db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm
URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm?view=diff&rev=503310&r1=503309&r2=503310
==============================================================================
--- db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm (original)
+++ db/torque/templates/trunk/src/templates/om/ObjectWithManager.vm Sat Feb  3 13:05:45 2007
@@ -93,6 +93,16 @@
 import ${packageManager}.*;
 #end
 
+#if ($complexObjectModel)
+#foreach ($col in $table.Columns)
+ #if ($col.isForeignKey())
+  #set ( $tblFK = $table.Database.getTable($col.RelatedTableName) )
+  #if ($tblFK.Interface && $tblFK.Interface.indexOf('.') != -1)
+import $tblFK.Interface;
+  #end
+ #end
+#end
+#end
 #if ($generateBeans)
   $generator.parse("om/bean/ObjectBeanImports.vm",$path,"child",$child)
 #end
@@ -241,7 +251,13 @@
         #set ( $tblFK = $table.Database.getTable($col.RelatedTableName) )
         #set ($interfaceName = $tblFK.JavaName)
         #if ($tblFK.Interface)
-          #set ($interfaceName = $tblFK.Interface)
+          #set($lastdotpos = $tblFK.Interface.lastIndexOf('.'))
+          #if($lastdotpos != -1)
+            #set ($lastdotpos = $lastdotpos + 1)
+            #set ($interfaceName = $tblFK.Interface.substring($lastdotpos))
+          #else
+            #set ($interfaceName = $tblFK.Interface)
+          #end
         #end
         #set ( $colFK = $tblFK.getColumn($col.RelatedColumnName) )
         #if ($col.isMultipleFK() || $col.RelatedTableName.equals($table.Name))
@@ -307,7 +323,13 @@
     #set ( $className = $tblFK.JavaName )
     #set ($interfaceName = $tblFK.JavaName)
     #if ($tblFK.Interface)
-      #set ($interfaceName = $tblFK.Interface)
+      #set($lastdotpos = $tblFK.Interface.lastIndexOf('.'))
+      #if($lastdotpos != -1)
+        #set ($lastdotpos = $lastdotpos + 1)
+        #set ($interfaceName = $tblFK.Interface.substring($lastdotpos))
+      #else
+        #set ($interfaceName = $tblFK.Interface)
+      #end
     #end
 
     #set ( $relCol = "" )
@@ -622,9 +644,15 @@
     }
 
         #set ($interfaceName = $table.JavaName)
-        #if ($table.Interface)
-          #set ($interfaceName = $table.Interface)
-        #end
+	    #if ($table.Interface)
+	      #set($lastdotpos = $table.Interface.lastIndexOf('.'))
+	      #if($lastdotpos != -1)
+	        #set ($lastdotpos = $lastdotpos + 1)
+	        #set ($interfaceName = $table.Interface.substring($lastdotpos))
+	      #else
+	        #set ($interfaceName = $table.Interface)
+	      #end
+	    #end
 
     /**
      * Method called to associate a $tblFK.JavaName object to this object
@@ -1459,9 +1487,15 @@
 
   #if ($tableHasPrimaryKey)
     #set ($interfaceName = $table.JavaName)
-    #if ($table.Interface)
-      #set ($interfaceName = $table.Interface)
-    #end
+	#if ($table.Interface)
+	  #set($lastdotpos = $table.Interface.lastIndexOf('.'))
+	  #if($lastdotpos != -1)
+	    #set ($lastdotpos = $lastdotpos + 1)
+	    #set ($interfaceName = $table.Interface.substring($lastdotpos))
+	  #else
+	    #set ($interfaceName = $table.Interface)
+	  #end
+	#end
                 if (isCacheOnSave())
                 {
                     ${interfaceName}Manager.putInstance(this);

Modified: db/torque/templates/trunk/src/templates/om/Peer.vm
URL: http://svn.apache.org/viewvc/db/torque/templates/trunk/src/templates/om/Peer.vm?view=diff&rev=503310&r1=503309&r2=503310
==============================================================================
--- db/torque/templates/trunk/src/templates/om/Peer.vm (original)
+++ db/torque/templates/trunk/src/templates/om/Peer.vm Sat Feb  3 13:05:45 2007
@@ -54,6 +54,17 @@
 import ${packagePeer}.*;
 #end
 
+#if ($complexObjectModel)
+#foreach ($col in $table.Columns)
+ #if ($col.isForeignKey())
+  #set ( $tblFK = $table.Database.getTable($col.RelatedTableName) )
+  #if ($tblFK.Interface && $tblFK.Interface.indexOf('.') != -1)
+import $tblFK.Interface;
+  #end
+ #end
+#end
+#end
+
 /**
 #if ($table.description)
  * $!table.description
@@ -1118,7 +1129,13 @@
         #set ( $joinClassName = $joinTable.JavaName )
         #set ($interfaceName = $joinTable.JavaName)
         #if ($joinTable.Interface)
-          #set ($interfaceName = $joinTable.Interface)
+          #set($lastdotpos = $joinTable.Interface.lastIndexOf('.'))
+          #if($lastdotpos != -1)
+            #set ($lastdotpos = $lastdotpos + 1)
+            #set ($interfaceName = $joinTable.Interface.substring($lastdotpos))
+          #else
+            #set ($interfaceName = $joinTable.Interface)
+          #end
         #end
 
         #if ($partJoinName == "")
@@ -1205,7 +1222,7 @@
             $classDecl omClass = ${table.JavaName}Peer.getOMClass();
         #end
         #set ($classDecl = "")
-            $className obj1 = ${table.JavaName}Peer
+            $className obj1 = ($className) ${table.JavaName}Peer
                 .row2Object(row, 1, omClass);
         #if ($joinTable.ChildrenColumn)
             $classDecl omClass = ${joinClassName}Peer.getOMClass(row, offset);
@@ -1213,14 +1230,14 @@
             $classDecl omClass = ${joinClassName}Peer.getOMClass();
         #end
         #set ($classDecl = "")
-            $joinClassName obj2 = ${joinClassName}Peer
+            $joinClassName obj2 = ($joinClassName) ${joinClassName}Peer
                 .row2Object(row, offset, omClass);
 
             boolean newObject = true;
             for (int j = 0; j < results.size(); j++)
             {
                 $className temp_obj1 = #if(!$enableJava5Features)($className)#end results.get(j);
-                $joinClassName temp_obj2 = temp_obj1.get${joinInterface}();
+                $joinClassName temp_obj2 = ($joinClassName) temp_obj1.get${joinInterface}();
                 if (temp_obj2.getPrimaryKey().equals(obj2.getPrimaryKey()))
                 {
                     newObject = false;
@@ -1366,7 +1383,7 @@
             $classDecl omClass = ${table.JavaName}Peer.getOMClass();
         #end
         #set ($classDecl = "")
-            $className obj1 = ${table.JavaName}Peer
+            $className obj1 = ($className) ${table.JavaName}Peer
                 .row2Object(row, 1, omClass);
         #set ( $index = 1 )
         #foreach ($fk in $table.ForeignKeys)
@@ -1376,8 +1393,14 @@
             #set ( $joinClassName = $joinTable.JavaName )
             #set ($interfaceName = $joinTable.JavaName)
             #if ($joinTable.Interface)
-              #set ($interfaceName = $joinTable.Interface)
-            #end
+	          #set($lastdotpos = $joinTable.Interface.lastIndexOf('.'))
+	          #if($lastdotpos != -1)
+	            #set ($lastdotpos = $lastdotpos + 1)
+	            #set ($interfaceName = $joinTable.Interface.substring($lastdotpos))
+	          #else
+	            #set ($interfaceName = $joinTable.Interface)
+	          #end
+	        #end
 
             #if (!$joinClassName.equals($excludeClassName))
               #set ( $partJoinName = "" )
@@ -1406,14 +1429,14 @@
             $classDecl omClass = ${joinClassName}Peer.getOMClass();
               #end
               #set ($classDecl = "")
-            $joinClassName obj$index = ${joinClassName}Peer
+            $joinClassName obj$index = ($joinClassName) ${joinClassName}Peer
                 .row2Object( row, offset$index, omClass);
 
               #if ($index == 2) boolean #end newObject = true;
             for (int j = 0; j < results.size(); j++)
             {
                 $className temp_obj1 = #if(!$enableJava5Features)($className)#end results.get(j);
-                $joinClassName temp_obj$index = temp_obj1.get${joinString}();
+                $joinClassName temp_obj$index = ($joinClassName) temp_obj1.get${joinString}();
                 if (temp_obj${index}.getPrimaryKey().equals(obj${index}.getPrimaryKey()))
                 {
                     newObject = false;

Modified: db/torque/test/trunk/test-project/src/java/org/apache/torque/DataTest.java
URL: http://svn.apache.org/viewvc/db/torque/test/trunk/test-project/src/java/org/apache/torque/DataTest.java?view=diff&rev=503310&r1=503309&r2=503310
==============================================================================
--- db/torque/test/trunk/test-project/src/java/org/apache/torque/DataTest.java (original)
+++ db/torque/test/trunk/test-project/src/java/org/apache/torque/DataTest.java Sat Feb  3
13:05:45 2007
@@ -68,10 +68,13 @@
 import org.apache.torque.test.DateTestPeer;
 import org.apache.torque.test.IfcTable;
 import org.apache.torque.test.IfcTablePeer;
+import org.apache.torque.test.IfcTable2;
+import org.apache.torque.test.IfcTable2Peer;
 import org.apache.torque.test.IntegerPk;
 import org.apache.torque.test.IntegerPkPeer;
 import org.apache.torque.test.LargePk;
 import org.apache.torque.test.LargePkPeer;
+import org.apache.torque.test.LocalTestInterface;
 import org.apache.torque.test.MultiPk;
 import org.apache.torque.test.MultiPkForeignKey;
 import org.apache.torque.test.MultiPkForeignKeyPeer;
@@ -1698,6 +1701,23 @@
             assertTrue("IfcTablePeer.doSelect should return instances of TestInterface",

                     i.next() instanceof TestInterface);
         }
+        
+        IfcTable2 ifc2 = new IfcTable2();
+
+        assertTrue("IfcTable2 should be an instance of LocalTestInterface", ifc2 instanceof
LocalTestInterface);
+
+        ifc2.setID(1);
+        ifc2.setName("John Doe");
+        ifc2.save();
+
+        List results2 = IfcTable2Peer.doSelect(new Criteria());
+        
+        for (Iterator i = results2.iterator(); i.hasNext();)
+        {
+            assertTrue("IfcTable2Peer.doSelect should return instances of LocalTestInterface",

+                    i.next() instanceof LocalTestInterface);
+        }
+        
     }
 
     public void testEscaping() throws Exception

Modified: db/torque/test/trunk/test-project/src/java/org/apache/torque/ManagerTestConditional.java
URL: http://svn.apache.org/viewvc/db/torque/test/trunk/test-project/src/java/org/apache/torque/ManagerTestConditional.java?view=diff&rev=503310&r1=503309&r2=503310
==============================================================================
--- db/torque/test/trunk/test-project/src/java/org/apache/torque/ManagerTestConditional.java
(original)
+++ db/torque/test/trunk/test-project/src/java/org/apache/torque/ManagerTestConditional.java
Sat Feb  3 13:05:45 2007
@@ -25,6 +25,9 @@
 import org.apache.torque.test.Book;
 import org.apache.torque.test.BookManager;
 import org.apache.torque.test.BookPeer;
+import org.apache.torque.test.IfcTable;
+import org.apache.torque.test.LocalTestInterface;
+import org.apache.torque.test.TestInterfaceManager;
 import org.apache.torque.util.Criteria;
 
 /**
@@ -75,6 +78,17 @@
         assertTrue("Author1 and the author of MyBook should point to the same cache instance",
author1 == mybook.getAuthor());
     }
     
+    /**
+     * Tests whether managers return the right interface
+     * @throws Exception if the test fails
+     */
+    public void testInterfaces() throws Exception
+    {
+        TestInterface ifc = TestInterfaceManager.getInstance();
+        
+        assertTrue("TestInterfaceManager should create instances of TestInterface", ifc instanceof
TestInterface);
+        assertTrue("TestInterfaceManager should also create instances of IfcTable", ifc instanceof
IfcTable);
+    }
 
     /**
      * Deletes all authors and books in the bookstore tables

Modified: db/torque/test/trunk/test-project/src/schema/bookstore-schema.xml
URL: http://svn.apache.org/viewvc/db/torque/test/trunk/test-project/src/schema/bookstore-schema.xml?view=diff&rev=503310&r1=503309&r2=503310
==============================================================================
--- db/torque/test/trunk/test-project/src/schema/bookstore-schema.xml (original)
+++ db/torque/test/trunk/test-project/src/schema/bookstore-schema.xml Sat Feb  3 13:05:45
2007
@@ -277,6 +277,22 @@
   	description="this table implements an interface">
     <column
       name="id" javaName="ID"
+      primaryKey="true" required="true"
+      type="INTEGER"
+    />
+    <column
+      name="name" javaName="Name"
+      type="VARCHAR"
+      size="50"
+    />
+  </table>
+
+  <table name="ifc_table2" idMethod="none"
+  	interface="LocalTestInterface"
+  	description="this table implements a local interface">
+    <column
+      name="id" javaName="ID"
+      primaryKey="true" required="true"
       type="INTEGER"
     />
     <column



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


Mime
View raw message