use of org.smartdata.actions.ActionStatus in project SSM by Intel-bigdata.
the class TestWriteFileAction method writeFile.
protected void writeFile(String filePath, int length) throws IOException {
String[] args = { filePath, String.valueOf(length) };
WriteFileAction writeFileAction = new WriteFileAction();
writeFileAction.setDfsClient(dfsClient);
writeFileAction.setContext(smartContext);
writeFileAction.init(args);
writeFileAction.run();
// check results
ActionStatus actionStatus = writeFileAction.getActionStatus();
Assert.assertTrue(actionStatus.isFinished());
Assert.assertTrue(actionStatus.isSuccessful());
System.out.println("Write file action running time : " + StringUtils.formatTime(actionStatus.getRunningTime()));
Assert.assertEquals(1.0f, actionStatus.getPercentage(), 0.00001f);
}
use of org.smartdata.actions.ActionStatus in project SSM by Intel-bigdata.
the class TestSetStoragePolicyAction method setStoragePolicy.
private byte setStoragePolicy(String file, String storagePolicy) throws IOException {
SetStoragePolicyAction action = new SetStoragePolicyAction();
action.setDfsClient(dfsClient);
action.setContext(smartContext);
action.init(new String[] { file, storagePolicy });
action.run();
ActionStatus status = action.getActionStatus();
// check results
System.out.println("Action running time = " + StringUtils.formatTime(status.getRunningTime()));
Assert.assertTrue(status.isFinished());
Assert.assertTrue(status.isSuccessful());
Assert.assertEquals(1.0f, status.getPercentage(), 0.00001f);
HdfsFileStatus fileStatus = dfsClient.getFileInfo(file);
return fileStatus.getStoragePolicy();
}
Aggregations