From 5f6dd35e8e1856ca5cbde35945f243639090ef03 Mon Sep 17 00:00:00 2001 From: Bilung Lee Date: Wed, 6 Jun 2012 20:49:36 +0000 Subject: [PATCH] SQOOP-480 MS SQL server connector is incompatible with Sqoop-1.4 git-svn-id: https://svn.apache.org/repos/asf/sqoop/trunk@1347112 13f79535-47bb-0310-9956-ffa450edef68 --- build.xml | 15 +++++++++++++++ .../sqoop/manager/ImportJobContext.java | 4 ++++ .../SQLServerManagerImportManualTest.java | 18 ++++++++++++++++++ 3 files changed, 37 insertions(+) diff --git a/build.xml b/build.xml index c727e555..296b9af3 100644 --- a/build.xml +++ b/build.xml @@ -248,6 +248,18 @@ + + + + + + + + + + + @@ -715,6 +727,9 @@ + + diff --git a/src/java/com/cloudera/sqoop/manager/ImportJobContext.java b/src/java/com/cloudera/sqoop/manager/ImportJobContext.java index 3c71dd2e..8eec2eb9 100644 --- a/src/java/com/cloudera/sqoop/manager/ImportJobContext.java +++ b/src/java/com/cloudera/sqoop/manager/ImportJobContext.java @@ -33,6 +33,10 @@ public class ImportJobContext super(table, jar, opts, destination); } + public void setConnManager(ConnManager mgr) { + super.setConnManager(mgr); + } + public ConnManager getConnManager() { return (ConnManager)super.getConnManager(); } diff --git a/src/test/com/cloudera/sqoop/manager/SQLServerManagerImportManualTest.java b/src/test/com/cloudera/sqoop/manager/SQLServerManagerImportManualTest.java index d8692a0b..0f949f41 100644 --- a/src/test/com/cloudera/sqoop/manager/SQLServerManagerImportManualTest.java +++ b/src/test/com/cloudera/sqoop/manager/SQLServerManagerImportManualTest.java @@ -30,8 +30,10 @@ import java.util.ArrayList; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.Path; import org.apache.hadoop.io.IOUtils; +import org.apache.sqoop.ConnFactory; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -77,9 +79,20 @@ public class SQLServerManagerImportManualTest extends ImportJobTestCase { static final String CONNECT_STRING = HOST_URL + ";databaseName=" + DATABASE_NAME; + static final String CONNECTOR_FACTORY = System.getProperty( + "sqoop.test.msserver.connector.factory", + ConnFactory.DEFAULT_FACTORY_CLASS_NAMES); + // instance variables populated during setUp, used during tests private SQLServerManager manager; + private Configuration conf = new Configuration(); + + @Override + protected Configuration getConf() { + return conf; + } + @Override protected boolean useHsqldbTestServer() { return false; @@ -173,6 +186,11 @@ public class SQLServerManagerImportManualTest extends ImportJobTestCase { "3,Fred,15.0,marketing", }; + // To test with Microsoft SQL server connector, copy the connector jar to + // sqoop.thirdparty.lib.dir and set sqoop.test.msserver.connector.factory + // to com.microsoft.sqoop.SqlServer.MSSQLServerManagerFactory. By default, + // the built-in SQL server connector is used. + conf.setStrings(ConnFactory.FACTORY_CLASS_NAMES_KEY, CONNECTOR_FACTORY); runSQLServerTest(expectedResults); }