org.sonatype.nexus.common.log.DryRunPrefix Java Examples

The following examples show how to use org.sonatype.nexus.common.log.DryRunPrefix. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GoogleCloudBlobStore.java    From nexus-blobstore-google-cloud with Eclipse Public License 1.0 6 votes vote down vote up
@Inject
public GoogleCloudBlobStore(final GoogleCloudStorageFactory storageFactory,
                            final BlobIdLocationResolver blobIdLocationResolver,
                            final PeriodicJobService periodicJobService,
                            final GoogleCloudDatastoreFactory datastoreFactory,
                            final DryRunPrefix dryRunPrefix,
                            final Uploader uploader,
                            final MetricRegistry metricRegistry,
                            final BlobStoreQuotaService quotaService,
                            @Named("${nexus.blobstore.quota.warnIntervalSeconds:-60}")
                            final int quotaCheckInterval)
{
  super(blobIdLocationResolver, dryRunPrefix);
  this.periodicJobService = periodicJobService;
  this.storageFactory = checkNotNull(storageFactory);
  this.datastoreFactory = datastoreFactory;
  this.uploader = uploader;
  this.metricRegistry = metricRegistry;
  this.quotaService = quotaService;
  this.quotaCheckInterval = quotaCheckInterval;
}
 
Example #2
Source File: P2RestoreBlobStrategyTest.java    From nexus-repository-p2 with Eclipse Public License 1.0 6 votes vote down vote up
@Before
public void setup() {
  restoreBlobStrategy = new P2RestoreBlobStrategy(nodeAccess, repositoryManager, blobStoreManager, new DryRunPrefix("dryrun"));

  when(repositoryManager.get(anyString())).thenReturn(repository);
  when(repository.facet(P2RestoreFacet.class)).thenReturn(p2RestoreFacet);
  when(repository.optionalFacet(P2RestoreFacet.class)).thenReturn(Optional.of(p2RestoreFacet));
  when(repository.optionalFacet(StorageFacet.class)).thenReturn(Optional.of(storageFacet));
  when(blob.getInputStream()).thenReturn(new ByteArrayInputStream(blobBytes));
  when(p2RestoreBlobData.getBlobData()).thenReturn(restoreBlobData);
  when(restoreBlobData.getBlobName()).thenReturn(PACKAGE_PATH);
  when(restoreBlobData.getRepository()).thenReturn(repository);
  when(restoreBlobData.getBlob()).thenReturn(blob);
  when(storageFacet.txSupplier()).thenReturn(() -> storageTx);
  when(blobStoreManager.get(TEST_BLOB_STORE_NAME)).thenReturn(blobStore);
  when(restoreBlobData.getRepository()).thenReturn(repository);

  properties.setProperty("@BlobStore.created-by", "anonymous");
  properties.setProperty("size", "894185");
  properties.setProperty("@Bucket.repo-name", "p2-proxy");
  properties.setProperty("creationTime", "1577179311620");
  properties.setProperty("@BlobStore.created-by-ip", "127.0.0.1");
  properties.setProperty("@BlobStore.content-type", "application/java-archive");
  properties.setProperty("@BlobStore.blob-name", PACKAGE_PATH);
  properties.setProperty("sha1", "ac7306bee8742701a1e81a702685a55c17b07e4a");
}
 
Example #3
Source File: HelmRestoreBlobStrategyTest.java    From nexus-repository-helm with Eclipse Public License 1.0 6 votes vote down vote up
@Before
public void setup() throws IOException {
  restoreBlobStrategy = new HelmRestoreBlobStrategy(nodeAccess, repositoryManager, blobStoreManager, new DryRunPrefix("dryrun"));

  when(repositoryManager.get(anyString())).thenReturn(repository);
  when(repository.facet(HelmRestoreFacet.class)).thenReturn(helmRestoreFacet);
  when(repository.optionalFacet(HelmRestoreFacet.class)).thenReturn(Optional.of(helmRestoreFacet));
  when(repository.optionalFacet(StorageFacet.class)).thenReturn(Optional.of(storageFacet));
  when(blob.getInputStream()).thenReturn(new ByteArrayInputStream(blobBytes));
  when(helmRestoreBlobData.getBlobData()).thenReturn(restoreBlobData);
  when(restoreBlobData.getBlobName()).thenReturn(ARCHIVE_PATH);
  when(restoreBlobData.getRepository()).thenReturn(repository);
  when(restoreBlobData.getBlob()).thenReturn(blob);
  when(storageFacet.txSupplier()).thenReturn(() -> storageTx);
  when(blobStoreManager.get(TEST_BLOB_STORE_NAME)).thenReturn(blobStore);
  when(restoreBlobData.getRepository()).thenReturn(repository);

  properties.setProperty("@BlobStore.created-by", "anonymous");
  properties.setProperty("size", "1330");
  properties.setProperty("@Bucket.repo-name", "helm-proxy");
  properties.setProperty("creationTime", "1533220387218");
  properties.setProperty("@BlobStore.created-by-ip", "127.0.0.1");
  properties.setProperty("@BlobStore.content-type", "text/html");
  properties.setProperty("@BlobStore.blob-name", ARCHIVE_PATH);
  properties.setProperty("sha1", "0088eb478752a810f48f04d3cf9f46d2924e334a");
}
 
