@Ignore @Test public void should_write_in_swiftContainer() throws Exception { ContentAddressableStorage contentAddressableStorage = StoreContextBuilder.newStoreContext(configuration, null); if (!contentAddressableStorage.isExistingContainer("testContainer")) { contentAddressableStorage.createContainer("testContainer"); } String uuid = UUID.randomUUID().toString(); File resourceFile = PropertiesUtils.getResourceFile("3500.txt"); contentAddressableStorage .putObject("testContainer", uuid, new FileInputStream(resourceFile), SHA512,3500L); ObjectContent response = contentAddressableStorage.getObject("testContainer", uuid); try(InputStream is = response.getInputStream()) { File fileDownloaded = tempFolder.newFile(); FileOutputStream fileOutputStream = new FileOutputStream(fileDownloaded); IOUtils.copy(is, fileOutputStream); assertThat(fileDownloaded.length()).isEqualTo(resourceFile.length()); } }
public static ContentAddressableStorage newStoreContext(StorageConfiguration configuration, MongoDatabase mongoDatabase) throws CertificateException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException { if (StorageProvider.SWIFT_AUTH_V1.getValue().equalsIgnoreCase(configuration.getProvider())) { return new OpenstackSwift(configuration); } else if (StorageProvider.HASHFILESYSTEM.getValue().equalsIgnoreCase(configuration.getProvider())) { return new HashFileSystem(configuration); } else if (StorageProvider.SWIFT_AUTH_V2.getValue().equalsIgnoreCase(configuration.getProvider())) { SwiftKeystoneFactoryV2 swiftKeystoneFactoryV2 = new SwiftKeystoneFactoryV2(configuration); return new Swift(swiftKeystoneFactoryV2, configuration); } else if (StorageProvider.SWIFT_AUTH_V3.getValue().equalsIgnoreCase(configuration.getProvider())) { SwiftKeystoneFactoryV3 swiftKeystoneFactoryV3 = new SwiftKeystoneFactoryV3(configuration); return new Swift(swiftKeystoneFactoryV3, configuration); } else if (StorageProvider.AMAZON_S3_V1.getValue().equalsIgnoreCase(configuration.getProvider())) { return new AmazonS3V1(configuration); } else if (StorageProvider.TAPE_LIBRARY.getValue().equalsIgnoreCase(configuration.getProvider())) { TapeLibraryFactory tapeLibraryFactory = TapeLibraryFactory.getInstance(); tapeLibraryFactory.initialize(configuration.getTapeLibraryConfiguration(), mongoDatabase); return tapeLibraryFactory.getTapeLibraryContentAddressableStorage(); } else { return new FileSystem(configuration); } }
StoreContextBuilder { public static ContentAddressableStorage newStoreContext(StorageConfiguration configuration, MongoDatabase mongoDatabase) throws CertificateException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException { if (StorageProvider.SWIFT_AUTH_V1.getValue().equalsIgnoreCase(configuration.getProvider())) { return new OpenstackSwift(configuration); } else if (StorageProvider.HASHFILESYSTEM.getValue().equalsIgnoreCase(configuration.getProvider())) { return new HashFileSystem(configuration); } else if (StorageProvider.SWIFT_AUTH_V2.getValue().equalsIgnoreCase(configuration.getProvider())) { SwiftKeystoneFactoryV2 swiftKeystoneFactoryV2 = new SwiftKeystoneFactoryV2(configuration); return new Swift(swiftKeystoneFactoryV2, configuration); } else if (StorageProvider.SWIFT_AUTH_V3.getValue().equalsIgnoreCase(configuration.getProvider())) { SwiftKeystoneFactoryV3 swiftKeystoneFactoryV3 = new SwiftKeystoneFactoryV3(configuration); return new Swift(swiftKeystoneFactoryV3, configuration); } else if (StorageProvider.AMAZON_S3_V1.getValue().equalsIgnoreCase(configuration.getProvider())) { return new AmazonS3V1(configuration); } else if (StorageProvider.TAPE_LIBRARY.getValue().equalsIgnoreCase(configuration.getProvider())) { TapeLibraryFactory tapeLibraryFactory = TapeLibraryFactory.getInstance(); tapeLibraryFactory.initialize(configuration.getTapeLibraryConfiguration(), mongoDatabase); return tapeLibraryFactory.getTapeLibraryContentAddressableStorage(); } else { return new FileSystem(configuration); } } }
StoreContextBuilder { public static ContentAddressableStorage newStoreContext(StorageConfiguration configuration, MongoDatabase mongoDatabase) throws CertificateException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException { if (StorageProvider.SWIFT_AUTH_V1.getValue().equalsIgnoreCase(configuration.getProvider())) { return new OpenstackSwift(configuration); } else if (StorageProvider.HASHFILESYSTEM.getValue().equalsIgnoreCase(configuration.getProvider())) { return new HashFileSystem(configuration); } else if (StorageProvider.SWIFT_AUTH_V2.getValue().equalsIgnoreCase(configuration.getProvider())) { SwiftKeystoneFactoryV2 swiftKeystoneFactoryV2 = new SwiftKeystoneFactoryV2(configuration); return new Swift(swiftKeystoneFactoryV2, configuration); } else if (StorageProvider.SWIFT_AUTH_V3.getValue().equalsIgnoreCase(configuration.getProvider())) { SwiftKeystoneFactoryV3 swiftKeystoneFactoryV3 = new SwiftKeystoneFactoryV3(configuration); return new Swift(swiftKeystoneFactoryV3, configuration); } else if (StorageProvider.AMAZON_S3_V1.getValue().equalsIgnoreCase(configuration.getProvider())) { return new AmazonS3V1(configuration); } else if (StorageProvider.TAPE_LIBRARY.getValue().equalsIgnoreCase(configuration.getProvider())) { TapeLibraryFactory tapeLibraryFactory = TapeLibraryFactory.getInstance(); tapeLibraryFactory.initialize(configuration.getTapeLibraryConfiguration(), mongoDatabase); return tapeLibraryFactory.getTapeLibraryContentAddressableStorage(); } else { return new FileSystem(configuration); } }  }
StoreContextBuilder { public static ContentAddressableStorage newStoreContext(StorageConfiguration configuration, MongoDatabase mongoDatabase) throws CertificateException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException { if (StorageProvider.SWIFT_AUTH_V1.getValue().equalsIgnoreCase(configuration.getProvider())) { return new OpenstackSwift(configuration); } else if (StorageProvider.HASHFILESYSTEM.getValue().equalsIgnoreCase(configuration.getProvider())) { return new HashFileSystem(configuration); } else if (StorageProvider.SWIFT_AUTH_V2.getValue().equalsIgnoreCase(configuration.getProvider())) { SwiftKeystoneFactoryV2 swiftKeystoneFactoryV2 = new SwiftKeystoneFactoryV2(configuration); return new Swift(swiftKeystoneFactoryV2, configuration); } else if (StorageProvider.SWIFT_AUTH_V3.getValue().equalsIgnoreCase(configuration.getProvider())) { SwiftKeystoneFactoryV3 swiftKeystoneFactoryV3 = new SwiftKeystoneFactoryV3(configuration); return new Swift(swiftKeystoneFactoryV3, configuration); } else if (StorageProvider.AMAZON_S3_V1.getValue().equalsIgnoreCase(configuration.getProvider())) { return new AmazonS3V1(configuration); } else if (StorageProvider.TAPE_LIBRARY.getValue().equalsIgnoreCase(configuration.getProvider())) { TapeLibraryFactory tapeLibraryFactory = TapeLibraryFactory.getInstance(); tapeLibraryFactory.initialize(configuration.getTapeLibraryConfiguration(), mongoDatabase); return tapeLibraryFactory.getTapeLibraryContentAddressableStorage(); } else { return new FileSystem(configuration); } }  static ContentAddressableStorage newStoreContext(StorageConfiguration configuration,
        MongoDatabase mongoDatabase); }
