HBASE-14572 TestImportExport#testImport94Table can't find its src data file

This commit is contained in:
stack 2015-10-06 23:27:58 -07:00
parent 298721b259
commit d80c7e95ec
1 changed files with 15 additions and 7 deletions

View File

@ -27,6 +27,7 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; import static org.mockito.Mockito.when;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.PrintStream; import java.io.PrintStream;
import java.net.URL; import java.net.URL;
@ -111,7 +112,8 @@ public class TestImportExport {
UTIL.getConfiguration().setInt(HConstants.REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT, 10); UTIL.getConfiguration().setInt(HConstants.REGION_SERVER_HIGH_PRIORITY_HANDLER_COUNT, 10);
UTIL.startMiniCluster(); UTIL.startMiniCluster();
UTIL.startMiniMapReduceCluster(); UTIL.startMiniMapReduceCluster();
FQ_OUTPUT_DIR = new Path(OUTPUT_DIR).makeQualified(FileSystem.get(UTIL.getConfiguration())).toString(); FQ_OUTPUT_DIR =
new Path(OUTPUT_DIR).makeQualified(FileSystem.get(UTIL.getConfiguration())).toString();
} }
@AfterClass @AfterClass
@ -226,13 +228,19 @@ public class TestImportExport {
*/ */
@Test @Test
public void testImport94Table() throws Exception { public void testImport94Table() throws Exception {
URL url = TestImportExport.class.getResource( final String name = "exportedTableIn94Format";
"exportedTableIn94Format"); URL url = TestImportExport.class.getResource(name);
Path importPath = new Path(url.getPath()); File f = new File(url.toURI());
if (!f.exists()) {
LOG.warn("FAILED TO FIND " + f + "; skipping out on test");
return;
}
assertTrue(f.exists());
LOG.info("FILE=" + f);
Path importPath = new Path(f.toURI());
FileSystem fs = FileSystem.get(UTIL.getConfiguration()); FileSystem fs = FileSystem.get(UTIL.getConfiguration());
fs.copyFromLocalFile(importPath, new Path(FQ_OUTPUT_DIR + Path.SEPARATOR fs.copyFromLocalFile(importPath, new Path(FQ_OUTPUT_DIR + Path.SEPARATOR + name));
+ "exportedTableIn94Format")); String IMPORT_TABLE = name;
String IMPORT_TABLE = "importTableExportedFrom94";
Table t = UTIL.createTable(TableName.valueOf(IMPORT_TABLE), Bytes.toBytes("f1"), 3); Table t = UTIL.createTable(TableName.valueOf(IMPORT_TABLE), Bytes.toBytes("f1"), 3);
String[] args = new String[] { String[] args = new String[] {
"-Dhbase.import.version=0.94" , "-Dhbase.import.version=0.94" ,