Example #4
Source File: FileBlobStore.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@Inject
public FileBlobStore(final BlobIdLocationResolver blobIdLocationResolver,
                     final FileOperations fileOperations,
                     final ApplicationDirectories applicationDirectories,
                     final FileBlobStoreMetricsStore metricsStore,
                     final NodeAccess nodeAccess,
                     final DryRunPrefix dryRunPrefix)
{
  super(blobIdLocationResolver, dryRunPrefix);
  this.fileOperations = checkNotNull(fileOperations);
  this.applicationDirectories = checkNotNull(applicationDirectories);
  this.metricsStore = checkNotNull(metricsStore);
  this.nodeAccess = checkNotNull(nodeAccess);
  this.supportsHardLinkCopy = true;
  this.supportsAtomicMove = true;
}
 
Example #5
Source File: RRestoreBlobStrategyTest.java    From nexus-repository-r with Eclipse Public License 1.0 6 votes vote down vote up
@Before
public void setup() {
  restoreBlobStrategy = new RRestoreBlobStrategy(nodeAccess, repositoryManager, blobStoreManager, new DryRunPrefix("dryrun"));

  when(repositoryManager.get(anyString())).thenReturn(repository);
  when(repository.facet(RRestoreFacet.class)).thenReturn(rRestoreFacet);
  when(repository.optionalFacet(RRestoreFacet.class)).thenReturn(Optional.of(rRestoreFacet));
  when(repository.optionalFacet(StorageFacet.class)).thenReturn(Optional.of(storageFacet));
  when(blob.getInputStream()).thenReturn(new ByteArrayInputStream(blobBytes));
  when(rRestoreBlobData.getBlobData()).thenReturn(restoreBlobData);
  when(restoreBlobData.getBlobName()).thenReturn(ARCHIVE_PATH);
  when(restoreBlobData.getRepository()).thenReturn(repository);
  when(restoreBlobData.getBlob()).thenReturn(blob);
  when(storageFacet.txSupplier()).thenReturn(() -> storageTx);
  when(blobStoreManager.get(TEST_BLOB_STORE_NAME)).thenReturn(blobStore);
  when(restoreBlobData.getRepository()).thenReturn(repository);

  properties.setProperty("@BlobStore.created-by", "anonymous");
  properties.setProperty("size", "1330");
  properties.setProperty("@Bucket.repo-name", "r-proxy");
  properties.setProperty("creationTime", "1533220387218");
  properties.setProperty("@BlobStore.created-by-ip", "127.0.0.1");
  properties.setProperty("@BlobStore.content-type", "text/html");
  properties.setProperty("@BlobStore.blob-name", ARCHIVE_PATH);
  properties.setProperty("sha1", "0088eb478752a810f48f04d3cf9f46d2924e334a");
}
 
Example #6
Source File: AptRestoreBlobStrategyTest.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@Before
public void setup() {
  underTest = new AptRestoreBlobStrategy(nodeAccess, repositoryManager, blobStoreManager, new DryRunPrefix("dryrun"));

  when(repositoryManager.get(anyString())).thenReturn(repository);
  when(repository.facet(AptRestoreFacet.class)).thenReturn(aptRestoreFacet);
  when(repository.optionalFacet(AptRestoreFacet.class)).thenReturn(Optional.of(aptRestoreFacet));
  when(repository.optionalFacet(StorageFacet.class)).thenReturn(Optional.of(storageFacet));
  when(aptRestoreBlobData.getBlobData()).thenReturn(restoreBlobData);
  when(aptRestoreBlobData.getBlobData().getBlobName()).thenReturn(PACKAGE_PATH);
  when(storageFacet.txSupplier()).thenReturn(() -> storageTx);
  when(blob.getInputStream()).thenReturn(new ByteArrayInputStream(blobBytes));
  when(blobStoreManager.get(TEST_BLOB_STORE_NAME)).thenReturn(blobStore);
  when(restoreBlobData.getRepository()).thenReturn(repository);

  properties.setProperty("@BlobStore.created-by", "anonymous");
  properties.setProperty("size", "1330");
  properties.setProperty("@Bucket.repo-name", "apt-proxy");
  properties.setProperty("creationTime", "1533220387218");
  properties.setProperty("@BlobStore.created-by-ip", "127.0.0.1");
  properties.setProperty("@BlobStore.content-type", "text/html");
  properties.setProperty("@BlobStore.blob-name", PACKAGE_PATH);
  properties.setProperty("sha1", "0088eb478752a810f48f04d3cf9f46d2924e334a");
}
 
