@Test @ConditionalRun(RepositoryInstalled.MercurialInstalled.class) public void testRemoveFileOnFileChange() throws Exception { RuntimeEnvironment env = RuntimeEnvironment.getInstance(); TestRepository testrepo = new TestRepository(); testrepo.create(HistoryGuru.class.getResourceAsStream("repositories.zip")); env.setSourceRoot(testrepo.getSourceRoot()); env.setDataRoot(testrepo.getDataRoot()); env.setRepositories(testrepo.getSourceRoot()); Project project = new Project("mercurial", "/mercurial"); IndexDatabase idb = new IndexDatabase(project); assertNotNull(idb); RemoveIndexChangeListener listener = new RemoveIndexChangeListener(); idb.addIndexChangedListener(listener); idb.update(); Assert.assertEquals(5, listener.filesToAdd.size()); listener.reset(); Thread.sleep(1100); File bar = new File(testrepo.getSourceRoot() + File.separator + "mercurial", "bar.txt"); Assert.assertTrue(bar.exists()); FileWriter fw = new FileWriter(bar, true); BufferedWriter bw = new BufferedWriter(fw); bw.write("foo\n"); bw.close(); fw.close(); idb.update(); assertEquals(1, listener.removedFiles.size()); assertEquals(1, listener.filesToAdd.size()); assertEquals("/mercurial/bar.txt", listener.removedFiles.peek()); testrepo.destroy(); }
public static Indexer getInstance() { return index; }
Indexer { public static Indexer getInstance() { return index; } }
Indexer { public static Indexer getInstance() { return index; } private  Indexer(); }
Indexer { public static Indexer getInstance() { return index; } private  Indexer(); static Indexer getInstance(); @SuppressWarnings("PMD.UseStringBufferForStringAppends") static void main(String[] argv); static String[] parseOptions(String[] argv); static void writeConfigToFile(RuntimeEnvironment env, String filename); void prepareIndexer(RuntimeEnvironment env,
                               boolean searchRepositories,
                               boolean addProjects,
                               boolean createDict,
                               List<String> subFiles,
                               List<String> repositories); @SuppressWarnings("PMD.SimplifyStartsWith") void prepareIndexer(RuntimeEnvironment env,
            Set<String> searchPaths,
            boolean addProjects,
            boolean createDict,
            boolean createHistoryCache,
            List<String> subFiles,
            List<String> repositories); void doIndexerExecution(final boolean update, List<String> subFiles,
        IndexChangedListener progress); void refreshSearcherManagers(RuntimeEnvironment env, List<String> projects, String host); void sendToConfigHost(RuntimeEnvironment env, String host); }
Indexer { public static Indexer getInstance() { return index; } private  Indexer(); static Indexer getInstance(); @SuppressWarnings("PMD.UseStringBufferForStringAppends") static void main(String[] argv); static String[] parseOptions(String[] argv); static void writeConfigToFile(RuntimeEnvironment env, String filename); void prepareIndexer(RuntimeEnvironment env,
                               boolean searchRepositories,
                               boolean addProjects,
                               boolean createDict,
                               List<String> subFiles,
                               List<String> repositories); @SuppressWarnings("PMD.SimplifyStartsWith") void prepareIndexer(RuntimeEnvironment env,
            Set<String> searchPaths,
            boolean addProjects,
            boolean createDict,
            boolean createHistoryCache,
            List<String> subFiles,
            List<String> repositories); void doIndexerExecution(final boolean update, List<String> subFiles,
        IndexChangedListener progress); void refreshSearcherManagers(RuntimeEnvironment env, List<String> projects, String host); void sendToConfigHost(RuntimeEnvironment env, String host); static final char PATH_SEPARATOR; static final String PATH_SEPARATOR_STRING; }