9f9e865b92d238ff8ae3e738b402a4436246f1d8
[sqoop.git] / src / test / org / apache / sqoop / metastore / postgres / PostgresSavedJobsTest.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.postgres;
20
21 import org.apache.sqoop.metastore.SavedJobsTestBase;
22 import org.apache.sqoop.manager.JdbcDrivers;
23 import org.apache.sqoop.testcategories.thirdpartytest.PostgresqlTest;
24 import org.junit.experimental.categories.Category;
25
26 /**
27 * Test of GenericJobStorage compatibility with PostgreSQL
28 *
29 * This uses JDBC to store and retrieve metastore data from a Postgres server
30 *
31 * Since this requires a Postgres 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=PostgresSavedJobsTest or -Dthirdparty=true.
35 *
36 * Once you have a running Postgres database,
37 * Set server URL, database name, username, and password with system variables
38 * -Dsqoop.test.postgresql.connectstring.host_url, -Dsqoop.test.postgresql.database,
39 * -Dsqoop.test.postgresql.username and -Dsqoop.test.postgresql.password respectively
40 */
41 @Category(PostgresqlTest.class)
42 public class PostgresSavedJobsTest extends SavedJobsTestBase {
43
44 private static final String HOST_URL = System.getProperty("sqoop.test.postgresql.connectstring.host_url",
45 "jdbc:postgresql://localhost/");
46 private static final String DATABASE_USER = System.getProperty(
47 "sqoop.test.postgresql.username", "sqooptest");
48 private static final String DATABASE_NAME = System.getProperty(
49 "sqoop.test.postgresql.database", "sqooptest");
50 private static final String PASSWORD = System.getProperty("sqoop.test.postgresql.password");
51 private static final String CONNECT_STRING = HOST_URL + DATABASE_NAME;
52
53 public PostgresSavedJobsTest() {
54 super(CONNECT_STRING, DATABASE_USER, PASSWORD, JdbcDrivers.POSTGRES.getDriverClass());
55 }
56 }