Example #7
Source File: S3BlobStore.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@Inject
public S3BlobStore(final AmazonS3Factory amazonS3Factory,
                   final BlobIdLocationResolver blobIdLocationResolver,
                   @Named("${nexus.s3.uploaderName:-parallelUploader}") final S3Uploader uploader,
                   @Named("${nexus.s3.copierName:-parallelCopier}") final S3Copier copier,
                   final S3BlobStoreMetricsStore storeMetrics,
                   final DryRunPrefix dryRunPrefix,
                   final BucketManager bucketManager)
{
  super(blobIdLocationResolver, dryRunPrefix);
  this.amazonS3Factory = checkNotNull(amazonS3Factory);
  this.copier = checkNotNull(copier);
  this.uploader = checkNotNull(uploader);
  this.storeMetrics = checkNotNull(storeMetrics);
  this.bucketManager = checkNotNull(bucketManager);
}
 
Example #8
Source File: RestoreMetadataTask.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@Inject
public RestoreMetadataTask(final BlobStoreManager blobStoreManager,
                           final RepositoryManager repositoryManager,
                           final Map<String, RestoreBlobStrategy> restoreBlobStrategies,
                           final BlobStoreUsageChecker blobStoreUsageChecker,
                           final DryRunPrefix dryRunPrefix,
                           final Map<String, IntegrityCheckStrategy> integrityCheckStrategies,
                           final BucketStore bucketStore,
                           final MaintenanceService maintenanceService)
{
  this.blobStoreManager = checkNotNull(blobStoreManager);
  this.repositoryManager = checkNotNull(repositoryManager);
  this.restoreBlobStrategies = checkNotNull(restoreBlobStrategies);
  this.blobStoreUsageChecker = checkNotNull(blobStoreUsageChecker);
  this.dryRunPrefix = checkNotNull(dryRunPrefix);
  this.defaultIntegrityCheckStrategy = checkNotNull(integrityCheckStrategies.get(DEFAULT_NAME));
  this.integrityCheckStrategies = checkNotNull(integrityCheckStrategies);
  this.bucketStore = checkNotNull(bucketStore);
  this.maintenanceService = checkNotNull(maintenanceService);
}
 
Example #9
Source File: P2RestoreBlobStrategy.java    From nexus-repository-p2 with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public P2RestoreBlobStrategy(final NodeAccess nodeAccess,
                             final RepositoryManager repositoryManager,
                             final BlobStoreManager blobStoreManager,
                             final DryRunPrefix dryRunPrefix)
{
  super(nodeAccess, repositoryManager, blobStoreManager, dryRunPrefix);
}
 
Example #10
Source File: FileBlobStore.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@VisibleForTesting
public FileBlobStore(final Path contentDir, //NOSONAR
                     final BlobIdLocationResolver blobIdLocationResolver,
                     final FileOperations fileOperations,
                     final FileBlobStoreMetricsStore metricsStore,
                     final BlobStoreConfiguration configuration,
                     final ApplicationDirectories directories,
                     final NodeAccess nodeAccess,
                     final DryRunPrefix dryRunPrefix)
{
  this(blobIdLocationResolver, fileOperations, directories, metricsStore, nodeAccess, dryRunPrefix);
  this.contentDir = checkNotNull(contentDir);
  this.blobStoreConfiguration = checkNotNull(configuration);
}
 
Example #11
Source File: MavenRestoreBlobStrategy.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public MavenRestoreBlobStrategy(
    final MavenPathParser mavenPathParser,
    final NodeAccess nodeAccess,
    final RepositoryManager repositoryManager,
    final BlobStoreManager blobStoreManager,
    final DryRunPrefix dryRunPrefix)
{
  super(nodeAccess, repositoryManager, blobStoreManager, dryRunPrefix);
  this.mavenPathParser = checkNotNull(mavenPathParser);
}
 
