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 2018/07/30 06:54:47 UTC

[1/8] james-project git commit: JAMES-2500 Don't get IP of stopped containers

Repository: james-project
Updated Branches:
  refs/heads/master cfd46a149 -> 2d6d69eca


JAMES-2500 Don't get IP of stopped containers

No more works with testcontainers 1.8.1


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

Branch: refs/heads/master
Commit: 5635e13304f3ae87afcf58e84ff9692f2abf174e
Parents: 2666bc4
Author: benwa <bt...@linagora.com>
Authored: Fri Jul 27 18:24:41 2018 +0700
Committer: benwa <bt...@linagora.com>
Committed: Mon Jul 30 13:50:35 2018 +0700

----------------------------------------------------------------------
 .../org/apache/james/queue/rabbitmq/RabbitMQClusterTest.java    | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/5635e133/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQClusterTest.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQClusterTest.java b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQClusterTest.java
index 26cf6e1..63146a9 100644
--- a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQClusterTest.java
+++ b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQClusterTest.java
@@ -49,8 +49,10 @@ import org.testcontainers.shaded.com.google.common.collect.ImmutableMap;
 
 import com.github.fge.lambdas.Throwing;
 import com.github.steveash.guavate.Guavate;
+import com.google.common.collect.ImmutableList;
 import com.jayway.awaitility.Awaitility;
 import com.jayway.awaitility.Duration;
+import com.rabbitmq.client.Address;
 import com.rabbitmq.client.Channel;
 import com.rabbitmq.client.Connection;
 import com.rabbitmq.client.ConnectionFactory;
