use of org.smartdata.hdfs.action.MoveFileAction in project SSM by Intel-bigdata.
the class TestMoveFileAction method testMove.
@Test(timeout = 300000)
public void testMove() throws Exception {
String dir = "/test";
String file = "/test/file";
dfs.mkdirs(new Path(dir));
// write to DISK
dfs.setStoragePolicy(new Path(dir), "HOT");
FSDataOutputStream out = dfs.create(new Path(file));
final String str = "testtesttest";
out.writeChars(str);
// move to SSD
MoveFileAction moveFileAction = new MoveFileAction();
moveFileAction.setDfsClient(dfsClient);
moveFileAction.setContext(smartContext);
Map<String, String> args = new HashMap();
args.put(MoveFileAction.FILE_PATH, dir);
String storageType = "ONE_SSD";
args.put(MoveFileAction.STORAGE_POLICY, storageType);
FileMovePlan plan = createPlan(file, storageType);
args.put(MoveFileAction.MOVE_PLAN, plan.toString());
// init and run
moveFileAction.init(args);
moveFileAction.run();
Assert.assertTrue(moveFileAction.getExpectedAfterRun());
}
use of org.smartdata.hdfs.action.MoveFileAction in project SSM by Intel-bigdata.
the class TestMoveFileAction method testMoveNonexitedFile.
@Test(timeout = 300000)
public void testMoveNonexitedFile() throws Exception {
String dir = "/testParallelMovers";
// schedule move to ALL_SSD
MoveFileAction moveFileAction = new MoveFileAction();
moveFileAction.setDfsClient(dfsClient);
moveFileAction.setContext(smartContext);
Map<String, String> args = new HashMap();
args.put(MoveFileAction.FILE_PATH, dir);
args.put(MoveFileAction.STORAGE_POLICY, "ALL_SSD");
moveFileAction.init(args);
moveFileAction.run();
Assert.assertNotNull(moveFileAction.getActionStatus().getThrowable());
}
Aggregations