SwiftStorageProvider extends S3StorageProvider { @Override public String createHiddenSpace(String spaceId, int expirationInDays) { String bucketName = getHiddenBucketName(spaceId); try { Bucket bucket = s3Client.createBucket(bucketName); return spaceId; } catch (AmazonClientException e) { String err = "Could not create Swift container with name " + bucketName + " due to error: " + e.getMessage(); throw new StorageException(err, e, RETRY); } } SwiftStorageProvider(String accessKey, String secretKey, Map<String, String> options);  SwiftStorageProvider(AmazonS3 s3Client, String accessKey); @Override StorageProviderType getStorageProviderType(); @Override void removeSpace(String spaceId); @Override String createHiddenSpace(String spaceId, int expirationInDays); ObjectMetadata expireObject(String bucketName, String contentId, Integer seconds);  }
@Test public void testCreateHiddenSpace() { setupS3Client(); SwiftStorageProvider provider = getProvider(); String hiddenSpace = "my-hidden-space"; String bucketName = getBucketName(hiddenSpace); Bucket bucket = createMock(Bucket.class); expect(s3Client.createBucket(bucketName)).andReturn(bucket); replay(s3Client); String spaceId = provider.createHiddenSpace(hiddenSpace, 0); assertEquals("returned spaceId is not correct", hiddenSpace, spaceId); }