cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r1144724 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src: main/java/org/apache/cayenne/access/jdbc/ main/java/org/apache/cayenne/dba/ main/java/org/apache/cayenne/dba/oracle/ main/java/org/apache/cayenne/dba/sqlite/ test/j...
Date Sat, 09 Jul 2011 19:52:42 GMT
Author: aadamchik
Date: Sat Jul  9 19:52:41 2011
New Revision: 1144724

URL: http://svn.apache.org/viewvc?rev=1144724&view=rev
Log:
CAY-1573 QueryLogger to DI JdbcEventLogger migration

SQLTemplateAction should work the same as SelectAction etc....

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/SQLTemplateAction.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/JdbcActionBuilder.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8ActionBuilder.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8SQLTemplateAction.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleActionBuilder.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleSQLTemplateAction.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteActionBuilder.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteSQLTemplateAction.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/BindDirectiveTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/ResultDirectiveTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SQLTemplateActionTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SelectActionTest.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseDbAdapterProvider.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseModule.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/SQLTemplateAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/SQLTemplateAction.java?rev=1144724&r1=1144723&r2=1144724&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/SQLTemplateAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/jdbc/SQLTemplateAction.java
Sat Jul  9 19:52:41 2011
@@ -37,9 +37,9 @@ import org.apache.cayenne.DataRow;
 import org.apache.cayenne.access.OperationObserver;
 import org.apache.cayenne.access.types.ExtendedTypeMap;
 import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.dba.TypesMapping;
 import org.apache.cayenne.log.JdbcEventLogger;
-import org.apache.cayenne.log.NoopJdbcEventLogger;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.EntityResolver;
@@ -68,13 +68,13 @@ public class SQLTemplateAction implement
     /**
      * @since 3.0
      */
