You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@james.apache.org by bt...@apache.org on 2021/06/29 01:34:43 UTC
[james-project] 02/09: JAMES-3621 Move JPA-SMTP mariaDB tests to
main JPA-SMTP package
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 138580fa57dfccf76fb508a3a2096dc8e5ac697d
Author: Benoit Tellier <bt...@linagora.com>
AuthorDate: Fri Jun 25 13:20:53 2021 +0700
JAMES-3621 Move JPA-SMTP mariaDB tests to main JPA-SMTP package
---
server/apps/jpa-smtp-app/pom.xml | 12 +++
.../james/mariadb/JPAMariaDBJamesServerTest.java} | 8 +-
.../TestJPAMariaDBConfigurationModule.java} | 6 +-
.../src/test/resources/dnsservice.xml | 25 -----
.../src/test/resources/domainlist.xml | 24 -----
.../src/test/resources/fakemailrepositorystore.xml | 31 ------
.../src/test/resources/keystore | Bin 2245 -> 0 bytes
.../src/test/resources/mailetcontainer.xml | 120 ---------------------
.../src/test/resources/mailrepositorystore.xml | 31 ------
.../src/test/resources/smtpserver.xml | 102 ------------------
10 files changed, 20 insertions(+), 339 deletions(-)
diff --git a/server/apps/jpa-smtp-app/pom.xml b/server/apps/jpa-smtp-app/pom.xml
index 94e94b9..8b988bc 100644
--- a/server/apps/jpa-smtp-app/pom.xml
+++ b/server/apps/jpa-smtp-app/pom.xml
@@ -113,10 +113,22 @@
<scope>test</scope>
</dependency>
<dependency>
+ <groupId>org.mariadb.jdbc</groupId>
+ <artifactId>mariadb-java-client</artifactId>
+ <version>2.7.2</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.testcontainers</groupId>
+ <artifactId>mariadb</artifactId>
+ <version>${testcontainers.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/server/apps/jpa-smtp-mariadb-app/src/test/java/org/apache/james/JPAJamesServerTest.java b/server/apps/jpa-smtp-app/src/test/java/org/apache/james/mariadb/JPAMariaDBJamesServerTest.java
similarity index 93%
rename from server/apps/jpa-smtp-mariadb-app/src/test/java/org/apache/james/JPAJamesServerTest.java
rename to server/apps/jpa-smtp-app/src/test/java/org/apache/james/mariadb/JPAMariaDBJamesServerTest.java
index 6f141fb..be9a34b 100644
--- a/server/apps/jpa-smtp-mariadb-app/src/test/java/org/apache/james/JPAJamesServerTest.java
+++ b/server/apps/jpa-smtp-app/src/test/java/org/apache/james/mariadb/JPAMariaDBJamesServerTest.java
@@ -17,7 +17,7 @@
* under the License. *
****************************************************************/
-package org.apache.james;
+package org.apache.james.mariadb;
import static org.assertj.core.api.Assertions.assertThat;
@@ -27,6 +27,8 @@ import java.nio.ByteBuffer;
import java.nio.channels.SocketChannel;
import java.nio.charset.StandardCharsets;
+import org.apache.james.GuiceJamesServer;
+import org.apache.james.JPAJamesServerMain;
import org.apache.james.modules.protocols.SmtpGuiceProbe;
import org.apache.james.server.core.configuration.Configuration;
import org.junit.After;
@@ -36,7 +38,7 @@ import org.junit.Test;
import org.junit.rules.TemporaryFolder;
import org.testcontainers.containers.MariaDBContainer;
-public class JPAJamesServerTest {
+public class JPAMariaDBJamesServerTest {
private GuiceJamesServer server;
private SocketChannel socketChannel;
@@ -66,7 +68,7 @@ public class JPAJamesServerTest {
.build();
return JPAJamesServerMain.createServer(configuration)
- .overrideWith(new TestJPAConfigurationModule(mariaDBUrl));
+ .overrideWith(new TestJPAMariaDBConfigurationModule(mariaDBUrl));
}
@After
diff --git a/server/apps/jpa-smtp-mariadb-app/src/test/java/org/apache/james/TestJPAConfigurationModule.java b/server/apps/jpa-smtp-app/src/test/java/org/apache/james/mariadb/TestJPAMariaDBConfigurationModule.java
similarity index 92%
rename from server/apps/jpa-smtp-mariadb-app/src/test/java/org/apache/james/TestJPAConfigurationModule.java
rename to server/apps/jpa-smtp-app/src/test/java/org/apache/james/mariadb/TestJPAMariaDBConfigurationModule.java
index 070d398..bc7d7a7 100644
--- a/server/apps/jpa-smtp-mariadb-app/src/test/java/org/apache/james/TestJPAConfigurationModule.java
+++ b/server/apps/jpa-smtp-app/src/test/java/org/apache/james/mariadb/TestJPAMariaDBConfigurationModule.java
@@ -17,7 +17,7 @@
* under the License. *
****************************************************************/
-package org.apache.james;
+package org.apache.james.mariadb;
import javax.inject.Singleton;
@@ -26,14 +26,14 @@ import org.apache.james.modules.data.JPAConfiguration;
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
-public class TestJPAConfigurationModule extends AbstractModule {
+public class TestJPAMariaDBConfigurationModule extends AbstractModule {
private static final String MARIA_USERNAME = "test";
private static final String MARIA_PASSWORD = "test";
private static final String JDBC_EMBEDDED_DRIVER = org.mariadb.jdbc.Driver.class.getName();
private final String mariaDBUrl;
- public TestJPAConfigurationModule(String mariaDBUrl) {
+ public TestJPAMariaDBConfigurationModule(String mariaDBUrl) {
this.mariaDBUrl = mariaDBUrl;
}
diff --git a/server/apps/jpa-smtp-mariadb-app/src/test/resources/dnsservice.xml b/server/apps/jpa-smtp-mariadb-app/src/test/resources/dnsservice.xml
deleted file mode 100644
index 6e4fbd2..0000000
--- a/server/apps/jpa-smtp-mariadb-app/src/test/resources/dnsservice.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- -->
-
-<dnsservice>
- <autodiscover>true</autodiscover>
- <authoritative>false</authoritative>
- <maxcachesize>50000</maxcachesize>
-</dnsservice>
diff --git a/server/apps/jpa-smtp-mariadb-app/src/test/resources/domainlist.xml b/server/apps/jpa-smtp-mariadb-app/src/test/resources/domainlist.xml
deleted file mode 100644
index fe17431..0000000
--- a/server/apps/jpa-smtp-mariadb-app/src/test/resources/domainlist.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0"?>
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- -->
-
-<domainlist>
- <autodetect>false</autodetect>
- <autodetectIP>false</autodetectIP>
-</domainlist>
diff --git a/server/apps/jpa-smtp-mariadb-app/src/test/resources/fakemailrepositorystore.xml b/server/apps/jpa-smtp-mariadb-app/src/test/resources/fakemailrepositorystore.xml
deleted file mode 100644
index 2d19a802..0000000
--- a/server/apps/jpa-smtp-mariadb-app/src/test/resources/fakemailrepositorystore.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- -->
-
-<mailrepositorystore>
- <mailrepositories>
- <mailrepository class="org.apache.james.mailrepository.None">
- <protocols>
- <protocol>file</protocol>
- </protocols>
- <config FIFO="false" CACHEKEYS="true"/>
- </mailrepository>
- </mailrepositories>
-</mailrepositorystore>
diff --git a/server/apps/jpa-smtp-mariadb-app/src/test/resources/keystore b/server/apps/jpa-smtp-mariadb-app/src/test/resources/keystore
deleted file mode 100644
index 536a6c7..0000000
Binary files a/server/apps/jpa-smtp-mariadb-app/src/test/resources/keystore and /dev/null differ
diff --git a/server/apps/jpa-smtp-mariadb-app/src/test/resources/mailetcontainer.xml b/server/apps/jpa-smtp-mariadb-app/src/test/resources/mailetcontainer.xml
deleted file mode 100644
index 6b79da2..0000000
--- a/server/apps/jpa-smtp-mariadb-app/src/test/resources/mailetcontainer.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- -->
-
-<mailetcontainer enableJmx="true">
-
- <context>
- <postmaster>postmaster</postmaster>
- </context>
-
- <spooler>
- <threads>20</threads>
- </spooler>
-
- <processors>
- <processor state="root" enableJmx="true">
- <mailet match="All" class="PostmasterAlias"/>
- <mailet match="RelayLimit=30" class="Null"/>
-
- <mailet match="SMTPAuthSuccessful" class="ToProcessor">
- <processor>transport</processor>
- </mailet>
-
- <mailet match="All" class="ToProcessor">
- <processor>transport</processor>
- </mailet>
- </processor>
-
- <processor state="error" enableJmx="true">
- <mailet match="All" class="Bounce">
- <onMailetException>ignore</onMailetException>
- </mailet>
- <mailet match="All" class="ToRepository">
- <repositoryPath>file://var/mail/error/</repositoryPath>
- <onMailetException>ignore</onMailetException>
- </mailet>
- </processor>
-
-
- <processor state="transport" enableJmx="true">
- <mailet match="All" class="RemoveMimeHeader">
- <name>bcc</name>
- </mailet>
- <mailet match="All" class="RecipientRewriteTable">
- <errorProcessor>rrt-error</errorProcessor>
- </mailet>
- <mailet match="All" class="RemoteDelivery">
- <outgoingQueue>outgoing</outgoingQueue>
- <delayTime>5 minutes</delayTime>
- <delayTime>10 minutes</delayTime>
- <delayTime>45 minutes</delayTime>
- <delayTime>2 hours</delayTime>
- <delayTime>3 hours</delayTime>
- <delayTime>6 hours</delayTime>
- <maxRetries>0</maxRetries>
- <maxDnsProblemRetries>0</maxDnsProblemRetries>
- <deliveryThreads>1</deliveryThreads>
- <sendpartial>false</sendpartial>
- <bounceProcessor>bounces</bounceProcessor>
- </mailet>
- </processor>
-
- <processor state="local-address-error" enableJmx="true">
- <mailet match="All" class="Bounce">
- <attachment>none</attachment>
- <passThrough>true</passThrough>
- <debug>true</debug>
- </mailet>
- <mailet match="All" class="ToRepository">
- <repositoryPath>file://var/mail/address-error/</repositoryPath>
- </mailet>
- </processor>
-
- <processor state="relay-denied" enableJmx="true">
- <mailet match="All" class="Bounce">
- <attachment>none</attachment>
- </mailet>
- <mailet match="All" class="ToRepository">
- <repositoryPath>file://var/mail/relay-denied/</repositoryPath>
- <notice>Warning: You are sending an e-mail to a remote server. You must be authentified to perform such an operation</notice>
- </mailet>
- </processor>
-
- <processor state="bounces" enableJmx="true">
- <mailet match="All" class="DSNBounce">
- <passThrough>false</passThrough>
- </mailet>
- </processor>
-
- <processor state="rrt-error" enableJmx="false">
- <mailet match="All" class="ToRepository">
- <repositoryPath>file://var/mail/rrt-error/</repositoryPath>
- <passThrough>true</passThrough>
- </mailet>
- <mailet match="IsSenderInRRTLoop" class="Null"/>
- <mailet match="All" class="Bounce">
- <notice>We were unable to deliver the attached message to the following recipients due to an address rewriting issue.</notice>
- </mailet>
- </processor>
- </processors>
-
-</mailetcontainer>
-
diff --git a/server/apps/jpa-smtp-mariadb-app/src/test/resources/mailrepositorystore.xml b/server/apps/jpa-smtp-mariadb-app/src/test/resources/mailrepositorystore.xml
deleted file mode 100644
index 3ca4a1d..0000000
--- a/server/apps/jpa-smtp-mariadb-app/src/test/resources/mailrepositorystore.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- -->
-
-<mailrepositorystore>
- <mailrepositories>
- <mailrepository class="org.apache.james.mailrepository.file.FileMailRepository">
- <protocols>
- <protocol>file</protocol>
- </protocols>
- <config FIFO="false" CACHEKEYS="true"/>
- </mailrepository>
- </mailrepositories>
-</mailrepositorystore>
diff --git a/server/apps/jpa-smtp-mariadb-app/src/test/resources/smtpserver.xml b/server/apps/jpa-smtp-mariadb-app/src/test/resources/smtpserver.xml
deleted file mode 100644
index 4fb392d..0000000
--- a/server/apps/jpa-smtp-mariadb-app/src/test/resources/smtpserver.xml
+++ /dev/null
@@ -1,102 +0,0 @@
-<?xml version="1.0"?>
-
-<!--
- Licensed to the Apache Software Foundation (ASF) under one
- or more contributor license agreements. See the NOTICE file
- distributed with this work for additional information
- regarding copyright ownership. The ASF licenses this file
- to you under the Apache License, Version 2.0 (the
- "License"); you may not use this file except in compliance
- with the License. You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing,
- software distributed under the License is distributed on an
- "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- KIND, either express or implied. See the License for the
- specific language governing permissions and limitations
- under the License.
- -->
-
-<smtpservers>
- <smtpserver enabled="true">
- <jmxName>smtpserver-global</jmxName>
- <bind>0.0.0.0:0</bind>
- <connectionBacklog>200</connectionBacklog>
- <tls socketTLS="false" startTLS="false">
- <keystore>file://conf/keystore</keystore>
- <secret>james72laBalle</secret>
- <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
- <algorithm>SunX509</algorithm>
- </tls>
- <connectiontimeout>360</connectiontimeout>
- <connectionLimit>0</connectionLimit>
- <connectionLimitPerIP>0</connectionLimitPerIP>
- <authRequired>false</authRequired>
- <verifyIdentity>false</verifyIdentity>
- <maxmessagesize>0</maxmessagesize>
- <addressBracketsEnforcement>true</addressBracketsEnforcement>
- <smtpGreeting>Apache JAMES awesome SMTP Server</smtpGreeting>
- <handlerchain>
- <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/>
- <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/>
- </handlerchain>
- </smtpserver>
- <smtpserver enabled="true">
- <jmxName>smtpserver-TLS</jmxName>
- <bind>0.0.0.0:0</bind>
- <connectionBacklog>200</connectionBacklog>
- <tls socketTLS="false" startTLS="false">
- <keystore>file://conf/keystore</keystore>
- <secret>james72laBalle</secret>
- <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
- <algorithm>SunX509</algorithm>
- </tls>
- <connectiontimeout>360</connectiontimeout>
- <connectionLimit>0</connectionLimit>
- <connectionLimitPerIP>0</connectionLimitPerIP>
- <!--
- Authorize only local users
- -->
- <authRequired>true</authRequired>
- <!-- Trust authenticated users -->
- <verifyIdentity>false</verifyIdentity>
- <maxmessagesize>0</maxmessagesize>
- <addressBracketsEnforcement>true</addressBracketsEnforcement>
- <smtpGreeting>Apache JAMES awesome SMTP Server</smtpGreeting>
- <handlerchain>
- <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/>
- <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/>
- </handlerchain>
- </smtpserver>
- <smtpserver enabled="true">
- <jmxName>smtpserver-authenticated</jmxName>
- <bind>0.0.0.0:1587</bind>
- <connectionBacklog>200</connectionBacklog>
- <tls socketTLS="false" startTLS="false">
- <keystore>file://conf/keystore</keystore>
- <secret>james72laBalle</secret>
- <provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
- <algorithm>SunX509</algorithm>
- </tls>
- <connectiontimeout>360</connectiontimeout>
- <connectionLimit>0</connectionLimit>
- <connectionLimitPerIP>0</connectionLimitPerIP>
- <!--
- Authorize only local users
- -->
- <authRequired>true</authRequired>
- <!-- Trust authenticated users -->
- <verifyIdentity>false</verifyIdentity>
- <maxmessagesize>0</maxmessagesize>
- <addressBracketsEnforcement>true</addressBracketsEnforcement>
- <smtpGreeting>Apache JAMES awesome SMTP Server</smtpGreeting>
- <handlerchain>
- <handler class="org.apache.james.smtpserver.fastfail.ValidRcptHandler"/>
- <handler class="org.apache.james.smtpserver.CoreCmdHandlerLoader"/>
- </handlerchain>
- </smtpserver>
-</smtpservers>
-
-
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@james.apache.org
For additional commands, e-mail: notifications-help@james.apache.org