59ea151a5c3c35bf6bcaba9bc050f174c39de024
[sqoop.git] / src / test / org / apache / sqoop / metastore / postgres / PostgresJobToolTest.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.JobToolTestBase;
22 import org.apache.sqoop.testcategories.thirdpartytest.PostgresqlTest;
23 import org.junit.experimental.categories.Category;
24
25 /**
26 * Test that the Job Tool works in PostgreSQL
27 *
28 * This uses JDBC to store and retrieve metastore data from a Postgres server
29 *
30 * Since this requires a Postgres installation,
31 * this class is named in such a way that Sqoop's default QA process does
32 * not run it. You need to run this manually with
33 * -Dtestcase=PostgresJobToolTest or -Dthirdparty=true.
34 *
35 * Once you have a running Postgres database,
36 * Set server URL, database name, username, and password with system variables
37 * -Dsqoop.test.postgresql.connectstring.host_url, -Dsqoop.test.postgresql.database,
38 * -Dsqoop.test.postgresql.username and -Dsqoop.test.postgresql.password respectively
39 */
40 @Category(PostgresqlTest.class)
41 public class PostgresJobToolTest extends JobToolTestBase {
42
43 private static final String HOST_URL = System.getProperty("sqoop.test.postgresql.connectstring.host_url",
44 "jdbc:postgresql://localhost/");
45 private static final String DATABASE_USER = System.getProperty(
46 "sqoop.test.postgresql.username", "sqooptest");
47 private static final String DATABASE_NAME = System.getProperty(
48 "sqoop.test.postgresql.database", "sqooptest");
49 private static final String PASSWORD = System.getProperty("sqoop.test.postgresql.password");
50 private static final String CONNECT_STRING = HOST_URL + DATABASE_NAME;
51
52 public PostgresJobToolTest() {
53 super(CONNECT_STRING, DATABASE_USER, PASSWORD);
54 }
55 }