test_class.file: smart-hadoop-support/smart-hadoop-3.1/src/test/java/org/smartdata/hdfs/action/TestUnErasureCodingAction.java
test_class.identifier: TestUnErasureCodingAction
test_class.superclass: extends TestErasureCodingMiniCluster
test_case.body: @Test
    public void testUnEcActionForFile() throws Exception {
      String testDir = "/test_dir";
      dfs.mkdirs(new Path(testDir));
      dfs.setErasureCodingPolicy(new Path(testDir), ecPolicy.getName());
      // create test file, its EC policy should be consistent with parent dir, i.e., ecPolicy.
      String srcPath = testDir + "/ec_file";
      createTestFile(srcPath, 1000);
      dfsClient.setStoragePolicy(srcPath, "COLD");
      HdfsFileStatus srcFileStatus = dfsClient.getFileInfo(srcPath);
      assertEquals(dfsClient.getErasureCodingPolicy(srcPath), ecPolicy);
  
      UnErasureCodingAction unEcAction = new UnErasureCodingAction();
      unEcAction.setContext(smartContext);
      String ecTmpPath = "/ssm/ec_tmp/tmp_file";
      Map<String, String> args = new HashMap<>();
      args.put(HdfsAction.FILE_PATH, srcPath);
      args.put(ErasureCodingBase.EC_TMP, ecTmpPath);
      unEcAction.init(args);
      unEcAction.run();
      assertTrue(unEcAction.getExpectedAfterRun());
      HdfsFileStatus fileStatus = dfsClient.getFileInfo(srcPath);
      assertNull(fileStatus.getErasureCodingPolicy());
      // Examine the consistency of file attributes.
      assertEquals(srcFileStatus.getLen(), fileStatus.getLen());
      assertEquals(srcFileStatus.getModificationTime(), fileStatus.getModificationTime());
      assertEquals(srcFileStatus.getAccessTime(), fileStatus.getAccessTime());
      assertEquals(srcFileStatus.getOwner(), fileStatus.getOwner());
      assertEquals(srcFileStatus.getGroup(), fileStatus.getGroup());
      assertEquals(srcFileStatus.getPermission(), fileStatus.getPermission());
      // UNDEF storage policy makes the converted file's storage type uncertain, so it is excluded.
      if (srcFileStatus.getStoragePolicy() != 0) {
        assertEquals(srcFileStatus.getStoragePolicy(), fileStatus.getStoragePolicy());
      }
    }
test_case.class_method_signature: TestUnErasureCodingAction.testUnEcActionForFile()
test_case.full_signature: @Test public void testUnEcActionForFile()
test_case.identifier: testUnEcActionForFile
test_case.invocations: mkdirs setErasureCodingPolicy getName createTestFile setStoragePolicy getFileInfo assertEquals getErasureCodingPolicy setContext put put init run assertTrue getExpectedAfterRun getFileInfo assertNull getErasureCodingPolicy assertEquals getLen getLen assertEquals getModificationTime getModificationTime assertEquals getAccessTime getAccessTime assertEquals getOwner getOwner assertEquals getGroup getGroup assertEquals getPermission getPermission getStoragePolicy assertEquals getStoragePolicy getStoragePolicy
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testUnEcActionForFile()
focal_class.declarator: LOG =
        LoggerFactory.getLogger(UnErasureCodingAction.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG =
        LoggerFactory.getLogger(UnErasureCodingAction.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: ecPolicyName
focal_class.modifier: private
focal_class.original_string: private String ecPolicyName;
focal_class.type: String
focal_class.var_name: ecPolicyName
focal_class.declarator: conf
focal_class.modifier: private
focal_class.original_string: private SmartConf conf;
focal_class.type: SmartConf
focal_class.var_name: conf
focal_class.file: smart-hadoop-support/smart-hadoop-3.1/src/main/java/org/smartdata/hdfs/action/UnErasureCodingAction.java
focal_class.identifier: UnErasureCodingAction
focal_class.class_method_signature: UnErasureCodingAction.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: UnErasureCodingAction.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: UnErasureCodingAction.getProgress()
focal_class.full_signature: @Override public float getProgress()
focal_class.identifier: getProgress
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: float
focal_class.signature: float getProgress()
focal_class.superclass: extends ErasureCodingBase
focal_method.body: @Override
    public void init(Map<String, String> args) {
      super.init(args);
      this.conf = getContext().getConf();
      this.srcPath = args.get(FILE_PATH);
      this.ecPolicyName = REPLICATION_POLICY_NAME;
      if (args.containsKey(EC_TMP)) {
        this.ecTmpPath = args.get(EC_TMP);
      }
      if (args.containsKey(BUF_SIZE) && !args.get(BUF_SIZE).isEmpty()) {
        this.bufferSize = (int) StringUtil.parseToByte(args.get(BUF_SIZE));
      }
      this.progress = 0.0F;
    }
focal_method.class_method_signature: UnErasureCodingAction.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 getConf getContext get containsKey get containsKey isEmpty get parseToByte 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)