You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by bt...@apache.org on 2019/07/08 15:59:36 UTC

[james-project] branch master updated (92da31b -> c6666eb)

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

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


    from 92da31b  JAMES-2815 Store directly small blobs in ObjectStore
     new 6f984a1  JAMES-2806 Upgrade Jcloud version
     new 542b4cb  JAMES-2806 ObjectStorage Swift save retry save() on non existing bucket
     new b5fb2f7  JAMES-2806 ObjectStorage S3 retry save() on non existing bucket
     new 126320b  JAMES-2806 ObjectStorageBlobDAO no need to create bucket explicitly
     new 95456ef  JAMES-2806 ObjectStorage Swift should retry when saving empty blob
     new 2232634  JAMES-2806 ObjectStorage Swift retry one more time when fails to save
     new c6666eb  JAMES-2806 use fixed bucket name in tests

The 7 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 server/blob/blob-objectstorage/pom.xml             |  6 +-
 .../blob/objectstorage/ObjectStorageBlobsDAO.java  |  7 --
 .../objectstorage/StreamCompatibleBlobPutter.java  | 65 +++++++++++++++-
 .../blob/objectstorage/aws/AwsS3ObjectStorage.java | 72 +++++++++++-------
 .../ObjectStorageBlobsDAOAWSTest.java              | 87 ++++++++++++++++++++++
 .../ObjectStorageBlobsDAOContract.java             |  1 -
 .../objectstorage/ObjectStorageBlobsDAOTest.java   | 33 ++------
 .../aws/AwsS3ObjectStorageBlobsDAOBuilderTest.java |  4 +-
 ...tKeystone2ObjectStorageBlobsDAOBuilderTest.java |  3 +-
 ...tKeystone3ObjectStorageBlobsDAOBuilderTest.java |  3 +-
 ...ftTempAuthObjectStorageBlobsDAOBuilderTest.java |  3 +-
 .../ObjectStorageDependenciesModule.java           |  2 -
 .../swift/ObjectStorageBlobStoreModuleTest.java    |  4 -
 13 files changed, 211 insertions(+), 79 deletions(-)
 create mode 100644 server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOAWSTest.java


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[james-project] 04/07: JAMES-2806 ObjectStorageBlobDAO no need to create bucket explicitly

Posted by bt...@apache.org.
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 126320bbb2db3836a6700905b9f3e2deb1c95bf6
Author: Tran Tien Duc <dt...@linagora.com>
AuthorDate: Fri Jul 5 12:59:51 2019 +0700

    JAMES-2806 ObjectStorageBlobDAO no need to create bucket explicitly
---
 .../blob/objectstorage/ObjectStorageBlobsDAO.java      |  7 -------
 .../objectstorage/ObjectStorageBlobsDAOAWSTest.java    |  1 -
 .../objectstorage/ObjectStorageBlobsDAOContract.java   |  1 -
 .../blob/objectstorage/ObjectStorageBlobsDAOTest.java  | 18 ------------------
 .../objectstorage/ObjectStorageDependenciesModule.java |  2 --
 .../swift/ObjectStorageBlobStoreModuleTest.java        |  4 ----
 6 files changed, 33 deletions(-)

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 94f63fe..3a0bf83 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
@@ -86,13 +86,6 @@ public class ObjectStorageBlobsDAO implements BlobStore {
         return AwsS3ObjectStorage.daoBuilder(testConfig);
     }
 
