DirectoryFactory implements LuceneIndexFactory { protected void loadIndexes(DirectoryType type, Analyzer analyzer, File hostingDir) { listFiles(hostingDir) .filter(File::isDirectory) .flatMap(file -> listFiles(file)) .filter(File::isDirectory) .flatMap(file -> listFiles(file)) .map(file -> new KClusterImpl(clusterIdOf(file))) .forEach(cluster -> clusters.put(cluster, type.newIndex(cluster, newConfig(analyzer)))); } DirectoryFactory(final DirectoryType type,
                            final Analyzer analyzer);  DirectoryFactory(final DirectoryType type,
                            final Analyzer analyzer,
                            final File hostingDir); static File defaultHostingDir(); @Override LuceneIndex newCluster(final KCluster kcluster); @Override void remove(KCluster cluster); @Override Map<? extends KCluster, ? extends LuceneIndex> getIndexes(); @Override synchronized void dispose(); static final String CLUSTER_ID_SEGMENT_SEPARATOR; }
@Test public void testLoadIndexes() { this.factory.loadIndexes(type, analyzer, hostingDir); List<String> indexes = this.factory.getIndexes().keySet().stream().map(KCluster::getClusterId).collect(Collectors.toList()); assertThat(indexes).containsExactly("myteam/myproject/master", "myteam/myproject/develop"); }