Repository: sqoop Updated Branches: refs/heads/trunk f37832842 -> d0770ac6a
http://git-wip-us.apache.org/repos/asf/sqoop/blob/d0770ac6/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 new file mode 100644 index 0000000..398f1a0 --- /dev/null +++ b/src/test/com/cloudera/sqoop/metastore/hsqldb/HsqldbSavedJobsTest.java @@ -0,0 +1,40 @@ +/** + * 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/d0770ac6/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 new file mode 100644 index 0000000..6a6bae4 --- /dev/null +++ b/src/test/com/cloudera/sqoop/metastore/mysql/MySqlJobToolTest.java @@ -0,0 +1,52 @@ +/** + * 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/d0770ac6/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 new file mode 100644 index 0000000..3a97cfd --- /dev/null +++ b/src/test/com/cloudera/sqoop/metastore/mysql/MySqlMetaConnectIncrementalImportTest.java @@ -0,0 +1,53 @@ +/** + * 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/d0770ac6/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 new file mode 100644 index 0000000..febb7da --- /dev/null +++ b/src/test/com/cloudera/sqoop/metastore/mysql/MySqlSavedJobsTest.java @@ -0,0 +1,53 @@ +/** + * 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/d0770ac6/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 new file mode 100644 index 0000000..4891b00 --- /dev/null +++ b/src/test/com/cloudera/sqoop/metastore/oracle/OracleJobToolTest.java @@ -0,0 +1,51 @@ +/** + * 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/d0770ac6/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 new file mode 100644 index 0000000..f916a13 --- /dev/null +++ b/src/test/com/cloudera/sqoop/metastore/oracle/OracleMetaConnectIncrementalImportTest.java @@ -0,0 +1,51 @@ +/** + * 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/d0770ac6/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 new file mode 100644 index 0000000..0f487d1 --- /dev/null +++ b/src/test/com/cloudera/sqoop/metastore/oracle/OracleSavedJobsTest.java @@ -0,0 +1,53 @@ +/** + * 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/d0770ac6/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 new file mode 100644 index 0000000..b596fc8 --- /dev/null +++ b/src/test/com/cloudera/sqoop/metastore/postgres/PostgresJobToolTest.java @@ -0,0 +1,53 @@ +/** + * 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/d0770ac6/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 new file mode 100644 index 0000000..21f4938 --- /dev/null +++ b/src/test/com/cloudera/sqoop/metastore/postgres/PostgresMetaConnectIncrementalImportTest.java @@ -0,0 +1,53 @@ +/** + * 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/d0770ac6/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 new file mode 100644 index 0000000..ed06cb2 --- /dev/null +++ b/src/test/com/cloudera/sqoop/metastore/postgres/PostgresSavedJobsTest.java @@ -0,0 +1,54 @@ +/** + * 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/d0770ac6/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 new file mode 100644 index 0000000..e3f8bde --- /dev/null +++ b/src/test/com/cloudera/sqoop/metastore/sqlserver/SqlServerJobToolTest.java @@ -0,0 +1,53 @@ +/** + * 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/d0770ac6/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 new file mode 100644 index 0000000..3c8ac5f --- /dev/null +++ b/src/test/com/cloudera/sqoop/metastore/sqlserver/SqlServerMetaConnectIncrementalImportTest.java @@ -0,0 +1,53 @@ +/** + * 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/d0770ac6/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 new file mode 100644 index 0000000..5589f14 --- /dev/null +++ b/src/test/com/cloudera/sqoop/metastore/sqlserver/SqlServerSavedJobsTest.java @@ -0,0 +1,55 @@ +/** + * 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()); + } +} http://git-wip-us.apache.org/repos/asf/sqoop/blob/d0770ac6/src/test/findbugsExcludeFile.xml ---------------------------------------------------------------------- diff --git a/src/test/findbugsExcludeFile.xml b/src/test/findbugsExcludeFile.xml index a27ec37..8aa4ed5 100644 --- a/src/test/findbugsExcludeFile.xml +++ b/src/test/findbugsExcludeFile.xml @@ -47,7 +47,7 @@ <!-- createRootTable() allows a user-specified table name retrieved from properties. This since instance is allowed for now. --> - <Class name="com.cloudera.sqoop.metastore.hsqldb.HsqldbJobStorage" /> + <Class name="com.cloudera.sqoop.metastore.GenericJobStorage" /> <Method name="createRootTable" /> <Bug pattern="SQL_NONCONSTANT_STRING_PASSED_TO_EXECUTE" /> </Match>