Example #12
Source File: BaseRestoreBlobStrategy.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
public BaseRestoreBlobStrategy(final NodeAccess nodeAccess,
                               final RepositoryManager repositoryManager,
                               final BlobStoreManager blobStoreManager,
                               final DryRunPrefix dryRunPrefix)
{
  this.nodeAccess = checkNotNull(nodeAccess);
  this.repositoryManager = checkNotNull(repositoryManager);
  this.blobStoreManager = checkNotNull(blobStoreManager);
  this.dryRunPrefix = checkNotNull(dryRunPrefix);
}
 
Example #13
Source File: OrientPyPiRestoreBlobStrategy.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public OrientPyPiRestoreBlobStrategy(final NodeAccess nodeAccess,
                                     final RepositoryManager repositoryManager,
                                     final BlobStoreManager blobStoreManager,
                                     final DryRunPrefix dryRunPrefix,
                                     final OrientPyPiRepairIndexComponent pyPiRepairIndexComponent,
                                     final PyPiRestoreBlobDataFactory pyPiRestoreBlobDataFactory)
{
  super(nodeAccess, repositoryManager, blobStoreManager, dryRunPrefix);
  this.pyPiRepairIndexComponent = pyPiRepairIndexComponent;
  this.pyPiRestoreBlobDataFactory = pyPiRestoreBlobDataFactory;
}
 
Example #14
Source File: NpmRestoreBlobStrategyTest.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Before
public void setup() throws IOException {
  underTest = new NpmRestoreBlobStrategy(nodeAccess, repositoryManager, blobStoreManager, new DryRunPrefix("dryrun"),
      npmRepairPackageRootComponent);

  packageProps.setProperty("@BlobStore.blob-name", TEST_PACKAGE_NAME);
  packageProps.setProperty("@Bucket.repo-name", "test-repo");
  packageProps.setProperty("size", "1000");
  packageProps.setProperty("@BlobStore.content-type", "application/xml");
  packageProps.setProperty("sha1", "b64de86ceaa4f0e4d8ccc44a26c562c6fb7fb230");

  tarballProps.setProperty("@BlobStore.blob-name", TEST_PACKAGE_NAME + "/-/" + TEST_TARBALL_NAME);
  tarballProps.setProperty("@Bucket.repo-name", "test-repo");
  tarballProps.setProperty("size", "2000");
  tarballProps.setProperty("@BlobStore.content-type", "application/x-tgz");
  tarballProps.setProperty("sha1", "244cb02c77ec2e74f78a9bd318218abc9c500a61");

  repoRootProps.setProperty("@BlobStore.blob-name", "-/all");
  repoRootProps.setProperty("@Bucket.repo-name", "test-repo");
  repoRootProps.setProperty("size", "3000");
  repoRootProps.setProperty("@BlobStore.content-type", "application/json");
  repoRootProps.setProperty("sha1", "e4edaa6af69865e35ceb0882ce61e460c07f700c");

  Mockito.when(repositoryManager.get("test-repo")).thenReturn(repository);

  Mockito.when(repository.optionalFacet(StorageFacet.class)).thenReturn(Optional.of(storageFacet));
  Mockito.when(repository.optionalFacet(NpmFacet.class)).thenReturn(Optional.of(npmFacet));
  Mockito.when(repository.facet(NpmFacet.class)).thenReturn(npmFacet);

  Mockito.when(storageFacet.txSupplier()).thenReturn(() -> storageTx);

  Mockito.when(storageTx.findBucket(repository)).thenReturn(bucket);

  Mockito.when(blob.getId()).thenReturn(new BlobId("test"));
  Mockito.when(blob.getInputStream()).thenReturn(new ByteArrayInputStream(blobBytes));

  Mockito.when(nodeAccess.getId()).thenReturn("node");

  Mockito.when(blobStoreManager.get(TEST_BLOB_STORE_NAME)).thenReturn(blobStore);
}
 
Example #15
Source File: NpmRestoreBlobStrategy.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public NpmRestoreBlobStrategy(final NodeAccess nodeAccess,
                              final RepositoryManager repositoryManager,
                              final BlobStoreManager blobStoreManager,
                              final DryRunPrefix dryRunPrefix,
                              final NpmRepairPackageRootComponent npmRepairPackageRootComponent)
{
  super(nodeAccess, repositoryManager, blobStoreManager, dryRunPrefix);
  this.npmRepairPackageRootComponent = checkNotNull(npmRepairPackageRootComponent);
}
 