@@ -217,9 +219,10 @@ class RabbitMQClusterTest {
         @Test
         void connectingToAClusterWithAFailedRabbit(DockerRabbitMQCluster cluster) throws Exception {
             ConnectionFactory node3ConnectionFactory = cluster.getRabbitMQ3().connectionFactory();
+            ImmutableList<Address> clusterAddresses = cluster.getAddresses();
             cluster.getRabbitMQ3().stop();
 
-            try (Connection connection = node3ConnectionFactory.newConnection(cluster.getAddresses());
+            try (Connection connection = node3ConnectionFactory.newConnection(clusterAddresses);
                  Channel channel = connection.createChannel()) {
 
                 channel.exchangeDeclare(EXCHANGE_NAME, DIRECT, DURABLE);


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


[8/8] james-project git commit: JAMES-2303 JDBC Mail repository do not persist Per recipient headers.

Posted by bt...@apache.org.
JAMES-2303 JDBC Mail repository do not persist Per recipient headers.

Using JDK serialization to persist Per recipient headers.


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

Branch: refs/heads/master
Commit: 2d6d69ecac24bf7c1b1d1e0f1dc009d2b1ff1bdf
Parents: a2cdc55
Author: Edgar Asatryan <ns...@gmail.com>
Authored: Tue Jul 24 18:27:32 2018 +0400
Committer: benwa <bt...@linagora.com>
Committed: Mon Jul 30 13:54:05 2018 +0700

----------------------------------------------------------------------
 .../mailrepository/jdbc/JDBCMailRepository.java | 27 +++++++++++++++-----
 .../jdbc/JDBCMailRepositoryTest.java            | 24 -----------------
 .../src/test/resources/sqlResources.xml         | 16 +++++++++---
 3 files changed, 33 insertions(+), 34 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/2d6d69ec/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java
----------------------------------------------------------------------
diff --git a/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java b/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java
index 9875676..0c95dd5 100644
--- a/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java
+++ b/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java
@@ -33,6 +33,7 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.SQLException;
 import java.sql.Statement;
+import java.sql.Types;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
@@ -51,6 +52,7 @@ import javax.sql.DataSource;
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.configuration.DefaultConfigurationBuilder;
 import org.apache.commons.configuration.HierarchicalConfiguration;
+import org.apache.commons.lang3.SerializationUtils;
 import org.apache.james.core.MailAddress;
 import org.apache.james.filesystem.api.FileSystem;
 import org.apache.james.mailrepository.api.MailKey;
@@ -528,7 +530,7 @@ public class JDBCMailRepository extends AbstractMailRepository {
                     insertMessage.setString(3, mc.getState());
                     insertMessage.setString(4, mc.getErrorMessage());
                     if (mc.getSender() == null) {
-                        insertMessage.setNull(5, java.sql.Types.VARCHAR);
+                        insertMessage.setNull(5, Types.VARCHAR);
                     } else {
                         insertMessage.setString(5, mc.getSender().toString());
                     }
@@ -542,12 +544,18 @@ public class JDBCMailRepository extends AbstractMailRepository {
                     insertMessage.setString(6, recipients.toString());
                     insertMessage.setString(7, mc.getRemoteHost());
                     insertMessage.setString(8, mc.getRemoteAddr());
-                    insertMessage.setTimestamp(9, new java.sql.Timestamp(mc.getLastUpdated().getTime()));
+                    if (mc.getPerRecipientSpecificHeaders().getHeadersByRecipient().isEmpty()) {
+                        insertMessage.setNull(9, Types.BLOB);
+                    } else {
+                        byte[] bytes = SerializationUtils.serialize(mc.getPerRecipientSpecificHeaders());
+                        insertMessage.setBinaryStream(9, new ByteArrayInputStream(bytes), bytes.length);
+                    }
+                    insertMessage.setTimestamp(10, new java.sql.Timestamp(mc.getLastUpdated().getTime()));
 
-                    insertMessage.setBinaryStream(10, is, (int) is.getSize());
+                    insertMessage.setBinaryStream(11, is, (int) is.getSize());
 
                     // Store attributes
-                    if (numberOfParameters > 10) {
+                    if (numberOfParameters > 11) {
                         ByteArrayOutputStream baos = new ByteArrayOutputStream();
                         ObjectOutputStream oos = new ObjectOutputStream(baos);
                         try {
@@ -563,7 +571,7 @@ public class JDBCMailRepository extends AbstractMailRepository {
                             }
                             oos.flush();
                             ByteArrayInputStream attrInputStream = new ByteArrayInputStream(baos.toByteArray());
-                            insertMessage.setBinaryStream(11, attrInputStream, baos.size());
+                            insertMessage.setBinaryStream(12, attrInputStream, baos.size());
                         } finally {
                             try {
                                 if (oos != null) {
@@ -680,7 +688,13 @@ public class JDBCMailRepository extends AbstractMailRepository {
             mc.setRecipients(recipients);
             mc.setRemoteHost(rsMessage.getString(5));
             mc.setRemoteAddr(rsMessage.getString(6));
-            mc.setLastUpdated(rsMessage.getTimestamp(7));
+            try (InputStream is = rsMessage.getBinaryStream(7)) {
+                if (is != null) {
+                    mc.addAllSpecificHeaderForRecipient(SerializationUtils.deserialize(is));
+                }
+            }
+
+            mc.setLastUpdated(rsMessage.getTimestamp(8));
 
             MimeMessageJDBCSource source = new MimeMessageJDBCSource(this, key.asString(), sr);
             MimeMessageCopyOnWriteProxy message = new MimeMessageCopyOnWriteProxy(source);
@@ -735,7 +749,6 @@ public class JDBCMailRepository extends AbstractMailRepository {
 
     @Override
     public Iterator<MailKey> list() throws MessagingException {
-        // System.err.println("listing messages");
         Connection conn = null;
         PreparedStatement listMessages = null;
         ResultSet rsListMessages = null;

http://git-wip-us.apache.org/repos/asf/james-project/blob/2d6d69ec/server/data/data-jdbc/src/test/java/org/apache/james/mailrepository/jdbc/JDBCMailRepositoryTest.java
----------------------------------------------------------------------
diff --git a/server/data/data-jdbc/src/test/java/org/apache/james/mailrepository/jdbc/JDBCMailRepositoryTest.java b/server/data/data-jdbc/src/test/java/org/apache/james/mailrepository/jdbc/JDBCMailRepositoryTest.java
index 08f03fd..db385a0 100644
--- a/server/data/data-jdbc/src/test/java/org/apache/james/mailrepository/jdbc/JDBCMailRepositoryTest.java
+++ b/server/data/data-jdbc/src/test/java/org/apache/james/mailrepository/jdbc/JDBCMailRepositoryTest.java
@@ -19,9 +19,6 @@
 
 package org.apache.james.mailrepository.jdbc;
 
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.junit.jupiter.api.Assertions.assertAll;
-
 import java.sql.SQLException;
 
 import javax.sql.DataSource;
@@ -33,11 +30,8 @@ import org.apache.james.filesystem.api.mock.MockFileSystem;
 import org.apache.james.lifecycle.api.LifecycleUtil;
 import org.apache.james.mailrepository.MailRepositoryContract;
 import org.apache.james.mailrepository.api.MailRepository;
-import org.apache.mailet.Mail;
 import org.junit.jupiter.api.AfterEach;
 import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Disabled;
-import org.junit.jupiter.api.Test;
 
 public class JDBCMailRepositoryTest implements MailRepositoryContract {
 
@@ -78,22 +72,4 @@ public class JDBCMailRepositoryTest implements MailRepositoryContract {
         ds.setPassword("james");
         return ds;
     }
-
-    /**
-     * JAMES-2303 JDBC doesn't store PerRecipientSpecificHeaders
-     */
-    @Override
-    public void checkMailEquality(Mail actual, Mail expected) {
-        assertAll(
-            () -> assertThat(actual.getMessage().getContent()).isEqualTo(expected.getMessage().getContent()),
-            () -> assertThat(actual.getMessageSize()).isEqualTo(expected.getMessageSize()),
-            () -> assertThat(actual.getName()).isEqualTo(expected.getName()),
-            () -> assertThat(actual.getState()).isEqualTo(expected.getState()),
-            () -> assertThat(actual.getAttribute(TEST_ATTRIBUTE)).isEqualTo(expected.getAttribute(TEST_ATTRIBUTE)),
-            () -> assertThat(actual.getErrorMessage()).isEqualTo(expected.getErrorMessage()),
-            () -> assertThat(actual.getRemoteHost()).isEqualTo(expected.getRemoteHost()),
-            () -> assertThat(actual.getRemoteAddr()).isEqualTo(expected.getRemoteAddr()),
-            () -> assertThat(actual.getLastUpdated()).isEqualTo(expected.getLastUpdated())
-        );
-    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/2d6d69ec/server/data/data-jdbc/src/test/resources/sqlResources.xml
----------------------------------------------------------------------
diff --git a/server/data/data-jdbc/src/test/resources/sqlResources.xml b/server/data/data-jdbc/src/test/resources/sqlResources.xml
index b91f974..68cd0e7 100644
--- a/server/data/data-jdbc/src/test/resources/sqlResources.xml
+++ b/server/data/data-jdbc/src/test/resources/sqlResources.xml
@@ -257,11 +257,11 @@
     <!-- Statements used to insert a message into this repository. -->
     <sql name="insertMessageSQL">INSERT INTO ${table} (message_name,
     repository_name, message_state, error_message, sender, recipients,
-    remote_host, remote_addr, last_updated, message_body,
-    message_attributes) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)</sql>
+    remote_host, remote_addr, per_recipient_headers, last_updated, message_body,
+    message_attributes) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)</sql>
 
     <!-- Statements used to retrieve a message stored in this repository. -->
-    <sql name="retrieveMessageSQL">SELECT message_state, error_message, sender, recipients, remote_host, remote_addr, last_updated FROM ${table} WHERE message_name = ? AND repository_name = ?</sql>
+    <sql name="retrieveMessageSQL">SELECT message_state, error_message, sender, recipients, remote_host, remote_addr, per_recipient_headers, last_updated FROM ${table} WHERE message_name = ? AND repository_name = ?</sql>
 
     <!-- Statements used to retrieve the body of a message stored in this repository. -->
     <sql name="retrieveMessageBodySQL">SELECT message_body FROM ${table} WHERE message_name = ? AND repository_name = ?</sql>
@@ -303,6 +303,7 @@
             remote_addr varchar (20) NOT NULL ,
             message_body longblob NOT NULL ,
             message_attributes longblob NULL ,
+            per_recipient_headers longblob NULL ,
             last_updated datetime NOT NULL,
             PRIMARY KEY (repository_name, message_name)
         )
@@ -319,6 +320,7 @@
             remote_addr varchar (20) NOT NULL ,
             message_body varchar NOT NULL ,
             message_attributes varchar NULL ,
+            per_recipient_headers varchar NULL ,
             last_updated timestamp NOT NULL,
             PRIMARY KEY (repository_name, message_name)
         )
@@ -335,6 +337,7 @@
             remote_addr varchar (20) NOT NULL ,
             message_body varchar NOT NULL ,
             message_attributes varchar NULL ,
+            per_recipient_headers varchar NULL ,
             last_updated timestamp NOT NULL,
             PRIMARY KEY (repository_name, message_name)
         )
@@ -351,6 +354,7 @@
             [remote_addr] [varchar] (20) NOT NULL ,
             [message_body] [image] NOT NULL ,
             [message_attributes] [image] NULL ,
+            [per_recipient_headers] [image] NULL ,
             [last_updated] [datetime] NOT NULL,
             PRIMARY KEY (repository_name, message_name)
         )
@@ -367,6 +371,7 @@
             remote_addr varchar2(20) NOT NULL ,
             message_body blob NOT NULL ,
             message_attributes blob NULL ,
+            per_recipient_headers blob NULL ,
             last_updated date NOT NULL ,
             PRIMARY KEY (repository_name, message_name)
         )
@@ -383,6 +388,7 @@
             remote_addr varchar (20) NOT NULL ,
             message_body bytea NOT NULL ,
             message_attributes bytea NULL ,
+            per_recipient_headers bytea NULL ,
             last_updated timestamp NOT NULL,
             PRIMARY KEY (repository_name, message_name)
         )
@@ -399,6 +405,7 @@
             remote_addr varchar (20) NOT NULL ,
             message_body long byte NOT NULL ,
             message_attributes long byte NULL ,
+            per_recipient_headers long byte NULL ,
             last_updated date NOT NULL,
             PRIMARY KEY (repository_name, message_name)
         )
@@ -415,6 +422,7 @@
             remote_addr varchar(20) NOT NULL ,
             message_body blob NOT NULL ,
             message_attributes blob ,
+            per_recipient_headers blob ,
             last_updated timestamp NOT NULL ,
             PRIMARY KEY (repository_name, message_name)
         )
@@ -431,6 +439,7 @@
             remote_addr varchar (20) NOT NULL ,
             message_body LONG BYTE NOT NULL ,
             message_attributes LONG BYTE ,
+            per_recipient_headers LONG BYTE ,
             last_updated DATE NOT NULL
         )
     </sql>
@@ -446,6 +455,7 @@
             remote_addr varchar (20) NOT NULL ,
             message_body blob NOT NULL ,
             message_attributes blob ,
+            per_recipient_headers blob ,
             last_updated timestamp NOT NULL,
             PRIMARY KEY (repository_name, message_name)
         )


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


[7/8] james-project git commit: JAMES-2498 JDBCMailRepository should not materialize entities for counting them.

Posted by bt...@apache.org.
JAMES-2498 JDBCMailRepository should not materialize entities for counting them.

Executing SQL query for size.


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

Branch: refs/heads/master
Commit: a2cdc55108321fa70fbeea4a2e712af40d724dcb
Parents: ff93cf5
Author: Edgar Asatryan <ns...@gmail.com>
Authored: Tue Jul 24 19:06:55 2018 +0400
Committer: benwa <bt...@linagora.com>
Committed: Mon Jul 30 13:54:04 2018 +0700

----------------------------------------------------------------------
 .../james/mailrepository/jdbc/JDBCMailRepository.java   | 12 ++++++++++++
 .../data/data-jdbc/src/test/resources/sqlResources.xml  |  3 +++
 2 files changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/a2cdc551/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java
----------------------------------------------------------------------
diff --git a/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java b/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java
index 31a728e..9875676 100644
--- a/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java
+++ b/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java
@@ -722,6 +722,18 @@ public class JDBCMailRepository extends AbstractMailRepository {
     }
 
     @Override
+    public long size() throws MessagingException {
+        try (Connection conn = datasource.getConnection();
+             PreparedStatement count = conn.prepareStatement(sqlQueries.getSqlString("countMessagesSQL", true));
+             ResultSet resultSet = count.executeQuery()) {
+
+            return resultSet.next() ? resultSet.getLong(1) : 0;
+        } catch (Exception e) {
+            throw new MessagingException("Exception while fetching size: " + e.getMessage(), e);
+        }
+    }
+
+    @Override
     public Iterator<MailKey> list() throws MessagingException {
         // System.err.println("listing messages");
         Connection conn = null;

http://git-wip-us.apache.org/repos/asf/james-project/blob/a2cdc551/server/data/data-jdbc/src/test/resources/sqlResources.xml
----------------------------------------------------------------------
diff --git a/server/data/data-jdbc/src/test/resources/sqlResources.xml b/server/data/data-jdbc/src/test/resources/sqlResources.xml
index 4fe890c..b91f974 100644
--- a/server/data/data-jdbc/src/test/resources/sqlResources.xml
+++ b/server/data/data-jdbc/src/test/resources/sqlResources.xml
@@ -287,6 +287,9 @@
     <!-- Statements used to list all messages stored in this repository. -->
     <sql name="listMessagesSQL">SELECT message_name, message_state, last_updated FROM ${table} WHERE repository_name = ? ORDER BY last_updated ASC</sql>
 
+    <!-- Statements used to count messages stored in this repository. -->
+    <sql name="countMessagesSQL">SELECT COUNT(*) FROM ${table}</sql>
+
     <!-- Statements used to create the table associated with this class. -->
     <sql name="createTable" db="mysql">
         CREATE TABLE ${table} (


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


[6/8] james-project git commit: JAMES-2492 Cut off the maven dependency of Karaf implementation

Posted by bt...@apache.org.
JAMES-2492 Cut off the maven dependency of Karaf implementation


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

Branch: refs/heads/master
Commit: ff93cf59147e84d799f8d9345b9e2cb2724c3de1
Parents: 1f51b69
Author: Antoine Duprat <ad...@linagora.com>
Authored: Mon Jul 23 15:01:44 2018 +0200
Committer: benwa <bt...@linagora.com>
Committed: Mon Jul 30 13:52:48 2018 +0700

----------------------------------------------------------------------
 pom.xml        | 22 ----------------------
 server/pom.xml |  3 ---
 2 files changed, 25 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/ff93cf59/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 723c7ee..e37be8a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2094,28 +2094,6 @@
                 <version>${jackrabbit.version}</version>
             </dependency>
             <dependency>
-                <groupId>${james.groupId}</groupId>
-                <artifactId>james-karaf-distribution</artifactId>
-                <version>${project.version}</version>
-                <type>tar.gz</type>
-                <exclusions>
-                    <exclusion>
-                        <groupId>org.apache.karaf</groupId>
-                        <artifactId>org.apache.karaf.client</artifactId>
-                    </exclusion>
-                    <exclusion>
-                        <groupId>org.eclipse.osgi</groupId>
-                        <artifactId>org.eclipse.osgi</artifactId>
-                    </exclusion>
-                </exclusions>
-            </dependency>
-            <dependency>
-                <groupId>${james.groupId}</groupId>
-                <artifactId>james-karaf-features</artifactId>
-                <version>${project.version}</version>
-                <type>pom</type>
-            </dependency>
-            <dependency>
                 <groupId>org.apache.james.jspf</groupId>
                 <artifactId>apache-jspf-resolver</artifactId>
                 <version>${apache-jspf-resolver.version}</version>

http://git-wip-us.apache.org/repos/asf/james-project/blob/ff93cf59/server/pom.xml
----------------------------------------------------------------------
diff --git a/server/pom.xml b/server/pom.xml
index e4a5265..b1b61e3 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -73,9 +73,6 @@
         <module>dns-service/dnsservice-dnsjava</module>
         <module>dns-service/dnsservice-library</module>
 
-        <module>karaf/distribution</module>
-        <module>karaf/features</module>
-        <module>karaf/integration</module>
         <module>mailet/integration-testing</module>
 
         <module>mailet/mailetcontainer-api</module>


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


[5/8] james-project git commit: JAMES-2470 Enable Tika container to be reused across classes

Posted by bt...@apache.org.
JAMES-2470 Enable Tika container to be reused across classes


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

Branch: refs/heads/master
Commit: 1f51b69dd778724592b0a1030add9ce2d5f6c31f
Parents: ddf6a53
Author: benwa <bt...@linagora.com>
Authored: Thu Jul 26 10:01:08 2018 +0700
Committer: benwa <bt...@linagora.com>
Committed: Mon Jul 30 13:51:28 2018 +0700

----------------------------------------------------------------------
 mailbox/elasticsearch/pom.xml                   | 12 +++++
 .../ElasticSearchIntegrationTest.java           |  4 +-
 .../json/IndexableMessageTest.java              |  4 +-
 .../json/MessageToElasticSearchJsonTest.java    |  4 +-
 .../james/mailbox/tika/TikaContainer.java       |  2 +-
 .../tika/TikaContainerSingletonRule.java        | 56 ++++++++++++++++++++
 6 files changed, 75 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/1f51b69d/mailbox/elasticsearch/pom.xml
----------------------------------------------------------------------
diff --git a/mailbox/elasticsearch/pom.xml b/mailbox/elasticsearch/pom.xml
index 22263b5..f2a2efd 100644
--- a/mailbox/elasticsearch/pom.xml
+++ b/mailbox/elasticsearch/pom.xml
@@ -172,4 +172,16 @@
         </dependency>
     </dependencies>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <reuseForks>true</reuseForks>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>

http://git-wip-us.apache.org/repos/asf/james-project/blob/1f51b69d/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIntegrationTest.java
----------------------------------------------------------------------
diff --git a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIntegrationTest.java b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIntegrationTest.java
index f237799..c6225c9 100644
--- a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIntegrationTest.java
+++ b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIntegrationTest.java
@@ -44,7 +44,7 @@ import org.apache.james.mailbox.model.SearchQuery;
 import org.apache.james.mailbox.store.StoreMessageIdManager;
 import org.apache.james.mailbox.store.search.AbstractMessageSearchIndexTest;
 import org.apache.james.mailbox.tika.TikaConfiguration;
-import org.apache.james.mailbox.tika.TikaContainer;
+import org.apache.james.mailbox.tika.TikaContainerSingletonRule;
 import org.apache.james.mailbox.tika.TikaHttpClientImpl;
 import org.apache.james.mailbox.tika.TikaTextExtractor;
 import org.apache.james.metrics.api.NoopMetricFactory;
@@ -70,7 +70,7 @@ public class ElasticSearchIntegrationTest extends AbstractMessageSearchIndexTest
     public RuleChain ruleChain = RuleChain.outerRule(temporaryFolder).around(embeddedElasticSearch);
 
     @ClassRule
-    public static TikaContainer tika = new TikaContainer();
+    public static TikaContainerSingletonRule tika = TikaContainerSingletonRule.rule;
     private TikaTextExtractor textExtractor;
 
     @Override

http://git-wip-us.apache.org/repos/asf/james-project/blob/1f51b69d/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessageTest.java
----------------------------------------------------------------------
diff --git a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessageTest.java b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessageTest.java
index 5119130..67535ff 100644
--- a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessageTest.java
+++ b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/IndexableMessageTest.java
@@ -33,6 +33,7 @@ import javax.mail.Flags;
 
 import org.apache.james.mailbox.MessageUid;
 import org.apache.james.mailbox.elasticsearch.IndexAttachments;
+import org.apache.james.mailbox.tika.TikaContainerSingletonRule;
 import org.apache.james.mailbox.extractor.ParsedContent;
 import org.apache.james.mailbox.extractor.TextExtractor;
 import org.apache.james.mailbox.inmemory.InMemoryMessageId;
@@ -44,7 +45,6 @@ import org.apache.james.mailbox.store.mail.model.MailboxMessage;
 import org.apache.james.mailbox.store.mail.model.impl.PropertyBuilder;
 import org.apache.james.mailbox.store.mail.model.impl.SimpleProperty;
 import org.apache.james.mailbox.tika.TikaConfiguration;
-import org.apache.james.mailbox.tika.TikaContainer;
 import org.apache.james.mailbox.tika.TikaHttpClientImpl;
 import org.apache.james.mailbox.tika.TikaTextExtractor;
 import org.apache.james.metrics.api.NoopMetricFactory;
@@ -61,7 +61,7 @@ public class IndexableMessageTest {
     public static final MessageUid MESSAGE_UID = MessageUid.of(154);
 
     @ClassRule
-    public static TikaContainer tika = new TikaContainer();
+    public static TikaContainerSingletonRule tika = TikaContainerSingletonRule.rule;
 
     private TikaTextExtractor textExtractor;
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/1f51b69d/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJsonTest.java
----------------------------------------------------------------------
diff --git a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJsonTest.java b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJsonTest.java
index a7d1943..9529e60 100644
--- a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJsonTest.java
+++ b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/json/MessageToElasticSearchJsonTest.java
@@ -36,6 +36,7 @@ import org.apache.james.mailbox.FlagsBuilder;
 import org.apache.james.mailbox.MailboxSession.User;
 import org.apache.james.mailbox.MessageUid;
 import org.apache.james.mailbox.elasticsearch.IndexAttachments;
+import org.apache.james.mailbox.tika.TikaContainerSingletonRule;
 import org.apache.james.mailbox.extractor.TextExtractor;
 import org.apache.james.mailbox.mock.MockMailboxSession;
 import org.apache.james.mailbox.model.MessageId;
@@ -46,7 +47,6 @@ import org.apache.james.mailbox.store.mail.model.MailboxMessage;
 import org.apache.james.mailbox.store.mail.model.impl.PropertyBuilder;
 import org.apache.james.mailbox.store.mail.model.impl.SimpleMailboxMessage;
 import org.apache.james.mailbox.tika.TikaConfiguration;
-import org.apache.james.mailbox.tika.TikaContainer;
 import org.apache.james.mailbox.tika.TikaHttpClientImpl;
 import org.apache.james.mailbox.tika.TikaTextExtractor;
 import org.apache.james.metrics.api.NoopMetricFactory;
@@ -73,7 +73,7 @@ public class MessageToElasticSearchJsonTest {
     private PropertyBuilder propertyBuilder;
 
     @ClassRule
-    public static TikaContainer tika = new TikaContainer();
+    public static TikaContainerSingletonRule tika = TikaContainerSingletonRule.rule;
 
     @Before
     public void setUp() throws Exception {

http://git-wip-us.apache.org/repos/asf/james-project/blob/1f51b69d/mailbox/tika/src/test/java/org/apache/james/mailbox/tika/TikaContainer.java
----------------------------------------------------------------------
diff --git a/mailbox/tika/src/test/java/org/apache/james/mailbox/tika/TikaContainer.java b/mailbox/tika/src/test/java/org/apache/james/mailbox/tika/TikaContainer.java
index ec6b776..c2f23dc 100644
--- a/mailbox/tika/src/test/java/org/apache/james/mailbox/tika/TikaContainer.java
+++ b/mailbox/tika/src/test/java/org/apache/james/mailbox/tika/TikaContainer.java
@@ -47,7 +47,7 @@ public class TikaContainer extends ExternalResource {
         start();
     }
 
-    public void start() throws Exception {
+    public void start() {
         tika.start();
     }
 

http://git-wip-us.apache.org/repos/asf/james-project/blob/1f51b69d/mailbox/tika/src/test/java/org/apache/james/mailbox/tika/TikaContainerSingletonRule.java
----------------------------------------------------------------------
diff --git a/mailbox/tika/src/test/java/org/apache/james/mailbox/tika/TikaContainerSingletonRule.java b/mailbox/tika/src/test/java/org/apache/james/mailbox/tika/TikaContainerSingletonRule.java
new file mode 100644
index 0000000..1fefb78
--- /dev/null
+++ b/mailbox/tika/src/test/java/org/apache/james/mailbox/tika/TikaContainerSingletonRule.java
@@ -0,0 +1,56 @@
+/****************************************************************
+ * 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.mailbox.tika;
+
+import org.junit.rules.TestRule;
+import org.junit.runner.Description;
+import org.junit.runners.model.Statement;
+
+public class TikaContainerSingletonRule implements TestRule {
+
+    public static final TikaContainerSingletonRule rule = new TikaContainerSingletonRule(new TikaContainer());
+
+    private final TikaContainer tikaContainer;
+
+    private TikaContainerSingletonRule(TikaContainer tikaContainer) {
+        this.tikaContainer = tikaContainer;
+        this.tikaContainer.start();
+    }
+
+    @Override
+    public Statement apply(Statement statement, Description description) {
+        return statement;
+    }
+
+    public String getIp() {
+        return tikaContainer.getIp();
+    }
+
+    public int getPort() {
+        return tikaContainer.getPort();
+    }
+
+    public int getTimeoutInMillis() {
+        return tikaContainer.getTimeoutInMillis();
+    }
+    
+    // Cleanup will be performed by test container resource reaper
+
+}


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


[2/8] james-project git commit: Revert "fixup! upgrade org.testcontainers:testcontainers"

Posted by bt...@apache.org.
Revert "fixup! upgrade org.testcontainers:testcontainers"

This reverts commit 2c9eda147d3f5e2c1fd7d680850d315c1b31f1ff.


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

Branch: refs/heads/master
Commit: 2666bc49a35f4001d4a04141ba50e4687efa3a22
Parents: 60249c0
Author: benwa <bt...@linagora.com>
Authored: Fri Jul 27 17:23:39 2018 +0700
Committer: benwa <bt...@linagora.com>
Committed: Mon Jul 30 13:50:35 2018 +0700

----------------------------------------------------------------------
 .../org/apache/james/queue/rabbitmq/RabbitMQClusterTest.java   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/2666bc49/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQClusterTest.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQClusterTest.java b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQClusterTest.java
index 66bc342..26cf6e1 100644
--- a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQClusterTest.java
+++ b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/RabbitMQClusterTest.java
@@ -217,10 +217,10 @@ class RabbitMQClusterTest {
         @Test
         void connectingToAClusterWithAFailedRabbit(DockerRabbitMQCluster cluster) throws Exception {
             ConnectionFactory node3ConnectionFactory = cluster.getRabbitMQ3().connectionFactory();
-            try (Connection connection = node3ConnectionFactory.newConnection(cluster.getAddresses());
-                    Channel channel = connection.createChannel()) {
+            cluster.getRabbitMQ3().stop();
 
-                cluster.getRabbitMQ3().stop();
+            try (Connection connection = node3ConnectionFactory.newConnection(cluster.getAddresses());
+                 Channel channel = connection.createChannel()) {
 
                 channel.exchangeDeclare(EXCHANGE_NAME, DIRECT, DURABLE);
                 channel.queueDeclare(QUEUE, DURABLE, !EXCLUSIVE, !AUTO_DELETE, ImmutableMap.of()).getQueue();


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


[4/8] james-project git commit: JAMES-2470 Enable reuseForks to benefit from a single HBase cluster singleton

Posted by bt...@apache.org.
JAMES-2470 Enable reuseForks to benefit from a single HBase cluster singleton


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

Branch: refs/heads/master
Commit: ddf6a53d5eac1a23ace7b67b9424fb185eb08f6d
Parents: 5635e13
Author: benwa <bt...@linagora.com>
Authored: Thu Jul 26 09:59:17 2018 +0700
Committer: benwa <bt...@linagora.com>
Committed: Mon Jul 30 13:51:03 2018 +0700

----------------------------------------------------------------------
 mailbox/hbase/pom.xml          | 12 ++++++++++++
 server/data/data-hbase/pom.xml |  5 +----
 2 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/ddf6a53d/mailbox/hbase/pom.xml
----------------------------------------------------------------------
diff --git a/mailbox/hbase/pom.xml b/mailbox/hbase/pom.xml
index 3b6af03..b8d13af 100644
--- a/mailbox/hbase/pom.xml
+++ b/mailbox/hbase/pom.xml
@@ -133,4 +133,16 @@
         </dependency>
     </dependencies>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <reuseForks>true</reuseForks>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
 </project>

http://git-wip-us.apache.org/repos/asf/james-project/blob/ddf6a53d/server/data/data-hbase/pom.xml
----------------------------------------------------------------------
diff --git a/server/data/data-hbase/pom.xml b/server/data/data-hbase/pom.xml
index f4d1d8e..cd7fab7 100644
--- a/server/data/data-hbase/pom.xml
+++ b/server/data/data-hbase/pom.xml
@@ -173,10 +173,7 @@
                 <groupId>org.apache.maven.plugins</groupId>
                 <artifactId>maven-surefire-plugin</artifactId>
                 <configuration>
-                    <forkMode>pertest</forkMode>
-                    <argLine>-Xms256m -Xmx512m</argLine>
-                    <testFailureIgnore>false</testFailureIgnore>
-                    <skip>false</skip>
+                    <reuseForks>true</reuseForks>
                 </configuration>
             </plugin>
             <plugin>


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


[3/8] james-project git commit: JAMES-2500 Don't fail when RabbitMQCluster fails to stop

Posted by bt...@apache.org.
JAMES-2500 Don't fail when RabbitMQCluster fails to stop


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

Branch: refs/heads/master
Commit: 60249c0d3c6da95c2bb9c7b09c54315762790a9f
Parents: cfd46a1
Author: benwa <bt...@linagora.com>
Authored: Thu Jul 26 16:49:24 2018 +0700
Committer: benwa <bt...@linagora.com>
Committed: Mon Jul 30 13:50:35 2018 +0700

----------------------------------------------------------------------
 .../james/queue/rabbitmq/DockerClusterRabbitMQExtension.java   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/60249c0d/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/DockerClusterRabbitMQExtension.java
----------------------------------------------------------------------
diff --git a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/DockerClusterRabbitMQExtension.java b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/DockerClusterRabbitMQExtension.java
index bbe9457..a24dde9 100644
--- a/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/DockerClusterRabbitMQExtension.java
+++ b/server/queue/queue-rabbitmq/src/test/java/org/apache/james/queue/rabbitmq/DockerClusterRabbitMQExtension.java
@@ -103,9 +103,9 @@ public class DockerClusterRabbitMQExtension implements BeforeEachCallback, After
 
         public void stop() {
             Runnables.runParallel(
-                rabbitMQ1::stop,
-                rabbitMQ2::stop,
-                rabbitMQ3::stop);
+                Throwing.runnable(rabbitMQ1::stop).orDoNothing(),
+                Throwing.runnable(rabbitMQ2::stop).orDoNothing(),
+                Throwing.runnable(rabbitMQ3::stop).orDoNothing());
         }
 
         public DockerRabbitMQ getRabbitMQ1() {


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