james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [09/10] james-project git commit: JAMES-2525 creates guice rule and cucumber singleton for swift docker container
Date Thu, 11 Oct 2018 02:28:47 GMT
JAMES-2525 creates guice rule and cucumber singleton for swift docker container


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/7554b2e0
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/7554b2e0
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/7554b2e0

Branch: refs/heads/master
Commit: 7554b2e0caaed7f3cfed15a49a2e9b6ee52fe3a0
Parents: a2c7e98
Author: Jean Helou <jhe@codamens.fr>
Authored: Tue Sep 11 13:20:53 2018 +0200
Committer: Benoit Tellier <btellier@linagora.com>
Committed: Thu Oct 11 09:27:08 2018 +0700

----------------------------------------------------------------------
 .../guice/blob-objectstorage-guice/pom.xml      | 18 ++++
 .../guice/DockerSwiftTestRule.java              | 87 ++++++++++++++++++++
 .../cassandra-jmap-integration-testing/pom.xml  | 17 ++++
 .../cucumber/CucumberSwiftSingleton.java        | 27 ++++++
 4 files changed, 149 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/7554b2e0/server/container/guice/blob-objectstorage-guice/pom.xml
----------------------------------------------------------------------
diff --git a/server/container/guice/blob-objectstorage-guice/pom.xml b/server/container/guice/blob-objectstorage-guice/pom.xml
index 24e96d4..20e74f0 100644
--- a/server/container/guice/blob-objectstorage-guice/pom.xml
+++ b/server/container/guice/blob-objectstorage-guice/pom.xml
@@ -41,9 +41,22 @@
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
+            <artifactId>blob-objectstorage</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
             <artifactId>james-server-guice-common</artifactId>
         </dependency>
         <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-guice-common</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.assertj</groupId>
             <artifactId>assertj-core</artifactId>
             <scope>test</scope>
@@ -58,5 +71,10 @@
             <artifactId>junit-platform-launcher</artifactId>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>org.testcontainers</groupId>
+            <artifactId>testcontainers</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/7554b2e0/server/container/guice/blob-objectstorage-guice/src/test/java/org/apache/james/modules/objectstorage/guice/DockerSwiftTestRule.java
----------------------------------------------------------------------
diff --git a/server/container/guice/blob-objectstorage-guice/src/test/java/org/apache/james/modules/objectstorage/guice/DockerSwiftTestRule.java
b/server/container/guice/blob-objectstorage-guice/src/test/java/org/apache/james/modules/objectstorage/guice/DockerSwiftTestRule.java
new file mode 100644
index 0000000..ac5c459
--- /dev/null
+++ b/server/container/guice/blob-objectstorage-guice/src/test/java/org/apache/james/modules/objectstorage/guice/DockerSwiftTestRule.java
@@ -0,0 +1,87 @@
+/****************************************************************
+ * 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.modules.objectstorage.guice;
+
+import java.util.UUID;
+
+import org.apache.james.GuiceModuleTestRule;
+import org.apache.james.blob.api.BlobStore;
+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.swift.Credentials;
+import org.apache.james.blob.objectstorage.swift.SwiftKeystone2ObjectStorage;
+import org.apache.james.blob.objectstorage.swift.TenantName;
+import org.apache.james.blob.objectstorage.swift.UserName;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+import org.testcontainers.containers.GenericContainer;
+
+import com.github.fge.lambdas.Throwing;
+import com.google.inject.Module;
+import com.google.inject.util.Modules;
+
+public class DockerSwiftTestRule implements GuiceModuleTestRule {
+
+    private org.apache.james.blob.objectstorage.DockerSwiftRule swiftContainer =
+        new org.apache.james.blob.objectstorage.DockerSwiftRule();
+
+    @Override
+    public Statement apply(Statement base, Description description) {
+        return swiftContainer.apply(base, description);
+    }
+
+    @Override
+    public void await() {
+    }
+
+    @Override
+    public Module getModule() {
+        SwiftKeystone2ObjectStorage.Configuration configuration = SwiftKeystone2ObjectStorage.configBuilder()
+            .credentials(Credentials.of("demo"))
+            .tenantName(TenantName.of("test"))
+            .userName(UserName.of("demo"))
+            .endpoint(swiftContainer.dockerSwift().keystoneV2Endpoint())
+            .build();
+
+        ContainerName containerName = ContainerName.of(UUID.randomUUID().toString());
+        ObjectStorageBlobsDAO dao = SwiftKeystone2ObjectStorage.daoBuilder(configuration)
+            .blobIdFactory(new HashBlobId.Factory())
+            .container(containerName)
+            .build();
+
+        Throwing.supplier(() -> dao.createContainer(containerName).get()).sneakyThrow().get();
+        return Modules.combine((binder) -> binder.bind(BlobStore.class).toInstance(dao));
+    }
+
+
+    public void start() {
+        swiftContainer.start();
+    }
+
+    public void stop() {
+        swiftContainer.stop();
+    }
+
+    public GenericContainer<?> getRawContainer() {
+        return swiftContainer.getRawContainer();
+    }
+
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/james-project/blob/7554b2e0/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/pom.xml
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/pom.xml
b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/pom.xml
index 1d7bbd3..0ae199b 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/pom.xml
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/pom.xml
@@ -82,6 +82,23 @@
         </dependency>
         <dependency>
             <groupId>${james.groupId}</groupId>
+            <artifactId>blob-objectstorage-guice</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>blob-objectstorage</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>blob-objectstorage-guice</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
             <artifactId>james-server-cassandra-guice</artifactId>
             <scope>test</scope>
         </dependency>

http://git-wip-us.apache.org/repos/asf/james-project/blob/7554b2e0/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CucumberSwiftSingleton.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CucumberSwiftSingleton.java
b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CucumberSwiftSingleton.java
new file mode 100644
index 0000000..e4afe6b
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CucumberSwiftSingleton.java
@@ -0,0 +1,27 @@
+/****************************************************************
+ * 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.jmap.cassandra.cucumber;
+
+import org.apache.james.modules.objectstorage.guice.DockerSwiftTestRule;
+
+public class CucumberSwiftSingleton {
+
+    public static DockerSwiftTestRule swiftServer = new DockerSwiftTestRule();
+
+}


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


Mime
View raw message