e9705e5dacf525835969c1b6d65e4a57ac063d8c
[sqoop.git] / src / test / org / apache / sqoop / manager / postgresql / PostgresqlTestUtil.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.manager.postgresql;
20
21 public class PostgresqlTestUtil {
22
23 public static final String HOST_URL = System.getProperty(
24 "sqoop.test.postgresql.connectstring.host_url",
25 "jdbc:postgresql://localhost/");
26
27 public static final String DATABASE_USER = System.getProperty(
28 "sqoop.test.postgresql.username",
29 "sqooptest");
30
31 public static final String DATABASE_NAME = System.getProperty(
32 "sqoop.test.postgresql.database",
33 "sqooptest");
34
35 public static final String CONNECT_STRING = HOST_URL + DATABASE_NAME;
36
37 public static final String PASSWORD = System.getProperty(
38 "sqoop.test.postgresql.password");
39
40 static final String TABLE_NAME = "EMPLOYEES_PG";
41
42 static final String NULL_TABLE_NAME = "NULL_EMPLOYEES_PG";
43
44 static final String SPECIAL_TABLE_NAME = "EMPLOYEES_PG's";
45
46 static final String DIFFERENT_TABLE_NAME = "DIFFERENT_TABLE";
47
48 public static final String SCHEMA_PUBLIC = "public";
49
50 public static final String SCHEMA_SPECIAL = "special";
51
52 public static String quoteTableOrSchemaName(String tableName) {
53 return "\"" + tableName + "\"";
54 }
55
56 public static String getDropTableStatement(String tableName, String schema) {
57 return "DROP TABLE IF EXISTS " + quoteTableOrSchemaName(schema) + "." + quoteTableOrSchemaName(tableName);
58 }
59 }