test_class.declarator: rootState = InitialContentHelper.INITIAL_CONTENT
test_class.modifier: private
test_class.original_string: private NodeState rootState = InitialContentHelper.INITIAL_CONTENT;
test_class.type: NodeState
test_class.var_name: rootState
test_class.declarator: idx = new LuceneIndexDefinitionBuilder().build().builder()
test_class.modifier: private
test_class.original_string: private NodeBuilder idx = new LuceneIndexDefinitionBuilder().build().builder();
test_class.type: NodeBuilder
test_class.var_name: idx
test_class.declarator: temporaryFolder = new TemporaryFolder(new File("target"))
test_class.modifier: @Rule
      public final
test_class.original_string: @Rule
      public final TemporaryFolder temporaryFolder = new TemporaryFolder(new File("target"));
test_class.type: TemporaryFolder
test_class.var_name: temporaryFolder
test_class.file: oak-lucene/src/test/java/org/apache/jackrabbit/oak/plugins/index/lucene/directory/LuceneIndexImporterTest.java
test_class.identifier: LuceneIndexImporterTest
test_case.body: @Test
      public void exportAndImport() throws Exception{
          NodeState baseIndexState = idx.getNodeState();
          LuceneIndexDefinition defn = LuceneIndexDefinition.newBuilder(rootState, baseIndexState, "/oak:index/fooIndex").build();
  
          LuceneIndexEditorContext.configureUniqueId(idx);
  
          String dirName = ":data";
          Directory dir = new OakDirectory(idx, dirName, defn, false);
          createFile(dir, "foo.txt", "Test content");
          dir.close();
  
          String dir2Name = ":data2" + MultiplexersLucene.INDEX_DIR_SUFFIX;
          Directory dir2 = new OakDirectory(idx, dir2Name, defn, false);
          createFile(dir2, "foo.txt", "Test content");
          dir2.close();
  
          NodeBuilder builder = rootState.builder();
          builder.child("oak:index").setChildNode("fooIndex", idx.getNodeState());
          NodeState indexState = builder.getNodeState();
  
          File out = temporaryFolder.newFolder();
          LuceneIndexDumper dumper = new LuceneIndexDumper(indexState, "/oak:index/fooIndex", out);
          dumper.dump();
  
          LuceneIndexImporter importer = new LuceneIndexImporter();
          NodeBuilder newIdxBuilder = indexState.builder().getChildNode("oak:index").getChildNode("fooIndex");
  
          //Add a file to builder to check if existing hidden nodes are removed or not
          Directory dir3 = new OakDirectory(newIdxBuilder, dirName, defn, false);
          createFile(dir3, "foo2.txt", "Test content");
          dir3.close();
  
          importer.importIndex(rootState, newIdxBuilder, dumper.getIndexDir());
  
          NodeState exportedIndexState = indexState.getChildNode("oak:index").getChildNode("fooIndex");
          NodeState importedIndexState = newIdxBuilder.getNodeState();
  
          assertDirectoryEquals(defn, exportedIndexState, importedIndexState, dirName);
  
          //The uid must be different for imported directory
          String exportedUid = exportedIndexState.getChildNode(STATUS_NODE).getString(PROP_UID);
          String importedUid = importedIndexState.getChildNode(STATUS_NODE).getString(PROP_UID);
          assertNotEquals(exportedUid, importedUid);
          assertNotNull(exportedUid);
          assertNotNull(importedUid);
      }
