test_class.declarator: azurite = new AzuriteDockerRule()
test_class.modifier: @ClassRule
      public static
test_class.original_string: @ClassRule
      public static AzuriteDockerRule azurite = new AzuriteDockerRule();
test_class.type: AzuriteDockerRule
test_class.var_name: azurite
test_class.declarator: container
test_class.modifier: private
test_class.original_string: private CloudBlobContainer container;
test_class.type: CloudBlobContainer
test_class.var_name: container
test_class.file: oak-segment-azure/src/test/java/org/apache/jackrabbit/oak/segment/azure/AzureArchiveManagerTest.java
test_class.identifier: AzureArchiveManagerTest
test_case.body: @Test
      public void testUncleanStopSegmentMissing() throws URISyntaxException, IOException, InvalidFileStoreVersionException, CommitFailedException, StorageException {
          AzurePersistence p = new AzurePersistence(container.getDirectoryReference("oak"));
          FileStore fs = FileStoreBuilder.fileStoreBuilder(new File("target")).withCustomPersistence(p).build();
          SegmentNodeStore segmentNodeStore = SegmentNodeStoreBuilders.builder(fs).build();
          NodeBuilder builder = segmentNodeStore.getRoot().builder();
          builder.setProperty("foo", "bar");
          segmentNodeStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
          fs.close();
  
          // make sure there are 2 archives
          fs = FileStoreBuilder.fileStoreBuilder(new File("target")).withCustomPersistence(p).build();
          segmentNodeStore = SegmentNodeStoreBuilders.builder(fs).build();
          builder = segmentNodeStore.getRoot().builder();
          builder.setProperty("foo0", "bar0");
          segmentNodeStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
          fs.flush();
          //create segment 0001
          builder.setProperty("foo1", "bar1");
          segmentNodeStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
          fs.flush();
          //create segment 0002
          builder.setProperty("foo2", "bar2");
          segmentNodeStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
          fs.flush();
          //create segment 0003
          builder.setProperty("foo3", "bar3");
          segmentNodeStore.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
          fs.flush();
          fs.close();
  
          // remove the segment 0002 from the second archive
          ListBlobItem segment0002 = container.listBlobs("oak/data00001a.tar/0002.").iterator().next();
          ((CloudBlob) segment0002).delete();
          container.getBlockBlobReference("oak/data00001a.tar/closed").delete();
  
          fs = FileStoreBuilder.fileStoreBuilder(new File("target")).withCustomPersistence(p).build();
          segmentNodeStore = SegmentNodeStoreBuilders.builder(fs).build();
          assertEquals("bar", segmentNodeStore.getRoot().getString("foo"));
  
          //recovered archive data00001a.tar should not contain segments 0002 and 0003
          assertFalse(container.listBlobs("oak/data00001a.tar/0002.").iterator().hasNext());
          assertFalse(container.listBlobs("oak/data00001a.tar/0003.").iterator().hasNext());
  
          assertTrue("Backup directory should have been created", container.listBlobs("oak/data00001a.tar.bak").iterator().hasNext());
          //backup has all segments but 0002 since it was deleted before recovery
          assertTrue(container.listBlobs("oak/data00001a.tar.bak/0001.").iterator().hasNext());
          assertFalse(container.listBlobs("oak/data00001a.tar.bak/0002.").iterator().hasNext());
          assertTrue(container.listBlobs("oak/data00001a.tar.bak/0003.").iterator().hasNext());
  
          //verify content from recovered segments preserved
          assertEquals("bar1", segmentNodeStore.getRoot().getString("foo1"));
          //content from deleted segments not preserved
          assertNull(segmentNodeStore.getRoot().getString("foo2"));
          assertNull(segmentNodeStore.getRoot().getString("foo3"));
          fs.close();
      }
