be086c5c242e5681871d70aa79ad491a62283c29
[sqoop.git] / src / test / org / apache / sqoop / manager / oracle / TimestampDataTest.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.apache.hadoop.conf.Configuration;
22 import org.junit.Test;
23
24 import static org.junit.Assert.assertEquals;
25
26 /**
27 * These tests need to be separate as changing the mapping type for timestamp
28 * requires the tests to be run in a different process. Maven needs to be setup
29 * to fork per test class.
30 */
31 public class TimestampDataTest extends OraOopTestCase {
32
33 private static final boolean DISABLE_ORACLE_ESCAPING_FLAG = false;
34
35 @Test
36 public void testProductImportTimezone() throws Exception {
37 setSqoopTargetDirectory(getSqoopTargetDirectory() + "tst_product_timezone");
38 createTable("table_tst_product.xml");
39
40 Configuration sqoopConf = getSqoopConf();
41 sqoopConf.setBoolean(OraOopConstants.ORAOOP_MAP_TIMESTAMP_AS_STRING, false);
42
43 try {
44 int retCode = runImport("TST_PRODUCT", sqoopConf, false, DISABLE_ORACLE_ESCAPING_FLAG);
45 assertEquals("Return code should be 0", 0, retCode);
46
47 } finally {
48 cleanupFolders();
49 closeTestEnvConnection();
50 }
51 }
52
53 }