Github user fszabo2 commented on a diff in the pull request: https://github.com/apache/sqoop/pull/60#discussion_r238694607 --- Diff: src/test/org/apache/sqoop/importjob/numerictypes/NumericTypesImportTestBase.java --- @@ -65,240 +46,79 @@ * 2. Decimal padding during avro or parquet import * In case of Oracle and Postgres, Sqoop has to pad the values with 0s to avoid errors. */ -public abstract class NumericTypesImportTestBase<T extends AvroTestConfiguration & ParquetTestConfiguration> extends ImportJobTestCase implements DatabaseAdapterFactory { +public abstract class NumericTypesImportTestBase<T extends ImportJobTestConfiguration> extends ThirdPartyTestBase<T> { public static final Log LOG = LogFactory.getLog(NumericTypesImportTestBase.class.getName()); - private Configuration conf = new Configuration(); - - private final T configuration; - private final DatabaseAdapter adapter; private final boolean failWithoutExtraArgs; private final boolean failWithPadding; - // Constants for the basic test case, that doesn't use extra arguments - // that are required to avoid errors, i.e. padding and default precision and scale. - protected final static boolean SUCCEED_WITHOUT_EXTRA_ARGS = false; - protected final static boolean FAIL_WITHOUT_EXTRA_ARGS = true; - - // Constants for the test case that has padding specified but not default precision and scale. - protected final static boolean SUCCEED_WITH_PADDING_ONLY = false; - protected final static boolean FAIL_WITH_PADDING_ONLY = true; - - private Path tableDirPath; - public NumericTypesImportTestBase(T configuration, boolean failWithoutExtraArgs, boolean failWithPaddingOnly) { - this.adapter = createAdapter(); - this.configuration = configuration; + super(configuration); this.failWithoutExtraArgs = failWithoutExtraArgs; this.failWithPadding = failWithPaddingOnly; } - @Rule - public ExpectedException thrown = ExpectedException.none(); - - @Override - protected Configuration getConf() { - return conf; - } - - @Override - protected boolean useHsqldbTestServer() { - return false; - } - - @Override - protected String getConnectString() { - return adapter.getConnectionString(); - } - - @Override - protected SqoopOptions getSqoopOptions(Configuration conf) { - SqoopOptions opts = new SqoopOptions(conf); - adapter.injectConnectionParameters(opts); - return opts; - } - - @Override - protected void dropTableIfExists(String table) throws SQLException { - adapter.dropTableIfExists(table, getManager()); - } - @Before public void setUp() { super.setUp(); - String[] names = configuration.getNames(); - String[] types = configuration.getTypes(); - createTableWithColTypesAndNames(names, types, new String[0]); - List<String[]> inputData = configuration.getSampleData(); - for (String[] input : inputData) { - insertIntoTable(names, types, input); - } tableDirPath = new Path(getWarehouseDir() + "/" + getTableName()); } - @After - public void tearDown() { - try { - dropTableIfExists(getTableName()); - } catch (SQLException e) { - LOG.warn("Error trying to drop table on tearDown: " + e); - } - super.tearDown(); - } + public Path tableDirPath; --- End diff -- Makes sense
---