Search in sources :

Example 1 with S3ChunkStorage

use of io.pravega.storage.s3.S3ChunkStorage in project pravega by pravega.

the class StorageFactoryTests method testS3StorageFactoryCreator.

private void testS3StorageFactoryCreator(S3StorageConfig config) {
    StorageFactoryCreator factoryCreator = new S3StorageFactoryCreator();
    val expected = new StorageFactoryInfo[] { StorageFactoryInfo.builder().name("S3").storageLayoutType(StorageLayoutType.CHUNKED_STORAGE).build() };
    val factoryInfoList = factoryCreator.getStorageFactories();
    Assert.assertEquals(1, factoryInfoList.length);
    Assert.assertArrayEquals(expected, factoryInfoList);
    // Simple Storage
    ConfigSetup configSetup1 = mock(ConfigSetup.class);
    when(configSetup1.getConfig(any())).thenReturn(ChunkedSegmentStorageConfig.DEFAULT_CONFIG, config);
    val factory1 = factoryCreator.createFactory(expected[0], configSetup1, executorService());
    Assert.assertTrue(factory1 instanceof S3SimpleStorageFactory);
    @Cleanup Storage storage1 = ((S3SimpleStorageFactory) factory1).createStorageAdapter(42, new InMemoryMetadataStore(ChunkedSegmentStorageConfig.DEFAULT_CONFIG, executorService()));
    Assert.assertTrue(storage1 instanceof ChunkedSegmentStorage);
    Assert.assertTrue(((ChunkedSegmentStorage) storage1).getChunkStorage() instanceof S3ChunkStorage);
    AssertExtensions.assertThrows("createStorageAdapter should throw UnsupportedOperationException.", () -> factory1.createStorageAdapter(), ex -> ex instanceof UnsupportedOperationException);
}
Also used : lombok.val(lombok.val) Storage(io.pravega.segmentstore.storage.Storage) ChunkedSegmentStorage(io.pravega.segmentstore.storage.chunklayer.ChunkedSegmentStorage) ExtendedS3ChunkStorage(io.pravega.storage.extendeds3.ExtendedS3ChunkStorage) HDFSChunkStorage(io.pravega.storage.hdfs.HDFSChunkStorage) S3ChunkStorage(io.pravega.storage.s3.S3ChunkStorage) SyncStorage(io.pravega.segmentstore.storage.SyncStorage) FileSystemChunkStorage(io.pravega.storage.filesystem.FileSystemChunkStorage) ExtendedS3SimpleStorageFactory(io.pravega.storage.extendeds3.ExtendedS3SimpleStorageFactory) S3SimpleStorageFactory(io.pravega.storage.s3.S3SimpleStorageFactory) ExtendedS3ChunkStorage(io.pravega.storage.extendeds3.ExtendedS3ChunkStorage) S3ChunkStorage(io.pravega.storage.s3.S3ChunkStorage) InMemoryMetadataStore(io.pravega.segmentstore.storage.mocks.InMemoryMetadataStore) StorageFactoryInfo(io.pravega.segmentstore.storage.StorageFactoryInfo) ChunkedSegmentStorage(io.pravega.segmentstore.storage.chunklayer.ChunkedSegmentStorage) S3StorageFactoryCreator(io.pravega.storage.s3.S3StorageFactoryCreator) HDFSStorageFactoryCreator(io.pravega.storage.hdfs.HDFSStorageFactoryCreator) StorageFactoryCreator(io.pravega.segmentstore.storage.StorageFactoryCreator) ExtendedS3StorageFactoryCreator(io.pravega.storage.extendeds3.ExtendedS3StorageFactoryCreator) FileSystemStorageFactoryCreator(io.pravega.storage.filesystem.FileSystemStorageFactoryCreator) S3StorageFactoryCreator(io.pravega.storage.s3.S3StorageFactoryCreator) ExtendedS3StorageFactoryCreator(io.pravega.storage.extendeds3.ExtendedS3StorageFactoryCreator) Cleanup(lombok.Cleanup) ConfigSetup(io.pravega.segmentstore.storage.ConfigSetup)

Aggregations

ConfigSetup (io.pravega.segmentstore.storage.ConfigSetup)1 Storage (io.pravega.segmentstore.storage.Storage)1 StorageFactoryCreator (io.pravega.segmentstore.storage.StorageFactoryCreator)1 StorageFactoryInfo (io.pravega.segmentstore.storage.StorageFactoryInfo)1 SyncStorage (io.pravega.segmentstore.storage.SyncStorage)1 ChunkedSegmentStorage (io.pravega.segmentstore.storage.chunklayer.ChunkedSegmentStorage)1 InMemoryMetadataStore (io.pravega.segmentstore.storage.mocks.InMemoryMetadataStore)1 ExtendedS3ChunkStorage (io.pravega.storage.extendeds3.ExtendedS3ChunkStorage)1 ExtendedS3SimpleStorageFactory (io.pravega.storage.extendeds3.ExtendedS3SimpleStorageFactory)1 ExtendedS3StorageFactoryCreator (io.pravega.storage.extendeds3.ExtendedS3StorageFactoryCreator)1 FileSystemChunkStorage (io.pravega.storage.filesystem.FileSystemChunkStorage)1 FileSystemStorageFactoryCreator (io.pravega.storage.filesystem.FileSystemStorageFactoryCreator)1 HDFSChunkStorage (io.pravega.storage.hdfs.HDFSChunkStorage)1 HDFSStorageFactoryCreator (io.pravega.storage.hdfs.HDFSStorageFactoryCreator)1 S3ChunkStorage (io.pravega.storage.s3.S3ChunkStorage)1 S3SimpleStorageFactory (io.pravega.storage.s3.S3SimpleStorageFactory)1 S3StorageFactoryCreator (io.pravega.storage.s3.S3StorageFactoryCreator)1 Cleanup (lombok.Cleanup)1 lombok.val (lombok.val)1