private SqoopOptions buildBaseSqoopOptions() { SqoopOptions result = new SqoopOptions(); result.setTableName(TABLE_NAME); result.setConnectString(CONNECT_STRING); return result; }
private org.apache.sqoop.metastore.JobData createTestJobData(String setTableName) throws IOException { SqoopOptions testOpts = new SqoopOptions(); testOpts.setTableName(setTableName); ImportTool testTool = new ImportTool(); return new org.apache.sqoop.metastore.JobData(testOpts,testTool); } }
/** * If the append source does not exist, don't crash. */ @Test public void testAppendSrcDoesNotExist() throws IOException { Configuration conf = new Configuration(); if (!isOnPhysicalCluster()) { conf.set(CommonArgs.FS_DEFAULT_NAME, CommonArgs.LOCAL_FS); } SqoopOptions options = new SqoopOptions(conf); options.setTableName("meep"); Path missingPath = new Path("doesNotExistForAnyReason"); FileSystem local = FileSystem.getLocal(conf); assertFalse(local.exists(missingPath)); ImportJobContext importContext = new ImportJobContext("meep", null, options, missingPath); AppendUtils utils = new AppendUtils(importContext); utils.append(); }
private void importData(String targetDir, SqoopOptions.FileLayout fileLayout) { SqoopOptions options; options = getSqoopOptions(newConf()); options.setTableName(TABLE_NAME); options.setNumMappers(1); options.setFileLayout(fileLayout); options.setDeleteMode(true); Path warehouse = new Path(getWarehouseDir()); options.setTargetDir(new Path(warehouse, targetDir).toString()); ImportTool importTool = new ImportTool(); Sqoop importer = new Sqoop(importTool, options.getConf(), options); int ret = Sqoop.runSqoop(importer, new String[0]); if (0 != ret) { fail("Initial import failed with exit code " + ret); } }
options.setTableName(TABLE_NAME); options.setClassName(MERGE_CLASS_NAME);
@Before public void setUp() { Configuration conf = getConf(); opts = getSqoopOptions(conf); opts.setConnectString("dummy.server"); opts.setTableName("dummy.pds"); opts.setConnManagerClassName(MainframeManager.class.getName()); context = new ImportJobContext(getTableName(), null, opts, null); ConnFactory f = new ConnFactory(conf); try { this.manager = f.getManager(new JobData(opts, new MainframeImportTool())); } catch (IOException ioe) { fail("IOException instantiating manager: " + StringUtils.stringifyException(ioe)); } }
SqoopOptions opts = getSqoopOptions(conf); opts.setConnectString(getConnectString()); opts.setTableName(getTableName()); ConnFactory f = new ConnFactory(conf); try {