sqoop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kathl...@apache.org
Subject [1/2] git commit: SQOOP-1009: Sqoop2: Integration: Create Teradata provider
Date Fri, 14 Jun 2013 07:22:41 GMT
Updated Branches:
  refs/heads/sqoop2 4d5e07e9d -> 6483fbab3


SQOOP-1009: Sqoop2: Integration: Create Teradata provider

(Jarek Jarcec Cecho via Kate Ting)


Project: http://git-wip-us.apache.org/repos/asf/sqoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/sqoop/commit/b5665fd4
Tree: http://git-wip-us.apache.org/repos/asf/sqoop/tree/b5665fd4
Diff: http://git-wip-us.apache.org/repos/asf/sqoop/diff/b5665fd4

Branch: refs/heads/sqoop2
Commit: b5665fd42ef44246542f75685d9dff7827b8da2e
Parents: 8412740
Author: Kate Ting <kathleen@apache.org>
Authored: Fri Jun 14 03:19:31 2013 -0400
Committer: Kate Ting <kathleen@apache.org>
Committed: Fri Jun 14 03:19:31 2013 -0400

----------------------------------------------------------------------
 pom.xml                                         | 11 +++
 test/pom.xml                                    | 28 +++++++
 .../apache/sqoop/test/db/TeradataProvider.java  | 79 ++++++++++++++++++++
 .../minicluster/TomcatSqoopMiniCluster.java     |  2 +
 .../connector/ConnectorTestCase.java            |  2 +-
 5 files changed, 121 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/sqoop/blob/b5665fd4/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0abbb18..4173c48 100644
--- a/pom.xml
+++ b/pom.xml
@@ -111,6 +111,7 @@ limitations under the License.
     <jdbc.postgresql.version>9.1-901.jdbc4</jdbc.postgresql.version>
     <jdbc.oracle.version>11.2.0.3</jdbc.oracle.version>
     <jdbc.sqlserver.version>4.0</jdbc.sqlserver.version>
+    <jdbc.teradata.version>14.00.00.21</jdbc.teradata.version>
   </properties>
 
   <dependencies>
@@ -375,6 +376,16 @@ limitations under the License.
         <artifactId>sqljdbc4</artifactId>
         <version>${jdbc.sqlserver.version}</version>
       </dependency>
+      <dependency>
+        <groupId>com.teradata</groupId>
+        <artifactId>tdgssconfig</artifactId>
+        <version>${jdbc.teradata.version}</version>
+      </dependency>
+      <dependency>
+        <groupId>com.teradata</groupId>
+        <artifactId>terajdbc4</artifactId>
+        <version>${jdbc.teradata.version}</version>
+      </dependency>
      <dependency>
       <groupId>org.mockito</groupId>
       <artifactId>mockito-all</artifactId>

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b5665fd4/test/pom.xml
----------------------------------------------------------------------
diff --git a/test/pom.xml b/test/pom.xml
index 58f1c49..4947e1c 100644
--- a/test/pom.xml
+++ b/test/pom.xml
@@ -275,6 +275,34 @@ limitations under the License.
       </dependencies>
     </profile>
 