test_case.class_method_signature: AzureArchiveManagerTest.testUncleanStopSegmentMissing()
test_case.full_signature: @Test public void testUncleanStopSegmentMissing()
test_case.identifier: testUncleanStopSegmentMissing
test_case.invocations: getDirectoryReference build withCustomPersistence fileStoreBuilder build builder builder getRoot setProperty merge close build withCustomPersistence fileStoreBuilder build builder builder getRoot setProperty merge flush setProperty merge flush setProperty merge flush setProperty merge flush close next iterator listBlobs delete delete getBlockBlobReference build withCustomPersistence fileStoreBuilder build builder assertEquals getString getRoot assertFalse hasNext iterator listBlobs assertFalse hasNext iterator listBlobs assertTrue hasNext iterator listBlobs assertTrue hasNext iterator listBlobs assertFalse hasNext iterator listBlobs assertTrue hasNext iterator listBlobs assertEquals getString getRoot assertNull getString getRoot assertNull getString getRoot close
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testUncleanStopSegmentMissing()
focal_class.declarator: log = LoggerFactory.getLogger(AzureSegmentArchiveReader.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(AzureSegmentArchiveReader.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: cloudBlobDirectory
focal_class.modifier: protected final
focal_class.original_string: protected final CloudBlobDirectory cloudBlobDirectory;
focal_class.type: CloudBlobDirectory
focal_class.var_name: cloudBlobDirectory
focal_class.declarator: ioMonitor
focal_class.modifier: protected final
focal_class.original_string: protected final IOMonitor ioMonitor;
focal_class.type: IOMonitor
focal_class.var_name: ioMonitor
focal_class.declarator: monitor
focal_class.modifier: protected final
focal_class.original_string: protected final FileStoreMonitor monitor;
focal_class.type: FileStoreMonitor
focal_class.var_name: monitor
focal_class.file: oak-segment-azure/src/main/java/org/apache/jackrabbit/oak/segment/azure/AzureArchiveManager.java
focal_class.identifier: AzureArchiveManager
focal_class.interfaces: implements SegmentArchiveManager
focal_class.class_method_signature: AzureArchiveManager.AzureArchiveManager(CloudBlobDirectory cloudBlobDirectory, IOMonitor ioMonitor, FileStoreMonitor fileStoreMonitor)
focal_class.full_signature: public  AzureArchiveManager(CloudBlobDirectory cloudBlobDirectory, IOMonitor ioMonitor, FileStoreMonitor fileStoreMonitor)
focal_class.identifier: AzureArchiveManager
focal_class.modifiers: public
focal_class.parameters: (CloudBlobDirectory cloudBlobDirectory, IOMonitor ioMonitor, FileStoreMonitor fileStoreMonitor)
focal_class.signature:  AzureArchiveManager(CloudBlobDirectory cloudBlobDirectory, IOMonitor ioMonitor, FileStoreMonitor fileStoreMonitor)
focal_class.class_method_signature: AzureArchiveManager.listArchives()
focal_class.full_signature: @Override public List<String> listArchives()
focal_class.identifier: listArchives
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: List<String>
focal_class.signature: List<String> listArchives()
focal_class.class_method_signature: AzureArchiveManager.isArchiveEmpty(String archiveName)
focal_class.full_signature: private boolean isArchiveEmpty(String archiveName)
focal_class.identifier: isArchiveEmpty
focal_class.modifiers: private
focal_class.parameters: (String archiveName)
focal_class.return: boolean
focal_class.signature: boolean isArchiveEmpty(String archiveName)
focal_class.class_method_signature: AzureArchiveManager.open(String archiveName)
focal_class.full_signature: @Override public SegmentArchiveReader open(String archiveName)
focal_class.identifier: open
focal_class.modifiers: @Override public
focal_class.parameters: (String archiveName)
focal_class.return: SegmentArchiveReader
focal_class.signature: SegmentArchiveReader open(String archiveName)
focal_class.class_method_signature: AzureArchiveManager.forceOpen(String archiveName)
focal_class.full_signature: @Override public SegmentArchiveReader forceOpen(String archiveName)
focal_class.identifier: forceOpen
focal_class.modifiers: @Override public
focal_class.parameters: (String archiveName)
focal_class.return: SegmentArchiveReader
focal_class.signature: SegmentArchiveReader forceOpen(String archiveName)
focal_class.class_method_signature: AzureArchiveManager.create(String archiveName)
focal_class.full_signature: @Override public SegmentArchiveWriter create(String archiveName)
focal_class.identifier: create
focal_class.modifiers: @Override public
focal_class.parameters: (String archiveName)
focal_class.return: SegmentArchiveWriter
focal_class.signature: SegmentArchiveWriter create(String archiveName)
focal_class.class_method_signature: AzureArchiveManager.delete(String archiveName)
focal_class.full_signature: @Override public boolean delete(String archiveName)
focal_class.identifier: delete
focal_class.modifiers: @Override public
focal_class.parameters: (String archiveName)
focal_class.return: boolean
focal_class.signature: boolean delete(String archiveName)
focal_class.class_method_signature: AzureArchiveManager.renameTo(String from, String to)
focal_class.full_signature: @Override public boolean renameTo(String from, String to)
focal_class.identifier: renameTo
focal_class.modifiers: @Override public
focal_class.parameters: (String from, String to)
focal_class.return: boolean
focal_class.signature: boolean renameTo(String from, String to)
focal_class.class_method_signature: AzureArchiveManager.copyFile(String from, String to)
focal_class.full_signature: @Override public void copyFile(String from, String to)
focal_class.identifier: copyFile
focal_class.modifiers: @Override public
focal_class.parameters: (String from, String to)
focal_class.return: void
focal_class.signature: void copyFile(String from, String to)
focal_class.class_method_signature: AzureArchiveManager.exists(String archiveName)
focal_class.full_signature: @Override public boolean exists(String archiveName)
focal_class.identifier: exists
focal_class.modifiers: @Override public
focal_class.parameters: (String archiveName)
focal_class.return: boolean
focal_class.signature: boolean exists(String archiveName)
focal_class.class_method_signature: AzureArchiveManager.recoverEntries(String archiveName, LinkedHashMap<UUID, byte[]> entries)
focal_class.full_signature: @Override public void recoverEntries(String archiveName, LinkedHashMap<UUID, byte[]> entries)
focal_class.identifier: recoverEntries
focal_class.modifiers: @Override public
focal_class.parameters: (String archiveName, LinkedHashMap<UUID, byte[]> entries)
focal_class.return: void
focal_class.signature: void recoverEntries(String archiveName, LinkedHashMap<UUID, byte[]> entries)
focal_class.class_method_signature: AzureArchiveManager.delete(String archiveName, Set<UUID> recoveredEntries)
focal_class.full_signature: private void delete(String archiveName, Set<UUID> recoveredEntries)
focal_class.identifier: delete
focal_class.modifiers: private
focal_class.parameters: (String archiveName, Set<UUID> recoveredEntries)
focal_class.return: void
focal_class.signature: void delete(String archiveName, Set<UUID> recoveredEntries)
focal_class.class_method_signature: AzureArchiveManager.backup(@NotNull String archiveName, @NotNull String backupArchiveName, @NotNull Set<UUID> recoveredEntries)
focal_class.full_signature: @Override public void backup(@NotNull String archiveName, @NotNull String backupArchiveName, @NotNull Set<UUID> recoveredEntries)
focal_class.identifier: backup
focal_class.modifiers: @Override public
focal_class.parameters: (@NotNull String archiveName, @NotNull String backupArchiveName, @NotNull Set<UUID> recoveredEntries)
focal_class.return: void
focal_class.signature: void backup(@NotNull String archiveName, @NotNull String backupArchiveName, @NotNull Set<UUID> recoveredEntries)
focal_class.class_method_signature: AzureArchiveManager.getDirectory(String archiveName)
focal_class.full_signature: protected CloudBlobDirectory getDirectory(String archiveName)
focal_class.identifier: getDirectory
focal_class.modifiers: protected
focal_class.parameters: (String archiveName)
focal_class.return: CloudBlobDirectory
focal_class.signature: CloudBlobDirectory getDirectory(String archiveName)
focal_class.class_method_signature: AzureArchiveManager.getBlobs(String archiveName)
focal_class.full_signature: private List<CloudBlob> getBlobs(String archiveName)
focal_class.identifier: getBlobs
focal_class.modifiers: private
focal_class.parameters: (String archiveName)
focal_class.return: List<CloudBlob>
focal_class.signature: List<CloudBlob> getBlobs(String archiveName)
focal_class.class_method_signature: AzureArchiveManager.renameBlob(CloudBlob blob, CloudBlobDirectory newParent)
focal_class.full_signature: private void renameBlob(CloudBlob blob, CloudBlobDirectory newParent)
focal_class.identifier: renameBlob
focal_class.modifiers: private
focal_class.parameters: (CloudBlob blob, CloudBlobDirectory newParent)
focal_class.return: void
focal_class.signature: void renameBlob(CloudBlob blob, CloudBlobDirectory newParent)
focal_class.class_method_signature: AzureArchiveManager.copyBlob(CloudBlob blob, CloudBlobDirectory newParent)
focal_class.full_signature: private void copyBlob(CloudBlob blob, CloudBlobDirectory newParent)
focal_class.identifier: copyBlob
focal_class.modifiers: private
focal_class.parameters: (CloudBlob blob, CloudBlobDirectory newParent)
focal_class.return: void
focal_class.signature: void copyBlob(CloudBlob blob, CloudBlobDirectory newParent)
focal_method.body: @Override
      public boolean delete(String archiveName) {
          try {
              getBlobs(archiveName)
                      .forEach(cloudBlob -> {
                          try {
                              cloudBlob.delete();
                          } catch (StorageException e) {
                              log.error("Can't delete segment {}", cloudBlob.getUri().getPath(), e);
                          }
                      });
              return true;
          } catch (IOException e) {
              log.error("Can't delete archive {}", archiveName, e);
              return false;
          }
      }
focal_method.class_method_signature: AzureArchiveManager.delete(String archiveName)
focal_method.full_signature: @Override public boolean delete(String archiveName)
focal_method.identifier: delete
focal_method.invocations: forEach getBlobs delete error getPath getUri error
focal_method.modifiers: @Override public
focal_method.parameters: (String archiveName)
focal_method.return: boolean
focal_method.signature: boolean delete(String archiveName)