a601687192d7149a7bbd0f4a8635c2b1c2bb946e
[sqoop.git] / src / test / org / apache / sqoop / manager / oracle / ExportTest.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.oracle;
20
21 import org.junit.AfterClass;
22 import org.junit.BeforeClass;
23 import org.junit.Test;
24
25 import static org.junit.Assert.assertEquals;
26
27 /**
28 * Test exporting data into Oracle.
29 */
30 public class ExportTest extends OraOopTestCase {
31
32 private static final ExportTest TEST_CASE = new ExportTest();
33
34 private static final boolean DISABLE_ORACLE_ESCAPING_FLAG = false;
35
36 @BeforeClass
37 public static void setUpHdfsData() throws Exception {
38 // Copy the TST_PRODUCT table into HDFS which can be used for the export
39 // tests
40 TEST_CASE.setSqoopTargetDirectory(TEST_CASE.getSqoopTargetDirectory()
41 + "tst_product");
42 TEST_CASE.createTable("table_tst_product.xml");
43
44 int retCode =
45 TEST_CASE.runImport("TST_PRODUCT", TEST_CASE.getSqoopConf(), false, DISABLE_ORACLE_ESCAPING_FLAG);
46 assertEquals("Return code should be 0", 0, retCode);
47 }
48
49 @Test
50 public void testProductExport() throws Exception {
51 int retCode =
52 TEST_CASE.runExportFromTemplateTable("TST_PRODUCT", "TST_PRODUCT_EXP", false, DISABLE_ORACLE_ESCAPING_FLAG);
53 assertEquals("Return code should be 0", 0, retCode);
54 }
55
56 @Test
57 public void testProductExportMixedCaseTableName() throws Exception {
58 int retCode =
59 TEST_CASE.runExportFromTemplateTable("TST_PRODUCT",
60 "\"\"T5+_Pr#duct_Exp\"\"", false, DISABLE_ORACLE_ESCAPING_FLAG);
61 assertEquals("Return code should be 0", 0, retCode);
62 }
63
64 @AfterClass
65 public static void cleanUpHdfsData() throws Exception {
66 TEST_CASE.cleanupFolders();
67 TEST_CASE.closeTestEnvConnection();
68 }
69
70 }