test_class.declarator: metaStore = null
test_class.modifier: private
test_class.original_string: private MetaStore metaStore = null;
test_class.type: MetaStore
test_class.var_name: metaStore
test_class.file: smart-hadoop-support/smart-hadoop/src/test/java/org/smartdata/hdfs/metric/fetcher/TestInotifyEventApplier.java
test_class.identifier: TestInotifyEventApplier
test_class.superclass: extends TestDaoUtil
test_case.body: @Test
    public void testApplierRenameEvent() throws Exception {
      DFSClient client = Mockito.mock(DFSClient.class);
      SmartConf conf = new SmartConf();
      NamespaceFetcher namespaceFetcher = new NamespaceFetcher(client, metaStore, null, conf);
      InotifyEventApplier applier = new InotifyEventApplier(metaStore, client, namespaceFetcher);
  
      FileInfo[] fileInfos = new FileInfo[]{
          HadoopUtil.convertFileStatus(getDummyFileStatus("/dirfile", 7000), "/dirfile"),
          HadoopUtil.convertFileStatus(getDummyDirStatus("/dir", 8000), "/dir"),
          HadoopUtil.convertFileStatus(getDummyFileStatus("/dir/file1", 8001), "/dir/file1"),
          HadoopUtil.convertFileStatus(getDummyFileStatus("/dir/file2", 8002), "/dir/file2"),
          HadoopUtil.convertFileStatus(getDummyDirStatus("/dir2", 8100), "/dir2"),
          HadoopUtil.convertFileStatus(getDummyFileStatus("/dir2/file1", 8101), "/dir2/file1"),
          HadoopUtil.convertFileStatus(getDummyFileStatus("/dir2/file2", 8102), "/dir2/file2"),
          HadoopUtil.convertFileStatus(getDummyDirStatus("/dir/dir", 8200), "/dir/dir"),
          HadoopUtil.convertFileStatus(getDummyFileStatus("/dir/dir/f1", 8201), "/dir/dir/f1"),
          HadoopUtil.convertFileStatus(getDummyFileStatus("/file", 2000), "/file"),
      };
      metaStore.insertFiles(fileInfos);
      Mockito.when(client.getFileInfo("/dir1")).thenReturn(getDummyDirStatus("/dir1", 8000));
      Event.RenameEvent dirRenameEvent = new Event.RenameEvent.Builder()
          .srcPath("/dir")
          .dstPath("/dir1")
          .build();
      applier.apply(new Event[] {dirRenameEvent});
      Assert.assertTrue(metaStore.getFile("/dir") == null);
      Assert.assertTrue(metaStore.getFile("/dir/file1") == null);
      Assert.assertTrue(metaStore.getFile("/dirfile") != null);
      Assert.assertTrue(metaStore.getFile("/dir1") != null);
      Assert.assertTrue(metaStore.getFile("/dir1/file1") != null);
      Assert.assertTrue(metaStore.getFile("/dir1/dir/f1") != null);
      Assert.assertTrue(metaStore.getFile("/dir2") != null);
      Assert.assertTrue(metaStore.getFile("/dir2/file1") != null);
      Assert.assertTrue(metaStore.getFile("/file") != null);
  
      List<Event> events = new ArrayList<>();
      Event.RenameEvent renameEvent = new Event.RenameEvent.Builder()
          .srcPath("/file1")
          .dstPath("/file2")
          .build();
      events.add(renameEvent);
      applier.apply(events);
      Assert.assertTrue(metaStore.getFile("/file2") == null);
  
      /*
      Mockito.when(client.getFileInfo("/file2")).thenReturn(getDummyFileStatus("/file2", 2000));
      applier.apply(events);
      FileInfo info = metaStore.getFile("/file2");
      Assert.assertTrue(info != null && info.getFileId() == 2000);
      */
  
      events.clear();
      renameEvent = new Event.RenameEvent.Builder()
          .srcPath("/file")
          .dstPath("/file1")
          .build();
      events.add(renameEvent);
      applier.apply(events);
      FileInfo info2 = metaStore.getFile("/file");
      Assert.assertTrue(info2 == null);
      FileInfo info3 = metaStore.getFile("/file1");
      Assert.assertTrue(info3 != null);
  
      renameEvent = new Event.RenameEvent.Builder()
          .srcPath("/file1")
          .dstPath("/file2")
          .build();
      events.clear();
      events.add(renameEvent);
      applier.apply(events);
      FileInfo info4 = metaStore.getFile("/file1");
      FileInfo info5 = metaStore.getFile("/file2");
      Assert.assertTrue(info4 == null && info5 != null);
    }
