test_class.file: smart-hadoop-support/smart-hadoop/src/test/java/org/smartdata/hdfs/action/TestReadFileAction.java
test_class.identifier: TestReadFileAction
test_class.superclass: extends MiniClusterHarness
test_case.body: @Test
    public void testExecute() throws IOException {
      String filePath = "/testWriteFile/file";
      int size = 66560;
      writeFile(filePath, size);
      ReadFileAction readFileAction = new ReadFileAction();
      readFileAction.setDfsClient(dfsClient);
      readFileAction.setContext(smartContext);
      Map<String, String> args = new HashMap();
      args.put(ReadFileAction.FILE_PATH, filePath);
      readFileAction.init(args);
      readFileAction.run();
      Assert.assertTrue(readFileAction.getExpectedAfterRun());
    }
test_case.class_method_signature: TestReadFileAction.testExecute()
test_case.full_signature: @Test public void testExecute()
test_case.identifier: testExecute
test_case.invocations: writeFile setDfsClient setContext put init run assertTrue getExpectedAfterRun
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testExecute()
focal_class.declarator: BUF_SIZE = "-bufSize"
focal_class.modifier: public static final
focal_class.original_string: public static final String BUF_SIZE = "-bufSize";
focal_class.type: String
focal_class.var_name: BUF_SIZE
focal_class.declarator: filePath
focal_class.modifier: private
focal_class.original_string: private String filePath;
focal_class.type: String
focal_class.var_name: filePath
focal_class.declarator: bufferSize = 64 * 1024
focal_class.modifier: private
focal_class.original_string: private int bufferSize = 64 * 1024;
focal_class.type: int
focal_class.var_name: bufferSize
focal_class.file: smart-hadoop-support/smart-hadoop/src/main/java/org/smartdata/hdfs/action/ReadFileAction.java
focal_class.identifier: ReadFileAction
focal_class.class_method_signature: ReadFileAction.init(Map<String, String> args)
focal_class.full_signature: @Override public void init(Map<String, String> args)
focal_class.identifier: init
focal_class.modifiers: @Override public
focal_class.parameters: (Map<String, String> args)
focal_class.return: void
focal_class.signature: void init(Map<String, String> args)
focal_class.class_method_signature: ReadFileAction.execute()
focal_class.full_signature: @Override protected void execute()
focal_class.identifier: execute
focal_class.modifiers: @Override protected
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void execute()
focal_class.superclass: extends HdfsAction
focal_method.body: @Override
    protected void execute() throws Exception {
      if (filePath == null) {
        throw new IllegalArgumentException("File parameter is missing.");
      }
      appendLog(
          String.format("Action starts at %s : Read %s",
              Utils.getFormatedCurrentTime(), filePath));
      if (!dfsClient.exists(filePath)) {
        throw new ActionException("ReadFile Action fails, file " +
            filePath + " doesn't exist!");
      }
      DFSInputStream dfsInputStream = dfsClient.open(filePath);
      byte[] buffer = new byte[bufferSize];
      // read from HDFS
      while (dfsInputStream.read(buffer, 0, bufferSize) != -1) {}
      dfsInputStream.close();
    }
focal_method.class_method_signature: ReadFileAction.execute()
focal_method.full_signature: @Override protected void execute()
focal_method.identifier: execute
focal_method.invocations: appendLog format getFormatedCurrentTime exists open read close
focal_method.modifiers: @Override protected
focal_method.parameters: ()
focal_method.return: void
focal_method.signature: void execute()