+    <!--
+      Teradata JDBC Driver
+      Install: mvn install:install-file -DgroupId=com.teradata -DartifactId=tdgssconfig 
-Dversion=14.00.00.21 -Dpackaging=jar -Dfile=/path/to/the/jar/tdgssconfig.jar
+               mvn install:install-file -DgroupId=com.teradata -DartifactId=terajdbc4  -Dversion=14.00.00.21
-Dpackaging=jar -Dfile=/path/to/the/jar/terajdbc4.jar
+      Usage: mvn integration-test -Djdbc.teradata
+    -->
+    <profile>
+      <id>jdbc-teradata</id>
+
+      <activation>
+        <property>
+          <name>jdbc.teradata</name>
+        </property>
+      </activation>
+
+      <dependencies>
+        <dependency>
+          <groupId>com.teradata</groupId>
+          <artifactId>tdgssconfig</artifactId>
+        </dependency>
+
+        <dependency>
+          <groupId>com.teradata</groupId>
+          <artifactId>terajdbc4</artifactId>
+        </dependency>
+      </dependencies>
+    </profile>
+
   </profiles>
 
 </project>

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b5665fd4/test/src/main/java/org/apache/sqoop/test/db/TeradataProvider.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/sqoop/test/db/TeradataProvider.java b/test/src/main/java/org/apache/sqoop/test/db/TeradataProvider.java
new file mode 100644
index 0000000..a66823e
--- /dev/null
+++ b/test/src/main/java/org/apache/sqoop/test/db/TeradataProvider.java
@@ -0,0 +1,79 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.sqoop.test.db;
+
+/**
+ * Teradata Provider that will connect to remote Teradata server.
+ *
+ * JDBC can be configured via system properties. Default value is server running
+ * on the same box (localhost) that is access via sqoop/sqoop credentials.
+ */
+public class TeradataProvider extends DatabaseProvider {
+
+  public static final String DRIVER = "com.teradata.jdbc.TeraDriver";
+
+  private static final String CONNECTION = System.getProperties().getProperty(
+    "sqoop.provider.teradata.jdbc",
+    "jdbc:teradata://localhost/test"
+  );
+
+  private static final String USERNAME = System.getProperties().getProperty(
+    "sqoop.provider.teradata.username",
+    "sqoop"
+  );
+
+  private static final String PASSWORD = System.getProperties().getProperty(
+    "sqoop.provider.teradata.password",
+    "sqoop"
+  );
+
+  @Override
+  public String getConnectionUrl() {
+    return CONNECTION;
+  }
+
+  @Override
+  public String getConnectionUsername() {
+    return USERNAME;
+  }
+
+  @Override
+  public String getConnectionPassword() {
+    return PASSWORD;
+  }
+
+  @Override
+  public String escapeColumnName(String columnName) {
+    return columnName;
+  }
+
+  @Override
+  public String escapeTableName(String tableName) {
+    return tableName;
+  }
+
+  @Override
+  public String escapeValueString(String value) {
+    return "'" + value + "'";
+  }
+
+  @Override
+  public String getJdbcDriver() {
+    return DRIVER;
+  }
+}

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b5665fd4/test/src/main/java/org/apache/sqoop/test/minicluster/TomcatSqoopMiniCluster.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/sqoop/test/minicluster/TomcatSqoopMiniCluster.java
b/test/src/main/java/org/apache/sqoop/test/minicluster/TomcatSqoopMiniCluster.java
index c7998a1..2aa55dc 100644
--- a/test/src/main/java/org/apache/sqoop/test/minicluster/TomcatSqoopMiniCluster.java
+++ b/test/src/main/java/org/apache/sqoop/test/minicluster/TomcatSqoopMiniCluster.java
@@ -96,6 +96,8 @@ public class TomcatSqoopMiniCluster extends SqoopMiniCluster {
          jar.contains("mysql")    || // MySQL JDBC driver
          jar.contains("postgre")  || // PostgreSQL JDBC driver
          jar.contains("oracle")   || // Oracle driver
+         jar.contains("terajdbc") || // Teradata driver
+         jar.contains("tdgs")     || // Teradata driver
          jar.contains("sqljdbc")  || // Microsoft SQL Server driver
          jar.contains("google")      // Google libraries (guava, ...)
        ) {

http://git-wip-us.apache.org/repos/asf/sqoop/blob/b5665fd4/test/src/test/java/org/apache/sqoop/integration/connector/ConnectorTestCase.java
----------------------------------------------------------------------
diff --git a/test/src/test/java/org/apache/sqoop/integration/connector/ConnectorTestCase.java
b/test/src/test/java/org/apache/sqoop/integration/connector/ConnectorTestCase.java
index 837a1aa..cdc3bd2 100644
--- a/test/src/test/java/org/apache/sqoop/integration/connector/ConnectorTestCase.java
+++ b/test/src/test/java/org/apache/sqoop/integration/connector/ConnectorTestCase.java
@@ -107,7 +107,7 @@ abstract public class ConnectorTestCase extends TomcatTestCase {
    */
   protected void createAndLoadTableCities() {
     createTable("id",
-      "id", "int",
+      "id", "int not null",
       "country", "varchar(50)",
       "city", "varchar(50)"
     );


Mime
View raw message