test_class.file: smart-hadoop-support/smart-hadoop-3.1/src/test/java/org/smartdata/hdfs/action/TestErasureCodingAction.java
test_class.identifier: TestErasureCodingAction
test_class.superclass: extends TestErasureCodingMiniCluster
test_case.body: @Test
    public void testEcActionForDir() throws Exception {
      String srcDirPath = "/test_dir/";
      dfs.mkdirs(new Path(srcDirPath));
      assertEquals(null, dfsClient.getErasureCodingPolicy(srcDirPath));
  
      ErasureCodingAction ecAction = new ErasureCodingAction();
      ecAction.setContext(smartContext);
      Map<String, String> args = new HashMap<>();
      args.put(HdfsAction.FILE_PATH, srcDirPath);
      args.put(ErasureCodingAction.EC_POLICY_NAME, ecPolicy.getName());
      ecAction.init(args);
      ecAction.run();
      assertTrue(ecAction.getExpectedAfterRun());
      assertEquals(dfsClient.getErasureCodingPolicy(srcDirPath), ecPolicy);
  
      String srcFilePath = "/test_dir/test_file";
      createTestFile(srcFilePath, 1000);
      // The newly created file should has the same EC policy as parent directory.
      assertEquals(dfsClient.getErasureCodingPolicy(srcFilePath), ecPolicy);
    }
test_case.class_method_signature: TestErasureCodingAction.testEcActionForDir()
test_case.full_signature: @Test public void testEcActionForDir()
test_case.identifier: testEcActionForDir
test_case.invocations: mkdirs assertEquals getErasureCodingPolicy setContext put put getName init run assertTrue getExpectedAfterRun assertEquals getErasureCodingPolicy createTestFile assertEquals getErasureCodingPolicy
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testEcActionForDir()
focal_class.declarator: LOG =
        LoggerFactory.getLogger(ErasureCodingAction.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG =
        LoggerFactory.getLogger(ErasureCodingAction.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: EC_POLICY_NAME = "-policy"
focal_class.modifier: public static final
focal_class.original_string: public static final String EC_POLICY_NAME = "-policy";
focal_class.type: String
focal_class.var_name: EC_POLICY_NAME
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.declarator: ecPolicyName
focal_class.modifier: private
focal_class.original_string: private String ecPolicyName;
focal_class.type: String
focal_class.var_name: ecPolicyName
focal_class.file: smart-hadoop-support/smart-hadoop-3.1/src/main/java/org/smartdata/hdfs/action/ErasureCodingAction.java
focal_class.identifier: ErasureCodingAction
focal_class.class_method_signature: ErasureCodingAction.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: ErasureCodingAction.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: ErasureCodingAction.validateEcPolicy(String ecPolicyName)
focal_class.full_signature: public void validateEcPolicy(String ecPolicyName)
focal_class.identifier: validateEcPolicy
focal_class.modifiers: public
focal_class.parameters: (String ecPolicyName)
focal_class.return: void
focal_class.signature: void validateEcPolicy(String ecPolicyName)
focal_class.class_method_signature: ErasureCodingAction.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);
      if (args.containsKey(EC_TMP)) {
        // this is a temp file kept for converting a file to another with other ec policy.
        this.ecTmpPath = args.get(EC_TMP);
      }
      if (args.containsKey(EC_POLICY_NAME) && !args.get(EC_POLICY_NAME).isEmpty()) {
        this.ecPolicyName = args.get(EC_POLICY_NAME);
      } else {
        String defaultEcPolicy = conf.getTrimmed(DFSConfigKeys.DFS_NAMENODE_EC_SYSTEM_DEFAULT_POLICY,
            DFSConfigKeys.DFS_NAMENODE_EC_SYSTEM_DEFAULT_POLICY_DEFAULT);
        this.ecPolicyName = defaultEcPolicy;
      }
      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: ErasureCodingAction.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 get getTrimmed 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)