-    public Mono<BucketName> createBucket(BucketName name) {
-        return Mono.fromCallable(() -> blobStore.createContainerInLocation(DEFAULT_LOCATION, name.asString()))
-            .filter(created -> created == false)
-            .doOnNext(ignored -> LOGGER.debug("{} already existed", name))
-            .thenReturn(name);
-    }
-
     @Override
     public Mono<BlobId> save(BucketName bucketName, byte[] data) {
         Preconditions.checkNotNull(data);
diff --git a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOAWSTest.java b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOAWSTest.java
index 716ff23..b9f101b 100644
--- a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOAWSTest.java
+++ b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOAWSTest.java
@@ -66,7 +66,6 @@ public class ObjectStorageBlobsDAOAWSTest implements MetricableBlobStoreContract
 
         blobStore = builder.getSupplier().get();
         objectStorageBlobsDAO = builder.build();
-        objectStorageBlobsDAO.createBucket(defaultBucketName).block();
         testee = new MetricableBlobStore(metricsTestExtension.getMetricFactory(), objectStorageBlobsDAO);
     }
 
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 f25393a..92bf2f8 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
@@ -37,7 +37,6 @@ public interface ObjectStorageBlobsDAOContract {
 
     default void assertBlobsDAOCanStoreAndRetrieve(ObjectStorageBlobsDAOBuilder.ReadyToBuild builder) {
         ObjectStorageBlobsDAO dao = builder.build();
-        dao.createBucket(dao.getDefaultBucketName()).block();
 
         BlobId blobId = dao.save(dao.getDefaultBucketName(), 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 a6321f7..9423ee8 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
@@ -20,7 +20,6 @@
 package org.apache.james.blob.objectstorage;
 
 import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.assertThatCode;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
@@ -92,7 +91,6 @@ public class ObjectStorageBlobsDAOTest implements MetricableBlobStoreContract, B
             .blobIdFactory(blobIdFactory);
         blobStore = daoBuilder.getSupplier().get();
         objectStorageBlobsDAO = daoBuilder.build();
-        objectStorageBlobsDAO.createBucket(defaultBucketName).block();
         testee = new MetricableBlobStore(metricsTestExtension.getMetricFactory(), objectStorageBlobsDAO);
     }
 
@@ -114,22 +112,6 @@ public class ObjectStorageBlobsDAOTest implements MetricableBlobStoreContract, B
     }
 
     @Test
-    void createBucketShouldMakeTheContainerToExist() {
-        BucketName bucketName = BucketName.of(UUID.randomUUID().toString());
-        objectStorageBlobsDAO.createBucket(bucketName).block();
-        assertThat(blobStore.containerExists(bucketName.asString())).isTrue();
-    }
-
-    @Test
-    void createBucketShouldNotFailWithRuntimeExceptionWhenCreateBucketTwice() {
-        BucketName bucketName = BucketName.of(UUID.randomUUID().toString());
-
-        objectStorageBlobsDAO.createBucket(bucketName).block();
-        assertThatCode(() -> objectStorageBlobsDAO.createBucket(bucketName).block())
-            .doesNotThrowAnyException();
-    }
-
-    @Test
     void supportsEncryptionWithCustomPayloadCodec() throws IOException {
         ObjectStorageBlobsDAO encryptedDao = ObjectStorageBlobsDAO
             .builder(testConfig)
diff --git a/server/container/guice/blob-objectstorage-guice/src/main/java/org/apache/james/modules/objectstorage/ObjectStorageDependenciesModule.java b/server/container/guice/blob-objectstorage-guice/src/main/java/org/apache/james/modules/objectstorage/ObjectStorageDependenciesModule.java
index fc7675b..7d92bcd 100644
--- a/server/container/guice/blob-objectstorage-guice/src/main/java/org/apache/james/modules/objectstorage/ObjectStorageDependenciesModule.java
+++ b/server/container/guice/blob-objectstorage-guice/src/main/java/org/apache/james/modules/objectstorage/ObjectStorageDependenciesModule.java
@@ -20,7 +20,6 @@
 package org.apache.james.modules.objectstorage;
 
 import java.io.FileNotFoundException;
-import java.time.Duration;
 import java.util.Optional;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.TimeoutException;
@@ -72,7 +71,6 @@ public class ObjectStorageDependenciesModule extends AbstractModule {
             .payloadCodec(configuration.getPayloadCodec())
             .blobPutter(putBlob(blobIdFactory, configuration, awsS3ObjectStorageProvider))
             .build();
-        dao.createBucket(dao.getDefaultBucketName()).block(Duration.ofMinutes(1));
         return dao;
     }
 
diff --git a/server/container/guice/blob-objectstorage-guice/src/test/java/org/apache/james/modules/objectstorage/swift/ObjectStorageBlobStoreModuleTest.java b/server/container/guice/blob-objectstorage-guice/src/test/java/org/apache/james/modules/objectstorage/swift/ObjectStorageBlobStoreModuleTest.java
index 8858216..7911d16 100644
--- a/server/container/guice/blob-objectstorage-guice/src/test/java/org/apache/james/modules/objectstorage/swift/ObjectStorageBlobStoreModuleTest.java
+++ b/server/container/guice/blob-objectstorage-guice/src/test/java/org/apache/james/modules/objectstorage/swift/ObjectStorageBlobStoreModuleTest.java
@@ -30,7 +30,6 @@ import org.apache.james.blob.api.BucketName;
 import org.apache.james.blob.api.MetricableBlobStore;
 import org.apache.james.blob.objectstorage.DockerSwift;
 import org.apache.james.blob.objectstorage.DockerSwiftExtension;
-import org.apache.james.blob.objectstorage.ObjectStorageBlobsDAO;
 import org.apache.james.blob.objectstorage.swift.Credentials;
 import org.apache.james.blob.objectstorage.swift.DomainName;
 import org.apache.james.blob.objectstorage.swift.IdentityV3;
@@ -136,9 +135,6 @@ class ObjectStorageBlobStoreModuleTest {
                 .override(new ObjectStorageBlobStoreModule())
                 .with(binder -> binder.bind(ObjectStorageBlobConfiguration.class).toInstance(configuration)));
 
-        ObjectStorageBlobsDAO dao = injector.getInstance(ObjectStorageBlobsDAO.class);
-        dao.createBucket(dao.getDefaultBucketName()).block();
-
         BlobStore blobStore = injector.getInstance(Key.get(BlobStore.class, Names.named(MetricableBlobStore.BLOB_STORE_IMPLEMENTATION)));
 
         assertThatCode(() -> blobStore.save(blobStore.getDefaultBucketName(), new byte[] {0x00})).doesNotThrowAnyException();


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[james-project] 03/07: JAMES-2806 ObjectStorage S3 retry save() on non existing bucket

Posted by bt...@apache.org.
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 b5fb2f7174e177944336953afa4fb9e09f615c3e
Author: Tran Tien Duc <dt...@linagora.com>
AuthorDate: Thu Jul 4 17:09:51 2019 +0700

    JAMES-2806 ObjectStorage S3 retry save() on non existing bucket
---
 .../blob/objectstorage/aws/AwsS3ObjectStorage.java | 72 +++++++++++------
 .../ObjectStorageBlobsDAOAWSTest.java              | 90 ++++++++++++++++++++++
 2 files changed, 137 insertions(+), 25 deletions(-)

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 1b52c85..4884dd5 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
@@ -21,6 +21,7 @@ package org.apache.james.blob.objectstorage.aws;
 
 import java.io.File;
 import java.io.IOException;
+import java.time.Duration;
 import java.util.Optional;
 import java.util.Properties;
 import java.util.UUID;
@@ -45,7 +46,6 @@ import org.jclouds.blobstore.BlobStoreContext;
 import org.jclouds.blobstore.domain.Blob;
 import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
 
-import com.amazonaws.AmazonClientException;
 import com.amazonaws.ClientConfiguration;
 import com.amazonaws.auth.AWSStaticCredentialsProvider;
 import com.amazonaws.auth.BasicAWSCredentials;
@@ -53,13 +53,19 @@ import com.amazonaws.client.builder.AwsClientBuilder;
 import com.amazonaws.retry.PredefinedRetryPolicies;
 import com.amazonaws.services.s3.AmazonS3;
 import com.amazonaws.services.s3.AmazonS3ClientBuilder;
+import com.amazonaws.services.s3.model.AmazonS3Exception;
 import com.amazonaws.services.s3.model.PutObjectRequest;
 import com.amazonaws.services.s3.transfer.TransferManager;
 import com.amazonaws.services.s3.transfer.TransferManagerBuilder;
+import com.github.fge.lambdas.Throwing;
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.ImmutableSet;
 import com.google.inject.Module;
 
+import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
+import reactor.retry.Retry;
+
 public class AwsS3ObjectStorage {
 
     private static final Iterable<Module> JCLOUDS_MODULES = ImmutableSet.of(new SLF4JLoggingModule());
@@ -82,7 +88,7 @@ public class AwsS3ObjectStorage {
 
     @Inject
     @VisibleForTesting
-    AwsS3ObjectStorage() {
+    public AwsS3ObjectStorage() {
         executorService = Executors.newFixedThreadPool(MAX_THREADS, NamedThreadFactory.withClassName(AwsS3ObjectStorage.class));
     }
 
@@ -125,6 +131,12 @@ public class AwsS3ObjectStorage {
     }
 
     private static class AwsS3BlobPutter implements BlobPutter {
+
+        private static final int NOT_FOUND_STATUS_CODE = 404;
+        private static final String BUCKET_NOT_FOUND_ERROR_CODE = "NoSuchBucket";
+        private static final Duration FIRST_BACK_OFF = Duration.ofMillis(100);
+        private static final Duration FOREVER = Duration.ofMillis(Long.MAX_VALUE);
+
         private final AwsS3AuthConfiguration configuration;
         private final ExecutorService executorService;
 
@@ -135,14 +147,14 @@ public class AwsS3ObjectStorage {
 
         @Override
         public void putDirectly(BucketName bucketName, Blob blob) {
-            writeFileAndAct(blob, (file) -> putWithRetry(bucketName, configuration, blob, file, FIRST_TRY));
+            writeFileAndAct(blob, (file) -> putWithRetry(bucketName, configuration, blob, file, FIRST_TRY).block());
         }
 
         @Override
         public BlobId putAndComputeId(BucketName bucketName, Blob initialBlob, Supplier<BlobId> blobIdSupplier) {
             Consumer<File> putChangedBlob = (file) -> {
                 initialBlob.getMetadata().setName(blobIdSupplier.get().asString());
-                putWithRetry(bucketName, configuration, initialBlob, file, FIRST_TRY);
+                putWithRetry(bucketName, configuration, initialBlob, file, FIRST_TRY).block();
             };
             writeFileAndAct(initialBlob, putChangedBlob);
             return blobIdSupplier.get();
@@ -163,30 +175,40 @@ public class AwsS3ObjectStorage {
             }
         }
 
-        private void putWithRetry(BucketName bucketName, AwsS3AuthConfiguration configuration, Blob blob, File file, int tried) {
-            try {
-                put(bucketName, configuration, blob, file);
-            } catch (RuntimeException e) {
-                if (tried < MAX_RETRY_ON_EXCEPTION) {
-                    putWithRetry(bucketName, configuration, blob, file, tried + 1);
-                } else {
-                    throw e;
-                }
-            }
+        private Mono<Void> putWithRetry(BucketName bucketName, AwsS3AuthConfiguration configuration, Blob blob, File file, int tried) {
+            return Mono.<Void>fromRunnable(Throwing.runnable(() -> put(bucketName, configuration, blob, file)).sneakyThrow())
+                .publishOn(Schedulers.elastic())
+                .retryWhen(Retry
+                    .<Void>onlyIf(retryContext -> needToCreateBucket(retryContext.exception()))
+                    .exponentialBackoff(FIRST_BACK_OFF, FOREVER)
+                    .withBackoffScheduler(Schedulers.elastic())
+                    .retryMax(MAX_RETRY_ON_EXCEPTION)
+                    .doOnRetry(retryContext -> createBucket(bucketName, configuration)));
         }
 
-        private void put(BucketName bucketName, AwsS3AuthConfiguration configuration, Blob blob, File file) {
-            try {
-                PutObjectRequest request = new PutObjectRequest(bucketName.asString(),
-                        blob.getMetadata().getName(),
-                        file);
-
-                getTransferManager(configuration)
-                        .upload(request)
-                        .waitForUploadResult();
-            } catch (AmazonClientException | InterruptedException e) {
-                throw new RuntimeException(e);
+        private void put(BucketName bucketName, AwsS3AuthConfiguration configuration, Blob blob, File file) throws InterruptedException {
+            PutObjectRequest request = new PutObjectRequest(bucketName.asString(),
+                blob.getMetadata().getName(),
+                file);
+
+            getTransferManager(configuration)
+                .upload(request)
+                .waitForUploadResult();
+        }
+
+        private void createBucket(BucketName bucketName, AwsS3AuthConfiguration configuration) {
+            getS3Client(configuration, getClientConfiguration())
+                .createBucket(bucketName.asString());
+        }
+
+        private boolean needToCreateBucket(Throwable th) {
+            if (th instanceof AmazonS3Exception) {
+                AmazonS3Exception s3Exception = (AmazonS3Exception) th;
+                return NOT_FOUND_STATUS_CODE == s3Exception.getStatusCode()
+                    && BUCKET_NOT_FOUND_ERROR_CODE.equals(s3Exception.getErrorCode());
             }
+
+            return false;
         }
 
         private TransferManager getTransferManager(AwsS3AuthConfiguration configuration) {
diff --git a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOAWSTest.java b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOAWSTest.java
new file mode 100644
index 0000000..716ff23
--- /dev/null
+++ b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOAWSTest.java
@@ -0,0 +1,90 @@
+/****************************************************************
+ * 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 java.util.UUID;
+
+import org.apache.james.blob.api.BlobId;
+import org.apache.james.blob.api.BlobStore;
+import org.apache.james.blob.api.BucketBlobStoreContract;
+import org.apache.james.blob.api.BucketName;
+import org.apache.james.blob.api.HashBlobId;
+import org.apache.james.blob.api.MetricableBlobStore;
+import org.apache.james.blob.api.MetricableBlobStoreContract;
+import org.apache.james.blob.objectstorage.aws.AwsS3AuthConfiguration;
+import org.apache.james.blob.objectstorage.aws.AwsS3ObjectStorage;
+import org.apache.james.blob.objectstorage.aws.DockerAwsS3Container;
+import org.apache.james.blob.objectstorage.aws.DockerAwsS3Extension;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+@ExtendWith(DockerAwsS3Extension.class)
+public class ObjectStorageBlobsDAOAWSTest implements MetricableBlobStoreContract, BucketBlobStoreContract {
+
+    private static final HashBlobId.Factory BLOB_ID_FACTORY = new HashBlobId.Factory();
+
+    private BucketName defaultBucketName;
+    private org.jclouds.blobstore.BlobStore blobStore;
+    private ObjectStorageBlobsDAO objectStorageBlobsDAO;
+    private AwsS3ObjectStorage awsS3ObjectStorage;
+    private AwsS3AuthConfiguration configuration;
+    private BlobStore testee;
+
+    @BeforeEach
+    void setUp(DockerAwsS3Container dockerAwsS3) {
+        awsS3ObjectStorage = new AwsS3ObjectStorage();
+        defaultBucketName = BucketName.of(UUID.randomUUID().toString());
+        configuration = AwsS3AuthConfiguration.builder()
+            .endpoint(dockerAwsS3.getEndpoint())
+            .accessKeyId(DockerAwsS3Container.ACCESS_KEY_ID)
+            .secretKey(DockerAwsS3Container.SECRET_ACCESS_KEY)
+            .build();
+
+        ObjectStorageBlobsDAOBuilder.ReadyToBuild builder = ObjectStorageBlobsDAO
+            .builder(configuration)
+            .defaultBucketName(defaultBucketName)
+            .blobIdFactory(BLOB_ID_FACTORY)
+            .blobPutter(awsS3ObjectStorage.putBlob(configuration));
+
+        blobStore = builder.getSupplier().get();
+        objectStorageBlobsDAO = builder.build();
+        objectStorageBlobsDAO.createBucket(defaultBucketName).block();
+        testee = new MetricableBlobStore(metricsTestExtension.getMetricFactory(), objectStorageBlobsDAO);
+    }
+
+    @AfterEach
+    void tearDown() {
+        blobStore.deleteContainer(defaultBucketName.asString());
+        blobStore.deleteContainer(CUSTOM.asString());
+        blobStore.getContext().close();
+        awsS3ObjectStorage.tearDown();
+    }
+
+    @Override
+    public BlobStore testee() {
+        return testee;
+    }
+
+    @Override
+    public BlobId.Factory blobIdFactory() {
+        return BLOB_ID_FACTORY;
+    }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[james-project] 05/07: JAMES-2806 ObjectStorage Swift should retry when saving empty blob

Posted by bt...@apache.org.
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 95456efc99f2b4e3ac737ed71aa698dbd8a6b8bb
Author: Tran Tien Duc <dt...@linagora.com>
AuthorDate: Fri Jul 5 17:16:57 2019 +0700

    JAMES-2806 ObjectStorage Swift should retry when saving empty blob
    
    The KeyNotFound exception thrown when saving empty blob in non existing
    bucket, we need to catch it also with the HttpResponseException
---
 .../objectstorage/StreamCompatibleBlobPutter.java  | 33 +++++++++++++++++++---
 1 file changed, 29 insertions(+), 4 deletions(-)

diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/StreamCompatibleBlobPutter.java b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/StreamCompatibleBlobPutter.java
index 1bac8e2..9a3a21f 100644
--- a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/StreamCompatibleBlobPutter.java
+++ b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/StreamCompatibleBlobPutter.java
@@ -20,11 +20,13 @@
 package org.apache.james.blob.objectstorage;
 
 import java.time.Duration;
+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 org.jclouds.blobstore.KeyNotFoundException;
 import org.jclouds.blobstore.domain.Blob;
 import org.jclouds.blobstore.options.CopyOptions;
 import org.jclouds.domain.Location;
@@ -74,12 +76,35 @@ public class StreamCompatibleBlobPutter implements BlobPutter {
     }
 
     private boolean needToCreateBucket(Throwable throwable, BucketName bucketName) {
-        if (throwable instanceof HttpResponseException) {
-            HttpResponseException ex = (HttpResponseException) throwable;
-            return ex.getCommand().getCurrentRequest().getMethod().equals("PUT")
-                && !blobStore.containerExists(bucketName.asString());
+        if (throwable instanceof HttpResponseException
+            || throwable instanceof KeyNotFoundException) {
+
+            return extractHttpException(throwable)
+                    .map(ex -> isPutMethod(ex) && !bucketExisted(bucketName))
+                    .orElse(false);
         }
 
         return false;
     }
+
+    private boolean isPutMethod(HttpResponseException ex) {
+        return ex.getCommand()
+            .getCurrentRequest()
+            .getMethod()
+            .equals("PUT");
+    }
+
+    private boolean bucketExisted(BucketName bucketName) {
+        return blobStore.containerExists(bucketName.asString());
+    }
+
+    private Optional<HttpResponseException> extractHttpException(Throwable throwable) {
+        if (throwable instanceof HttpResponseException) {
+            return Optional.of((HttpResponseException) throwable);
+        } else if (throwable.getCause() instanceof HttpResponseException) {
+            return Optional.of((HttpResponseException) throwable.getCause());
+        }
+
+        return Optional.empty();
+    }
 }
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[james-project] 02/07: JAMES-2806 ObjectStorage Swift save retry save() on non existing bucket

Posted by bt...@apache.org.
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 542b4cbf4fdc7aac7c5d59e8879fea3063e2c963
Author: Tran Tien Duc <dt...@linagora.com>
AuthorDate: Thu Jul 4 17:09:03 2019 +0700

    JAMES-2806 ObjectStorage Swift save retry save() on non existing bucket
---
 server/blob/blob-objectstorage/pom.xml             |  4 +++
 .../objectstorage/StreamCompatibleBlobPutter.java  | 34 ++++++++++++++++++++--
 .../objectstorage/ObjectStorageBlobsDAOTest.java   | 12 +++-----
 3 files changed, 40 insertions(+), 10 deletions(-)

diff --git a/server/blob/blob-objectstorage/pom.xml b/server/blob/blob-objectstorage/pom.xml
index c312e93..dabae94 100644
--- a/server/blob/blob-objectstorage/pom.xml
+++ b/server/blob/blob-objectstorage/pom.xml
@@ -87,6 +87,10 @@
             <artifactId>guava</artifactId>
         </dependency>
         <dependency>
+            <groupId>io.projectreactor.addons</groupId>
+            <artifactId>reactor-extra</artifactId>
+        </dependency>
+        <dependency>
             <groupId>nl.jqno.equalsverifier</groupId>
             <artifactId>equalsverifier</artifactId>
             <scope>test</scope>
diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/StreamCompatibleBlobPutter.java b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/StreamCompatibleBlobPutter.java
index f01bc34..1bac8e2 100644
--- a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/StreamCompatibleBlobPutter.java
+++ b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/StreamCompatibleBlobPutter.java
@@ -19,6 +19,7 @@
 
 package org.apache.james.blob.objectstorage;
 
+import java.time.Duration;
 import java.util.function.Supplier;
 
 import org.apache.james.blob.api.BlobId;
@@ -26,9 +27,21 @@ import org.apache.james.blob.api.BucketName;
 import org.jclouds.blobstore.BlobStore;
 import org.jclouds.blobstore.domain.Blob;
 import org.jclouds.blobstore.options.CopyOptions;
+import org.jclouds.domain.Location;
+import org.jclouds.http.HttpResponseException;
+
+import reactor.core.publisher.Mono;
+import reactor.core.scheduler.Schedulers;
+import reactor.retry.Retry;
 
 public class StreamCompatibleBlobPutter implements BlobPutter {
-    private final org.jclouds.blobstore.BlobStore blobStore;
+
+    private static final int MAX_RETRIES = 3;
+    private static final Duration FIRST_BACK_OFF = Duration.ofMillis(100);
+    private static final Duration FOREVER = Duration.ofMillis(Long.MAX_VALUE);
+    private static final Location DEFAULT_LOCATION = null;
+
+    private final BlobStore blobStore;
 
     public StreamCompatibleBlobPutter(BlobStore blobStore) {
         this.blobStore = blobStore;
@@ -36,7 +49,14 @@ public class StreamCompatibleBlobPutter implements BlobPutter {
 
     @Override
     public void putDirectly(BucketName bucketName, Blob blob) {
-        blobStore.putBlob(bucketName.asString(), blob);
+        Mono.fromRunnable(() -> blobStore.putBlob(bucketName.asString(), blob))
+            .publishOn(Schedulers.elastic())
+            .retryWhen(Retry.onlyIf(retryContext -> needToCreateBucket(retryContext.exception(), bucketName))
+                .exponentialBackoff(FIRST_BACK_OFF, FOREVER)
+                .withBackoffScheduler(Schedulers.elastic())
+                .retryMax(MAX_RETRIES)
+                .doOnRetry(retryContext -> blobStore.createContainerInLocation(DEFAULT_LOCATION, bucketName.asString())))
+            .block();
     }
 
     @Override
@@ -52,4 +72,14 @@ public class StreamCompatibleBlobPutter implements BlobPutter {
         blobStore.copyBlob(bucketNameAsString, from, bucketNameAsString, to, CopyOptions.NONE);
         blobStore.removeBlob(bucketNameAsString, from);
     }
+
+    private boolean needToCreateBucket(Throwable throwable, BucketName bucketName) {
+        if (throwable instanceof HttpResponseException) {
+            HttpResponseException ex = (HttpResponseException) throwable;
+            return ex.getCommand().getCurrentRequest().getMethod().equals("PUT")
+                && !blobStore.containerExists(bucketName.asString());
+        }
+
+        return false;
+    }
 }
\ No newline at end of file
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 12f11b8..a6321f7 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
@@ -31,6 +31,7 @@ import java.util.UUID;
 import org.apache.commons.io.IOUtils;
 import org.apache.james.blob.api.BlobId;
 import org.apache.james.blob.api.BlobStore;
+import org.apache.james.blob.api.BucketBlobStoreContract;
 import org.apache.james.blob.api.BucketName;
 import org.apache.james.blob.api.HashBlobId;
 import org.apache.james.blob.api.MetricableBlobStore;
@@ -45,7 +46,6 @@ import org.apache.james.blob.objectstorage.swift.UserHeaderName;
 import org.apache.james.blob.objectstorage.swift.UserName;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.extension.ExtendWith;
 
@@ -56,7 +56,8 @@ import reactor.core.publisher.Mono;
 import reactor.core.scheduler.Schedulers;
 
 @ExtendWith(DockerSwiftExtension.class)
-public class ObjectStorageBlobsDAOTest implements MetricableBlobStoreContract {
+public class ObjectStorageBlobsDAOTest implements MetricableBlobStoreContract, BucketBlobStoreContract {
+
     private static final String BIG_STRING = Strings.repeat("big blob content", 10 * 1024);
     private static final TenantName TENANT_NAME = TenantName.of("test");
     private static final UserName USER_NAME = UserName.of("tester");
@@ -98,6 +99,7 @@ public class ObjectStorageBlobsDAOTest implements MetricableBlobStoreContract {
     @AfterEach
     void tearDown() {
         blobStore.deleteContainer(defaultBucketName.asString());
+        blobStore.deleteContainer(CUSTOM.asString());
         blobStore.getContext().close();
     }
 
@@ -111,12 +113,6 @@ public class ObjectStorageBlobsDAOTest implements MetricableBlobStoreContract {
         return new HashBlobId.Factory();
     }
 
-    @Override
-    @Disabled("JAMES-2806: delete bucket not implemented yet for ObjectStorage")
-    public void deleteBucketShouldPublishDeleteTimerMetrics() {
-
-    }
-
     @Test
     void createBucketShouldMakeTheContainerToExist() {
         BucketName bucketName = BucketName.of(UUID.randomUUID().toString());


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[james-project] 06/07: JAMES-2806 ObjectStorage Swift retry one more time when fails to save

Posted by bt...@apache.org.
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 2232634235d72a8c4ed0a84a85422118fe662bbd
Author: Tran Tien Duc <dt...@linagora.com>
AuthorDate: Fri Jul 5 17:37:39 2019 +0700

    JAMES-2806 ObjectStorage Swift retry one more time when fails to save
    
    Swift cause a big time wait for the first put blob request to response.
    
    Assuming there are 2 thread trying to save a blob in the same time,
    and both are expected to fail and when a thread fall back to retry and
    create the bucket, the other thread comes to the step of checking
    bucket existing, now the bucket is already created then retry mechanism
    is rejected.
    
    I want to have the last retry regardless bucket existence to increase
    the chance to save a blob. This is just a conner case and rarely we never
    come up with retrying saving blob. Except the only one use case of Vault
    switching new Bucket to save deleted message.
    
    Then I have to take care about this issue rather than relax
    test concurrency level or disable it.
---
 .../objectstorage/StreamCompatibleBlobPutter.java  | 24 ++++++++++++++--------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/StreamCompatibleBlobPutter.java b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/StreamCompatibleBlobPutter.java
index 9a3a21f..2375864 100644
--- a/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/StreamCompatibleBlobPutter.java
+++ b/server/blob/blob-objectstorage/src/main/java/org/apache/james/blob/objectstorage/StreamCompatibleBlobPutter.java
@@ -42,6 +42,7 @@ public class StreamCompatibleBlobPutter implements BlobPutter {
     private static final Duration FIRST_BACK_OFF = Duration.ofMillis(100);
     private static final Duration FOREVER = Duration.ofMillis(Long.MAX_VALUE);
     private static final Location DEFAULT_LOCATION = null;
+    private static final long RETRY_ONE_LAST_TIME_ON_CONCURRENT_SAVING = 1;
 
     private final BlobStore blobStore;
 
@@ -58,6 +59,10 @@ public class StreamCompatibleBlobPutter implements BlobPutter {
                 .withBackoffScheduler(Schedulers.elastic())
                 .retryMax(MAX_RETRIES)
                 .doOnRetry(retryContext -> blobStore.createContainerInLocation(DEFAULT_LOCATION, bucketName.asString())))
+            .retryWhen(Retry.onlyIf(RetryContext -> isPutMethod(RetryContext.exception()))
+                .withBackoffScheduler(Schedulers.elastic())
+                .exponentialBackoff(FIRST_BACK_OFF, FOREVER)
+                .retryMax(RETRY_ONE_LAST_TIME_ON_CONCURRENT_SAVING))
             .block();
     }
 
@@ -76,15 +81,16 @@ public class StreamCompatibleBlobPutter implements BlobPutter {
     }
 
     private boolean needToCreateBucket(Throwable throwable, BucketName bucketName) {
-        if (throwable instanceof HttpResponseException
-            || throwable instanceof KeyNotFoundException) {
-
-            return extractHttpException(throwable)
-                    .map(ex -> isPutMethod(ex) && !bucketExisted(bucketName))
-                    .orElse(false);
-        }
+        return Optional.of(throwable)
+            .filter(t -> t instanceof HttpResponseException || t instanceof KeyNotFoundException)
+            .flatMap(this::extractHttpException)
+            .map(ex -> isPutMethod(ex) && !bucketExists(bucketName))
+            .orElse(false);
+    }
 
-        return false;
+    private boolean isPutMethod(Throwable throwable) {
+        return throwable instanceof HttpResponseException
+            && isPutMethod((HttpResponseException) throwable);
     }
 
     private boolean isPutMethod(HttpResponseException ex) {
@@ -94,7 +100,7 @@ public class StreamCompatibleBlobPutter implements BlobPutter {
             .equals("PUT");
     }
 
-    private boolean bucketExisted(BucketName bucketName) {
+    private boolean bucketExists(BucketName bucketName) {
         return blobStore.containerExists(bucketName.asString());
     }
 


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[james-project] 07/07: JAMES-2806 use fixed bucket name in tests

Posted by bt...@apache.org.
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 c6666eb1d9e71d5b6fa77b1c16e4fe4ddcabb35b
Author: Tran Tien Duc <dt...@linagora.com>
AuthorDate: Mon Jul 8 10:09:17 2019 +0700

    JAMES-2806 use fixed bucket name in tests
---
 .../apache/james/blob/objectstorage/ObjectStorageBlobsDAOAWSTest.java | 4 +---
 .../apache/james/blob/objectstorage/ObjectStorageBlobsDAOTest.java    | 3 +--
 .../blob/objectstorage/aws/AwsS3ObjectStorageBlobsDAOBuilderTest.java | 4 +---
 .../swift/SwiftKeystone2ObjectStorageBlobsDAOBuilderTest.java         | 3 +--
 .../swift/SwiftKeystone3ObjectStorageBlobsDAOBuilderTest.java         | 3 +--
 .../swift/SwiftTempAuthObjectStorageBlobsDAOBuilderTest.java          | 3 +--
 6 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOAWSTest.java b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOAWSTest.java
index b9f101b..209be69 100644
--- a/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOAWSTest.java
+++ b/server/blob/blob-objectstorage/src/test/java/org/apache/james/blob/objectstorage/ObjectStorageBlobsDAOAWSTest.java
@@ -19,8 +19,6 @@
 
 package org.apache.james.blob.objectstorage;
 
-import java.util.UUID;
-
 import org.apache.james.blob.api.BlobId;
 import org.apache.james.blob.api.BlobStore;
 import org.apache.james.blob.api.BucketBlobStoreContract;
@@ -51,7 +49,7 @@ public class ObjectStorageBlobsDAOAWSTest implements MetricableBlobStoreContract
     @BeforeEach
     void setUp(DockerAwsS3Container dockerAwsS3) {
         awsS3ObjectStorage = new AwsS3ObjectStorage();
-        defaultBucketName = BucketName.of(UUID.randomUUID().toString());
+        defaultBucketName = BucketName.of("e7a929fe-2003-48d4-aaa9-a65d4954379d");
         configuration = AwsS3AuthConfiguration.builder()
             .endpoint(dockerAwsS3.getEndpoint())
             .accessKeyId(DockerAwsS3Container.ACCESS_KEY_ID)
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 9423ee8..18c6bf2 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
@@ -25,7 +25,6 @@ import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.nio.charset.StandardCharsets;
-import java.util.UUID;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.james.blob.api.BlobId;
@@ -76,7 +75,7 @@ public class ObjectStorageBlobsDAOTest implements MetricableBlobStoreContract, B
 
     @BeforeEach
     void setUp(DockerSwift dockerSwift) {
-        defaultBucketName = BucketName.of(UUID.randomUUID().toString());
+        defaultBucketName = BucketName.of("e4fc2427-f2aa-422a-a535-3df0d2a086c4");
         testConfig = SwiftTempAuthObjectStorage.configBuilder()
             .endpoint(dockerSwift.swiftEndpoint())
             .identity(SWIFT_IDENTITY)
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 1592c99..a81e930 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
@@ -21,8 +21,6 @@ package org.apache.james.blob.objectstorage.aws;
 
 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.ObjectStorageBlobsDAO;
@@ -43,7 +41,7 @@ class AwsS3ObjectStorageBlobsDAOBuilderTest implements ObjectStorageBlobsDAOCont
     @BeforeEach
     void setUp(DockerAwsS3Container dockerAwsS3Container) {
         awsS3ObjectStorage = new AwsS3ObjectStorage();
-        defaultBucketName = BucketName.of(UUID.randomUUID().toString());
+        defaultBucketName = BucketName.of("d1953ef8-cfe8-460b-bc29-3977f5b6656f");
         configuration = AwsS3AuthConfiguration.builder()
             .endpoint(dockerAwsS3Container.getEndpoint())
             .accessKeyId(DockerAwsS3Container.ACCESS_KEY_ID)
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 38d2386..649bb91 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
@@ -22,7 +22,6 @@ package org.apache.james.blob.objectstorage.swift;
 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;
@@ -48,7 +47,7 @@ class SwiftKeystone2ObjectStorageBlobsDAOBuilderTest implements ObjectStorageBlo
 
     @BeforeEach
     void setUp(DockerSwift dockerSwift) {
-        defaultBucketName = BucketName.of(UUID.randomUUID().toString());
+        defaultBucketName = BucketName.of("795d5ff2-510b-487b-a112-fb4b4ed9a9d5");
         endpoint = dockerSwift.keystoneV2Endpoint();
         testConfig = SwiftKeystone2ObjectStorage.configBuilder()
             .endpoint(endpoint)
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 246efae..dd5be4d 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
@@ -23,7 +23,6 @@ import static org.assertj.core.api.Assertions.assertThatThrownBy;
 
 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;
@@ -78,7 +77,7 @@ class SwiftKeystone3ObjectStorageBlobsDAOBuilderTest implements ObjectStorageBlo
     @BeforeEach
     void setUp(DockerSwift dockerSwift) {
         this.dockerSwift = dockerSwift;
-        defaultBucketName = BucketName.of(UUID.randomUUID().toString());
+        defaultBucketName = BucketName.of("4f75f792-205c-4279-a2ab-dbf2fba1c24d");
         testConfig = PROJECT_CONFIG
             .endpoint(dockerSwift.keystoneV3Endpoint())
             .build();
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 853b382..ba729a3 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
@@ -22,7 +22,6 @@ package org.apache.james.blob.objectstorage.swift;
 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;
@@ -48,7 +47,7 @@ class SwiftTempAuthObjectStorageBlobsDAOBuilderTest implements ObjectStorageBlob
 
     @BeforeEach
     void setUp(DockerSwift dockerSwift) {
-        defaultBucketName = BucketName.of(UUID.randomUUID().toString());
+        defaultBucketName = BucketName.of("ea21582e-f6c1-4737-867a-b25d0b36eccc");
         endpoint = dockerSwift.swiftEndpoint();
         testConfig = SwiftTempAuthObjectStorage.configBuilder()
             .endpoint(endpoint)


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[james-project] 01/07: JAMES-2806 Upgrade Jcloud version

Posted by bt...@apache.org.
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 6f984a184bc10408d72017e20b61ddde35de1757
Author: Tran Tien Duc <dt...@linagora.com>
AuthorDate: Tue Jul 2 17:28:40 2019 +0700

    JAMES-2806 Upgrade Jcloud version
    
    This upgrade contains a fix for BlobStore Container cache validation
    that the following commit need it to not break the ObjectStorage DAO
    with Swift
---
 server/blob/blob-objectstorage/pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/server/blob/blob-objectstorage/pom.xml b/server/blob/blob-objectstorage/pom.xml
index a92e073..c312e93 100644
--- a/server/blob/blob-objectstorage/pom.xml
+++ b/server/blob/blob-objectstorage/pom.xml
@@ -33,7 +33,7 @@
     <name>Apache James :: Server :: Blob :: Object storage</name>
 
     <properties>
-        <jclouds.version>2.1.1</jclouds.version>
+        <jclouds.version>2.1.2</jclouds.version>
     </properties>
 
     <dependencies>


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org