test_class.file: smart-hadoop-support/smart-hadoop/src/test/java/org/smartdata/hdfs/action/TestConcatFileAction.java
test_class.identifier: TestConcatFileAction
test_class.superclass: extends MiniClusterHarness
test_case.body: @Test
    public void testRemoteFileConcat() throws IOException {
      final String srcPath = "/testConcat";
      final String file1 = "file1";
      final String file2 = "file2";
      final String target = "/target";
  
      dfs.mkdirs(new Path(srcPath));
      dfs.mkdirs(new Path(target));
      //write to DISK
      //write 50 Bytes to file1 and 50 Byte to file2. then concat them
      FSDataOutputStream out1 = dfs.create(new Path(srcPath + "/" + file1));
      for (int i = 0; i < DEFAULT_BLOCK_SIZE; i++) {
        out1.writeByte(1);
      }
      out1.close();
  
      out1 = dfs.create(new Path(srcPath + "/" + file2));
      for (int i = 0; i < DEFAULT_BLOCK_SIZE; i++) {
        out1.writeByte(2);
      }
      out1.close();
  
      ConcatFileAction concatFileAction = new ConcatFileAction();
      concatFileAction.setDfsClient(dfsClient);
      concatFileAction.setContext(smartContext);
      Map<String, String> args = new HashMap<>();
      args.put(CopyFileAction.FILE_PATH, dfs.getUri() + srcPath + "/" +
          file1 + "," + dfs.getUri() + srcPath + "/" + "file2");
      args.put(ConcatFileAction.DEST_PATH, dfs.getUri() + target);
      concatFileAction.init(args);
      concatFileAction.run();
  
      Assert.assertTrue(concatFileAction.getExpectedAfterRun());
      Assert.assertTrue(dfsClient.exists(target));
      //read and check file
      FSDataInputStream in = dfs.open(new Path(target),50);
      for (int i = 0; i < DEFAULT_BLOCK_SIZE; i++) {
        Assert.assertTrue(in.readByte() == 1);
      }
      for (int i = 0; i < DEFAULT_BLOCK_SIZE; i++) {
        Assert.assertTrue(in.readByte() == 2);
      }
    }
test_case.class_method_signature: TestConcatFileAction.testRemoteFileConcat()
test_case.full_signature: @Test public void testRemoteFileConcat()
test_case.identifier: testRemoteFileConcat
test_case.invocations: mkdirs mkdirs create writeByte close create writeByte close setDfsClient setContext put getUri getUri put getUri init run assertTrue getExpectedAfterRun assertTrue exists open assertTrue readByte assertTrue readByte
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testRemoteFileConcat()
focal_class.declarator: LOG = LoggerFactory.getLogger(ConcatFileAction.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(ConcatFileAction.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: DEST_PATH = "-dest"
focal_class.modifier: public static final
focal_class.original_string: public static final String DEST_PATH = "-dest";
focal_class.type: String
focal_class.var_name: DEST_PATH
focal_class.declarator: srcPathList
focal_class.modifier: private
focal_class.original_string: private LinkedList<String> srcPathList;
focal_class.type: LinkedList<String>
focal_class.var_name: srcPathList
focal_class.declarator: targetPath
focal_class.modifier: private
focal_class.original_string: private String targetPath;
focal_class.type: String
focal_class.var_name: targetPath
focal_class.file: smart-hadoop-support/smart-hadoop/src/main/java/org/smartdata/hdfs/action/ConcatFileAction.java
focal_class.identifier: ConcatFileAction
focal_class.class_method_signature: ConcatFileAction.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: ConcatFileAction.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.class_method_signature: ConcatFileAction.concatFiles(LinkedList<String> allFiles, String target)
focal_class.full_signature: private boolean concatFiles(LinkedList<String> allFiles, String target)
focal_class.identifier: concatFiles
focal_class.modifiers: private
focal_class.parameters: (LinkedList<String> allFiles, String target)
focal_class.return: boolean
focal_class.signature: boolean concatFiles(LinkedList<String> allFiles, String target)
focal_class.superclass: extends HdfsAction
focal_method.body: @Override
    public void init(Map<String, String> args) {
      super.init(args);
      String inputSrcPath = args.get(FILE_PATH);
      //init the linkedList
      String[] srcArray = inputSrcPath.split(",");
      srcPathList = new LinkedList<>(Arrays.asList(srcArray));
      if (args.containsKey(DEST_PATH)) {
        this.targetPath = args.get(DEST_PATH);
      }
    }
focal_method.class_method_signature: ConcatFileAction.init(Map<String, String> args)
focal_method.full_signature: @Override public void init(Map<String, String> args)
focal_method.identifier: init
focal_method.invocations: init get split asList containsKey get
focal_method.modifiers: @Override public
focal_method.parameters: (Map<String, String> args)
focal_method.return: void
focal_method.signature: void init(Map<String, String> args)