test_case.class_method_signature: LuceneIndexImporterTest.exportAndImport()
test_case.full_signature: @Test public void exportAndImport()
test_case.identifier: exportAndImport
test_case.invocations: getNodeState build newBuilder configureUniqueId createFile close createFile close builder setChildNode child getNodeState getNodeState newFolder dump getChildNode getChildNode builder createFile close importIndex getIndexDir getChildNode getChildNode getNodeState assertDirectoryEquals getString getChildNode getString getChildNode assertNotEquals assertNotNull assertNotNull
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void exportAndImport()
focal_class.declarator: blobStore
focal_class.modifier: private
focal_class.original_string: private GarbageCollectableBlobStore blobStore;
focal_class.type: GarbageCollectableBlobStore
focal_class.var_name: blobStore
focal_class.file: oak-lucene/src/main/java/org/apache/jackrabbit/oak/plugins/index/lucene/directory/LuceneIndexImporter.java
focal_class.identifier: LuceneIndexImporter
focal_class.interfaces: implements IndexImporterProvider
focal_class.class_method_signature: LuceneIndexImporter.LuceneIndexImporter()
focal_class.full_signature: public  LuceneIndexImporter()
focal_class.identifier: LuceneIndexImporter
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.signature:  LuceneIndexImporter()
focal_class.class_method_signature: LuceneIndexImporter.LuceneIndexImporter(GarbageCollectableBlobStore blobStore)
focal_class.full_signature: public  LuceneIndexImporter(GarbageCollectableBlobStore blobStore)
focal_class.identifier: LuceneIndexImporter
focal_class.modifiers: public
focal_class.parameters: (GarbageCollectableBlobStore blobStore)
focal_class.signature:  LuceneIndexImporter(GarbageCollectableBlobStore blobStore)
focal_class.class_method_signature: LuceneIndexImporter.importIndex(NodeState root, NodeBuilder definitionBuilder, File indexDir)
focal_class.full_signature: @Override public void importIndex(NodeState root, NodeBuilder definitionBuilder, File indexDir)
focal_class.identifier: importIndex
focal_class.modifiers: @Override public
focal_class.parameters: (NodeState root, NodeBuilder definitionBuilder, File indexDir)
focal_class.return: void
focal_class.signature: void importIndex(NodeState root, NodeBuilder definitionBuilder, File indexDir)
focal_class.class_method_signature: LuceneIndexImporter.getType()
focal_class.full_signature: @Override public String getType()
focal_class.identifier: getType
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getType()
focal_class.class_method_signature: LuceneIndexImporter.setBlobStore(GarbageCollectableBlobStore blobStore)
focal_class.full_signature: public void setBlobStore(GarbageCollectableBlobStore blobStore)
focal_class.identifier: setBlobStore
focal_class.modifiers: public
focal_class.parameters: (GarbageCollectableBlobStore blobStore)
focal_class.return: void
focal_class.signature: void setBlobStore(GarbageCollectableBlobStore blobStore)
focal_class.class_method_signature: LuceneIndexImporter.copyDirectory(LuceneIndexDefinition definition, NodeBuilder definitionBuilder, String jcrName, File dir)
focal_class.full_signature: private void copyDirectory(LuceneIndexDefinition definition, NodeBuilder definitionBuilder, String jcrName, File dir)
focal_class.identifier: copyDirectory
focal_class.modifiers: private
focal_class.parameters: (LuceneIndexDefinition definition, NodeBuilder definitionBuilder, String jcrName, File dir)
focal_class.return: void
focal_class.signature: void copyDirectory(LuceneIndexDefinition definition, NodeBuilder definitionBuilder, String jcrName, File dir)
focal_method.body: @Override
      public void importIndex(NodeState root, NodeBuilder definitionBuilder, File indexDir) throws IOException {
          LocalIndexDir localIndex = new LocalIndexDir(indexDir);
  
          //TODO The indexFormatVersion would be considered latest. Need to be revisited
          //if off line indexing uses older Lucene
  
          definitionBuilder.getChildNode(IndexDefinition.STATUS_NODE).remove();
  
          ReindexOperations reindexOps = new ReindexOperations(root, definitionBuilder, localIndex.getJcrPath(),
                  new LuceneIndexDefinition.Builder());
          LuceneIndexDefinition definition = (LuceneIndexDefinition)reindexOps.apply(true);
  
          for (File dir : localIndex.dir.listFiles(File::isDirectory)) {
              String jcrName = localIndex.indexMeta.getJcrNameFromFSName(dir.getName());
              if (jcrName != null) {
                  copyDirectory(definition, definitionBuilder, jcrName, dir);
              }
          }
      }
focal_method.class_method_signature: LuceneIndexImporter.importIndex(NodeState root, NodeBuilder definitionBuilder, File indexDir)
focal_method.full_signature: @Override public void importIndex(NodeState root, NodeBuilder definitionBuilder, File indexDir)
focal_method.identifier: importIndex
focal_method.invocations: remove getChildNode getJcrPath apply listFiles getJcrNameFromFSName getName copyDirectory
focal_method.modifiers: @Override public
focal_method.parameters: (NodeState root, NodeBuilder definitionBuilder, File indexDir)
focal_method.return: void
focal_method.signature: void importIndex(NodeState root, NodeBuilder definitionBuilder, File indexDir)