james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From matth...@apache.org
Subject [03/13] james-project git commit: JAMES-2133 Switch from cassandraunit to cassandra in docker
Date Sat, 02 Sep 2017 06:00:05 GMT
http://git-wip-us.apache.org/repos/asf/james-project/blob/a18a4488/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMessagesMethodTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMessagesMethodTest.java
b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMessagesMethodTest.java
index 5ab494a..2691aaf 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMessagesMethodTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetMessagesMethodTest.java
@@ -20,20 +20,25 @@
 package org.apache.james.jmap.cassandra;
 
 import org.apache.james.CassandraJmapTestRule;
+import org.apache.james.DockerCassandraRule;
 import org.apache.james.GuiceJamesServer;
 import org.apache.james.jmap.methods.integration.SetMessagesMethodTest;
 import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
 import org.apache.james.mailbox.model.MessageId;
+import org.junit.ClassRule;
 import org.junit.Rule;
 
 public class CassandraSetMessagesMethodTest extends SetMessagesMethodTest {
 
+    @ClassRule
+    public static DockerCassandraRule cassandra = new DockerCassandraRule();
+    
     @Rule 
     public CassandraJmapTestRule rule = CassandraJmapTestRule.defaultTestRule();
 
     @Override
     protected GuiceJamesServer createJmapServer() {
-        return rule.jmapServer();
+        return rule.jmapServer(cassandra.getModule());
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/a18a4488/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetVacationResponseTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetVacationResponseTest.java
b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetVacationResponseTest.java
index ca9af6b..f1003e8 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetVacationResponseTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraSetVacationResponseTest.java
@@ -20,18 +20,23 @@
 package org.apache.james.jmap.cassandra;
 
 import org.apache.james.CassandraJmapTestRule;
+import org.apache.james.DockerCassandraRule;
 import org.apache.james.GuiceJamesServer;
 import org.apache.james.jmap.methods.integration.SetVacationResponseTest;
+import org.junit.ClassRule;
 import org.junit.Rule;
 
 public class CassandraSetVacationResponseTest extends SetVacationResponseTest {
 
+    @ClassRule
+    public static DockerCassandraRule cassandra = new DockerCassandraRule();
+    
     @Rule 
     public CassandraJmapTestRule rule = CassandraJmapTestRule.defaultTestRule();
     
     @Override
     protected GuiceJamesServer createJmapServer() {
-        return rule.jmapServer();
+        return rule.jmapServer(cassandra.getModule());
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/a18a4488/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraUserProvisionningConcurrencyTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraUserProvisionningConcurrencyTest.java
b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraUserProvisionningConcurrencyTest.java
index ea63d10..d9c71f1 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraUserProvisionningConcurrencyTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraUserProvisionningConcurrencyTest.java
@@ -20,17 +20,23 @@
 package org.apache.james.jmap.cassandra;
 
 import org.apache.james.CassandraJmapTestRule;
+import org.apache.james.DockerCassandraRule;
 import org.apache.james.GuiceJamesServer;
 import org.apache.james.jmap.UserProvisionningConcurrencyTest;
+import org.junit.ClassRule;
 import org.junit.Rule;
 
 public class CassandraUserProvisionningConcurrencyTest extends UserProvisionningConcurrencyTest
{
+
+    @ClassRule
+    public static DockerCassandraRule cassandra = new DockerCassandraRule();
+    
     @Rule
     public CassandraJmapTestRule rule = CassandraJmapTestRule.defaultTestRule();
 
     @Override
     protected GuiceJamesServer createJmapServer() {
-        return rule.jmapServer();
+        return rule.jmapServer(cassandra.getModule());
     }
 
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/a18a4488/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraVacationIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraVacationIntegrationTest.java
b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraVacationIntegrationTest.java
index 186a3ce..197aad9 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraVacationIntegrationTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraVacationIntegrationTest.java
@@ -20,19 +20,23 @@
 package org.apache.james.jmap.cassandra;
 
 import org.apache.james.CassandraJmapTestRule;
+import org.apache.james.DockerCassandraRule;
 import org.apache.james.GuiceJamesServer;
 import org.apache.james.jmap.VacationIntegrationTest;
+import org.junit.ClassRule;
 import org.junit.Rule;
 
 public class CassandraVacationIntegrationTest extends VacationIntegrationTest {
 
+    @ClassRule
+    public static DockerCassandraRule cassandra = new DockerCassandraRule();
 
     @Rule 
     public CassandraJmapTestRule rule = CassandraJmapTestRule.defaultTestRule();
     
     @Override
     protected GuiceJamesServer createJmapServer() {
-        return rule.jmapServer();
+        return rule.jmapServer(cassandra.getModule());
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/a18a4488/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraVacationRelayIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraVacationRelayIntegrationTest.java
b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraVacationRelayIntegrationTest.java
index 57c5ff5..15d7d54 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraVacationRelayIntegrationTest.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/CassandraVacationRelayIntegrationTest.java
@@ -20,22 +20,29 @@
 package org.apache.james.jmap.cassandra;
 
 import org.apache.james.CassandraJmapTestRule;
+import org.apache.james.DockerCassandraRule;
 import org.apache.james.GuiceJamesServer;
 import org.apache.james.dnsservice.api.DNSService;
 import org.apache.james.dnsservice.api.InMemoryDNSService;
 import org.apache.james.jmap.VacationRelayIntegrationTest;
+import org.junit.ClassRule;
 import org.junit.Rule;
 
 public class CassandraVacationRelayIntegrationTest extends VacationRelayIntegrationTest {
 
     private final InMemoryDNSService inMemoryDNSService = new InMemoryDNSService();
 
+    @ClassRule
+    public static DockerCassandraRule cassandra = new DockerCassandraRule();
+    
     @Rule
     public CassandraJmapTestRule jamesServerRule = CassandraJmapTestRule.defaultTestRule();
 
     @Override
     protected GuiceJamesServer getJmapServer() {
-        return jamesServerRule.jmapServer((binder) -> binder.bind(DNSService.class).toInstance(inMemoryDNSService));
+        return jamesServerRule.jmapServer(
+                cassandra.getModule(),
+                (binder) -> binder.bind(DNSService.class).toInstance(inMemoryDNSService));
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/a18a4488/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraStepdefs.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraStepdefs.java
b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraStepdefs.java
index d19bb2f..34aef64 100644
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraStepdefs.java
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraStepdefs.java
@@ -27,7 +27,7 @@ import org.apache.activemq.store.PersistenceAdapter;
 import org.apache.activemq.store.memory.MemoryPersistenceAdapter;
 import org.apache.james.CassandraJamesServerMain;
 import org.apache.james.GuiceJamesServer;
-import org.apache.james.backends.cassandra.EmbeddedCassandra;
+import org.apache.james.backends.cassandra.DockerCassandraRule;
 import org.apache.james.backends.es.EmbeddedElasticSearch;
 import org.apache.james.jmap.methods.integration.cucumber.MainStepdefs;
 import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
@@ -47,7 +47,7 @@ public class CassandraStepdefs {
     private final MainStepdefs mainStepdefs;
     private TemporaryFolder temporaryFolder = new TemporaryFolder();
     private EmbeddedElasticSearch embeddedElasticSearch = new EmbeddedElasticSearch(temporaryFolder,
MailboxElasticsearchConstants.MAILBOX_INDEX);
-    private EmbeddedCassandra cassandra = EmbeddedCassandra.createStartServer();
+    private DockerCassandraRule cassandraServer = new DockerCassandraRule();
 
     @Inject
     private CassandraStepdefs(MainStepdefs mainStepdefs) {
@@ -58,10 +58,11 @@ public class CassandraStepdefs {
     public void init() throws Exception {
         temporaryFolder.create();
         embeddedElasticSearch.before();
+        cassandraServer.start();
         mainStepdefs.messageIdFactory = new CassandraMessageId.Factory();
         mainStepdefs.jmapServer = new GuiceJamesServer()
                 .combineWith(CassandraJamesServerMain.cassandraServerModule, CassandraJamesServerMain.protocols)
-                .overrideWith(new CassandraJmapServerModule(temporaryFolder, embeddedElasticSearch,
cassandra))
+                .overrideWith(new CassandraJmapServerModule(temporaryFolder, embeddedElasticSearch,
cassandraServer.getIp(), cassandraServer.getBindingPort()))
                 .overrideWith((binder) -> binder.bind(PersistenceAdapter.class).to(MemoryPersistenceAdapter.class));
         mainStepdefs.awaitMethod = () -> embeddedElasticSearch.awaitForElasticSearch();
         mainStepdefs.init();
@@ -71,7 +72,8 @@ public class CassandraStepdefs {
     public void tearDown() {
         ignoreFailures(mainStepdefs::tearDown,
                 () -> embeddedElasticSearch.after(),
-                () -> temporaryFolder.delete());
+                () -> temporaryFolder.delete(),
+                () -> cassandraServer.stop());
     }
 
     private void ignoreFailures(ThrowingRunnable... cleaners) {

http://git-wip-us.apache.org/repos/asf/james-project/blob/a18a4488/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/ContainerTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/ContainerTest.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/ContainerTest.java
index 5ac9018..99f2d89 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/ContainerTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/ContainerTest.java
@@ -40,8 +40,8 @@ public class ContainerTest {
     public void containerShouldBeReachableOnExposedPort() throws IOException, URISyntaxException
{
         Response response = Request.Get(new URIBuilder()
             .setScheme("http")
-            .setHost(container.getIp())
-            .setPort(80).build())
+            .setHost(container.getHostIp())
+            .setPort(container.getMappedPort(80)).build())
             .execute();
 
         assertThat(response.returnResponse().getStatusLine().getStatusCode())

http://git-wip-us.apache.org/repos/asf/james-project/blob/a18a4488/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationRelayIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationRelayIntegrationTest.java
b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationRelayIntegrationTest.java
index dbc6816..7bc8266 100644
--- a/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationRelayIntegrationTest.java
+++ b/server/protocols/jmap-integration-testing/jmap-integration-testing-common/src/test/java/org/apache/james/jmap/VacationRelayIntegrationTest.java
@@ -43,7 +43,6 @@ import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
-import org.testcontainers.shaded.com.google.common.net.InetAddresses;
 
 import com.google.common.base.Charsets;
 import com.jayway.awaitility.Awaitility;
@@ -83,7 +82,7 @@ public abstract class VacationRelayIntegrationTest {
     @Before
     public void setUp() throws Exception {
 
-        InetAddress containerIp = InetAddresses.forString(fakeSmtp.getIp());
+        InetAddress containerIp = InetAddress.getByName(fakeSmtp.getContainerIp());
         getInMemoryDns()
             .registerRecord("yopmail.com", containerIp, "yopmail.com");
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/a18a4488/server/protocols/webadmin-integration-test/pom.xml
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin-integration-test/pom.xml b/server/protocols/webadmin-integration-test/pom.xml
index bbdc8a5..319b8b2 100644
--- a/server/protocols/webadmin-integration-test/pom.xml
+++ b/server/protocols/webadmin-integration-test/pom.xml
@@ -35,6 +35,12 @@
     <dependencies>
         <dependency>
             <groupId>${project.groupId}</groupId>
+            <artifactId>apache-james-backends-cassandra</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${project.groupId}</groupId>
             <artifactId>apache-james-backends-es</artifactId>
             <type>test-jar</type>
             <scope>test</scope>
@@ -99,11 +105,6 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>org.cassandraunit</groupId>
-            <artifactId>cassandra-unit</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
             <groupId>org.hamcrest</groupId>
             <artifactId>java-hamcrest</artifactId>
             <scope>test</scope>

http://git-wip-us.apache.org/repos/asf/james-project/blob/a18a4488/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/JwtFilterIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/JwtFilterIntegrationTest.java
b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/JwtFilterIntegrationTest.java
index dee4122..e15f178 100644
--- a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/JwtFilterIntegrationTest.java
+++ b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/JwtFilterIntegrationTest.java
@@ -29,6 +29,7 @@ import java.util.Optional;
 
 import org.apache.commons.io.IOUtils;
 import org.apache.james.CassandraJmapTestRule;
+import org.apache.james.DockerCassandraRule;
 import org.apache.james.GuiceJamesServer;
 import org.apache.james.jwt.JwtConfiguration;
 import org.apache.james.utils.DataProbeImpl;
@@ -38,6 +39,7 @@ import org.apache.james.webadmin.authentication.JwtFilter;
 import org.apache.james.webadmin.routes.DomainRoutes;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.ClassRule;
 import org.junit.Rule;
 import org.junit.Test;
 
@@ -62,6 +64,9 @@ public class JwtFilterIntegrationTest {
         "xtedOK2JnQZn7t9sUzSrcyjWverm7gZkPptkIVoS8TsEeMMME5vFXe_nqkEG69q3kuBUm_33tbR5oNS0ZGZKlG9r41lHBjyf9J1xN4UYV8n866d"
+
         "a7RPPCzshIWUtO0q9T2umWTnp-6OnOdBCkndrZmRR6pPxsD5YL0_77Wq8KT_5__fGA";
 
+    @ClassRule
+    public static DockerCassandraRule cassandra = new DockerCassandraRule();
+    
     @Rule
     public CassandraJmapTestRule cassandraJmapTestRule = CassandraJmapTestRule.defaultTestRule();
 
@@ -75,7 +80,7 @@ public class JwtFilterIntegrationTest {
             Optional.of(
                 IOUtils.toString(ClassLoader.getSystemResourceAsStream("jwt_publickey"),
Charsets.UTF_8)));
 
-        guiceJamesServer = cassandraJmapTestRule.jmapServer()
+        guiceJamesServer = cassandraJmapTestRule.jmapServer(cassandra.getModule())
             .overrideWith(new WebAdminConfigurationModule(),
                 binder -> binder.bind(AuthenticationFilter.class).to(JwtFilter.class),
                 binder -> binder.bind(JwtConfiguration.class).toInstance(jwtConfiguration));

http://git-wip-us.apache.org/repos/asf/james-project/blob/a18a4488/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
index 03963eb..bb243cc 100644
--- a/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
+++ b/server/protocols/webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/WebAdminServerIntegrationTest.java
@@ -28,6 +28,7 @@ import static org.hamcrest.Matchers.containsString;
 import static org.hamcrest.Matchers.is;
 
 import org.apache.james.CassandraJmapTestRule;
+import org.apache.james.DockerCassandraRule;
 import org.apache.james.GuiceJamesServer;
 import org.apache.james.backends.cassandra.versions.CassandraSchemaVersionManager;
 import org.apache.james.modules.MailboxProbeImpl;
@@ -40,6 +41,7 @@ import org.apache.james.webadmin.routes.UserRoutes;
 import org.apache.james.webadmin.swagger.routes.SwaggerRoutes;
 import org.junit.After;
 import org.junit.Before;
+import org.junit.ClassRule;
 import org.junit.Rule;
 import org.junit.Test;
 
@@ -61,6 +63,9 @@ public class WebAdminServerIntegrationTest {
     public static final String UPGRADE_VERSION = VERSION + "/upgrade";
     public static final String UPGRADE_TO_LATEST_VERSION = UPGRADE_VERSION + "/latest";
 
+    @ClassRule
+    public static DockerCassandraRule cassandra = new DockerCassandraRule();
+    
     @Rule
     public CassandraJmapTestRule cassandraJmapTestRule = CassandraJmapTestRule.defaultTestRule();
 
@@ -70,7 +75,7 @@ public class WebAdminServerIntegrationTest {
 
     @Before
     public void setUp() throws Exception {
-        guiceJamesServer = cassandraJmapTestRule.jmapServer()
+        guiceJamesServer = cassandraJmapTestRule.jmapServer(cassandra.getModule())
                 .overrideWith(new WebAdminConfigurationModule());
         guiceJamesServer.start();
         dataProbe = guiceJamesServer.getProbe(DataProbeImpl.class);


---------------------------------------------------------------------
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