b41eda110f371e58d7b22c73eff9bf6d890f29a8
[sqoop.git] / src / test / org / apache / sqoop / metastore / db2 / DB2SavedJobsTest.java
1 /**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19 package org.apache.sqoop.metastore.db2;
20
21 import org.apache.sqoop.metastore.SavedJobsTestBase;
22 import org.apache.sqoop.manager.JdbcDrivers;
23 import org.apache.sqoop.testcategories.thirdpartytest.Db2Test;
24 import org.junit.experimental.categories.Category;
25
26 /**
27 * Test of GenericJobStorage compatibility with DB2
28 *
29 * This uses JDBC to store and retrieve metastore data from a DB2 server
30 *
31 * Since this requires a DB2 installation,
32 * this class is named in such a way that Sqoop's default QA process does
33 * not run it. You need to run this manually with
34 * -Dtestcase=DB2SavedJobsTest or -Dthirdparty=true.
35 *
36 * You need to put DB2 JDBC driver library (db2jcc4.jar) in a location
37 * where Sqoop will be able to access it (since this library cannot be checked
38 * into Apache's tree for licensing reasons) and set it's path through -Dsqoop.thirdparty.lib.dir.
39 *
40 * Once you have a running DB2 database,
41 * Set server URL, database name, username, and password with system variables
42 * -Dsqoop.test.db2.connectstring.host_url, -Dsqoop.test.db2.connectstring.database,
43 * -Dsqoop.test.db2.connectstring.username and -Dsqoop.test.db2.connectstring.password respectively
44 */
45 @Category(Db2Test.class)
46 public class DB2SavedJobsTest extends SavedJobsTestBase {
47
48 private static final String HOST_URL = System.getProperty(
49 "sqoop.test.db2.connectstring.host_url",
50 "jdbc:db2://db2host:50000");
51
52 private static final String DATABASE_NAME = System.getProperty(
53 "sqoop.test.db2.connectstring.database",
54 "SQOOP");
55 private static final String DATABASE_USER = System.getProperty(
56 "sqoop.test.db2.connectstring.username",
57 "SQOOP");
58 private static final String DATABASE_PASSWORD = System.getProperty(
59 "sqoop.test.db2.connectstring.password",
60 "SQOOP");
61 private static final String CONNECT_STRING = HOST_URL
62 + "/" + DATABASE_NAME
63 + ":currentSchema=" + DATABASE_USER +";";
64
65 public DB2SavedJobsTest() {
66 super(CONNECT_STRING, DATABASE_USER, DATABASE_PASSWORD, JdbcDrivers.DB2.getDriverClass());
67 }
68 }