Search in sources :

Example 1 with Blob

use of org.sonatype.nexus.blobstore.api.Blob in project nexus-repository-r by sonatype-nexus-community.

the class RRestoreBlobIT method runBlobRestore.

private void runBlobRestore(final boolean isDryRun) {
    Asset asset;
    Blob blob;
    try (StorageTx tx = getStorageTx(proxyRepository)) {
        tx.begin();
        asset = tx.findAssetWithProperty(AssetEntityAdapter.P_NAME, AGRICOLAE_131_TARGZ.fullPath, tx.findBucket(proxyRepository));
        assertThat(asset, Matchers.notNullValue());
        blob = tx.getBlob(asset.blobRef());
    }
    testHelper.simulateAssetMetadataLoss();
    Properties properties = new Properties();
    properties.setProperty(HEADER_PREFIX + REPO_NAME_HEADER, proxyRepository.getName());
    properties.setProperty(HEADER_PREFIX + BLOB_NAME_HEADER, asset.name());
    properties.setProperty(HEADER_PREFIX + CONTENT_TYPE_HEADER, asset.contentType());
    rRestoreBlobStrategy.restore(properties, blob, BlobStoreManager.DEFAULT_BLOBSTORE_NAME, isDryRun);
}
Also used : Blob(org.sonatype.nexus.blobstore.api.Blob) StorageTx(org.sonatype.nexus.repository.storage.StorageTx) Asset(org.sonatype.nexus.repository.storage.Asset) Properties(java.util.Properties)

Aggregations

Properties (java.util.Properties)1 Blob (org.sonatype.nexus.blobstore.api.Blob)1 Asset (org.sonatype.nexus.repository.storage.Asset)1 StorageTx (org.sonatype.nexus.repository.storage.StorageTx)1