StoreContextBuilder { public static ContentAddressableStorage newStoreContext(StorageConfiguration configuration, MongoDatabase mongoDatabase) throws CertificateException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException, IOException { if (StorageProvider.SWIFT_AUTH_V1.getValue().equalsIgnoreCase(configuration.getProvider())) { return new OpenstackSwift(configuration); } else if (StorageProvider.HASHFILESYSTEM.getValue().equalsIgnoreCase(configuration.getProvider())) { return new HashFileSystem(configuration); } else if (StorageProvider.SWIFT_AUTH_V2.getValue().equalsIgnoreCase(configuration.getProvider())) { SwiftKeystoneFactoryV2 swiftKeystoneFactoryV2 = new SwiftKeystoneFactoryV2(configuration); return new Swift(swiftKeystoneFactoryV2, configuration); } else if (StorageProvider.SWIFT_AUTH_V3.getValue().equalsIgnoreCase(configuration.getProvider())) { SwiftKeystoneFactoryV3 swiftKeystoneFactoryV3 = new SwiftKeystoneFactoryV3(configuration); return new Swift(swiftKeystoneFactoryV3, configuration); } else if (StorageProvider.AMAZON_S3_V1.getValue().equalsIgnoreCase(configuration.getProvider())) { return new AmazonS3V1(configuration); } else if (StorageProvider.TAPE_LIBRARY.getValue().equalsIgnoreCase(configuration.getProvider())) { TapeLibraryFactory tapeLibraryFactory = TapeLibraryFactory.getInstance(); tapeLibraryFactory.initialize(configuration.getTapeLibraryConfiguration(), mongoDatabase); return tapeLibraryFactory.getTapeLibraryContentAddressableStorage(); } else { return new FileSystem(configuration); } }  static ContentAddressableStorage newStoreContext(StorageConfiguration configuration,
        MongoDatabase mongoDatabase);  }