-    public SQLTemplateAction(SQLTemplate query, DbAdapter adapter,
+    public SQLTemplateAction(SQLTemplate query, JdbcAdapter adapter,
             EntityResolver entityResolver) {
         this.query = query;
         this.adapter = adapter;
         this.queryMetadata = query.getMetaData(entityResolver);
         this.dbEntity = query.getMetaData(entityResolver).getDbEntity();
-        this.logger = NoopJdbcEventLogger.getInstance();
+        this.logger = adapter.getJdbcEventLogger();
     }
 
     /**
@@ -83,14 +83,6 @@ public class SQLTemplateAction implement
     public DbAdapter getAdapter() {
         return adapter;
     }
-    
-    public void setJdbcEventLogger(JdbcEventLogger logger) {
-        this.logger = logger;
-    }
-    
-    public JdbcEventLogger getJdbcEventLogger() {
-        return this.logger;
-    }
 
     /**
      * Runs a SQLTemplate query, collecting all results. If a callback expects an iterated
@@ -107,7 +99,7 @@ public class SQLTemplateAction implement
                     + getAdapter().getClass().getName());
         }
 
-        boolean loggable = getJdbcEventLogger().isLoggable();
+        boolean loggable = logger.isLoggable();
         int size = query.parametersSize();
 
         SQLTemplateProcessor templateProcessor = new SQLTemplateProcessor();
@@ -127,8 +119,7 @@ public class SQLTemplateAction implement
                     nextParameters);
 
             if (loggable) {
-                getJdbcEventLogger().logQuery(compiled.getSql(), Arrays.asList(compiled
-                        .getBindings()));
+                logger.logQuery(compiled.getSql(), Arrays.asList(compiled.getBindings()));
             }
 
             execute(connection, callback, compiled, counts);
@@ -203,7 +194,7 @@ public class SQLTemplateAction implement
                     }
 
                     updateCounts.add(Integer.valueOf(updateCount));
-                    getJdbcEventLogger().logUpdateCount(updateCount);
+                    logger.logUpdateCount(updateCount);
                 }
             }
         }
@@ -235,8 +226,10 @@ public class SQLTemplateAction implement
                 builder.getDescriptor(types),
                 queryMetadata);
 
-        LimitResultIterator it = new LimitResultIterator(result, getFetchOffset(), query
-                .getFetchLimit());
+        LimitResultIterator it = new LimitResultIterator(
+                result,
+                getFetchOffset(),
+                query.getFetchLimit());
 
         if (!iteratedResult) {
 
@@ -245,7 +238,7 @@ public class SQLTemplateAction implement
             // is due here.
             List<DataRow> resultRows = (List<DataRow>) it.allRows();
 
-            getJdbcEventLogger().logSelectCount(resultRows.size(), System.currentTimeMillis()
+            logger.logSelectCount(resultRows.size(), System.currentTimeMillis()
                     - startTime);
 
             callback.nextRows(query, resultRows);
@@ -299,8 +292,9 @@ public class SQLTemplateAction implement
                 if (!builder.isOverriden(attribute.getName())
                         && TypesMapping.isNumeric(attribute.getType())) {
 
-                    builder.overrideColumnType(attribute.getName(), TypesMapping
-                            .getJavaBySqlType(attribute.getType()));
+                    builder.overrideColumnType(
+                            attribute.getName(),
+                            TypesMapping.getJavaBySqlType(attribute.getType()));
                 }
             }
         }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/JdbcActionBuilder.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/JdbcActionBuilder.java?rev=1144724&r1=1144723&r2=1144724&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/JdbcActionBuilder.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/JdbcActionBuilder.java
Sat Jul  9 19:52:41 2011
@@ -73,9 +73,7 @@ public class JdbcActionBuilder implement
     }
 
     public SQLAction sqlAction(SQLTemplate query) {
-        SQLTemplateAction action = new SQLTemplateAction(query, adapter, entityResolver);
-        action.setJdbcEventLogger(logger);
-        return action;
+        return new SQLTemplateAction(query, adapter, entityResolver);
     }
 
     /**

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8ActionBuilder.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8ActionBuilder.java?rev=1144724&r1=1144723&r2=1144724&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8ActionBuilder.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8ActionBuilder.java
Sat Jul  9 19:52:41 2011
@@ -20,7 +20,6 @@
 package org.apache.cayenne.dba.oracle;
 
 import org.apache.cayenne.access.jdbc.BatchAction;
-import org.apache.cayenne.access.jdbc.SQLTemplateAction;
 import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.map.EntityResolver;
 import org.apache.cayenne.query.BatchQuery;
@@ -41,9 +40,7 @@ class Oracle8ActionBuilder extends Oracl
 
     @Override
     public SQLAction sqlAction(SQLTemplate query) {
-        SQLTemplateAction action = new Oracle8SQLTemplateAction(query, adapter, getEntityResolver());
-        action.setJdbcEventLogger(logger);
-        return action;
+        return new Oracle8SQLTemplateAction(query, adapter, getEntityResolver());
     }
 
     @Override
@@ -70,7 +67,7 @@ class Oracle8ActionBuilder extends Oracl
                     query,
                     adapter,
                     getEntityResolver());
-            ((OracleBatchAction)action).setBatch(runningAsBatch);
+            ((OracleBatchAction) action).setBatch(runningAsBatch);
             return action;
         }
     }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8SQLTemplateAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8SQLTemplateAction.java?rev=1144724&r1=1144723&r2=1144724&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8SQLTemplateAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/Oracle8SQLTemplateAction.java
Sat Jul  9 19:52:41 2011
@@ -28,7 +28,7 @@ import java.util.Collection;
 import org.apache.cayenne.access.OperationObserver;
 import org.apache.cayenne.access.jdbc.SQLStatement;
 import org.apache.cayenne.access.jdbc.SQLTemplateAction;
-import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.map.EntityResolver;
 import org.apache.cayenne.query.SQLTemplate;
 
@@ -39,7 +39,8 @@ import org.apache.cayenne.query.SQLTempl
  */
 class Oracle8SQLTemplateAction extends SQLTemplateAction {
 
-    Oracle8SQLTemplateAction(SQLTemplate query, DbAdapter adapter, EntityResolver resolver)
{
+    Oracle8SQLTemplateAction(SQLTemplate query, JdbcAdapter adapter,
+            EntityResolver resolver) {
         super(query, adapter, resolver);
     }
 
@@ -88,7 +89,7 @@ class Oracle8SQLTemplateAction extends S
             else {
                 int updateCount = statement.executeUpdate();
                 updateCounts.add(Integer.valueOf(updateCount));
-                getJdbcEventLogger().logUpdateCount(updateCount);
+                logger.logUpdateCount(updateCount);
             }
 
             // end - code different from super

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleActionBuilder.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleActionBuilder.java?rev=1144724&r1=1144723&r2=1144724&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleActionBuilder.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleActionBuilder.java
Sat Jul  9 19:52:41 2011
@@ -20,7 +20,6 @@
 package org.apache.cayenne.dba.oracle;
 
 import org.apache.cayenne.access.jdbc.BatchAction;
-import org.apache.cayenne.access.jdbc.SQLTemplateAction;
 import org.apache.cayenne.dba.JdbcActionBuilder;
 import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.map.EntityResolver;
@@ -41,9 +40,7 @@ class OracleActionBuilder extends JdbcAc
 
     @Override
     public SQLAction sqlAction(SQLTemplate query) {
-        SQLTemplateAction action = new Oracle8SQLTemplateAction(query, adapter, getEntityResolver());
-        action.setJdbcEventLogger(logger);
-        return action;
+        return new Oracle8SQLTemplateAction(query, adapter, getEntityResolver());
     }
 
     @Override
@@ -66,7 +63,7 @@ class OracleActionBuilder extends JdbcAc
                     query,
                     adapter,
                     getEntityResolver());
-            ((OracleBatchAction)action).setBatch(runningAsBatch);
+            ((OracleBatchAction) action).setBatch(runningAsBatch);
             return action;
         }
 

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleSQLTemplateAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleSQLTemplateAction.java?rev=1144724&r1=1144723&r2=1144724&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleSQLTemplateAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/oracle/OracleSQLTemplateAction.java
Sat Jul  9 19:52:41 2011
@@ -46,7 +46,7 @@ import org.apache.cayenne.access.Operati
 import org.apache.cayenne.access.jdbc.RowDescriptorBuilder;
 import org.apache.cayenne.access.jdbc.SQLStatement;
 import org.apache.cayenne.access.jdbc.SQLTemplateAction;
-import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.EntityResolver;
 import org.apache.cayenne.query.SQLTemplate;
@@ -58,7 +58,7 @@ class OracleSQLTemplateAction extends SQ
 
     protected DbEntity dbEntity;
 
-    OracleSQLTemplateAction(SQLTemplate query, DbAdapter adapter,
+    OracleSQLTemplateAction(SQLTemplate query, JdbcAdapter adapter,
             EntityResolver entityResolver) {
         super(query, adapter, entityResolver);
         this.dbEntity = query.getMetaData(entityResolver).getDbEntity();

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteActionBuilder.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteActionBuilder.java?rev=1144724&r1=1144723&r2=1144724&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteActionBuilder.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteActionBuilder.java
Sat Jul  9 19:52:41 2011
@@ -18,7 +18,6 @@
  ****************************************************************/
 package org.apache.cayenne.dba.sqlite;
 
-import org.apache.cayenne.access.jdbc.SQLTemplateAction;
 import org.apache.cayenne.dba.JdbcActionBuilder;
 import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.map.EntityResolver;
@@ -36,8 +35,6 @@ class SQLiteActionBuilder extends JdbcAc
 
     @Override
     public SQLAction sqlAction(SQLTemplate query) {
-        SQLTemplateAction action = new SQLiteSQLTemplateAction(query, adapter, getEntityResolver());
-        action.setJdbcEventLogger(logger);
-        return action;
+        return new SQLiteSQLTemplateAction(query, adapter, getEntityResolver());
     }
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteSQLTemplateAction.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteSQLTemplateAction.java?rev=1144724&r1=1144723&r2=1144724&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteSQLTemplateAction.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/dba/sqlite/SQLiteSQLTemplateAction.java
Sat Jul  9 19:52:41 2011
@@ -27,7 +27,7 @@ import java.util.Collection;
 import org.apache.cayenne.access.OperationObserver;
 import org.apache.cayenne.access.jdbc.SQLStatement;
 import org.apache.cayenne.access.jdbc.SQLTemplateAction;
-import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.map.EntityResolver;
 import org.apache.cayenne.query.SQLTemplate;
 
@@ -36,7 +36,8 @@ import org.apache.cayenne.query.SQLTempl
  */
 class SQLiteSQLTemplateAction extends SQLTemplateAction {
 
-    public SQLiteSQLTemplateAction(SQLTemplate query, DbAdapter adapter, EntityResolver resolver)
{
+    public SQLiteSQLTemplateAction(SQLTemplate query, JdbcAdapter adapter,
+            EntityResolver resolver) {
         super(query, adapter, resolver);
     }
 
@@ -81,10 +82,10 @@ class SQLiteSQLTemplateAction extends SQ
                     }
                 }
             }
-            else {                
+            else {
                 int updateCount = statement.executeUpdate();
                 updateCounts.add(Integer.valueOf(updateCount));
-                getJdbcEventLogger().logUpdateCount(updateCount);
+                logger.logUpdateCount(updateCount);
             }
 
             // end - code different from super

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/BindDirectiveTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/BindDirectiveTest.java?rev=1144724&r1=1144723&r2=1144724&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/BindDirectiveTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/BindDirectiveTest.java
Sat Jul  9 19:52:41 2011
@@ -34,7 +34,7 @@ import javax.sql.DataSource;
 import org.apache.cayenne.DataRow;
 import org.apache.cayenne.ObjectContext;
 import org.apache.cayenne.access.MockOperationObserver;
-import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.log.JdbcEventLogger;
 import org.apache.cayenne.query.CapsStrategy;
@@ -55,14 +55,14 @@ public class BindDirectiveTest extends S
     private DataSource dataSource;
 
     @Inject
-    private DbAdapter adapter;
+    private JdbcAdapter adapter;
 
     @Inject
     private ObjectContext context;
 
     @Inject
     private DBHelper dbHelper;
-    
+
     @Inject
     private JdbcEventLogger logger;
 
@@ -127,7 +127,7 @@ public class BindDirectiveTest extends S
     }
 
     public void testBindingForCollection() throws Exception {
-        
+
         // insert 3 artists
         for (int i = 1; i < 4; i++) {
             Map<String, Object> parameters = new HashMap<String, Object>();
@@ -229,9 +229,10 @@ public class BindDirectiveTest extends S
 
         template.setParameters(parameters);
 
-        SQLTemplateAction action = new SQLTemplateAction(template, adapter, context
-                .getEntityResolver());
-        action.setJdbcEventLogger(logger);
+        SQLTemplateAction action = new SQLTemplateAction(
+                template,
+                adapter,
+                context.getEntityResolver());
 
         Connection c = dataSource.getConnection();
         try {

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/ResultDirectiveTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/ResultDirectiveTest.java?rev=1144724&r1=1144723&r2=1144724&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/ResultDirectiveTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/ResultDirectiveTest.java
Sat Jul  9 19:52:41 2011
@@ -27,9 +27,8 @@ import java.util.Map;
 import org.apache.cayenne.DataRow;
 import org.apache.cayenne.access.MockOperationObserver;
 import org.apache.cayenne.configuration.server.ServerRuntime;
-import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.di.Inject;
-import org.apache.cayenne.log.JdbcEventLogger;
 import org.apache.cayenne.query.CapsStrategy;
 import org.apache.cayenne.query.SQLTemplate;
 import org.apache.cayenne.query.SelectQuery;
@@ -51,10 +50,7 @@ public class ResultDirectiveTest extends
     private DBHelper dbHelper;
 
     @Inject
-    private DbAdapter dbAdapter;
-    
-    @Inject
-    private JdbcEventLogger logger;
+    private JdbcAdapter dbAdapter;
 
     @Override
     protected void setUpAfterInjection() throws Exception {
@@ -149,8 +145,7 @@ public class ResultDirectiveTest extends
         SQLTemplateAction action = new SQLTemplateAction(template, dbAdapter, runtime
                 .getDataDomain()
                 .getEntityResolver());
-        action.setJdbcEventLogger(logger);
-        
+
         assertSame(dbAdapter, action.getAdapter());
 
         Connection c = runtime

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SQLTemplateActionTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SQLTemplateActionTest.java?rev=1144724&r1=1144723&r2=1144724&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SQLTemplateActionTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SQLTemplateActionTest.java
Sat Jul  9 19:52:41 2011
@@ -32,7 +32,6 @@ import org.apache.cayenne.DataRow;
 import org.apache.cayenne.ObjectContext;
 import org.apache.cayenne.access.DataNode;
 import org.apache.cayenne.access.MockOperationObserver;
-import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.query.Query;
@@ -57,7 +56,7 @@ public class SQLTemplateActionTest exten
     protected DataNode node;
 
     @Inject
-    protected DbAdapter adapter;
+    protected JdbcAdapter adapter;
 
     @Inject
     protected ObjectContext objectContext;
@@ -93,10 +92,11 @@ public class SQLTemplateActionTest exten
     }
 
     public void testProperties() throws Exception {
-        DbAdapter adapter = new JdbcAdapter();
         SQLTemplate template = new SQLTemplate(Object.class, "AAAAA");
-        SQLTemplateAction action = new SQLTemplateAction(template, adapter, objectContext
-                .getEntityResolver());
+        SQLTemplateAction action = new SQLTemplateAction(
+                template,
+                adapter,
+                objectContext.getEntityResolver());
         assertSame(adapter, action.getAdapter());
         assertSame(template, action.getQuery());
     }
@@ -360,8 +360,10 @@ public class SQLTemplateActionTest exten
 
     public void testExtractTemplateString() throws Exception {
         SQLTemplate template = new SQLTemplate(Artist.class, "A\nBC");
-        SQLTemplateAction action = new SQLTemplateAction(template, adapter, objectContext
-                .getEntityResolver());
+        SQLTemplateAction action = new SQLTemplateAction(
+                template,
+                adapter,
+                objectContext.getEntityResolver());
 
         assertEquals("A BC", action.extractTemplateString());
     }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SelectActionTest.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SelectActionTest.java?rev=1144724&r1=1144723&r2=1144724&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SelectActionTest.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/access/jdbc/SelectActionTest.java
Sat Jul  9 19:52:41 2011
@@ -92,5 +92,4 @@ public class SelectActionTest extends Se
             obj.setClobId(clobId);
         }
     }
-
 }

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseDbAdapterProvider.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseDbAdapterProvider.java?rev=1144724&r1=1144723&r2=1144724&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseDbAdapterProvider.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseDbAdapterProvider.java
Sat Jul  9 19:52:41 2011
@@ -22,10 +22,11 @@ import org.apache.cayenne.ConfigurationE
 import org.apache.cayenne.configuration.AdhocObjectFactory;
 import org.apache.cayenne.conn.DataSourceInfo;
 import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.di.Inject;
 import org.apache.cayenne.di.Provider;
 
-public class ServerCaseDbAdapterProvider implements Provider<DbAdapter> {
+public class ServerCaseDbAdapterProvider implements Provider<JdbcAdapter> {
 
     private DataSourceInfo dataSourceInfo;
     private AdhocObjectFactory objectFactory;
@@ -36,7 +37,7 @@ public class ServerCaseDbAdapterProvider
         this.objectFactory = objectFactory;
     }
 
-    public DbAdapter get() throws ConfigurationException {
+    public JdbcAdapter get() throws ConfigurationException {
 
         return objectFactory.newInstance(DbAdapter.class, dataSourceInfo
                 .getAdapterClassName());

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseModule.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseModule.java?rev=1144724&r1=1144723&r2=1144724&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseModule.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/test/java/org/apache/cayenne/unit/di/server/ServerCaseModule.java
Sat Jul  9 19:52:41 2011
@@ -29,6 +29,7 @@ import org.apache.cayenne.configuration.
 import org.apache.cayenne.configuration.server.ServerRuntime;
 import org.apache.cayenne.conn.DataSourceInfo;
 import org.apache.cayenne.dba.DbAdapter;
+import org.apache.cayenne.dba.JdbcAdapter;
 import org.apache.cayenne.dba.db2.DB2Adapter;
 import org.apache.cayenne.dba.derby.DerbyAdapter;
 import org.apache.cayenne.dba.frontbase.FrontBaseAdapter;
@@ -127,6 +128,7 @@ public class ServerCaseModule implements
                 .bind(DataSource.class)
                 .toProvider(ServerCaseSharedDataSourceProvider.class);
         binder.bind(DbAdapter.class).toProvider(ServerCaseDbAdapterProvider.class);
+        binder.bind(JdbcAdapter.class).toProvider(ServerCaseDbAdapterProvider.class);
         binder.bind(UnitDbAdapter.class).toProvider(UnitDbAdapterProvider.class);
 
         // this factory is a hack that allows to inject to DbAdapters loaded outside of



Mime
View raw message