This is an automated email from the ASF dual-hosted git repository.

btellier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit d9b23f5718bcf5a8af2e0113ba3abac66cf991b8
Author: Tran Tien Duc <[email protected]>
AuthorDate: Tue Jun 25 15:23:28 2019 +0700

    JAMES-2806 Replace ContainerName by BucketName in ObjectStorage
    
    because they represent for the same concept
---
 .../james/blob/objectstorage/ContainerName.java    | 63 ----------------------
 .../blob/objectstorage/ObjectStorageBlobsDAO.java  | 28 +++++-----
 .../ObjectStorageBlobsDAOBuilder.java              | 21 ++++----
 .../blob/objectstorage/aws/AwsS3ObjectStorage.java | 18 +++----
 .../swift/SwiftKeystone2ObjectStorage.java         |  2 +-
 .../swift/SwiftKeystone3ObjectStorage.java         |  2 +-
 .../swift/SwiftTempAuthObjectStorage.java          |  2 +-
 .../blob/objectstorage/ContainerNameTest.java      | 31 -----------
 .../ObjectStorageBlobsDAOContract.java             |  4 +-
 .../objectstorage/ObjectStorageBlobsDAOTest.java   | 28 +++++-----
 .../aws/AwsS3ObjectStorageBlobsDAOBuilderTest.java | 18 +++----
 ...tKeystone2ObjectStorageBlobsDAOBuilderTest.java | 16 +++---
 ...tKeystone3ObjectStorageBlobsDAOBuilderTest.java | 16 +++---
 ...ftTempAuthObjectStorageBlobsDAOBuilderTest.java | 16 +++---
 14 files changed, 86 insertions(+), 179 deletions(-)

diff --git 
a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/ContainerName.java
 
b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/ContainerName.java
deleted file mode 100644
index 5c3c05d..0000000
--- 
a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/ContainerName.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.blob.objectstorage;
-
-import com.google.common.base.MoreObjects;
-import com.google.common.base.Objects;
-
-public final class ContainerName {
-    public static ContainerName of(String value) {
-        return new ContainerName(value);
-    }
-
-    private final String container;
-
-    private ContainerName(String value) {
-        this.container = value;
-    }
-
-    public String value() {
-        return container;
-    }
-
-    @Override
-    public boolean equals(Object o) {
-        if (this == o) {
-            return true;
-        }
-        if (o == null || getClass() != o.getClass()) {
-            return false;
-        }
-        ContainerName that = (ContainerName) o;
-        return Objects.equal(container, that.container);
-    }
-
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(container);
-    }
-
-    @Override
-    public String toString() {
-        return MoreObjects.toStringHelper(this)
-            .add("container", container)
-            .toString();
-    }
-}
diff --git 
a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAO.java
 
