StorageFacetImpl extends FacetSupport implements StorageFacet { @Override protected void doConfigure(final Configuration configuration) throws Exception { config = facet(ConfigurationFacet.class).readSection(configuration, STORAGE, Config.class); log.debug("Config: {}", config); } @Inject  StorageFacetImpl(final NodeAccess nodeAccess,
                          final BlobStoreManager blobStoreManager,
                          @Named(ComponentDatabase.NAME) final Provider<DatabaseInstance> databaseInstanceProvider,
                          final BucketEntityAdapter bucketEntityAdapter,
                          final ComponentEntityAdapter componentEntityAdapter,
                          final AssetEntityAdapter assetEntityAdapter,
                          final ClientInfoProvider clientInfoProvider,
                          final ContentValidatorSelector contentValidatorSelector,
                          final MimeRulesSourceSelector mimeRulesSourceSelector,
                          final StorageFacetManager storageFacetManager,
                          final ComponentFactory componentFactory,
                          final ConstraintViolationFactory constraintViolationFactory,
                          final Provider<RepositoryMoveService> repositoryMoveStoreProvider); @Override @Guarded(by = {INITIALISED, ATTACHED}) void registerWritePolicySelector(final WritePolicySelector writePolicySelector); @Override @Guarded(by = STARTED) Supplier<StorageTx> txSupplier(); @Override TempBlob createTempBlob(final InputStream inputStream, final Iterable<HashAlgorithm> hashAlgorithms); @Override TempBlob createTempBlob(final Payload payload, final Iterable<HashAlgorithm> hashAlgorithms); @Override BlobStore blobStore();  }
@Test public void blobStoreGroupMemberAsStorageCreatesConstraintViolation() throws Exception { underTest.doConfigure(configuration); when(blobStoreManager.get(BLOB_STORE_NAME)).thenReturn(blobStore); when(blobStoreManager.getParent(BLOB_STORE_NAME)).thenReturn(Optional.of("group1")); BlobStoreConfiguration groupConfig = mock(BlobStoreConfiguration.class); when(groupConfig.getName()).thenReturn("group1"); underTest.validate(configuration); verify(violationFactory, times(1)).createViolation(format("%s.%s.blobStoreName", P_ATTRIBUTES, STORAGE), format("Blob Store '%s' is a member of Blob Store Group 'group1' and cannot be set as storage", BLOB_STORE_NAME)); }