Author: shawkins
Date: 2010-04-10 21:59:21 -0400 (Sat, 10 Apr 2010)
New Revision: 2048
Added:
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCManagedConnectionFactory.java
Modified:
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCBaseExecution.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCManagedConnectionFactory.java
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceConnection.java
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCProcedureExecution.java
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCUpdateExecution.java
Log:
TEIID-833 renaming the method and adding a test of the getTranslator method
Modified:
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCBaseExecution.java
===================================================================
---
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCBaseExecution.java 2010-04-11
01:56:24 UTC (rev 2047)
+++
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCBaseExecution.java 2010-04-11
01:59:21 UTC (rev 2048)
@@ -68,7 +68,7 @@
protected JDBCBaseExecution(Connection connection, ExecutionContext context,
JDBCManagedConnectionFactory env) throws ConnectorException {
this.connection = connection;
- this.sqlTranslator = env.getExtensionTranslationClass();
+ this.sqlTranslator = env.getTranslator();
this.logger = env.getLogger();
this.context = context;
this.env = env;
Modified:
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java
===================================================================
---
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java 2010-04-11
01:56:24 UTC (rev 2047)
+++
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCConnector.java 2010-04-11
01:59:21 UTC (rev 2048)
@@ -65,7 +65,7 @@
throw new
ConnectorException(JDBCPlugin.Util.getString("JDBCSourceConnectionFactory.Missing_JDBC_jndi_1"));
//$NON-NLS-1$
}
- capabilities = config.getExtensionTranslationClass().getConnectorCapabilities();
+ capabilities = config.getTranslator().getConnectorCapabilities();
logger.logInfo(JDBCPlugin.Util.getString("JDBCConnector.JDBCConnector_started._4"));
//$NON-NLS-1$
}
Modified:
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCManagedConnectionFactory.java
===================================================================
---
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCManagedConnectionFactory.java 2010-04-11
01:56:24 UTC (rev 2047)
+++
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCManagedConnectionFactory.java 2010-04-11
01:59:21 UTC (rev 2048)
@@ -56,7 +56,7 @@
return extensionTranslationClassName;
}
- public Translator getExtensionTranslationClass() throws ConnectorException {
+ public Translator getTranslator() throws ConnectorException {
if (this.sqlTranslator == null) {
try {
String className = getExtensionTranslationClassName();
Modified:
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceConnection.java
===================================================================
---
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceConnection.java 2010-04-11
01:56:24 UTC (rev 2047)
+++
trunk/connectors/connector-jdbc/src/main/java/org/teiid/connector/jdbc/JDBCSourceConnection.java 2010-04-11
01:59:21 UTC (rev 2048)
@@ -54,7 +54,7 @@
public JDBCSourceConnection(java.sql.Connection connection,
JDBCManagedConnectionFactory environment) throws ConnectorException {
this.physicalConnection = connection;
this.environment = environment;
- this.sqlTranslator = environment.getExtensionTranslationClass();
+ this.sqlTranslator = environment.getTranslator();
this.sqlTranslator.afterConnectionCreation(connection);
}
Added:
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCManagedConnectionFactory.java
===================================================================
---
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCManagedConnectionFactory.java
(rev 0)
+++
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCManagedConnectionFactory.java 2010-04-11
01:59:21 UTC (rev 2048)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * See the COPYRIGHT.txt file distributed with this work for information
+ * regarding copyright ownership. Some portions may be licensed
+ * to Red Hat, Inc. under one or more contributor license agreements.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA.
+ */
+
+package org.teiid.connector.jdbc;
+
+import static org.junit.Assert.*;
+
+import org.junit.Test;
+import org.teiid.connector.jdbc.sqlserver.SQLServerSQLTranslator;
+import org.teiid.connector.jdbc.translator.Translator;
+public class TestJDBCManagedConnectionFactory {
+
+ @Test public void testGetExtensionTranslationClassDefault() throws Exception {
+ JDBCManagedConnectionFactory mcf = new JDBCManagedConnectionFactory();
+ assertSame(Translator.class, mcf.getTranslator().getClass());
+ }
+
+ @Test public void testGetExtensionTranslationClass() throws Exception {
+ JDBCManagedConnectionFactory mcf = new JDBCManagedConnectionFactory();
+ mcf.setExtensionTranslationClassName(SQLServerSQLTranslator.class.getName());
+ assertSame(SQLServerSQLTranslator.class, mcf.getTranslator().getClass());
+ }
+
+}
Property changes on:
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCManagedConnectionFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCProcedureExecution.java
===================================================================
---
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCProcedureExecution.java 2010-04-11
01:56:24 UTC (rev 2047)
+++
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCProcedureExecution.java 2010-04-11
01:59:21 UTC (rev 2048)
@@ -48,7 +48,7 @@
Translator sqlTranslator = new Translator();
JDBCManagedConnectionFactory config =
Mockito.mock(JDBCManagedConnectionFactory.class);
- Mockito.stub(config.getExtensionTranslationClass()).toReturn(sqlTranslator);
+ Mockito.stub(config.getTranslator()).toReturn(sqlTranslator);
Mockito.stub(config.getLogger()).toReturn(Mockito.mock(ConnectorLogger.class));
JDBCProcedureExecution procedureExecution = new JDBCProcedureExecution(command,
connection, Mockito.mock(ExecutionContext.class), config);
@@ -66,7 +66,7 @@
Translator sqlTranslator = new Translator();
JDBCManagedConnectionFactory config =
Mockito.mock(JDBCManagedConnectionFactory.class);
- Mockito.stub(config.getExtensionTranslationClass()).toReturn(sqlTranslator);
+ Mockito.stub(config.getTranslator()).toReturn(sqlTranslator);
Mockito.stub(config.getLogger()).toReturn(Mockito.mock(ConnectorLogger.class));
JDBCProcedureExecution procedureExecution = new JDBCProcedureExecution(command,
connection, Mockito.mock(ExecutionContext.class), config );
Modified:
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCUpdateExecution.java
===================================================================
---
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCUpdateExecution.java 2010-04-11
01:56:24 UTC (rev 2047)
+++
trunk/connectors/connector-jdbc/src/test/java/org/teiid/connector/jdbc/TestJDBCUpdateExecution.java 2010-04-11
01:59:21 UTC (rev 2048)
@@ -54,7 +54,7 @@
Mockito.stub(connection.prepareStatement("INSERT INTO SmallA (IntKey, IntNum)
VALUES (?, ?)")).toReturn(p); //$NON-NLS-1$
JDBCManagedConnectionFactory config =
Mockito.mock(JDBCManagedConnectionFactory.class);
- Mockito.stub(config.getExtensionTranslationClass()).toReturn(new Translator());
+ Mockito.stub(config.getTranslator()).toReturn(new Translator());
Mockito.stub(config.getLogger()).toReturn(Mockito.mock(ConnectorLogger.class));
JDBCUpdateExecution updateExecution = new JDBCUpdateExecution(command, connection,
Mockito.mock(ExecutionContext.class), config);
Show replies by date