@Test public void notThrowsIfPathIsNotUniqueInOtherBlobStoreType() { BlobStoreConfiguration configuration = generateBlobStore(FileBlobStore.TYPE, "f_d", "/nexus/10").getBlobStoreConfiguration(); underTest.validatePathUniqueConstraint(configuration); }
public void validatePathUniqueConstraint(final BlobStoreConfiguration configuration) { final Path pathToCheck = fromBlobStoreConfiguration(configuration); Iterable<BlobStore> blobStores = blobStoreManager.get().browse(); List<BlobStoreConfiguration> pathDuplicates = StreamSupport.stream(blobStores.spliterator(), false) .map(BlobStore::getBlobStoreConfiguration) .filter(config -> config.getType().equals(FileBlobStore.TYPE) && !config.getName().equals(configuration.getName()) && pathsViolateUniqueConstraint(fromBlobStoreConfiguration(config), pathToCheck)) .collect(Collectors.toList()); if (!pathDuplicates.isEmpty()) { throw new ValidationErrorsException(buildWarning(pathDuplicates)); } }
FileBlobStorePathValidator extends HealthCheck { public void validatePathUniqueConstraint(final BlobStoreConfiguration configuration) { final Path pathToCheck = fromBlobStoreConfiguration(configuration); Iterable<BlobStore> blobStores = blobStoreManager.get().browse(); List<BlobStoreConfiguration> pathDuplicates = StreamSupport.stream(blobStores.spliterator(), false) .map(BlobStore::getBlobStoreConfiguration) .filter(config -> config.getType().equals(FileBlobStore.TYPE) && !config.getName().equals(configuration.getName()) && pathsViolateUniqueConstraint(fromBlobStoreConfiguration(config), pathToCheck)) .collect(Collectors.toList()); if (!pathDuplicates.isEmpty()) { throw new ValidationErrorsException(buildWarning(pathDuplicates)); } } }
FileBlobStorePathValidator extends HealthCheck { public void validatePathUniqueConstraint(final BlobStoreConfiguration configuration) { final Path pathToCheck = fromBlobStoreConfiguration(configuration); Iterable<BlobStore> blobStores = blobStoreManager.get().browse(); List<BlobStoreConfiguration> pathDuplicates = StreamSupport.stream(blobStores.spliterator(), false) .map(BlobStore::getBlobStoreConfiguration) .filter(config -> config.getType().equals(FileBlobStore.TYPE) && !config.getName().equals(configuration.getName()) && pathsViolateUniqueConstraint(fromBlobStoreConfiguration(config), pathToCheck)) .collect(Collectors.toList()); if (!pathDuplicates.isEmpty()) { throw new ValidationErrorsException(buildWarning(pathDuplicates)); } } @Inject  FileBlobStorePathValidator(
      final Provider<BlobStoreManager> blobStoreManager,
      final Provider<ApplicationDirectories> applicationDirectories); }
FileBlobStorePathValidator extends HealthCheck { public void validatePathUniqueConstraint(final BlobStoreConfiguration configuration) { final Path pathToCheck = fromBlobStoreConfiguration(configuration); Iterable<BlobStore> blobStores = blobStoreManager.get().browse(); List<BlobStoreConfiguration> pathDuplicates = StreamSupport.stream(blobStores.spliterator(), false) .map(BlobStore::getBlobStoreConfiguration) .filter(config -> config.getType().equals(FileBlobStore.TYPE) && !config.getName().equals(configuration.getName()) && pathsViolateUniqueConstraint(fromBlobStoreConfiguration(config), pathToCheck)) .collect(Collectors.toList()); if (!pathDuplicates.isEmpty()) { throw new ValidationErrorsException(buildWarning(pathDuplicates)); } } @Inject  FileBlobStorePathValidator(
      final Provider<BlobStoreManager> blobStoreManager,
      final Provider<ApplicationDirectories> applicationDirectories); void validatePathUniqueConstraint(final BlobStoreConfiguration configuration); }
FileBlobStorePathValidator extends HealthCheck { public void validatePathUniqueConstraint(final BlobStoreConfiguration configuration) { final Path pathToCheck = fromBlobStoreConfiguration(configuration); Iterable<BlobStore> blobStores = blobStoreManager.get().browse(); List<BlobStoreConfiguration> pathDuplicates = StreamSupport.stream(blobStores.spliterator(), false) .map(BlobStore::getBlobStoreConfiguration) .filter(config -> config.getType().equals(FileBlobStore.TYPE) && !config.getName().equals(configuration.getName()) && pathsViolateUniqueConstraint(fromBlobStoreConfiguration(config), pathToCheck)) .collect(Collectors.toList()); if (!pathDuplicates.isEmpty()) { throw new ValidationErrorsException(buildWarning(pathDuplicates)); } } @Inject  FileBlobStorePathValidator(
      final Provider<BlobStoreManager> blobStoreManager,
      final Provider<ApplicationDirectories> applicationDirectories); void validatePathUniqueConstraint(final BlobStoreConfiguration configuration);  }