test_case.class_method_signature: TestInotifyEventApplier.testApplierRenameEvent()
test_case.full_signature: @Test public void testApplierRenameEvent()
test_case.identifier: testApplierRenameEvent
test_case.invocations: mock convertFileStatus getDummyFileStatus convertFileStatus getDummyDirStatus convertFileStatus getDummyFileStatus convertFileStatus getDummyFileStatus convertFileStatus getDummyDirStatus convertFileStatus getDummyFileStatus convertFileStatus getDummyFileStatus convertFileStatus getDummyDirStatus convertFileStatus getDummyFileStatus convertFileStatus getDummyFileStatus insertFiles thenReturn when getFileInfo getDummyDirStatus build dstPath srcPath apply assertTrue getFile assertTrue getFile assertTrue getFile assertTrue getFile assertTrue getFile assertTrue getFile assertTrue getFile assertTrue getFile assertTrue getFile build dstPath srcPath add apply assertTrue getFile clear build dstPath srcPath add apply getFile assertTrue getFile assertTrue build dstPath srcPath clear add apply getFile getFile assertTrue
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testApplierRenameEvent()
focal_class.declarator: metaStore
focal_class.modifier: private final
focal_class.original_string: private final MetaStore metaStore;
focal_class.type: MetaStore
focal_class.var_name: metaStore
focal_class.declarator: client
focal_class.modifier: private
focal_class.original_string: private DFSClient client;
focal_class.type: DFSClient
focal_class.var_name: client
focal_class.declarator: LOG =
        LoggerFactory.getLogger(InotifyEventFetcher.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOG =
        LoggerFactory.getLogger(InotifyEventFetcher.class);
focal_class.type: Logger
focal_class.var_name: LOG
focal_class.declarator: ignoreEventDirs
focal_class.modifier: private
focal_class.original_string: private List<String> ignoreEventDirs;
focal_class.type: List<String>
focal_class.var_name: ignoreEventDirs
focal_class.declarator: fetchEventDirs
focal_class.modifier: private
focal_class.original_string: private List<String> fetchEventDirs;
focal_class.type: List<String>
focal_class.var_name: fetchEventDirs
focal_class.declarator: namespaceFetcher
focal_class.modifier: private
focal_class.original_string: private NamespaceFetcher namespaceFetcher;
focal_class.type: NamespaceFetcher
focal_class.var_name: namespaceFetcher
focal_class.file: smart-hadoop-support/smart-hadoop/src/main/java/org/smartdata/hdfs/metric/fetcher/InotifyEventApplier.java
focal_class.identifier: InotifyEventApplier
focal_class.class_method_signature: InotifyEventApplier.InotifyEventApplier(MetaStore metaStore, DFSClient client)
focal_class.full_signature: public  InotifyEventApplier(MetaStore metaStore, DFSClient client)
focal_class.identifier: InotifyEventApplier
focal_class.modifiers: public
focal_class.parameters: (MetaStore metaStore, DFSClient client)
focal_class.signature:  InotifyEventApplier(MetaStore metaStore, DFSClient client)
focal_class.class_method_signature: InotifyEventApplier.InotifyEventApplier(MetaStore metaStore, DFSClient client, NamespaceFetcher namespaceFetcher)
focal_class.full_signature: public  InotifyEventApplier(MetaStore metaStore, DFSClient client, NamespaceFetcher namespaceFetcher)
focal_class.identifier: InotifyEventApplier
focal_class.modifiers: public
focal_class.parameters: (MetaStore metaStore, DFSClient client, NamespaceFetcher namespaceFetcher)
focal_class.signature:  InotifyEventApplier(MetaStore metaStore, DFSClient client, NamespaceFetcher namespaceFetcher)
focal_class.class_method_signature: InotifyEventApplier.initialize()
focal_class.full_signature: private void initialize()
focal_class.identifier: initialize
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void initialize()
focal_class.class_method_signature: InotifyEventApplier.apply(List<Event> events)
focal_class.full_signature: public void apply(List<Event> events)
focal_class.identifier: apply
focal_class.modifiers: public
focal_class.parameters: (List<Event> events)
focal_class.return: void
focal_class.signature: void apply(List<Event> events)
focal_class.class_method_signature: InotifyEventApplier.apply(Event[] events)
focal_class.full_signature: public void apply(Event[] events)
focal_class.identifier: apply
focal_class.modifiers: public
focal_class.parameters: (Event[] events)
focal_class.return: void
focal_class.signature: void apply(Event[] events)
focal_class.class_method_signature: InotifyEventApplier.shouldIgnore(String path)
focal_class.full_signature: private boolean shouldIgnore(String path)
focal_class.identifier: shouldIgnore
focal_class.modifiers: private
focal_class.parameters: (String path)
focal_class.return: boolean
focal_class.signature: boolean shouldIgnore(String path)
focal_class.class_method_signature: InotifyEventApplier.getSqlStatement(Event event)
focal_class.full_signature: private List<String> getSqlStatement(Event event)
focal_class.identifier: getSqlStatement
focal_class.modifiers: private
focal_class.parameters: (Event event)
focal_class.return: List<String>
focal_class.signature: List<String> getSqlStatement(Event event)
focal_class.class_method_signature: InotifyEventApplier.getCreateSql(Event.CreateEvent createEvent)
focal_class.full_signature: private String getCreateSql(Event.CreateEvent createEvent)
focal_class.identifier: getCreateSql
focal_class.modifiers: private
focal_class.parameters: (Event.CreateEvent createEvent)
focal_class.return: String
focal_class.signature: String getCreateSql(Event.CreateEvent createEvent)
focal_class.class_method_signature: InotifyEventApplier.inBackup(String src)
focal_class.full_signature: private boolean inBackup(String src)
focal_class.identifier: inBackup
focal_class.modifiers: private
focal_class.parameters: (String src)
focal_class.return: boolean
focal_class.signature: boolean inBackup(String src)
focal_class.class_method_signature: InotifyEventApplier.getCloseSql(Event.CloseEvent closeEvent)
focal_class.full_signature: private String getCloseSql(Event.CloseEvent closeEvent)
focal_class.identifier: getCloseSql
focal_class.modifiers: private
focal_class.parameters: (Event.CloseEvent closeEvent)
focal_class.return: String
focal_class.signature: String getCloseSql(Event.CloseEvent closeEvent)
focal_class.class_method_signature: InotifyEventApplier.getRenameSql(Event.RenameEvent renameEvent)
focal_class.full_signature: private List<String> getRenameSql(Event.RenameEvent renameEvent)
focal_class.identifier: getRenameSql
focal_class.modifiers: private
focal_class.parameters: (Event.RenameEvent renameEvent)
focal_class.return: List<String>
focal_class.signature: List<String> getRenameSql(Event.RenameEvent renameEvent)
focal_class.class_method_signature: InotifyEventApplier.generateFileDiff(Event.RenameEvent renameEvent)
focal_class.full_signature: private void generateFileDiff(Event.RenameEvent renameEvent)
focal_class.identifier: generateFileDiff
focal_class.modifiers: private
focal_class.parameters: (Event.RenameEvent renameEvent)
focal_class.return: void
focal_class.signature: void generateFileDiff(Event.RenameEvent renameEvent)
focal_class.class_method_signature: InotifyEventApplier.getMetaDataUpdateSql(Event.MetadataUpdateEvent metadataUpdateEvent)
focal_class.full_signature: private String getMetaDataUpdateSql(Event.MetadataUpdateEvent metadataUpdateEvent)
focal_class.identifier: getMetaDataUpdateSql
focal_class.modifiers: private
focal_class.parameters: (Event.MetadataUpdateEvent metadataUpdateEvent)
focal_class.return: String
focal_class.signature: String getMetaDataUpdateSql(Event.MetadataUpdateEvent metadataUpdateEvent)
focal_class.class_method_signature: InotifyEventApplier.getAppendSql(Event.AppendEvent appendEvent)
focal_class.full_signature: private List<String> getAppendSql(Event.AppendEvent appendEvent)
focal_class.identifier: getAppendSql
focal_class.modifiers: private
focal_class.parameters: (Event.AppendEvent appendEvent)
focal_class.return: List<String>
focal_class.signature: List<String> getAppendSql(Event.AppendEvent appendEvent)
focal_class.class_method_signature: InotifyEventApplier.getUnlinkSql(Event.UnlinkEvent unlinkEvent)
focal_class.full_signature: private List<String> getUnlinkSql(Event.UnlinkEvent unlinkEvent)
focal_class.identifier: getUnlinkSql
focal_class.modifiers: private
focal_class.parameters: (Event.UnlinkEvent unlinkEvent)
focal_class.return: List<String>
focal_class.signature: List<String> getUnlinkSql(Event.UnlinkEvent unlinkEvent)
focal_class.class_method_signature: InotifyEventApplier.insertDeleteDiff(String path, boolean isDir)
focal_class.full_signature: private void insertDeleteDiff(String path, boolean isDir)
focal_class.identifier: insertDeleteDiff
focal_class.modifiers: private
focal_class.parameters: (String path, boolean isDir)
focal_class.return: void
focal_class.signature: void insertDeleteDiff(String path, boolean isDir)
focal_class.class_method_signature: InotifyEventApplier.insertDeleteDiff(String path)
focal_class.full_signature: private void insertDeleteDiff(String path)
focal_class.identifier: insertDeleteDiff
focal_class.modifiers: private
focal_class.parameters: (String path)
focal_class.return: void
focal_class.signature: void insertDeleteDiff(String path)
focal_class.class_method_signature: InotifyEventApplier.getFilesUnderDir(String dir)
focal_class.full_signature: private List<String> getFilesUnderDir(String dir)
focal_class.identifier: getFilesUnderDir
focal_class.modifiers: private
focal_class.parameters: (String dir)
focal_class.return: List<String>
focal_class.signature: List<String> getFilesUnderDir(String dir)
focal_class.class_method_signature: InotifyEventApplier.isUnderDir(String path, List<String> dirs)
focal_class.full_signature: private boolean isUnderDir(String path, List<String> dirs)
focal_class.identifier: isUnderDir
focal_class.modifiers: private
focal_class.parameters: (String path, List<String> dirs)
focal_class.return: boolean
focal_class.signature: boolean isUnderDir(String path, List<String> dirs)
focal_method.body: public void apply(List<Event> events) throws IOException, MetaStoreException, InterruptedException {
      List<String> statements = new ArrayList<>();
      for (Event event : events) {
        List<String> gen = getSqlStatement(event);
        if (gen != null && !gen.isEmpty()) {
          for (String s : gen) {
            if (s != null && s.length() > 0) {
              statements.add(s);
            }
          }
        }
      }
      this.metaStore.execute(statements);
    }
focal_method.class_method_signature: InotifyEventApplier.apply(List<Event> events)
focal_method.full_signature: public void apply(List<Event> events)
focal_method.identifier: apply
focal_method.invocations: getSqlStatement isEmpty length add execute
focal_method.modifiers: public
focal_method.parameters: (List<Event> events)
focal_method.return: void
focal_method.signature: void apply(List<Event> events)