test_class.file: smart-hadoop-support/smart-hadoop/src/test/java/org/smartdata/hdfs/action/TestMetaDataAction.java
test_class.identifier: TestMetaDataAction
test_class.superclass: extends MiniClusterHarness
test_case.body: @Test
    public void testRemoteMetadataChange() throws IOException {
      final String srcPath = "/test";
      final String file = "file";
  
      dfs.mkdirs(new Path(srcPath));
      FSDataOutputStream out = dfs.create(new Path(srcPath + "/" + file));
      out.close();
  
      MetaDataAction metaFileAction = new MetaDataAction();
      metaFileAction.setDfsClient(dfsClient);
      metaFileAction.setContext(smartContext);
  
      Map<String, String> args = new HashMap<>();
      args.put(MetaDataAction.FILE_PATH, dfs.getUri() + srcPath + "/" + file);
      args.put(MetaDataAction.OWNER_NAME, "test");
      args.put(MetaDataAction.PERMISSION, "777");
  
      metaFileAction.init(args);
      metaFileAction.run();
  
      Assert.assertTrue(metaFileAction.getExpectedAfterRun());
      Assert.assertTrue(dfs.getFileStatus(new Path(srcPath + "/" + file)).getOwner().equals("test"));
      Assert.assertTrue(dfs.getFileStatus(new Path(srcPath + "/" + file)).getPermission().toString().equals("rwxrwxrwx"));
  
    }
test_case.class_method_signature: TestMetaDataAction.testRemoteMetadataChange()
test_case.full_signature: @Test public void testRemoteMetadataChange()
test_case.identifier: testRemoteMetadataChange
test_case.invocations: mkdirs create close setDfsClient setContext put getUri put put init run assertTrue getExpectedAfterRun assertTrue equals getOwner getFileStatus assertTrue equals toString getPermission getFileStatus
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testRemoteMetadataChange()
focal_class.declarator: LOG = LoggerFactory.getLogger(MetaDataAction.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG = LoggerFactory.getLogger(MetaDataAction.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: OWNER_NAME = "-owner"
focal_class.modifier: public static final
focal_class.original_string: public static final String OWNER_NAME = "-owner";
focal_class.type: String
focal_class.var_name: OWNER_NAME
focal_class.declarator: GROUP_NAME = "-group"
focal_class.modifier: public static final
focal_class.original_string: public static final String GROUP_NAME = "-group";
focal_class.type: String
focal_class.var_name: GROUP_NAME
focal_class.declarator: BLOCK_REPLICATION = "-replication"
focal_class.modifier: public static final
focal_class.original_string: public static final String BLOCK_REPLICATION = "-replication";
focal_class.type: String
focal_class.var_name: BLOCK_REPLICATION
focal_class.declarator: PERMISSION = "-permission"
focal_class.modifier: public static final
focal_class.original_string: public static final String PERMISSION = "-permission";
focal_class.type: String
focal_class.var_name: PERMISSION
focal_class.declarator: MTIME = "-mtime"
focal_class.modifier: public static final
focal_class.original_string: public static final String MTIME = "-mtime";
focal_class.type: String
focal_class.var_name: MTIME
focal_class.declarator: ATIME = "-atime"
focal_class.modifier: public static final
focal_class.original_string: public static final String ATIME = "-atime";
focal_class.type: String
focal_class.var_name: ATIME
focal_class.declarator: srcPath
focal_class.modifier: private
focal_class.original_string: private String srcPath;
focal_class.type: String
focal_class.var_name: srcPath
focal_class.declarator: ownerName
focal_class.modifier: private
focal_class.original_string: private String ownerName;
focal_class.type: String
focal_class.var_name: ownerName
focal_class.declarator: groupName
focal_class.modifier: private
focal_class.original_string: private String groupName;
focal_class.type: String
focal_class.var_name: groupName
focal_class.declarator: replication
focal_class.modifier: private
focal_class.original_string: private short replication;
focal_class.type: short
focal_class.var_name: replication
focal_class.declarator: permission
focal_class.modifier: private
focal_class.original_string: private short permission;
focal_class.type: short
focal_class.var_name: permission
focal_class.declarator: aTime
focal_class.modifier: private
focal_class.original_string: private long aTime;
focal_class.type: long
focal_class.var_name: aTime
focal_class.declarator: mTime
focal_class.modifier: private
focal_class.original_string: private long mTime;
focal_class.type: long
focal_class.var_name: mTime
focal_class.file: smart-hadoop-support/smart-hadoop/src/main/java/org/smartdata/hdfs/action/MetaDataAction.java
focal_class.identifier: MetaDataAction
focal_class.class_method_signature: MetaDataAction.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: MetaDataAction.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: MetaDataAction.changeFileMetaData(String srcFile, FileInfo fileInfo)
focal_class.full_signature: private boolean changeFileMetaData(String srcFile, FileInfo fileInfo)
focal_class.identifier: changeFileMetaData
focal_class.modifiers: private
focal_class.parameters: (String srcFile, FileInfo fileInfo)
focal_class.return: boolean
focal_class.signature: boolean changeFileMetaData(String srcFile, FileInfo fileInfo)
focal_class.superclass: extends HdfsAction
focal_method.body: @Override
    public void init(Map<String, String> args) {
      super.init(args);
      srcPath = args.get(FILE_PATH);
  
      ownerName = null;
      groupName = null;
      replication = -1;
      permission = -1;
      aTime = -1;
      mTime = -1;
  
      if (args.containsKey(OWNER_NAME)) {
        this.ownerName = args.get(OWNER_NAME);
      }
      if (args.containsKey(GROUP_NAME)) {
        this.groupName = args.get(GROUP_NAME);
      }
      if (args.containsKey(BLOCK_REPLICATION)) {
        this.replication = Short.parseShort(args.get(BLOCK_REPLICATION));
      }
      if (args.containsKey(PERMISSION)) {
        FsPermission fsPermission = new FsPermission(args.get(PERMISSION));
        this.permission = fsPermission.toShort();
      }
      if (args.containsKey(MTIME)) {
        this.mTime = Long.parseLong(args.get(MTIME));
      }
      if (args.containsKey(ATIME)) {
        this.aTime = Long.parseLong(args.get(ATIME));
      }
    }
focal_method.class_method_signature: MetaDataAction.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 containsKey get containsKey get containsKey parseShort get containsKey get toShort containsKey parseLong get containsKey parseLong 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)