@Test public void testCopyNewFilesOnDifferentFileSystem() throws IOException { Path sourcePath = new Path(sourceFolder.getRoot().getAbsolutePath()); sourceFolder.newFile("000000_0"); sourceFolder.newFile("000001_0"); sourceFolder.newFile("000000_0.gz"); sourceFolder.newFile("000001_0.gz"); Path targetPath = new Path(targetFolder.getRoot().getAbsolutePath()); // Simulate different filesystems by returning a different URI FileSystem spyTargetFs = Mockito.spy(targetPath.getFileSystem(hiveConf)); Mockito.when(spyTargetFs.getUri()).thenReturn(URI.create("hdfs://" + targetPath.toUri().getPath())); try { Hive.copyFiles(hiveConf, sourcePath, targetPath, spyTargetFs, isSourceLocal, NO_ACID, false, null, false, false, false); } catch (HiveException e) { e.printStackTrace(); assertTrue("Hive.copyFiles() threw an unexpected exception.", false); } assertTrue(spyTargetFs.exists(new Path(targetPath, "000000_0"))); assertTrue(spyTargetFs.exists(new Path(targetPath, "000001_0"))); assertTrue(spyTargetFs.exists(new Path(targetPath, "000000_0.gz"))); assertTrue(spyTargetFs.exists(new Path(targetPath, "000001_0.gz"))); }
@Test public void testRenameNewFilesOnSameFileSystem() throws IOException { Path sourcePath = new Path(sourceFolder.getRoot().getAbsolutePath()); sourceFolder.newFile("000000_0"); sourceFolder.newFile("000001_0"); sourceFolder.newFile("000000_0.gz"); sourceFolder.newFile("000001_0.gz"); Path targetPath = new Path(targetFolder.getRoot().getAbsolutePath()); FileSystem targetFs = targetPath.getFileSystem(hiveConf); try { Hive.copyFiles(hiveConf, sourcePath, targetPath, targetFs, isSourceLocal, NO_ACID, false,null, false, false, false); } catch (HiveException e) { e.printStackTrace(); assertTrue("Hive.copyFiles() threw an unexpected exception.", false); } assertTrue(targetFs.exists(new Path(targetPath, "000000_0"))); assertTrue(targetFs.exists(new Path(targetPath, "000001_0"))); assertTrue(targetFs.exists(new Path(targetPath, "000000_0.gz"))); assertTrue(targetFs.exists(new Path(targetPath, "000001_0.gz"))); }
Hive.copyFiles(hiveConf, sourcePath, targetPath, spyTargetFs, isSourceLocal, NO_ACID, false, null, false, false, false); } catch (HiveException e) { e.printStackTrace(); assertTrue("Hive.copyFiles() threw an unexpected exception.", false); Hive.copyFiles(hiveConf, sourcePath, targetPath, spyTargetFs, isSourceLocal, NO_ACID, false, null, false, false, false); } catch (HiveException e) { e.printStackTrace(); assertTrue("Hive.copyFiles() threw an unexpected exception.", false);
Hive.copyFiles(hiveConf, sourcePath, targetPath, targetFs, isSourceLocal, NO_ACID, false, null, false, false, false); } catch (HiveException e) { e.printStackTrace(); assertTrue("Hive.copyFiles() threw an unexpected exception.", false); Hive.copyFiles(hiveConf, sourcePath, targetPath, targetFs, isSourceLocal, NO_ACID, false, null, false, false, false); } catch (HiveException e) { e.printStackTrace(); assertTrue("Hive.copyFiles() threw an unexpected exception.", false);
hm.dropTable(Warehouse.DEFAULT_DATABASE_NAME, tableName); } catch (HiveException e1) { e1.printStackTrace(); assertTrue("Unable to drop table", false); tbl.setBucketCols(bucketCols); } catch (HiveException e) { e.printStackTrace(); assertTrue("Unable to set bucket column for table: " + tableName, false); hm.createTable(tbl); } catch (HiveException e) { e.printStackTrace(); assertTrue("Unable to create table: " + tableName, false);
e.printStackTrace(); throw e;