cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r552270 - /cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/dba/AutoAdapterTest.java
Date Sun, 01 Jul 2007 10:26:10 GMT
Author: aadamchik
Date: Sun Jul  1 03:26:07 2007
New Revision: 552270

URL: http://svn.apache.org/viewvc?view=rev&rev=552270
Log:
test to confirm that SQLTemplate template dialects work with auto adapter (they do)

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/dba/AutoAdapterTest.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/dba/AutoAdapterTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/dba/AutoAdapterTest.java?view=diff&rev=552270&r1=552269&r2=552270
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/dba/AutoAdapterTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.4-unpublished/src/test/java/org/apache/cayenne/dba/AutoAdapterTest.java
Sun Jul  1 03:26:07 2007
@@ -19,6 +19,9 @@
 
 package org.apache.cayenne.dba;
 
+import org.apache.art.Artist;
+import org.apache.cayenne.access.jdbc.SQLTemplateAction;
+import org.apache.cayenne.query.SQLTemplate;
 import org.apache.cayenne.unit.CayenneCase;
 
 import com.mockrunner.mock.jdbc.MockConnection;
@@ -44,5 +47,20 @@
 
         assertNotNull(detected);
         assertEquals(getNode().getAdapter().getClass(), detected.getClass());
+    }
+
+    public void testCreateSQLTemplateAction() {
+
+        AutoAdapter adapter = new AutoAdapter(getNode().getDataSource());
+        SQLTemplateAction action = (SQLTemplateAction) adapter.getAction(new SQLTemplate(
+                Artist.class,
+                "select * from artist"), getNode());
+
+        // it is important for SQLTemplateAction to be used with unwrapped adapter, as the
+        // adapter class name is used as a key to the correct SQL template.
+        assertNotNull(action);
+        assertNotNull(action.getAdapter());
+        assertFalse(action.getAdapter() instanceof AutoAdapter);
+        assertSame(adapter.getAdapter(), action.getAdapter());
     }
 }



Mime
View raw message