b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAO.java
index aa209b5..22e52db 100644
--- 
a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAO.java
+++ 
b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAO.java
@@ -53,40 +53,40 @@ public class ObjectStorageBlobsDAO implements BlobStore {
 
     private final BlobId.Factory blobIdFactory;
 
-    private final ContainerName containerName;
+    private final BucketName bucketName;
     private final org.jclouds.blobstore.BlobStore blobStore;
     private final PutBlobFunction putBlobFunction;
     private final PayloadCodec payloadCodec;
 
-    ObjectStorageBlobsDAO(ContainerName containerName, BlobId.Factory 
blobIdFactory,
+    ObjectStorageBlobsDAO(BucketName bucketName, BlobId.Factory blobIdFactory,
                           org.jclouds.blobstore.BlobStore blobStore,
                           PutBlobFunction putBlobFunction,
                           PayloadCodec payloadCodec) {
         this.blobIdFactory = blobIdFactory;
-        this.containerName = containerName;
+        this.bucketName = bucketName;
         this.blobStore = blobStore;
         this.putBlobFunction = putBlobFunction;
         this.payloadCodec = payloadCodec;
     }
 
-    public static ObjectStorageBlobsDAOBuilder.RequireContainerName 
builder(SwiftTempAuthObjectStorage.Configuration testConfig) {
+    public static ObjectStorageBlobsDAOBuilder.RequireBucketName 
builder(SwiftTempAuthObjectStorage.Configuration testConfig) {
         return SwiftTempAuthObjectStorage.daoBuilder(testConfig);
     }
 
-    public static ObjectStorageBlobsDAOBuilder.RequireContainerName 
builder(SwiftKeystone2ObjectStorage.Configuration testConfig) {
+    public static ObjectStorageBlobsDAOBuilder.RequireBucketName 
builder(SwiftKeystone2ObjectStorage.Configuration testConfig) {
         return SwiftKeystone2ObjectStorage.daoBuilder(testConfig);
     }
 
-    public static ObjectStorageBlobsDAOBuilder.RequireContainerName 
builder(SwiftKeystone3ObjectStorage.Configuration testConfig) {
+    public static ObjectStorageBlobsDAOBuilder.RequireBucketName 
builder(SwiftKeystone3ObjectStorage.Configuration testConfig) {
         return SwiftKeystone3ObjectStorage.daoBuilder(testConfig);
     }
 
-    public static ObjectStorageBlobsDAOBuilder.RequireContainerName 
builder(AwsS3AuthConfiguration testConfig) {
+    public static ObjectStorageBlobsDAOBuilder.RequireBucketName 
builder(AwsS3AuthConfiguration testConfig) {
         return AwsS3ObjectStorage.daoBuilder(testConfig);
     }
 
-    public Mono<ContainerName> createContainer(ContainerName name) {
-        return Mono.fromCallable(() -> 
blobStore.createContainerInLocation(DEFAULT_LOCATION, name.value()))
+    public Mono<BucketName> createContainer(BucketName name) {
+        return Mono.fromCallable(() -> 
blobStore.createContainerInLocation(DEFAULT_LOCATION, name.asString()))
             .filter(created -> created == false)
             .doOnNext(ignored -> LOGGER.debug("{} already existed", name))
             .thenReturn(name);
@@ -117,10 +117,10 @@ public class ObjectStorageBlobsDAO implements BlobStore {
     }
 
     private Mono<BlobId> updateBlobId(BlobId from, BlobId to) {
-        String containerName = this.containerName.value();
+        String bucketName = this.bucketName.asString();
         return Mono
-            .fromCallable(() -> blobStore.copyBlob(containerName, 
from.asString(), containerName, to.asString(), CopyOptions.NONE))
-            .then(Mono.fromRunnable(() -> blobStore.removeBlob(containerName, 
from.asString())))
+            .fromCallable(() -> blobStore.copyBlob(bucketName, 
from.asString(), bucketName, to.asString(), CopyOptions.NONE))
+            .then(Mono.fromRunnable(() -> blobStore.removeBlob(bucketName, 
from.asString())))
             .thenReturn(to);
     }
 
@@ -146,7 +146,7 @@ public class ObjectStorageBlobsDAO implements BlobStore {
 
     @Override
     public InputStream read(BucketName bucketName, BlobId blobId) throws 
ObjectStoreException {
-        Blob blob = blobStore.getBlob(containerName.value(), 
blobId.asString());
+        Blob blob = blobStore.getBlob(this.bucketName.asString(), 
blobId.asString());
 
         try {
             if (blob != null) {
@@ -167,7 +167,7 @@ public class ObjectStorageBlobsDAO implements BlobStore {
     }
 
     public void deleteContainer() {
-        blobStore.deleteContainer(containerName.value());
+        blobStore.deleteContainer(bucketName.asString());
     }
 
     public PayloadCodec getPayloadCodec() {
diff --git 
a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOBuilder.java
 
b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOBuilder.java
index f6aa7ff..f890f0d 100644
--- 
a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOBuilder.java
+++ 
b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOBuilder.java
@@ -23,6 +23,7 @@ import java.util.Optional;
 import java.util.function.Supplier;
 
 import org.apache.james.blob.api.BlobId;
+import org.apache.james.blob.api.BucketName;
 import org.jclouds.blobstore.BlobStore;
 
 import com.google.common.annotations.VisibleForTesting;
@@ -30,13 +31,13 @@ import com.google.common.base.Preconditions;
 
 public class ObjectStorageBlobsDAOBuilder {
 
-    public static RequireContainerName forBlobStore(Supplier<BlobStore> 
supplier) {
-        return containerName -> blobIdFactory -> new ReadyToBuild(supplier, 
blobIdFactory, containerName);
+    public static RequireBucketName forBlobStore(Supplier<BlobStore> supplier) 
{
+        return bucketName -> blobIdFactory -> new ReadyToBuild(supplier, 
blobIdFactory, bucketName);
     }
 
     @FunctionalInterface
-    public interface RequireContainerName {
-        RequireBlobIdFactory container(ContainerName containerName);
+    public interface RequireBucketName {
+        RequireBlobIdFactory container(BucketName bucketName);
     }
 
     @FunctionalInterface
@@ -47,14 +48,14 @@ public class ObjectStorageBlobsDAOBuilder {
     public static class ReadyToBuild {
 
         private final Supplier<BlobStore> supplier;
-        private final ContainerName containerName;
+        private final BucketName bucketName;
         private final BlobId.Factory blobIdFactory;
         private Optional<PayloadCodec> payloadCodec;
         private Optional<PutBlobFunction> putBlob;
 
-        public ReadyToBuild(Supplier<BlobStore> supplier, BlobId.Factory 
blobIdFactory, ContainerName containerName) {
+        public ReadyToBuild(Supplier<BlobStore> supplier, BlobId.Factory 
blobIdFactory, BucketName bucketName) {
             this.blobIdFactory = blobIdFactory;
-            this.containerName = containerName;
+            this.bucketName = bucketName;
             this.payloadCodec = Optional.empty();
             this.supplier = supplier;
             this.putBlob = Optional.empty();
@@ -76,12 +77,12 @@ public class ObjectStorageBlobsDAOBuilder {
         }
 
         public ObjectStorageBlobsDAO build() {
-            Preconditions.checkState(containerName != null);
+            Preconditions.checkState(bucketName != null);
             Preconditions.checkState(blobIdFactory != null);
 
             BlobStore blobStore = supplier.get();
 
-            return new ObjectStorageBlobsDAO(containerName,
+            return new ObjectStorageBlobsDAO(bucketName,
                 blobIdFactory,
                 blobStore,
                 putBlob.orElse(defaultPutBlob(blobStore)),
@@ -89,7 +90,7 @@ public class ObjectStorageBlobsDAOBuilder {
         }
 
         private PutBlobFunction defaultPutBlob(BlobStore blobStore) {
-            return (blob) -> blobStore.putBlob(containerName.value(), blob);
+            return (blob) -> blobStore.putBlob(bucketName.asString(), blob);
         }
 
         @VisibleForTesting
diff --git 
a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/aws/AwsS3ObjectStorage.java
 
b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/aws/AwsS3ObjectStorage.java
index 5454af0..0d8ef20 100644
--- 
a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/aws/AwsS3ObjectStorage.java
+++ 
b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/aws/AwsS3ObjectStorage.java
@@ -32,7 +32,7 @@ import javax.annotation.PreDestroy;
 import javax.inject.Inject;
 
 import org.apache.commons.io.FileUtils;
-import org.apache.james.blob.objectstorage.ContainerName;
+import org.apache.james.blob.api.BucketName;
 import org.apache.james.blob.objectstorage.ObjectStorageBlobsDAOBuilder;
 import org.apache.james.blob.objectstorage.PutBlobFunction;
 import org.apache.james.util.Size;
@@ -89,17 +89,17 @@ public class AwsS3ObjectStorage {
         executorService.shutdownNow();
     }
 
-    public static ObjectStorageBlobsDAOBuilder.RequireContainerName 
daoBuilder(AwsS3AuthConfiguration configuration) {
+    public static ObjectStorageBlobsDAOBuilder.RequireBucketName 
daoBuilder(AwsS3AuthConfiguration configuration) {
         return ObjectStorageBlobsDAOBuilder.forBlobStore(new 
BlobStoreBuilder(configuration));
     }
 
-    public Optional<PutBlobFunction> putBlob(ContainerName containerName, 
AwsS3AuthConfiguration configuration) {
+    public Optional<PutBlobFunction> putBlob(BucketName bucketName, 
AwsS3AuthConfiguration configuration) {
         return Optional.of((blob) -> {
             File file = null;
             try {
                 file = File.createTempFile(UUID.randomUUID().toString(), 
".tmp");
                 FileUtils.copyToFile(blob.getPayload().openStream(), file);
-                putWithRetry(containerName, configuration, blob, file, 
FIRST_TRY);
+                putWithRetry(bucketName, configuration, blob, file, FIRST_TRY);
             } catch (IOException e) {
                 throw new RuntimeException(e);
             } finally {
@@ -110,21 +110,21 @@ public class AwsS3ObjectStorage {
         });
     }
 
-    private void putWithRetry(ContainerName containerName, 
AwsS3AuthConfiguration configuration, Blob blob, File file, int tried) {
+    private void putWithRetry(BucketName bucketName, AwsS3AuthConfiguration 
configuration, Blob blob, File file, int tried) {
         try {
-            put(containerName, configuration, blob, file);
+            put(bucketName, configuration, blob, file);
         } catch (RuntimeException e) {
             if (tried < MAX_RETRY_ON_EXCEPTION) {
-                putWithRetry(containerName, configuration, blob, file, tried + 
1);
+                putWithRetry(bucketName, configuration, blob, file, tried + 1);
             } else {
                 throw e;
             }
         }
     }
 
-    private void put(ContainerName containerName, AwsS3AuthConfiguration 
configuration, Blob blob, File file) {
+    private void put(BucketName bucketName, AwsS3AuthConfiguration 
configuration, Blob blob, File file) {
         try {
-            PutObjectRequest request = new 
PutObjectRequest(containerName.value(),
+            PutObjectRequest request = new 
PutObjectRequest(bucketName.asString(),
                 blob.getMetadata().getName(),
                 file);
 
diff --git 
a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/SwiftKeystone2ObjectStorage.java
 
b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/SwiftKeystone2ObjectStorage.java
index 7269aef..5756a29 100644
--- 
a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/SwiftKeystone2ObjectStorage.java
+++ 
b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/SwiftKeystone2ObjectStorage.java
@@ -43,7 +43,7 @@ public class SwiftKeystone2ObjectStorage {
     private static final Iterable<Module> JCLOUDS_MODULES =
         ImmutableSet.of(new SLF4JLoggingModule());
 
-    public static ObjectStorageBlobsDAOBuilder.RequireContainerName 
daoBuilder(Configuration testConfig) {
+    public static ObjectStorageBlobsDAOBuilder.RequireBucketName 
daoBuilder(Configuration testConfig) {
         return ObjectStorageBlobsDAOBuilder.forBlobStore(new 
BlobStoreBuilder(testConfig));
     }
 
diff --git 
a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/SwiftKeystone3ObjectStorage.java
 
b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/SwiftKeystone3ObjectStorage.java
index 276629e..c526a5d 100644
--- 
a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/SwiftKeystone3ObjectStorage.java
+++ 
b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/SwiftKeystone3ObjectStorage.java
@@ -45,7 +45,7 @@ public class SwiftKeystone3ObjectStorage {
     private static final Iterable<Module> JCLOUDS_MODULES =
         ImmutableSet.of(new SLF4JLoggingModule());
 
-    public static ObjectStorageBlobsDAOBuilder.RequireContainerName 
daoBuilder(Configuration testConfig) {
+    public static ObjectStorageBlobsDAOBuilder.RequireBucketName 
daoBuilder(Configuration testConfig) {
         return ObjectStorageBlobsDAOBuilder.forBlobStore(new 
BlobStoreBuilder(testConfig));
     }
 
diff --git 
a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/SwiftTempAuthObjectStorage.java
 
b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/SwiftTempAuthObjectStorage.java
index 747e983..e55ee34 100644
--- 
a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/SwiftTempAuthObjectStorage.java
+++ 
b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/swift/SwiftTempAuthObjectStorage.java
@@ -44,7 +44,7 @@ public class SwiftTempAuthObjectStorage {
     private static final Iterable<Module> JCLOUDS_MODULES =
         ImmutableSet.of(new SLF4JLoggingModule());
 
-    public static ObjectStorageBlobsDAOBuilder.RequireContainerName 
daoBuilder(Configuration testConfig) {
+    public static ObjectStorageBlobsDAOBuilder.RequireBucketName 
daoBuilder(Configuration testConfig) {
         return ObjectStorageBlobsDAOBuilder.forBlobStore(new 
BlobStoreBuilder(testConfig));
     }
 
diff --git 
a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ContainerNameTest.java
 
b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ContainerNameTest.java
deleted file mode 100644
index 2043537..0000000
--- 
a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ContainerNameTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/****************************************************************
- * Licensed to the Apache Software Foundation (ASF) under one   *
- * or more contributor license agreements.  See the NOTICE file *
- * distributed with this work for additional information        *
- * regarding copyright ownership.  The ASF licenses this file   *
- * to you under the Apache License, Version 2.0 (the            *
- * "License"); you may not use this file except in compliance   *
- * with the License.  You may obtain a copy of the License at   *
- *                                                              *
- *   http://www.apache.org/licenses/LICENSE-2.0                 *
- *                                                              *
- * Unless required by applicable law or agreed to in writing,   *
- * software distributed under the License is distributed on an  *
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
- * KIND, either express or implied.  See the License for the    *
- * specific language governing permissions and limitations      *
- * under the License.                                           *
- ****************************************************************/
-
-package org.apache.james.blob.objectstorage;
-
-import org.junit.jupiter.api.Test;
-
-import nl.jqno.equalsverifier.EqualsVerifier;
-
-class ContainerNameTest {
-    @Test
-    public void credentialsShouldRespectBeanContract() {
-        EqualsVerifier.forClass(ContainerName.class).verify();
-    }
-}
\ No newline at end of file
diff --git 
a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOContract.java
 
b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOContract.java
index 8f7e868..883416f 100644
--- 
a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOContract.java
+++ 
b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOContract.java
@@ -33,11 +33,11 @@ public interface ObjectStorageBlobsDAOContract {
 
     String CONTENT = "content";
 
-    ContainerName containerName();
+    BucketName bucketName();
 
     default void 
assertBlobsDAOCanStoreAndRetrieve(ObjectStorageBlobsDAOBuilder.ReadyToBuild 
builder) {
         ObjectStorageBlobsDAO dao = builder.build();
-        dao.createContainer(containerName()).block();
+        dao.createContainer(bucketName()).block();
 
         BlobId blobId = dao.save(BucketName.DEFAULT, CONTENT).block();
 
diff --git 
a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOTest.java
 
b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOTest.java
index 1164af5..674a340 100644
--- 
a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOTest.java
+++ 
b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOTest.java
@@ -68,7 +68,7 @@ public class ObjectStorageBlobsDAOTest implements 
MetricableBlobStoreContract {
         .password(PASSWORD.value().toCharArray())
         .build();
 
-    private ContainerName containerName;
+    private BucketName bucketName;
     private org.jclouds.blobstore.BlobStore blobStore;
     private SwiftTempAuthObjectStorage.Configuration testConfig;
     private ObjectStorageBlobsDAO objectStorageBlobsDAO;
@@ -76,7 +76,7 @@ public class ObjectStorageBlobsDAOTest implements 
MetricableBlobStoreContract {
 
     @BeforeEach
     void setUp(DockerSwift dockerSwift) {
-        containerName = ContainerName.of(UUID.randomUUID().toString());
+        bucketName = BucketName.of(UUID.randomUUID().toString());
         testConfig = SwiftTempAuthObjectStorage.configBuilder()
             .endpoint(dockerSwift.swiftEndpoint())
             .identity(SWIFT_IDENTITY)
@@ -87,17 +87,17 @@ public class ObjectStorageBlobsDAOTest implements 
MetricableBlobStoreContract {
         BlobId.Factory blobIdFactory = blobIdFactory();
         ObjectStorageBlobsDAOBuilder.ReadyToBuild daoBuilder = 
ObjectStorageBlobsDAO
             .builder(testConfig)
-            .container(containerName)
+            .container(bucketName)
             .blobIdFactory(blobIdFactory);
         blobStore = daoBuilder.getSupplier().get();
         objectStorageBlobsDAO = daoBuilder.build();
-        objectStorageBlobsDAO.createContainer(containerName).block();
+        objectStorageBlobsDAO.createContainer(bucketName).block();
         testee = new 
MetricableBlobStore(metricsTestExtension.getMetricFactory(), 
objectStorageBlobsDAO);
     }
 
     @AfterEach
     void tearDown() {
-        blobStore.deleteContainer(containerName.value());
+        blobStore.deleteContainer(bucketName.asString());
         blobStore.getContext().close();
     }
 
@@ -119,17 +119,17 @@ public class ObjectStorageBlobsDAOTest implements 
MetricableBlobStoreContract {
 
     @Test
     void createContainerShouldMakeTheContainerToExist() {
-        ContainerName containerName = 
ContainerName.of(UUID.randomUUID().toString());
-        objectStorageBlobsDAO.createContainer(containerName).block();
-        assertThat(blobStore.containerExists(containerName.value())).isTrue();
+        BucketName bucketName = BucketName.of(UUID.randomUUID().toString());
+        objectStorageBlobsDAO.createContainer(bucketName).block();
+        assertThat(blobStore.containerExists(bucketName.asString())).isTrue();
     }
 
     @Test
     void 
createContainerShouldNotFailWithRuntimeExceptionWhenCreateContainerTwice() {
-        ContainerName containerName = 
ContainerName.of(UUID.randomUUID().toString());
+        BucketName bucketName = BucketName.of(UUID.randomUUID().toString());
 
-        objectStorageBlobsDAO.createContainer(containerName).block();
-        assertThatCode(() -> 
objectStorageBlobsDAO.createContainer(containerName).block())
+        objectStorageBlobsDAO.createContainer(bucketName).block();
+        assertThatCode(() -> 
objectStorageBlobsDAO.createContainer(bucketName).block())
             .doesNotThrowAnyException();
     }
 
@@ -137,7 +137,7 @@ public class ObjectStorageBlobsDAOTest implements 
MetricableBlobStoreContract {
     void supportsEncryptionWithCustomPayloadCodec() throws IOException {
         ObjectStorageBlobsDAO encryptedDao = ObjectStorageBlobsDAO
             .builder(testConfig)
-            .container(containerName)
+            .container(bucketName)
             .blobIdFactory(blobIdFactory())
             .payloadCodec(new AESPayloadCodec(CRYPTO_CONFIG))
             .build();
@@ -153,7 +153,7 @@ public class ObjectStorageBlobsDAOTest implements 
MetricableBlobStoreContract {
     void encryptionWithCustomPayloadCodeCannotBeReadFromUnencryptedDAO() 
throws Exception {
         ObjectStorageBlobsDAO encryptedDao = ObjectStorageBlobsDAO
             .builder(testConfig)
-            .container(containerName)
+            .container(bucketName)
             .blobIdFactory(blobIdFactory())
             .payloadCodec(new AESPayloadCodec(CRYPTO_CONFIG))
             .build();
@@ -173,7 +173,7 @@ public class ObjectStorageBlobsDAOTest implements 
MetricableBlobStoreContract {
     @Test
     void deleteContainerShouldDeleteSwiftContainer() {
         objectStorageBlobsDAO.deleteContainer();
-        assertThat(blobStore.containerExists(containerName.value()))
+        assertThat(blobStore.containerExists(bucketName.asString()))
             .isFalse();
     }
 
diff --git 
a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/aws/AwsS3ObjectStorageBlobsDAOBuilderTest.java
 
b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/aws/AwsS3ObjectStorageBlobsDAOBuilderTest.java
index 3e71477..efd784d 100644
--- 
a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/aws/AwsS3ObjectStorageBlobsDAOBuilderTest.java
+++ 
b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/aws/AwsS3ObjectStorageBlobsDAOBuilderTest.java
@@ -23,8 +23,8 @@ import static 
org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import java.util.UUID;
 
+import org.apache.james.blob.api.BucketName;
 import org.apache.james.blob.api.HashBlobId;
-import org.apache.james.blob.objectstorage.ContainerName;
 import org.apache.james.blob.objectstorage.ObjectStorageBlobsDAO;
 import org.apache.james.blob.objectstorage.ObjectStorageBlobsDAOBuilder;
 import org.apache.james.blob.objectstorage.ObjectStorageBlobsDAOContract;
@@ -36,14 +36,14 @@ import org.junit.jupiter.api.extension.ExtendWith;
 @ExtendWith(DockerAwsS3Extension.class)
 class AwsS3ObjectStorageBlobsDAOBuilderTest implements 
ObjectStorageBlobsDAOContract {
 
-    private ContainerName containerName;
+    private BucketName bucketName;
     private AwsS3AuthConfiguration configuration;
     private AwsS3ObjectStorage awsS3ObjectStorage;
 
     @BeforeEach
     void setUp(DockerAwsS3Container dockerAwsS3Container) {
         awsS3ObjectStorage = new AwsS3ObjectStorage();
-        containerName = ContainerName.of(UUID.randomUUID().toString());
+        bucketName = BucketName.of(UUID.randomUUID().toString());
         configuration = AwsS3AuthConfiguration.builder()
             .endpoint(dockerAwsS3Container.getEndpoint())
             .accessKeyId(DockerAwsS3Container.ACCESS_KEY_ID)
@@ -57,12 +57,12 @@ class AwsS3ObjectStorageBlobsDAOBuilderTest implements 
ObjectStorageBlobsDAOCont
     }
 
     @Override
-    public ContainerName containerName() {
-        return containerName;
+    public BucketName bucketName() {
+        return bucketName;
     }
 
     @Test
-    void containerNameIsMandatoryToBuildBlobsDAO() {
+    void bucketNameIsMandatoryToBuildBlobsDAO() {
         ObjectStorageBlobsDAOBuilder.ReadyToBuild builder = 
ObjectStorageBlobsDAO
             .builder(configuration)
             .container(null)
@@ -75,7 +75,7 @@ class AwsS3ObjectStorageBlobsDAOBuilderTest implements 
ObjectStorageBlobsDAOCont
     void blobIdFactoryIsMandatoryToBuildBlobsDAO() {
         ObjectStorageBlobsDAOBuilder.ReadyToBuild builder = 
ObjectStorageBlobsDAO
             .builder(configuration)
-            .container(containerName)
+            .container(bucketName)
             .blobIdFactory(null);
 
         
assertThatThrownBy(builder::build).isInstanceOf(IllegalStateException.class);
@@ -85,9 +85,9 @@ class AwsS3ObjectStorageBlobsDAOBuilderTest implements 
ObjectStorageBlobsDAOCont
     void builtBlobsDAOCanStoreAndRetrieve() {
         ObjectStorageBlobsDAOBuilder.ReadyToBuild builder = 
ObjectStorageBlobsDAO
             .builder(configuration)
-            .container(containerName)
+            .container(bucketName)
             .blobIdFactory(new HashBlobId.Factory())
-            .putBlob(awsS3ObjectStorage.putBlob(containerName, configuration));
+            .putBlob(awsS3ObjectStorage.putBlob(bucketName, configuration));
 
         assertBlobsDAOCanStoreAndRetrieve(builder);
     }
diff --git 
a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/SwiftKeystone2ObjectStorageBlobsDAOBuilderTest.java
 
b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/SwiftKeystone2ObjectStorageBlobsDAOBuilderTest.java
index 0be2cb1..b807a59 100644
--- 
a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/SwiftKeystone2ObjectStorageBlobsDAOBuilderTest.java
+++ 
b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/SwiftKeystone2ObjectStorageBlobsDAOBuilderTest.java
@@ -24,8 +24,8 @@ import static 
org.assertj.core.api.Assertions.assertThatThrownBy;
 import java.net.URI;
 import java.util.UUID;
 
+import org.apache.james.blob.api.BucketName;
 import org.apache.james.blob.api.HashBlobId;
-import org.apache.james.blob.objectstorage.ContainerName;
 import org.apache.james.blob.objectstorage.DockerSwift;
 import org.apache.james.blob.objectstorage.DockerSwiftExtension;
 import org.apache.james.blob.objectstorage.ObjectStorageBlobsDAO;
@@ -42,13 +42,13 @@ class SwiftKeystone2ObjectStorageBlobsDAOBuilderTest 
implements ObjectStorageBlo
     private static final UserName USER_NAME = UserName.of("demo");
     private static final Credentials PASSWORD = Credentials.of("demo");
     private static final Identity SWIFT_IDENTITY = Identity.of(TENANT_NAME, 
USER_NAME);
-    private ContainerName containerName;
+    private BucketName bucketName;
     private URI endpoint;
     private SwiftKeystone2ObjectStorage.Configuration testConfig;
 
     @BeforeEach
     void setUp(DockerSwift dockerSwift) {
-        containerName = ContainerName.of(UUID.randomUUID().toString());
+        bucketName = BucketName.of(UUID.randomUUID().toString());
         endpoint = dockerSwift.keystoneV2Endpoint();
         testConfig = SwiftKeystone2ObjectStorage.configBuilder()
             .endpoint(endpoint)
@@ -58,12 +58,12 @@ class SwiftKeystone2ObjectStorageBlobsDAOBuilderTest 
implements ObjectStorageBlo
     }
 
     @Override
-    public ContainerName containerName() {
-        return containerName;
+    public BucketName bucketName() {
+        return bucketName;
     }
 
     @Test
-    void containerNameIsMandatoryToBuildBlobsDAO() {
+    void bucketNameIsMandatoryToBuildBlobsDAO() {
         ObjectStorageBlobsDAOBuilder.ReadyToBuild builder = 
ObjectStorageBlobsDAO
             .builder(testConfig)
             .container(null)
@@ -76,7 +76,7 @@ class SwiftKeystone2ObjectStorageBlobsDAOBuilderTest 
implements ObjectStorageBlo
     void blobIdFactoryIsMandatoryToBuildBlobsDAO() {
         ObjectStorageBlobsDAOBuilder.ReadyToBuild builder = 
ObjectStorageBlobsDAO
             .builder(testConfig)
-            .container(containerName)
+            .container(bucketName)
             .blobIdFactory(null);
 
         
assertThatThrownBy(builder::build).isInstanceOf(IllegalStateException.class);
@@ -86,7 +86,7 @@ class SwiftKeystone2ObjectStorageBlobsDAOBuilderTest 
implements ObjectStorageBlo
     void builtBlobsDAOCanStoreAndRetrieve() {
         ObjectStorageBlobsDAOBuilder.ReadyToBuild builder = 
ObjectStorageBlobsDAO
             .builder(testConfig)
-            .container(containerName)
+            .container(bucketName)
             .blobIdFactory(new HashBlobId.Factory());
 
         assertBlobsDAOCanStoreAndRetrieve(builder);
diff --git 
a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/SwiftKeystone3ObjectStorageBlobsDAOBuilderTest.java
 
b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/SwiftKeystone3ObjectStorageBlobsDAOBuilderTest.java
index 35f85dc..d9e0576 100644
--- 
a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/SwiftKeystone3ObjectStorageBlobsDAOBuilderTest.java
+++ 
b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/SwiftKeystone3ObjectStorageBlobsDAOBuilderTest.java
@@ -25,8 +25,8 @@ import java.util.HashMap;
 import java.util.Map;
 import java.util.UUID;
 
+import org.apache.james.blob.api.BucketName;
 import org.apache.james.blob.api.HashBlobId;
-import org.apache.james.blob.objectstorage.ContainerName;
 import org.apache.james.blob.objectstorage.DockerSwift;
 import org.apache.james.blob.objectstorage.DockerSwiftExtension;
 import org.apache.james.blob.objectstorage.ObjectStorageBlobsDAO;
@@ -69,7 +69,7 @@ class SwiftKeystone3ObjectStorageBlobsDAOBuilderTest 
implements ObjectStorageBlo
             .credentials(DEMO_PASSWORD)
             .project(Project.of(PROJECT_NAME, DOMAIN_ID));
 
-    private ContainerName containerName;
+    private BucketName bucketName;
 
     private SwiftKeystone3ObjectStorage.Configuration testConfig;
     private DockerSwift dockerSwift;
@@ -78,7 +78,7 @@ class SwiftKeystone3ObjectStorageBlobsDAOBuilderTest 
implements ObjectStorageBlo
     @BeforeEach
     void setUp(DockerSwift dockerSwift) {
         this.dockerSwift = dockerSwift;
-        containerName = ContainerName.of(UUID.randomUUID().toString());
+        bucketName = BucketName.of(UUID.randomUUID().toString());
         testConfig = PROJECT_CONFIG
             .endpoint(dockerSwift.keystoneV3Endpoint())
             .build();
@@ -91,12 +91,12 @@ class SwiftKeystone3ObjectStorageBlobsDAOBuilderTest 
implements ObjectStorageBlo
     }
 
     @Override
-    public ContainerName containerName() {
-        return containerName;
+    public BucketName bucketName() {
+        return bucketName;
     }
 
     @Test
-    void containerNameIsMandatoryToBuildBlobsDAO() {
+    void bucketNameIsMandatoryToBuildBlobsDAO() {
         ObjectStorageBlobsDAOBuilder.ReadyToBuild builder = 
ObjectStorageBlobsDAO
             .builder(testConfig)
             .container(null)
@@ -109,7 +109,7 @@ class SwiftKeystone3ObjectStorageBlobsDAOBuilderTest 
implements ObjectStorageBlo
     void blobIdFactoryIsMandatoryToBuildBlobsDAO() {
         ObjectStorageBlobsDAOBuilder.ReadyToBuild builder = 
ObjectStorageBlobsDAO
             .builder(testConfig)
-            .container(containerName)
+            .container(bucketName)
             .blobIdFactory(null);
 
         
assertThatThrownBy(builder::build).isInstanceOf(IllegalStateException.class);
@@ -122,7 +122,7 @@ class SwiftKeystone3ObjectStorageBlobsDAOBuilderTest 
implements ObjectStorageBlo
             
configBuilders.get(key).endpoint(dockerSwift.keystoneV3Endpoint()).build();
         ObjectStorageBlobsDAOBuilder.ReadyToBuild builder = 
ObjectStorageBlobsDAO
             .builder(config)
-            .container(containerName)
+            .container(bucketName)
             .blobIdFactory(new HashBlobId.Factory());
 
         assertBlobsDAOCanStoreAndRetrieve(builder);
diff --git 
a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/SwiftTempAuthObjectStorageBlobsDAOBuilderTest.java
 
b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/SwiftTempAuthObjectStorageBlobsDAOBuilderTest.java
index 09619ed..662211b 100644
--- 
a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/SwiftTempAuthObjectStorageBlobsDAOBuilderTest.java
+++ 
b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/swift/SwiftTempAuthObjectStorageBlobsDAOBuilderTest.java
@@ -24,8 +24,8 @@ import static 
org.assertj.core.api.Assertions.assertThatThrownBy;
 import java.net.URI;
 import java.util.UUID;
 
+import org.apache.james.blob.api.BucketName;
 import org.apache.james.blob.api.HashBlobId;
-import org.apache.james.blob.objectstorage.ContainerName;
 import org.apache.james.blob.objectstorage.DockerSwift;
 import org.apache.james.blob.objectstorage.DockerSwiftExtension;
 import org.apache.james.blob.objectstorage.ObjectStorageBlobsDAO;
@@ -42,13 +42,13 @@ class SwiftTempAuthObjectStorageBlobsDAOBuilderTest 
implements ObjectStorageBlob
     private static final UserName USER_NAME = UserName.of("tester");
     private static final Credentials PASSWORD = Credentials.of("testing");
     private static final Identity SWIFT_IDENTITY = Identity.of(TENANT_NAME, 
USER_NAME);
-    private ContainerName containerName;
+    private BucketName bucketName;
     private URI endpoint;
     private SwiftTempAuthObjectStorage.Configuration testConfig;
 
     @BeforeEach
     void setUp(DockerSwift dockerSwift) {
-        containerName = ContainerName.of(UUID.randomUUID().toString());
+        bucketName = BucketName.of(UUID.randomUUID().toString());
         endpoint = dockerSwift.swiftEndpoint();
         testConfig = SwiftTempAuthObjectStorage.configBuilder()
             .endpoint(endpoint)
@@ -60,12 +60,12 @@ class SwiftTempAuthObjectStorageBlobsDAOBuilderTest 
implements ObjectStorageBlob
     }
 
     @Override
-    public ContainerName containerName() {
-        return containerName;
+    public BucketName bucketName() {
+        return bucketName;
     }
 
     @Test
-    void containerNameIsMandatoryToBuildBlobsDAO() {
+    void bucketNameIsMandatoryToBuildBlobsDAO() {
         ObjectStorageBlobsDAOBuilder.ReadyToBuild builder = 
ObjectStorageBlobsDAO
             .builder(testConfig)
             .container(null)
@@ -78,7 +78,7 @@ class SwiftTempAuthObjectStorageBlobsDAOBuilderTest 
implements ObjectStorageBlob
     void blobIdFactoryIsMandatoryToBuildBlobsDAO() {
         ObjectStorageBlobsDAOBuilder.ReadyToBuild builder = 
ObjectStorageBlobsDAO
             .builder(testConfig)
-            .container(containerName)
+            .container(bucketName)
             .blobIdFactory(null);
 
         
assertThatThrownBy(builder::build).isInstanceOf(IllegalStateException.class);
@@ -88,7 +88,7 @@ class SwiftTempAuthObjectStorageBlobsDAOBuilderTest 
implements ObjectStorageBlob
     void builtBlobsDAOCanStoreAndRetrieve() {
         ObjectStorageBlobsDAOBuilder.ReadyToBuild builder = 
ObjectStorageBlobsDAO
             .builder(testConfig)
-            .container(containerName)
+            .container(bucketName)
             .blobIdFactory(new HashBlobId.Factory());
 
         assertBlobsDAOCanStoreAndRetrieve(builder);


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to