http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/JobToolTestBase.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/JobToolTestBase.java b/src/test/com/cloudera/sqoop/metastore/JobToolTestBase.java deleted file mode 100644 index 2f46ec9..0000000 --- a/src/test/com/cloudera/sqoop/metastore/JobToolTestBase.java +++ /dev/null @@ -1,215 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore; - -import static org.junit.Assert.assertEquals; - -import com.cloudera.sqoop.SqoopOptions; -import com.cloudera.sqoop.testutil.BaseSqoopTestCase; -import com.cloudera.sqoop.testutil.CommonArgs; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.hadoop.conf.Configuration; -import org.apache.sqoop.manager.ConnManager; -import org.apache.sqoop.manager.DefaultManagerFactory; -import org.apache.sqoop.Sqoop; -import org.apache.sqoop.tool.JobTool; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import java.io.IOException; -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - -/** - * Base test class for JobTool, implemented for specific database services in sub-classes - */ - -public abstract class JobToolTestBase extends BaseSqoopTestCase { - - public static final Log LOG = LogFactory - .getLog(MetaConnectIncrementalImportTestBase.class.getName()); - - private String metaConnectString; - private String metaUser; - private String metaPass; - private ConnManager cm; - - - public JobToolTestBase(String metaConnectString, String metaUser, String metaPass) { - this.metaConnectString = metaConnectString; - this.metaUser = metaUser; - this.metaPass = metaPass; - } - - @Before - public void setUp() { - super.setUp(); - - SqoopOptions options = getSqoopOptions(); - - Connection conn = getConnection(options); - - try { - Statement statement = conn.createStatement(); - statement.execute("DROP TABLE " + cm.escapeTableName("SQOOP_ROOT")); - statement.execute("DROP TABLE " + cm.escapeTableName("SQOOP_SESSIONS")); - conn.commit(); - } catch (Exception e) { - LOG.error("Failed to clear metastore database"); - } - //Methods from BaseSqoopTestClass reference the test Hsqldb database, not the metastore - try{ - dropTableIfExists("CarLocations"); - } catch (SQLException e) { - LOG.error("Failed to drop table CarLocations"); - } - setCurTableName("CarLocations"); - createTableWithColTypesAndNames( - new String [] {"carId", "Locations"}, - new String [] {"INTEGER", "VARCHAR"}, - new String [] {"1", "'Lexus'"}); - } - - private Connection getConnection(SqoopOptions options) { - try { - com.cloudera.sqoop.metastore.JobData jd = new com.cloudera.sqoop.metastore.JobData(options, null); - DefaultManagerFactory dmf = new DefaultManagerFactory(); - cm = dmf.accept(jd); - return cm.getConnection(); - } catch (SQLException e) { - LOG.error("Failed to create a connection to the Metastore"); - return null; - } - } - - private SqoopOptions getSqoopOptions() { - SqoopOptions options = new SqoopOptions(); - options.setConnectString(metaConnectString); - options.setUsername(metaUser); - options.setPassword(metaPass); - return options; - } - - @After - public void tearDown() { - super.tearDown(); - - try { - cm.close(); - } catch (SQLException e) { - LOG.error("Failed to close ConnManager"); - } - - } - - protected String[] getCreateJob(String metaConnectString, String metaUser, String metaPass) { - List<String> args = new ArrayList<>(); - CommonArgs.addHadoopFlags(args); - args.add("--create"); - args.add("testJob"); - args.add("--meta-connect"); - args.add(metaConnectString); - args.add("--meta-username"); - args.add(metaUser); - args.add("--meta-password"); - args.add(metaPass); - args.add("--"); - args.add("list-tables"); - args.add("--connect"); - args.add(getConnectString()); - - return args.toArray(new String[0]); - } - - protected String[] getExecJob(String metaConnectString, String metaUser, String metaPass) { - List<String> args = new ArrayList<>(); - CommonArgs.addHadoopFlags(args); - args.add("--exec"); - args.add("testJob"); - args.add("--meta-connect"); - args.add(metaConnectString); - args.add("--meta-username"); - args.add(metaUser); - args.add("--meta-password"); - args.add(metaPass); - - return args.toArray(new String[0]); - } - - - protected String[] getDeleteJob(String metaConnectString, String metaUser, String metaPass) { - List<String> args = new ArrayList<>(); - CommonArgs.addHadoopFlags(args); - args.add("--delete"); - args.add("testJob"); - args.add("--meta-connect"); - args.add(metaConnectString); - args.add("--meta-username"); - args.add(metaUser); - args.add("--meta-password"); - args.add(metaPass); - - return args.toArray(new String[0]); - } - - @Test - public void testCreateJob() throws IOException { - org.apache.sqoop.tool.JobTool jobTool = new org.apache.sqoop.tool.JobTool(); - org.apache.sqoop.Sqoop sqoop = new Sqoop(jobTool); - String[] args = getCreateJob(metaConnectString, metaUser, metaPass); - assertEquals("Error creating Sqoop Job", 0, Sqoop.runSqoop(sqoop, args)); - } - - @Test - public void testExecJob() throws IOException { - Configuration conf = new Configuration(); - //creates the job - JobTool jobToolCreate = new JobTool(); - Sqoop sqoopCreate = new Sqoop(jobToolCreate, conf); - String[] argsCreate = getCreateJob(metaConnectString, metaUser, metaPass); - Sqoop.runSqoop(sqoopCreate, argsCreate); - //executes the job - JobTool jobToolExec = new JobTool(); - Sqoop sqoopExec = new Sqoop(jobToolExec); - String[] argsExec = getExecJob(metaConnectString, metaUser, metaPass); - assertEquals("Error executing Sqoop Job", 0, Sqoop.runSqoop(sqoopExec, argsExec)); - } - - @Test - public void testDeleteJob() throws IOException { - Configuration conf = new Configuration(); - //Creates the job - JobTool jobToolCreate = new JobTool(); - Sqoop sqoopCreate = new Sqoop(jobToolCreate, conf); - String[] argsCreate = getCreateJob(metaConnectString, metaUser, metaPass); - Sqoop.runSqoop(sqoopCreate, argsCreate); - //Deletes the job - JobTool jobToolDelete = new JobTool(); - Sqoop sqoopExec = new Sqoop(jobToolDelete); - String[] argsDelete = getDeleteJob(metaConnectString, metaUser, metaPass); - assertEquals("Error deleting Sqoop Job", 0, Sqoop.runSqoop(sqoopExec, argsDelete)); - } -} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/MetaConnectIncrementalImportTestBase.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/MetaConnectIncrementalImportTestBase.java b/src/test/com/cloudera/sqoop/metastore/MetaConnectIncrementalImportTestBase.java deleted file mode 100644 index 587aaff..0000000 --- a/src/test/com/cloudera/sqoop/metastore/MetaConnectIncrementalImportTestBase.java +++ /dev/null @@ -1,215 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore; - -import static org.junit.Assert.assertEquals; - -import com.cloudera.sqoop.SqoopOptions; -import com.cloudera.sqoop.testutil.BaseSqoopTestCase; -import com.cloudera.sqoop.testutil.CommonArgs; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.apache.hadoop.conf.Configuration; -import org.apache.sqoop.manager.ConnManager; -import org.apache.sqoop.manager.DefaultManagerFactory; -import org.apache.sqoop.tool.JobTool; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; -import java.util.ArrayList; -import java.util.List; - - -/** - * Base test class for Incremental Import Metastore data, implemented for specific database services in sub-classes - */ - -public abstract class MetaConnectIncrementalImportTestBase extends BaseSqoopTestCase { - - public static final Log LOG = LogFactory - .getLog(MetaConnectIncrementalImportTestBase.class.getName()); - - private String metaConnectString; - private String metaUser; - private String metaPass; - - private Connection connMeta; - private ConnManager cm; - - public MetaConnectIncrementalImportTestBase(String metaConnectString, String metaUser, String metaPass) { - this.metaConnectString = metaConnectString; - this.metaUser = metaUser; - this.metaPass = metaPass; - } - - @Before - public void setUp() { - super.setUp(); - } - - @After - public void tearDown() { - super.tearDown(); - } - - protected String[] getIncrementalJob(String metaConnectString, String metaUser, String metaPass) { - List<String> args = new ArrayList<>(); - CommonArgs.addHadoopFlags(args); - args.add("--create"); - args.add("testJob"); - args.add("--meta-connect"); - args.add(metaConnectString); - args.add("--meta-username"); - args.add(metaUser); - args.add("--meta-password"); - args.add(metaPass); - args.add("--"); - args.add("import"); - args.add("-m"); - args.add("1"); - args.add("--connect"); - args.add(getConnectString()); - args.add("--table"); - args.add("CARLOCATIONS"); - args.add("--incremental"); - args.add("append"); - args.add("--check-column"); - args.add("CARID"); - args.add("--last-value"); - args.add("0"); - args.add("--as-textfile"); - - return args.toArray(new String[0]); - } - - - protected String[] getExecJob(String metaConnectString, String metaUser, String metaPass) { - List<String> args = new ArrayList<>(); - CommonArgs.addHadoopFlags(args); - args.add("--exec"); - args.add("testJob"); - args.add("--meta-connect"); - args.add(metaConnectString); - args.add("--meta-username"); - args.add(metaUser); - args.add("--meta-password"); - args.add(metaPass); - - return args.toArray(new String[0]); - } - - @Test - public void testIncrementalJob() throws SQLException { - resetTable(); - - initMetastoreConnection(); - - resetMetastoreSchema(); - - //creates Job - createJob(); - - //Executes the import - execJob(); - - //Ensures the saveIncrementalState saved the right row - checkIncrementalState(1); - - //Adds rows to the import table - Statement insertStmt = getConnection().createStatement(); - insertStmt.executeUpdate("INSERT INTO CARLOCATIONS VALUES (2, 'lexus')"); - getConnection().commit(); - - //Execute the import again - execJob(); - - //Ensures the last incremental value is updated correctly. - checkIncrementalState(2); - - cm.close(); - } - - private void checkIncrementalState(int expected) throws SQLException { - Statement getSaveIncrementalState = connMeta.createStatement(); - ResultSet lastCol = getSaveIncrementalState.executeQuery( - "SELECT propVal FROM " + cm.escapeTableName("SQOOP_SESSIONS") + " WHERE propname = 'incremental.last.value'"); - lastCol.next(); - assertEquals("Last row value differs from expected", - expected, lastCol.getInt("propVal")); - } - - private void execJob() { - JobTool jobToolExec = new JobTool(); - org.apache.sqoop.Sqoop sqoopExec = new org.apache.sqoop.Sqoop(jobToolExec); - String[] argsExec = getExecJob(metaConnectString, metaUser, metaPass); - assertEquals("Sqoop Job did not execute properly", - 0, org.apache.sqoop.Sqoop.runSqoop(sqoopExec, argsExec)); - } - - private void createJob() { - Configuration conf = new Configuration(); - conf.set(org.apache.sqoop.SqoopOptions.METASTORE_PASSWORD_KEY, "true"); - JobTool jobToolCreate = new JobTool(); - org.apache.sqoop.Sqoop sqoopCreate = new org.apache.sqoop.Sqoop(jobToolCreate, conf); - String[] argsCreate = getIncrementalJob(metaConnectString, metaUser, metaPass); - org.apache.sqoop.Sqoop.runSqoop(sqoopCreate, argsCreate); - } - - private void resetTable() throws SQLException { - //Resets the target table - dropTableIfExists("CARLOCATIONS"); - setCurTableName("CARLOCATIONS"); - createTableWithColTypesAndNames( - new String [] {"CARID", "LOCATIONS"}, - new String [] {"INTEGER", "VARCHAR"}, - new String [] {"1", "'Lexus'"}); - } - - private void resetMetastoreSchema() { - try { - //Resets the metastore schema - Statement metastoreStatement = connMeta.createStatement(); - metastoreStatement.execute("DROP TABLE " + cm.escapeTableName("SQOOP_ROOT")); - metastoreStatement.execute("DROP TABLE " + cm.escapeTableName("SQOOP_SESSIONS")); - connMeta.commit(); - } - catch (Exception e) { - LOG.error( e.getLocalizedMessage() ); - } - } - - private void initMetastoreConnection() throws SQLException{ - SqoopOptions options = new SqoopOptions(); - options.setConnectString(metaConnectString); - options.setUsername(metaUser); - options.setPassword(metaPass); - com.cloudera.sqoop.metastore.JobData jd = - new com.cloudera.sqoop.metastore.JobData(options, new JobTool()); - DefaultManagerFactory dmf = new DefaultManagerFactory(); - cm = dmf.accept(jd); - connMeta= cm.getConnection(); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/SavedJobsTestBase.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/SavedJobsTestBase.java b/src/test/com/cloudera/sqoop/metastore/SavedJobsTestBase.java deleted file mode 100644 index 3a414ea..0000000 --- a/src/test/com/cloudera/sqoop/metastore/SavedJobsTestBase.java +++ /dev/null @@ -1,311 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore; - -import static org.apache.sqoop.metastore.GenericJobStorage.META_CONNECT_KEY; -import static org.apache.sqoop.metastore.GenericJobStorage.META_PASSWORD_KEY; -import static org.apache.sqoop.metastore.GenericJobStorage.META_USERNAME_KEY; - -import static org.hamcrest.core.IsCollectionContaining.hasItems; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThat; - -import com.cloudera.sqoop.manager.ConnManager; -import com.cloudera.sqoop.SqoopOptions; -import com.cloudera.sqoop.tool.VersionTool; - -import org.apache.hadoop.conf.Configuration; -import org.apache.sqoop.manager.DefaultManagerFactory; -import org.apache.sqoop.tool.ImportTool; -import org.junit.After; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; - -import java.io.IOException; - -import java.sql.Connection; -import java.sql.SQLException; -import java.sql.Statement; - -import java.util.List; -import java.util.Map; -import java.util.TreeMap; - -/** - * Test the metastore and job-handling features, - * implemented for specific database services in sub-classes. - */ -public abstract class SavedJobsTestBase { - - public static final String TEST_JOB = "testJob"; - public static final String TEST_TABLE_NAME = "abcd"; - public static final String TEST_TABLE_NAME_2 = "efgh"; - public static final String TEST_JOB_2 = "testJob2"; - public static final String TEST_JOB_3 = "testJob3"; - public static final String TEST_TABLE_NAME_3 = "ijkl"; - private String metaConnect; - private String metaUser; - private String metaPassword; - private String driverClass; - private JobStorage storage; - - private Configuration conf; - private Map<String, String> descriptor; - - public SavedJobsTestBase(String metaConnect, String metaUser, String metaPassword, String driverClass){ - this.metaConnect = metaConnect; - this.metaUser = metaUser; - this.metaPassword = metaPassword; - this.driverClass = driverClass; - this.descriptor = new TreeMap<>(); - } - - @Rule - public ExpectedException thrown = ExpectedException.none(); - - @Before - public void setUp() throws Exception { - // Delete db state between tests. - resetJobSchema(); - conf = newConf(); - - descriptor.put(META_CONNECT_KEY, metaConnect); - descriptor.put(META_USERNAME_KEY, metaUser); - descriptor.put(META_PASSWORD_KEY, metaPassword); - - JobStorageFactory ssf = new JobStorageFactory(conf); - storage = ssf.getJobStorage(descriptor); - storage.open(descriptor); - } - - @After - public void tearDown() throws Exception { - descriptor.clear(); - storage.close(); - } - - public void resetJobSchema() - throws SQLException { - SqoopOptions options = new SqoopOptions(); - options.setConnectString(metaConnect); - options.setUsername(metaUser); - options.setPassword(metaPassword); - options.setDriverClassName(driverClass); - - resetSchema(options); - } - - /** - * Drop all tables in the configured HSQLDB-based schema/user/pass. - */ - public static void resetSchema(SqoopOptions options) throws SQLException { - JobData jd = new JobData(); - jd.setSqoopOptions(options); - DefaultManagerFactory dmf = new DefaultManagerFactory(); - ConnManager manager = dmf.accept(jd); - Connection c = manager.getConnection(); - Statement s = c.createStatement(); - try { - String [] tables = manager.listTables(); - for (String table : tables) { - if(table.equals("SQOOP_ROOT") || table.equals("SQOOP_SESSIONS")){ - s.execute("DROP TABLE " + manager.escapeTableName(table)); - } - } - - c.commit(); - } finally { - s.close(); - } - } - - public Configuration newConf() { - Configuration conf = new Configuration(); - conf.set(META_CONNECT_KEY, metaConnect); - conf.set(META_USERNAME_KEY, metaUser); - conf.set(META_PASSWORD_KEY, metaPassword); - - return conf; - } - - @Test - public void testReadJobDoesExistPasses() throws Exception{ - storage.create(TEST_JOB, createTestJobData(TEST_TABLE_NAME)); - - assertEquals("Read did not return job data correctly", - storage.read(TEST_JOB).getSqoopOptions().getTableName(), - TEST_TABLE_NAME); - } - - @Test - public void testUpdateJob() throws Exception { - storage.create(TEST_JOB, createTestJobData(TEST_TABLE_NAME)); - - storage.update(TEST_JOB, createTestJobData(TEST_TABLE_NAME_2) ); - - assertEquals("Update did not change data correctly", - storage.read(TEST_JOB).getSqoopOptions().getTableName(), - TEST_TABLE_NAME_2); - } - - @Test - public void testList() throws IOException { - storage.create(TEST_JOB, createTestJobData(TEST_TABLE_NAME)); - storage.create(TEST_JOB_2, createTestJobData(TEST_TABLE_NAME_2)); - storage.create(TEST_JOB_3, createTestJobData(TEST_TABLE_NAME_3)); - - assertThat("List did not return correct job data", - storage.list(), hasItems(TEST_JOB, TEST_JOB_2, TEST_JOB_3)); - } - - @Test - public void testCreateSameJob() throws IOException { - - // Job list should start out empty. - List<String> jobs = storage.list(); - assertEquals("Job list should start out empty", 0, jobs.size()); - - // Create a job that displays the version. - JobData data = new JobData(new SqoopOptions(), new VersionTool()); - storage.create(TEST_JOB, data); - - jobs = storage.list(); - assertEquals("Test Job not created correctly",1, jobs.size()); - assertEquals("Test Job data not returned correctly", TEST_JOB, jobs.get(0)); - - try { - // Try to create that same job name again. This should fail. - thrown.expect(IOException.class); - thrown.reportMissingExceptionWithMessage("Expected IOException since job already exists"); - storage.create(TEST_JOB, data); - } finally { - jobs = storage.list(); - assertEquals("Incorrect number of jobs present",1, jobs.size()); - - // Restore our job, check that it exists. - JobData outData = storage.read(TEST_JOB); - assertEquals("Test job does not exist", new VersionTool().getToolName(), - outData.getSqoopTool().getToolName()); - } - } - - @Test - public void testDeleteJob() throws IOException { - // Job list should start out empty. - List<String> jobs = storage.list(); - assertEquals("Job List should start out empty", 0, jobs.size()); - - // Create a job that displays the version. - JobData data = new JobData(new SqoopOptions(), new VersionTool()); - storage.create(TEST_JOB, data); - - jobs = storage.list(); - assertEquals("Incorrect number of jobs present",1, jobs.size()); - assertEquals("Test Job created incorrectly", TEST_JOB, jobs.get(0)); - - // Now delete the job. - storage.delete(TEST_JOB); - - // After delete, we should have no jobs. - jobs = storage.list(); - assertEquals("Job was not deleted correctly", 0, jobs.size()); - } - - @Test - public void testRestoreNonExistingJob() throws IOException { - // Try to restore a job that doesn't exist. Watch it fail. - thrown.expect(IOException.class); - thrown.reportMissingExceptionWithMessage("Expected IOException since job doesn't exist"); - storage.read("DoesNotExist"); - } - - @Test - public void testCreateJobWithExtraArgs() throws IOException { - - // Job list should start out empty. - List<String> jobs = storage.list(); - assertEquals("Job list should start out empty", 0, jobs.size()); - - // Create a job with extra args - com.cloudera.sqoop.SqoopOptions opts = new SqoopOptions(); - String[] args = {"-schema", "test"}; - opts.setExtraArgs(args); - JobData data = new JobData(opts, new VersionTool()); - storage.create(TEST_JOB, data); - - jobs = storage.list(); - assertEquals("Incorrect number of jobs", 1, jobs.size()); - assertEquals("Job not created properly", TEST_JOB, jobs.get(0)); - - // Restore our job, check that it exists. - JobData outData = storage.read(TEST_JOB); - assertEquals("Incorrect Tool in Test Job", - new VersionTool().getToolName(), - outData.getSqoopTool().getToolName()); - - String[] storedArgs = outData.getSqoopOptions().getExtraArgs(); - for(int index = 0; index < args.length; ++index) { - assertEquals(args[index], storedArgs[index]); - } - - // Now delete the job. - storage.delete(TEST_JOB); - } - - @Test - public void testMultiConnections() throws IOException { - - // Job list should start out empty. - List<String> jobs = storage.list(); - assertEquals("Job list should start out empty", 0, jobs.size()); - - // Create a job that displays the version. - JobData data = new JobData(new SqoopOptions(), new VersionTool()); - storage.create(TEST_JOB, data); - - jobs = storage.list(); - assertEquals("Incorrect number of jobs", 1, jobs.size()); - assertEquals("Job not created correctly", TEST_JOB, jobs.get(0)); - - storage.close(); // Close the existing connection - - // Now re-open the storage. - storage.open(descriptor); - - jobs = storage.list(); - assertEquals("Test Job did not persist through re-open", 1, jobs.size()); - assertEquals("Job data not correct after re-open", TEST_JOB, jobs.get(0)); - - // Restore our job, check that it exists. - JobData outData = storage.read(TEST_JOB); - assertEquals("Incorrect Tool in Test Job", - new VersionTool().getToolName(), - outData.getSqoopTool().getToolName()); - } - - private com.cloudera.sqoop.metastore.JobData createTestJobData(String setTableName) throws IOException { - SqoopOptions testOpts = new SqoopOptions(); - testOpts.setTableName(setTableName); - ImportTool testTool = new ImportTool(); - return new com.cloudera.sqoop.metastore.JobData(testOpts,testTool); - - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/TestMetastoreConfigurationParameters.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/TestMetastoreConfigurationParameters.java b/src/test/com/cloudera/sqoop/metastore/TestMetastoreConfigurationParameters.java deleted file mode 100644 index a485b9a..0000000 --- a/src/test/com/cloudera/sqoop/metastore/TestMetastoreConfigurationParameters.java +++ /dev/null @@ -1,120 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore; - -import com.cloudera.sqoop.testutil.HsqldbTestServer; -import org.apache.sqoop.Sqoop; -import org.apache.sqoop.testutil.Argument; -import org.apache.sqoop.tool.JobTool; -import org.junit.AfterClass; -import org.junit.Before; -import org.junit.BeforeClass; -import org.junit.Test; - -import java.io.IOException; -import java.sql.Connection; -import java.sql.ResultSet; -import java.sql.SQLException; -import java.sql.Statement; - -import static java.util.Arrays.asList; -import static java.util.Collections.singleton; -import static org.apache.sqoop.testutil.Argument.from; -import static org.apache.sqoop.testutil.Argument.fromPair; -import static org.apache.sqoop.testutil.ArgumentUtils.createArgumentArray; -import static org.apache.sqoop.testutil.ArgumentUtils.createArgumentArrayFromProperties; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - - -public class TestMetastoreConfigurationParameters { - - private static final int STATUS_FAILURE = 1; - private static final int STATUS_SUCCESS = 0; - private static final String TEST_USER = "sqoop"; - private static final String TEST_PASSWORD = "sqoop"; - private static final String DEFAULT_HSQLDB_USER = "SA"; - private static final String NON_DEFAULT_PASSWORD = "NOT_DEFAULT"; - private static HsqldbTestServer testHsqldbServer; - - private Sqoop sqoop; - - @BeforeClass - public static void beforeClass() throws Exception { - testHsqldbServer = new HsqldbTestServer(); - testHsqldbServer.start(); - setupUsersForTesting(); - } - - @AfterClass - public static void afterClass() { - testHsqldbServer.stop(); - } - - @Before - public void before() { - sqoop = new Sqoop(new JobTool()); - } - - @Test - public void testJobToolWithAutoConnectDisabledFails() throws IOException { - Argument autoConnectProperty = fromPair("sqoop.metastore.client.enable.autoconnect", "false"); - String[] arguments = createArgumentArrayFromProperties(singleton(autoConnectProperty)); - assertEquals(STATUS_FAILURE, Sqoop.runSqoop(sqoop, arguments)); - } - - @Test - public void testJobToolWithAutoConnectUrlAndCorrectUsernamePasswordSpecifiedSuccessfullyRuns() { - int status = runJobToolWithAutoConnectUrlAndCorrectUsernamePasswordSpecified(); - assertEquals(STATUS_SUCCESS, status); - } - - @Test - public void testJobToolWithAutoConnectUrlAndCorrectUsernamePasswordSpecifiedInitializesSpecifiedDatabase() throws SQLException { - runJobToolWithAutoConnectUrlAndCorrectUsernamePasswordSpecified(); - verifyMetastoreIsInitialized(); - } - - private int runJobToolWithAutoConnectUrlAndCorrectUsernamePasswordSpecified() { - Argument url = fromPair("sqoop.metastore.client.autoconnect.url", HsqldbTestServer.getUrl()); - Argument user = fromPair("sqoop.metastore.client.autoconnect.username", TEST_USER); - Argument password = fromPair("sqoop.metastore.client.autoconnect.password", TEST_PASSWORD); - Argument listJob = from("list"); - - Iterable<Argument> properties = asList(url, user, password); - Iterable<Argument> options = singleton(listJob); - - String[] arguments = createArgumentArray(properties, options); - return Sqoop.runSqoop(sqoop, arguments); - } - - private static void setupUsersForTesting() throws SQLException { - // We create a new user and change the password of SA to make sure that Sqoop does not connect to metastore with the default user and password. - testHsqldbServer.createNewUser(TEST_USER, TEST_PASSWORD); - testHsqldbServer.changePasswordForUser(DEFAULT_HSQLDB_USER, NON_DEFAULT_PASSWORD); - } - - private void verifyMetastoreIsInitialized() throws SQLException { - try (Connection connection = testHsqldbServer.getConnection(TEST_USER, TEST_PASSWORD); Statement statement = connection.createStatement()) { - ResultSet resultSet = statement.executeQuery("SELECT * FROM SQOOP_ROOT"); - assertTrue(resultSet.next()); - } - } - -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/db2/DB2JobToolTest.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/db2/DB2JobToolTest.java b/src/test/com/cloudera/sqoop/metastore/db2/DB2JobToolTest.java deleted file mode 100644 index b92d36a..0000000 --- a/src/test/com/cloudera/sqoop/metastore/db2/DB2JobToolTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore.db2; - -import com.cloudera.sqoop.metastore.JobToolTestBase; - -/** - * Test that the Job Tool works in DB2 - * - * This uses JDBC to store and retrieve metastore data from a DB2 server - * - * Since this requires a DB2 installation, - * this class is named in such a way that Sqoop's default QA process does - * not run it. You need to run this manually with - * -Dtestcase=DB2JobToolTest or -Dthirdparty=true. - * - * You need to put DB2 JDBC driver library (db2jcc4.jar) in a location - * where Sqoop will be able to access it (since this library cannot be checked - * into Apache's tree for licensing reasons) and set it's path through -Dsqoop.thirdparty.lib.dir. - * - * Once you have a running DB2 database, - * Set server URL, database name, username, and password with system variables - * -Dsqoop.test.db2.connectstring.host_url, -Dsqoop.test.db2.connectstring.database, - * -Dsqoop.test.db2.connectstring.username and -Dsqoop.test.db2.connectstring.password respectively - */ - -public class DB2JobToolTest extends JobToolTestBase { - - private static final String HOST_URL = System.getProperty( - "sqoop.test.db2.connectstring.host_url", - "jdbc:db2://db2host:50000"); - - private static final String DATABASE_NAME = System.getProperty( - "sqoop.test.db2.connectstring.database", - "SQOOP"); - private static final String DATABASE_USER = System.getProperty( - "sqoop.test.db2.connectstring.username", - "SQOOP"); - private static final String DATABASE_PASSWORD = System.getProperty( - "sqoop.test.db2.connectstring.password", - "SQOOP"); - private static final String CONNECT_STRING = HOST_URL - + "/" + DATABASE_NAME - + ":currentSchema=" + DATABASE_USER +";"; - - public DB2JobToolTest() { - super(CONNECT_STRING, DATABASE_USER, DATABASE_PASSWORD); - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/db2/DB2MetaConnectIncrementalImportTest.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/db2/DB2MetaConnectIncrementalImportTest.java b/src/test/com/cloudera/sqoop/metastore/db2/DB2MetaConnectIncrementalImportTest.java deleted file mode 100644 index c1ae70c..0000000 --- a/src/test/com/cloudera/sqoop/metastore/db2/DB2MetaConnectIncrementalImportTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore.db2; - -import com.cloudera.sqoop.metastore.MetaConnectIncrementalImportTestBase; - -/** - * Test that Incremental-Import values are stored correctly in DB2 - * - * This uses JDBC to store and retrieve metastore data from a DB2 server - * - * Since this requires a DB2 installation, - * this class is named in such a way that Sqoop's default QA process does - * not run it. You need to run this manually with - * -Dtestcase=DB2MetaConnectIncrementalImportTest or -Dthirdparty=true. - * - * You need to put DB2 JDBC driver library (db2jcc4.jar) in a location - * where Sqoop will be able to access it (since this library cannot be checked - * into Apache's tree for licensing reasons) and set it's path through -Dsqoop.thirdparty.lib.dir. - * - * Once you have a running DB2 database, - * Set server URL, database name, username, and password with system variables - * -Dsqoop.test.db2.connectstring.host_url, -Dsqoop.test.db2.connectstring.database, - * -Dsqoop.test.db2.connectstring.username and -Dsqoop.test.db2.connectstring.password respectively - */ - -public class DB2MetaConnectIncrementalImportTest extends MetaConnectIncrementalImportTestBase { - - private static final String HOST_URL = System.getProperty( - "sqoop.test.db2.connectstring.host_url", - "jdbc:db2://db2host:50000"); - - private static final String DATABASE_NAME = System.getProperty( - "sqoop.test.db2.connectstring.database", - "SQOOP"); - private static final String DATABASE_USER = System.getProperty( - "sqoop.test.db2.connectstring.username", - "SQOOP"); - private static final String DATABASE_PASSWORD = System.getProperty( - "sqoop.test.db2.connectstring.password", - "SQOOP"); - private static final String CONNECT_STRING = HOST_URL - + "/" + DATABASE_NAME - + ":currentSchema=" + DATABASE_USER +";"; - - public DB2MetaConnectIncrementalImportTest() { - super(CONNECT_STRING, DATABASE_USER, DATABASE_PASSWORD); - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/db2/DB2SavedJobsTest.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/db2/DB2SavedJobsTest.java b/src/test/com/cloudera/sqoop/metastore/db2/DB2SavedJobsTest.java deleted file mode 100644 index efeef62..0000000 --- a/src/test/com/cloudera/sqoop/metastore/db2/DB2SavedJobsTest.java +++ /dev/null @@ -1,66 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore.db2; - -import com.cloudera.sqoop.metastore.SavedJobsTestBase; -import org.apache.sqoop.manager.JdbcDrivers; - -/** - * Test of GenericJobStorage compatibility with DB2 - * - * This uses JDBC to store and retrieve metastore data from a DB2 server - * - * Since this requires a DB2 installation, - * this class is named in such a way that Sqoop's default QA process does - * not run it. You need to run this manually with - * -Dtestcase=DB2SavedJobsTest or -Dthirdparty=true. - * - * You need to put DB2 JDBC driver library (db2jcc4.jar) in a location - * where Sqoop will be able to access it (since this library cannot be checked - * into Apache's tree for licensing reasons) and set it's path through -Dsqoop.thirdparty.lib.dir. - * - * Once you have a running DB2 database, - * Set server URL, database name, username, and password with system variables - * -Dsqoop.test.db2.connectstring.host_url, -Dsqoop.test.db2.connectstring.database, - * -Dsqoop.test.db2.connectstring.username and -Dsqoop.test.db2.connectstring.password respectively - */ - -public class DB2SavedJobsTest extends SavedJobsTestBase { - - private static final String HOST_URL = System.getProperty( - "sqoop.test.db2.connectstring.host_url", - "jdbc:db2://db2host:50000"); - - private static final String DATABASE_NAME = System.getProperty( - "sqoop.test.db2.connectstring.database", - "SQOOP"); - private static final String DATABASE_USER = System.getProperty( - "sqoop.test.db2.connectstring.username", - "SQOOP"); - private static final String DATABASE_PASSWORD = System.getProperty( - "sqoop.test.db2.connectstring.password", - "SQOOP"); - private static final String CONNECT_STRING = HOST_URL - + "/" + DATABASE_NAME - + ":currentSchema=" + DATABASE_USER +";"; - - public DB2SavedJobsTest() { - super(CONNECT_STRING, DATABASE_USER, DATABASE_PASSWORD, JdbcDrivers.DB2.getDriverClass()); - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/hsqldb/HsqldbJobToolTest.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/hsqldb/HsqldbJobToolTest.java b/src/test/com/cloudera/sqoop/metastore/hsqldb/HsqldbJobToolTest.java deleted file mode 100644 index 07eefee..0000000 --- a/src/test/com/cloudera/sqoop/metastore/hsqldb/HsqldbJobToolTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore.hsqldb; - -import com.cloudera.sqoop.metastore.JobToolTestBase; - -/** - * Test that the Job Tool works in Hsqldb - * - * This class is named in such a way that Sqoop's default QA process does - * not run it. You need to run this manually with - * -Dtestcase=HsqldbJobToolTest or -Dthirdparty=true. - * - * This uses JDBC to store and retrieve metastore data from a local Hsqldb server - */ - -public class HsqldbJobToolTest extends JobToolTestBase { - - public HsqldbJobToolTest() { - super( "jdbc:hsqldb:mem:sqoopmetastore", "SA" , ""); - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/hsqldb/HsqldbMetaConnectIncrementalImportTest.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/hsqldb/HsqldbMetaConnectIncrementalImportTest.java b/src/test/com/cloudera/sqoop/metastore/hsqldb/HsqldbMetaConnectIncrementalImportTest.java deleted file mode 100644 index d302bfb..0000000 --- a/src/test/com/cloudera/sqoop/metastore/hsqldb/HsqldbMetaConnectIncrementalImportTest.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore.hsqldb; - -import com.cloudera.sqoop.metastore.MetaConnectIncrementalImportTestBase; - -/** - * Test that Incremental-Import values are stored correctly in Hsqldb - * - * This class is named in such a way that Sqoop's default QA process does - * not run it. You need to run this manually with - * -Dtestcase=HsqldbMetaConnectIncrementalImportTest or -Dthirdparty=true. - * - * This uses JDBC to store and retrieve metastore data from a local Hsqldb server - */ - -public class HsqldbMetaConnectIncrementalImportTest extends MetaConnectIncrementalImportTestBase { - - public HsqldbMetaConnectIncrementalImportTest() { - super( "jdbc:hsqldb:mem:sqoopmetastore", "SA" , ""); - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/hsqldb/HsqldbSavedJobsTest.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/hsqldb/HsqldbSavedJobsTest.java b/src/test/com/cloudera/sqoop/metastore/hsqldb/HsqldbSavedJobsTest.java deleted file mode 100644 index 398f1a0..0000000 --- a/src/test/com/cloudera/sqoop/metastore/hsqldb/HsqldbSavedJobsTest.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore.hsqldb; - -import com.cloudera.sqoop.metastore.SavedJobsTestBase; -import org.apache.sqoop.manager.JdbcDrivers; - -/** - * Test of GenericJobStorage compatibility with Hsqldb - * - * This class is named in such a way that Sqoop's default QA process does - * not run it. You need to run this manually with - * -Dtestcase=HsqldbSavedJobsTest or -Dthirdparty=true. - * - * This uses JDBC to store and retrieve metastore data from a local Hsqldb server - */ - -public class HsqldbSavedJobsTest extends SavedJobsTestBase { - - public HsqldbSavedJobsTest() { - super("jdbc:hsqldb:mem:sqoopmetastore", - "SA" , "", JdbcDrivers.HSQLDB.getDriverClass()); - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/mysql/MySqlJobToolTest.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/mysql/MySqlJobToolTest.java b/src/test/com/cloudera/sqoop/metastore/mysql/MySqlJobToolTest.java deleted file mode 100644 index 6a6bae4..0000000 --- a/src/test/com/cloudera/sqoop/metastore/mysql/MySqlJobToolTest.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore.mysql; - -import com.cloudera.sqoop.manager.MySQLTestUtils; -import com.cloudera.sqoop.metastore.JobToolTestBase; - -/** - * Test that the Job Tool works in MySql - * - * This uses JDBC to store and retrieve metastore data from a MySql server - * - * Since this requires a MySql installation, - * this class is named in such a way that Sqoop's default QA process does - * not run it. You need to run this manually with - * -Dtestcase=MySqlJobToolTest or -Dthirdparty=true. - * - * You need to put MySql JDBC driver library (mysql-connector-java-5.1.38-bin.jar) in a location - * where Sqoop will be able to access it (since this library cannot be checked - * into Apache's tree for licensing reasons) and set it's path through -Dsqoop.thirdparty.lib.dir. - * - * Once you have a running MySql database, - * Set server URL, database name, username, and password with system variables - * -Dsqoop.test.mysql.connectstring.host_url, -Dsqoop.test.mysql.databasename, - * -Dsqoop.test.mysql.username and -Dsqoop.test.mysql.password respectively - */ - -public class MySqlJobToolTest extends JobToolTestBase { - - private static MySQLTestUtils mySQLTestUtils = new MySQLTestUtils(); - - public MySqlJobToolTest() { - super(mySQLTestUtils.getMySqlConnectString(), mySQLTestUtils.getUserName(), - mySQLTestUtils.getUserPass()); - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/mysql/MySqlMetaConnectIncrementalImportTest.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/mysql/MySqlMetaConnectIncrementalImportTest.java b/src/test/com/cloudera/sqoop/metastore/mysql/MySqlMetaConnectIncrementalImportTest.java deleted file mode 100644 index 3a97cfd..0000000 --- a/src/test/com/cloudera/sqoop/metastore/mysql/MySqlMetaConnectIncrementalImportTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore.mysql; - - -import com.cloudera.sqoop.manager.MySQLTestUtils; -import com.cloudera.sqoop.metastore.MetaConnectIncrementalImportTestBase; - -/** - * Test that Incremental-Import values are stored correctly in MySql - * - * This uses JDBC to store and retrieve metastore data from a MySql server - * - * Since this requires a DB2 installation, - * this class is named in such a way that Sqoop's default QA process does - * not run it. You need to run this manually with - * -Dtestcase=MySqlMetaConnectIncrementalImportTest or -Dthirdparty=true. - * - * You need to put MySql JDBC driver library (mysql-connector-java-5.1.38-bin.jar) in a location - * where Sqoop will be able to access it (since this library cannot be checked - * into Apache's tree for licensing reasons) and set it's path through -Dsqoop.thirdparty.lib.dir. - * - * Once you have a running MySql database, - * Set server URL, database name, username, and password with system variables - * -Dsqoop.test.mysql.connectstring.host_url, -Dsqoop.test.mysql.databasename, - * -Dsqoop.test.mysql.username and -Dsqoop.test.mysql.password respectively - */ - -public class MySqlMetaConnectIncrementalImportTest extends MetaConnectIncrementalImportTestBase { - - private static MySQLTestUtils mySQLTestUtils = new MySQLTestUtils(); - - public MySqlMetaConnectIncrementalImportTest() { - super(mySQLTestUtils.getMySqlConnectString(), mySQLTestUtils.getUserName(), - mySQLTestUtils.getUserPass()); - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/mysql/MySqlSavedJobsTest.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/mysql/MySqlSavedJobsTest.java b/src/test/com/cloudera/sqoop/metastore/mysql/MySqlSavedJobsTest.java deleted file mode 100644 index febb7da..0000000 --- a/src/test/com/cloudera/sqoop/metastore/mysql/MySqlSavedJobsTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore.mysql; - -import com.cloudera.sqoop.manager.MySQLTestUtils; -import com.cloudera.sqoop.metastore.SavedJobsTestBase; -import org.apache.sqoop.manager.JdbcDrivers; - -/** - * Test of GenericJobStorage compatibility with MySql - * - * This uses JDBC to store and retrieve metastore data from a MySql server - * - * Since this requires a MySql installation, - * this class is named in such a way that Sqoop's default QA process does - * not run it. You need to run this manually with - * -Dtestcase=MySqlSavedJobsTest or -Dthirdparty=true. - * - * You need to put MySql JDBC driver library (mysql-connector-java-5.1.38-bin.jar) in a location - * where Sqoop will be able to access it (since this library cannot be checked - * into Apache's tree for licensing reasons) and set it's path through -Dsqoop.thirdparty.lib.dir. - * - * Once you have a running MySql database, - * Set server URL, database name, username, and password with system variables - * -Dsqoop.test.mysql.connectstring.host_url, -Dsqoop.test.mysql.databasename, - * -Dsqoop.test.mysql.username and -Dsqoop.test.mysql.password respectively - */ - -public class MySqlSavedJobsTest extends SavedJobsTestBase { - - private static MySQLTestUtils mySQLTestUtils = new MySQLTestUtils(); - - public MySqlSavedJobsTest() { - super(mySQLTestUtils.getMySqlConnectString(), mySQLTestUtils.getUserName(), - mySQLTestUtils.getUserPass(), JdbcDrivers.MYSQL.getDriverClass()); - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/oracle/OracleJobToolTest.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/oracle/OracleJobToolTest.java b/src/test/com/cloudera/sqoop/metastore/oracle/OracleJobToolTest.java deleted file mode 100644 index 4891b00..0000000 --- a/src/test/com/cloudera/sqoop/metastore/oracle/OracleJobToolTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore.oracle; - -import com.cloudera.sqoop.manager.OracleUtils; -import com.cloudera.sqoop.metastore.JobToolTestBase; - -/** - * Test that the Job Tool works in Oracle - * - * This uses JDBC to store and retrieve metastore data from an Oracle server - * - * Since this requires an Oracle installation, - * this class is named in such a way that Sqoop's default QA process does - * not run it. You need to run this manually with - * -Dtestcase=OracleJobToolTest or -Dthirdparty=true. - * - * You need to put Oracle JDBC driver library (ojdbc6.jar) in a location - * where Sqoop will be able to access it (since this library cannot be checked - * into Apache's tree for licensing reasons) and set it's path through -Dsqoop.thirdparty.lib.dir. - * - * Once you have a running Oracle database, - * Set server URL, username, and password with system variables - * -Dsqoop.test.oracle.connectstring, -Dsqoop.test.oracle.username - * and -Dsqoop.test.oracle.password respectively - */ - -public class OracleJobToolTest extends JobToolTestBase { - - public OracleJobToolTest() { - super(OracleUtils.CONNECT_STRING, - OracleUtils.ORACLE_USER_NAME, - OracleUtils.ORACLE_USER_PASS); - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/oracle/OracleMetaConnectIncrementalImportTest.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/oracle/OracleMetaConnectIncrementalImportTest.java b/src/test/com/cloudera/sqoop/metastore/oracle/OracleMetaConnectIncrementalImportTest.java deleted file mode 100644 index f916a13..0000000 --- a/src/test/com/cloudera/sqoop/metastore/oracle/OracleMetaConnectIncrementalImportTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore.oracle; - -import com.cloudera.sqoop.manager.OracleUtils; -import com.cloudera.sqoop.metastore.MetaConnectIncrementalImportTestBase; - -/** - * Test that Incremental-Import values are stored correctly in Oracle - * - * This uses JDBC to store and retrieve metastore data from an Oracle server - * - * Since this requires an Oracle installation, - * this class is named in such a way that Sqoop's default QA process does - * not run it. You need to run this manually with - * -Dtestcase=OracleMetaConnectIncrementalImportTest or -Dthirdparty=true. - * - * You need to put Oracle JDBC driver library (ojdbc6.jar) in a location - * where Sqoop will be able to access it (since this library cannot be checked - * into Apache's tree for licensing reasons) and set it's path through -Dsqoop.thirdparty.lib.dir. - * - * Once you have a running Oracle database, - * Set server URL, username, and password with system variables - * -Dsqoop.test.oracle.connectstring, -Dsqoop.test.oracle.username - * and -Dsqoop.test.oracle.password respectively - */ - -public class OracleMetaConnectIncrementalImportTest extends MetaConnectIncrementalImportTestBase { - - public OracleMetaConnectIncrementalImportTest() { - super(OracleUtils.CONNECT_STRING, - OracleUtils.ORACLE_USER_NAME, - OracleUtils.ORACLE_USER_PASS); - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/oracle/OracleSavedJobsTest.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/oracle/OracleSavedJobsTest.java b/src/test/com/cloudera/sqoop/metastore/oracle/OracleSavedJobsTest.java deleted file mode 100644 index 0f487d1..0000000 --- a/src/test/com/cloudera/sqoop/metastore/oracle/OracleSavedJobsTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore.oracle; - -import com.cloudera.sqoop.manager.OracleUtils; -import com.cloudera.sqoop.metastore.SavedJobsTestBase; -import org.apache.sqoop.manager.JdbcDrivers; - -/** - * Test of GenericJobStorage compatibility with Oracle - * - * This uses JDBC to store and retrieve metastore data from an Oracle server - * - * Since this requires an Oracle installation, - * this class is named in such a way that Sqoop's default QA process does - * not run it. You need to run this manually with - * -Dtestcase=OracleSavedJobsTest or -Dthirdparty=true. - * - * You need to put Oracle JDBC driver library (ojdbc6.jar) in a location - * where Sqoop will be able to access it (since this library cannot be checked - * into Apache's tree for licensing reasons) and set it's path through -Dsqoop.thirdparty.lib.dir. - * - * Once you have a running Oracle database, - * Set server URL, username, and password with system variables - * -Dsqoop.test.oracle.connectstring, -Dsqoop.test.oracle.username - * and -Dsqoop.test.oracle.password respectively - */ - -public class OracleSavedJobsTest extends SavedJobsTestBase { - - public OracleSavedJobsTest() { - super(OracleUtils.CONNECT_STRING, - OracleUtils.ORACLE_USER_NAME, - OracleUtils.ORACLE_USER_PASS, - JdbcDrivers.ORACLE.getDriverClass()); - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/postgres/PostgresJobToolTest.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/postgres/PostgresJobToolTest.java b/src/test/com/cloudera/sqoop/metastore/postgres/PostgresJobToolTest.java deleted file mode 100644 index b596fc8..0000000 --- a/src/test/com/cloudera/sqoop/metastore/postgres/PostgresJobToolTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore.postgres; - -import com.cloudera.sqoop.metastore.JobToolTestBase; - -/** - * Test that the Job Tool works in PostgreSQL - * - * This uses JDBC to store and retrieve metastore data from a Postgres server - * - * Since this requires a Postgres installation, - * this class is named in such a way that Sqoop's default QA process does - * not run it. You need to run this manually with - * -Dtestcase=PostgresJobToolTest or -Dthirdparty=true. - * - * Once you have a running Postgres database, - * Set server URL, database name, username, and password with system variables - * -Dsqoop.test.postgresql.connectstring.host_url, -Dsqoop.test.postgresql.database, - * -Dsqoop.test.postgresql.username and -Dsqoop.test.postgresql.password respectively - */ - -public class PostgresJobToolTest extends JobToolTestBase { - - private static final String HOST_URL = System.getProperty("sqoop.test.postgresql.connectstring.host_url", - "jdbc:postgresql://localhost/"); - private static final String DATABASE_USER = System.getProperty( - "sqoop.test.postgresql.username", "sqooptest"); - private static final String DATABASE_NAME = System.getProperty( - "sqoop.test.postgresql.database", "sqooptest"); - private static final String PASSWORD = System.getProperty("sqoop.test.postgresql.password"); - private static final String CONNECT_STRING = HOST_URL + DATABASE_NAME; - - public PostgresJobToolTest() { - super(CONNECT_STRING, DATABASE_USER, PASSWORD); - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/postgres/PostgresMetaConnectIncrementalImportTest.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/postgres/PostgresMetaConnectIncrementalImportTest.java b/src/test/com/cloudera/sqoop/metastore/postgres/PostgresMetaConnectIncrementalImportTest.java deleted file mode 100644 index 21f4938..0000000 --- a/src/test/com/cloudera/sqoop/metastore/postgres/PostgresMetaConnectIncrementalImportTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore.postgres; - -import com.cloudera.sqoop.metastore.MetaConnectIncrementalImportTestBase; - -/** - * Test that Incremental-Import values are stored correctly in PostgreSQL - * - * This uses JDBC to store and retrieve metastore data from a Postgres server - * - * Since this requires a Postgres installation, - * this class is named in such a way that Sqoop's default QA process does - * not run it. You need to run this manually with - * -Dtestcase=PostgresMetaConnectIncrementalImportTest or -Dthirdparty=true. - * - * Once you have a running Postgres database, - * Set server URL, database name, username, and password with system variables - * -Dsqoop.test.postgresql.connectstring.host_url, -Dsqoop.test.postgresql.database, - * -Dsqoop.test.postgresql.username and -Dsqoop.test.postgresql.password respectively - */ - -public class PostgresMetaConnectIncrementalImportTest extends MetaConnectIncrementalImportTestBase { - - private static final String HOST_URL = System.getProperty("sqoop.test.postgresql.connectstring.host_url", - "jdbc:postgresql://localhost/"); - private static final String DATABASE_USER = System.getProperty( - "sqoop.test.postgresql.username", "sqooptest"); - private static final String DATABASE_NAME = System.getProperty( - "sqoop.test.postgresql.database", "sqooptest"); - private static final String PASSWORD = System.getProperty("sqoop.test.postgresql.password"); - private static final String CONNECT_STRING = HOST_URL + DATABASE_NAME; - - public PostgresMetaConnectIncrementalImportTest() { - super(CONNECT_STRING, DATABASE_USER, PASSWORD); - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/postgres/PostgresSavedJobsTest.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/postgres/PostgresSavedJobsTest.java b/src/test/com/cloudera/sqoop/metastore/postgres/PostgresSavedJobsTest.java deleted file mode 100644 index ed06cb2..0000000 --- a/src/test/com/cloudera/sqoop/metastore/postgres/PostgresSavedJobsTest.java +++ /dev/null @@ -1,54 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore.postgres; - -import com.cloudera.sqoop.metastore.SavedJobsTestBase; -import org.apache.sqoop.manager.JdbcDrivers; - -/** - * Test of GenericJobStorage compatibility with PostgreSQL - * - * This uses JDBC to store and retrieve metastore data from a Postgres server - * - * Since this requires a Postgres installation, - * this class is named in such a way that Sqoop's default QA process does - * not run it. You need to run this manually with - * -Dtestcase=PostgresSavedJobsTest or -Dthirdparty=true. - * - * Once you have a running Postgres database, - * Set server URL, database name, username, and password with system variables - * -Dsqoop.test.postgresql.connectstring.host_url, -Dsqoop.test.postgresql.database, - * -Dsqoop.test.postgresql.username and -Dsqoop.test.postgresql.password respectively - */ - -public class PostgresSavedJobsTest extends SavedJobsTestBase { - - private static final String HOST_URL = System.getProperty("sqoop.test.postgresql.connectstring.host_url", - "jdbc:postgresql://localhost/"); - private static final String DATABASE_USER = System.getProperty( - "sqoop.test.postgresql.username", "sqooptest"); - private static final String DATABASE_NAME = System.getProperty( - "sqoop.test.postgresql.database", "sqooptest"); - private static final String PASSWORD = System.getProperty("sqoop.test.postgresql.password"); - private static final String CONNECT_STRING = HOST_URL + DATABASE_NAME; - - public PostgresSavedJobsTest() { - super(CONNECT_STRING, DATABASE_USER, PASSWORD, JdbcDrivers.POSTGRES.getDriverClass()); - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/sqlserver/SqlServerJobToolTest.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/sqlserver/SqlServerJobToolTest.java b/src/test/com/cloudera/sqoop/metastore/sqlserver/SqlServerJobToolTest.java deleted file mode 100644 index e3f8bde..0000000 --- a/src/test/com/cloudera/sqoop/metastore/sqlserver/SqlServerJobToolTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore.sqlserver; - -import com.cloudera.sqoop.metastore.JobToolTestBase; -import org.apache.sqoop.manager.sqlserver.MSSQLTestUtils; - -/** - * Test that the Job Tool works in SQLServer - * - * This uses JDBC to store and retrieve metastore data from an SQLServer - * - * Since this requires an SQLServer installation, - * this class is named in such a way that Sqoop's default QA process does - * not run it. You need to run this manually with - * -Dtestcase=SqlServerJobToolTest or -Dthirdparty=true. - * - * You need to put SQL Server JDBC driver library (sqljdbc4.jar) in a location - * where Sqoop will be able to access it (since this library cannot be checked - * into Apache's tree for licensing reasons) and set it's path through -Dsqoop.thirdparty.lib.dir. - * - * Once you have a running SQLServer database, - * Set server URL, database name, username, and password with system variables - * -Dsqoop.test.sqlserver.connectstring.host_url, -Dsqoop.test.sqlserver.database, - * -Dms.sqlserver.username and -Dms.sqlserver.password respectively - */ - -public class SqlServerJobToolTest extends JobToolTestBase { - - private static MSSQLTestUtils msSQLTestUtils = new MSSQLTestUtils(); - - public SqlServerJobToolTest() { - super(msSQLTestUtils.getDBConnectString(), - msSQLTestUtils.getDBUserName(), - msSQLTestUtils.getDBPassWord()); - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/sqlserver/SqlServerMetaConnectIncrementalImportTest.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/sqlserver/SqlServerMetaConnectIncrementalImportTest.java b/src/test/com/cloudera/sqoop/metastore/sqlserver/SqlServerMetaConnectIncrementalImportTest.java deleted file mode 100644 index 3c8ac5f..0000000 --- a/src/test/com/cloudera/sqoop/metastore/sqlserver/SqlServerMetaConnectIncrementalImportTest.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore.sqlserver; - -import com.cloudera.sqoop.metastore.MetaConnectIncrementalImportTestBase; -import org.apache.sqoop.manager.sqlserver.MSSQLTestUtils; - -/** - * Test that Incremental-Import values are stored correctly in SQLServer - * - * This uses JDBC to store and retrieve metastore data from an SQLServer - * - * Since this requires an SQLServer installation, - * this class is named in such a way that Sqoop's default QA process does - * not run it. You need to run this manually with - * -Dtestcase=SqlServerJobToolTest or -Dthirdparty=true. - * - * You need to put SQL Server JDBC driver library (sqljdbc4.jar) in a location - * where Sqoop will be able to access it (since this library cannot be checked - * into Apache's tree for licensing reasons) and set it's path through -Dsqoop.thirdparty.lib.dir. - * - * Once you have a running SQLServer database, - * Set server URL, database name, username, and password with system variables - * -Dsqoop.test.sqlserver.connectstring.host_url, -Dsqoop.test.sqlserver.database, - * -Dms.sqlserver.username and -Dms.sqlserver.password respectively - */ - -public class SqlServerMetaConnectIncrementalImportTest extends MetaConnectIncrementalImportTestBase { - - private static MSSQLTestUtils msSQLTestUtils = new MSSQLTestUtils(); - - public SqlServerMetaConnectIncrementalImportTest() { - super(msSQLTestUtils.getDBConnectString(), - msSQLTestUtils.getDBUserName(), - msSQLTestUtils.getDBPassWord()); - } -} http://git-wip-us.apache.org/repos/asf/sqoop/blob/6984a36c/src/test/com/cloudera/sqoop/metastore/sqlserver/SqlServerSavedJobsTest.java ---------------------------------------------------------------------- diff --git a/src/test/com/cloudera/sqoop/metastore/sqlserver/SqlServerSavedJobsTest.java b/src/test/com/cloudera/sqoop/metastore/sqlserver/SqlServerSavedJobsTest.java deleted file mode 100644 index 5589f14..0000000 --- a/src/test/com/cloudera/sqoop/metastore/sqlserver/SqlServerSavedJobsTest.java +++ /dev/null @@ -1,55 +0,0 @@ -/** - * 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 com.cloudera.sqoop.metastore.sqlserver; - -import com.cloudera.sqoop.metastore.SavedJobsTestBase; -import org.apache.sqoop.manager.JdbcDrivers; -import org.apache.sqoop.manager.sqlserver.MSSQLTestUtils; - -/** - * Test of GenericJobStorage compatibility with SQLServer - * - * This uses JDBC to store and retrieve metastore data from an SQLServer - * - * Since this requires an SQLServer installation, - * this class is named in such a way that Sqoop's default QA process does - * not run it. You need to run this manually with - * -Dtestcase=SqlServerJobToolTest or -Dthirdparty=true. - * - * You need to put SQL Server JDBC driver library (sqljdbc4.jar) in a location - * where Sqoop will be able to access it (since this library cannot be checked - * into Apache's tree for licensing reasons) and set it's path through -Dsqoop.thirdparty.lib.dir. - * - * Once you have a running SQLServer database, - * Set server URL, database name, username, and password with system variables - * -Dsqoop.test.sqlserver.connectstring.host_url, -Dsqoop.test.sqlserver.database, - * -Dms.sqlserver.username and -Dms.sqlserver.password respectively - */ - -public class SqlServerSavedJobsTest extends SavedJobsTestBase { - - private static MSSQLTestUtils msSQLTestUtils = new MSSQLTestUtils(); - - public SqlServerSavedJobsTest() { - super(msSQLTestUtils.getDBConnectString(), - msSQLTestUtils.getDBUserName(), - msSQLTestUtils.getDBPassWord(), - JdbcDrivers.SQLSERVER.getDriverClass()); - } -}
