Search in sources :

Example 1 with MoveFileAction

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());
}
Also used : MoveFileAction(org.smartdata.hdfs.action.MoveFileAction) HashMap(java.util.HashMap) FileMovePlan(org.smartdata.model.action.FileMovePlan) Test(org.junit.Test)

Example 2 with MoveFileAction

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());
}
Also used : MoveFileAction(org.smartdata.hdfs.action.MoveFileAction) HashMap(java.util.HashMap) Test(org.junit.Test)

Aggregations

HashMap (java.util.HashMap)2 Test (org.junit.Test)2 MoveFileAction (org.smartdata.hdfs.action.MoveFileAction)2 FileMovePlan (org.smartdata.model.action.FileMovePlan)1