Example #16
Source File: RawRestoreBlobStrategy.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public RawRestoreBlobStrategy(final NodeAccess nodeAccess,
                              final RepositoryManager repositoryManager,
                              final BlobStoreManager blobStoreManager,
                              final DryRunPrefix dryRunPrefix)
{
  super(nodeAccess, repositoryManager, blobStoreManager, dryRunPrefix);
}
 
Example #17
Source File: AptRestoreBlobStrategy.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public AptRestoreBlobStrategy(final NodeAccess nodeAccess,
                              final RepositoryManager repositoryManager,
                              final BlobStoreManager blobStoreManager,
                              final DryRunPrefix dryRunPrefix)
{
  super(nodeAccess, repositoryManager, blobStoreManager, dryRunPrefix);
}
 
Example #18
Source File: RRestoreBlobStrategy.java    From nexus-repository-r with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public RRestoreBlobStrategy(final NodeAccess nodeAccess,
                            final RepositoryManager repositoryManager,
                            final BlobStoreManager blobStoreManager,
                            final DryRunPrefix dryRunPrefix)
{
  super(nodeAccess, repositoryManager, blobStoreManager, dryRunPrefix);
}
 
Example #19
Source File: HelmRestoreBlobStrategy.java    From nexus-repository-helm with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public HelmRestoreBlobStrategy(final NodeAccess nodeAccess,
                               final RepositoryManager repositoryManager,
                               final BlobStoreManager blobStoreManager,
                               final DryRunPrefix dryRunPrefix)
{
  super(nodeAccess, repositoryManager, blobStoreManager, dryRunPrefix);
}
 
Example #20
Source File: OrientPyPiRestoreBlobStrategyTest.java    From nexus-public with Eclipse Public License 1.0 4 votes vote down vote up
@Before
public void setup() {
  underTest = new OrientPyPiRestoreBlobStrategy(nodeAccess,
      repositoryManager,
      blobStoreManager,
      new DryRunPrefix("dryrun"),
      pyPiRepairIndexComponent,
      pyPiRestoreBlobDataFactory);

  packageProps.setProperty("@BlobStore.created-by", "admin");
  packageProps.setProperty("size", "5674");
  packageProps.setProperty("@Bucket.repo-name", "pypi-hosted");
  packageProps.setProperty("creationTime", "1533220056556");
  packageProps.setProperty("@BlobStore.created-by-ip", "127.0.0.1");
  packageProps.setProperty("@BlobStore.content-type", "application/x-gzip");
  packageProps.setProperty("@BlobStore.blob-name", PACKAGE_PATH);
  packageProps.setProperty("sha1", "c402bbe79807576de00c1fa61fa037a27ee6b62b");

  indexProps.setProperty("@BlobStore.created-by", "anonymous");
  indexProps.setProperty("size", "1330");
  indexProps.setProperty("@Bucket.repo-name", "pypi-proxy");
  indexProps.setProperty("creationTime", "1533220387218");
  indexProps.setProperty("@BlobStore.created-by-ip", "127.0.0.1");
  indexProps.setProperty("@BlobStore.content-type", "text/html");
  indexProps.setProperty("@BlobStore.blob-name", INDEX_PATH);
  indexProps.setProperty("sha1", "0088eb478752a810f48f04d3cf9f46d2924e334a");

  when(repositoryManager.get(anyString())).thenReturn(repository);

  when(repository.facet(PyPiFacet.class)).thenReturn(pyPiFacet);
  when(repository.optionalFacet(StorageFacet.class)).thenReturn(Optional.of(storageFacet));
  when(repository.optionalFacet(PyPiFacet.class)).thenReturn(Optional.of(pyPiFacet));

  when(storageFacet.txSupplier()).thenReturn(() -> storageTx);

  when(storageTx.findBucket(repository)).thenReturn(bucket);

  when(blob.getInputStream()).thenReturn(new ByteArrayInputStream(blobBytes));

  when(blobStoreManager.get(TEST_BLOB_STORE_NAME)).thenReturn(blobStore);

  when(pyPiRestoreBlobDataFactory.create(any())).thenReturn(pyPiRestoreBlobData);
  when(pyPiRestoreBlobData.getBlobData()).thenReturn(restoreBlobData);
}
 
Example #21
Source File: BlobStoreSupport.java    From nexus-public with Eclipse Public License 1.0 4 votes vote down vote up
public BlobStoreSupport(final BlobIdLocationResolver blobIdLocationResolver,
                        final DryRunPrefix dryRunPrefix)
{
  this.blobIdLocationResolver = checkNotNull(blobIdLocationResolver);
  this.dryRunPrefix = checkNotNull(dryRunPrefix);
}