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

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

commit bf9a4b1d00594219269665232ea05de80edc3d8f
Author: Quan Tran <[email protected]>
AuthorDate: Mon Jan 8 14:43:47 2024 +0700

    JAMES-2586 PostgresDeletedMessageVaultIntegrationTest
    
    Can not rely on `DeletedMessageVaultIntegrationTest` for now, as it 
requires `JmapGuiceProbe`.
---
 Jenkinsfile                                        |   1 +
 pom.xml                                            |  11 ++
 .../org/apache/james/PostgresJamesServerMain.java  |   2 +-
 server/protocols/webadmin-integration-test/pom.xml |   1 +
 .../postgres-webadmin-integration-test/pom.xml     | 114 ++++++++++++++++++
 ...PostgresDeletedMessageVaultIntegrationTest.java | 131 +++++++++++++++++++++
 .../src/test/resources/dnsservice.xml              |  25 ++++
 .../src/test/resources/domainlist.xml              |  24 ++++
 .../src/test/resources/imapserver.xml              |  41 +++++++
 .../src/test/resources/jwt_publickey               |   9 ++
 .../src/test/resources/listeners.xml               |  49 ++++++++
 .../src/test/resources/lmtpserver.xml              |  23 ++++
 .../src/test/resources/mailetcontainer.xml         | 117 ++++++++++++++++++
 .../src/test/resources/mailrepositorystore.xml     |  31 +++++
 .../src/test/resources/managesieveserver.xml       |  32 +++++
 .../src/test/resources/pop3server.xml              |  23 ++++
 .../src/test/resources/smtpserver.xml              |  54 +++++++++
 .../src/test/resources/webadmin.properties         |  27 +++++
 18 files changed, 714 insertions(+), 1 deletion(-)

diff --git a/Jenkinsfile b/Jenkinsfile
index cb220daa6e..b2be2d09b9 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -45,6 +45,7 @@ pipeline {
                 'server/container/guice/postgres-common,' +
                 'server/container/guice/mailbox-postgres,' +
                 'server/apps/postgres-app,' +
+                
'server/protocols/webadmin-integration-test/postgres-webadmin-integration-test,'
 +
                 'mpt/impl/imap-mailbox/postgres,' +
                 'event-bus/postgres,' +
                 'mailbox/plugin/deleted-messages-vault-postgres'
diff --git a/pom.xml b/pom.xml
index d36c4280e1..7f9582eb68 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1760,6 +1760,17 @@
                 <artifactId>james-server-onami</artifactId>
                 <version>${project.version}</version>
             </dependency>
+            <dependency>
+                <groupId>${james.groupId}</groupId>
+                <artifactId>james-server-postgres-app</artifactId>
+                <version>${project.version}</version>
+            </dependency>
+            <dependency>
+                <groupId>${james.groupId}</groupId>
+                <artifactId>james-server-postgres-app</artifactId>
+                <version>${project.version}</version>
+                <type>test-jar</type>
+            </dependency>
             <dependency>
                 <groupId>${james.groupId}</groupId>
                 <artifactId>james-server-protocols-imap4</artifactId>
diff --git 
a/server/apps/postgres-app/src/main/java/org/apache/james/PostgresJamesServerMain.java
 
b/server/apps/postgres-app/src/main/java/org/apache/james/PostgresJamesServerMain.java
index fd07cc23ac..5da7524604 100644
--- 
a/server/apps/postgres-app/src/main/java/org/apache/james/PostgresJamesServerMain.java
+++ 
b/server/apps/postgres-app/src/main/java/org/apache/james/PostgresJamesServerMain.java
@@ -127,7 +127,7 @@ public class PostgresJamesServerMain implements 
JamesServerMain {
         JamesServerMain.main(server);
     }
 
-    static GuiceJamesServer createServer(PostgresJamesConfiguration 
configuration) {
+    public static GuiceJamesServer createServer(PostgresJamesConfiguration 
configuration) {
         SearchConfiguration searchConfiguration = 
configuration.searchConfiguration();
 
         return GuiceJamesServer.forConfiguration(configuration)
diff --git a/server/protocols/webadmin-integration-test/pom.xml 
b/server/protocols/webadmin-integration-test/pom.xml
index ea9509f515..f3bd318799 100644
--- a/server/protocols/webadmin-integration-test/pom.xml
+++ b/server/protocols/webadmin-integration-test/pom.xml
@@ -35,6 +35,7 @@
     <modules>
         <module>distributed-webadmin-integration-test</module>
         <module>memory-webadmin-integration-test</module>
+        <module>postgres-webadmin-integration-test</module>
         <module>webadmin-integration-test-common</module>
     </modules>
 </project>
diff --git 
a/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/pom.xml
 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/pom.xml
new file mode 100644
index 0000000000..3bed95cec3
--- /dev/null
+++ 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/pom.xml
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.james</groupId>
+        <artifactId>webadmin-integration-test</artifactId>
+        <version>3.9.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>postgres-webadmin-integration-test</artifactId>
+    <packaging>jar</packaging>
+
+    <name>Apache James :: Server :: Web Admin server integration tests :: 
Postgres App</name>
+
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>${james.groupId}</groupId>
+                <artifactId>james-server-guice</artifactId>
+                <version>${project.version}</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
+    <dependencies>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>apache-james-backends-postgres</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>apache-james-mailbox-opensearch</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>blob-s3</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>blob-s3-guice</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-guice-opensearch</artifactId>
+            <version>${project.version}</version>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-postgres-app</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            <artifactId>james-server-postgres-app</artifactId>
+            <type>test-jar</type>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>${james.groupId}</groupId>
+            
<artifactId>james-server-webadmin-integration-test-common</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.testcontainers</groupId>
+            <artifactId>postgresql</artifactId>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <reuseForks>true</reuseForks>
+                    
<forkedProcessTimeoutInSeconds>1800</forkedProcessTimeoutInSeconds>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git 
a/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/vault/PostgresDeletedMessageVaultIntegrationTest.java
 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/vault/PostgresDeletedMessageVaultIntegrationTest.java
new file mode 100644
index 0000000000..fc12a04360
--- /dev/null
+++ 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/java/org/apache/james/webadmin/integration/vault/PostgresDeletedMessageVaultIntegrationTest.java
@@ -0,0 +1,131 @@
+/****************************************************************
+ * 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.webadmin.integration.vault;
+
+import static io.restassured.config.ParamConfig.UpdateStrategy.REPLACE;
+import static 
org.apache.james.data.UsersRepositoryModuleChooser.Implementation.DEFAULT;
+import static org.awaitility.Durations.FIVE_HUNDRED_MILLISECONDS;
+import static org.awaitility.Durations.ONE_MINUTE;
+
+import org.apache.james.GuiceJamesServer;
+import org.apache.james.JamesServerBuilder;
+import org.apache.james.JamesServerExtension;
+import org.apache.james.PostgresJamesConfiguration;
+import org.apache.james.PostgresJamesServerMain;
+import org.apache.james.SearchConfiguration;
+import org.apache.james.backends.postgres.PostgresExtension;
+import org.apache.james.mailbox.DefaultMailboxes;
+import org.apache.james.modules.protocols.ImapGuiceProbe;
+import org.apache.james.modules.protocols.SmtpGuiceProbe;
+import org.apache.james.utils.DataProbeImpl;
+import org.apache.james.utils.SMTPMessageSender;
+import org.apache.james.utils.TestIMAPClient;
+import org.apache.james.utils.WebAdminGuiceProbe;
+import org.apache.james.vault.VaultConfiguration;
+import org.apache.james.webadmin.WebAdminUtils;
+import org.awaitility.Awaitility;
+import org.awaitility.core.ConditionFactory;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+import io.restassured.config.ParamConfig;
+import io.restassured.specification.RequestSpecification;
+
+class PostgresDeletedMessageVaultIntegrationTest {
+    @RegisterExtension
+    static JamesServerExtension jamesServerExtension = new 
JamesServerBuilder<PostgresJamesConfiguration>(tmpDir ->
+        PostgresJamesConfiguration.builder()
+            .workingDirectory(tmpDir)
+            .configurationFromClasspath()
+            .searchConfiguration(SearchConfiguration.scanning())
+            .usersRepository(DEFAULT)
+            .eventBusImpl(PostgresJamesConfiguration.EventBusImpl.IN_MEMORY)
+            
.deletedMessageVaultConfiguration(VaultConfiguration.ENABLED_DEFAULT)
+            .build())
+        .server(PostgresJamesServerMain::createServer)
+        .extension(PostgresExtension.empty())
+        .lifeCycle(JamesServerExtension.Lifecycle.PER_CLASS)
+        .build();
+
+    private static final ConditionFactory AWAIT = Awaitility.await()
+        .atMost(ONE_MINUTE)
+        .with()
+        .pollInterval(FIVE_HUNDRED_MILLISECONDS);
+    private static final String DOMAIN = "james.local";
+    private static final String USER = "toto@" + DOMAIN;
+    private static final String PASSWORD = "123456";
+    private static final String JAMES_SERVER_HOST = "127.0.0.1";
+
+    private TestIMAPClient testIMAPClient;
+    private SMTPMessageSender smtpMessageSender;
+    private RequestSpecification webAdminApi;
+
+    @BeforeEach
+    void setUp(GuiceJamesServer jamesServer) throws Exception {
+        this.testIMAPClient = new TestIMAPClient();
+        this.smtpMessageSender = new SMTPMessageSender(DOMAIN);
+        this.webAdminApi = 
WebAdminUtils.spec(jamesServer.getProbe(WebAdminGuiceProbe.class).getWebAdminPort())
+            .config(WebAdminUtils.defaultConfig()
+                .paramConfig(new ParamConfig(REPLACE, REPLACE, REPLACE)));
+
+        jamesServer.getProbe(DataProbeImpl.class)
+            .fluent()
+            .addDomain(DOMAIN)
+            .addUser(USER, PASSWORD);
+    }
+
+    @Test
+    void restoreDeletedMessageShouldSucceed(GuiceJamesServer jamesServer) 
throws Exception {
+        // Create a message
+        int imapPort = 
jamesServer.getProbe(ImapGuiceProbe.class).getImapPort();
+        smtpMessageSender.connect(JAMES_SERVER_HOST, 
jamesServer.getProbe(SmtpGuiceProbe.class).getSmtpPort())
+            .authenticate(USER, PASSWORD)
+            .sendMessageWithHeaders(USER, USER, "Subject: 
thisIsASubject\r\n\r\nBody");
+        testIMAPClient.connect(JAMES_SERVER_HOST, imapPort)
+            .login(USER, PASSWORD)
+            .select(TestIMAPClient.INBOX)
+            .awaitMessageCount(AWAIT, 1);
+
+        // Delete the message
+        testIMAPClient.setFlagsForAllMessagesInMailbox("\\Deleted");
+        testIMAPClient.expunge();
+        testIMAPClient.awaitNoMessage(AWAIT);
+
+        // Restore the message using the Deleted message vault webadmin 
endpoint
+        String restoreBySubjectQuery = "{" +
+            "  \"combinator\": \"and\"," +
+            "  \"limit\": 1," +
+            "  \"criteria\": [" +
+            "    {" +
+            "      \"fieldName\": \"subject\"," +
+            "      \"operator\": \"equals\"," +
+            "      \"value\": \"thisIsASubject\"" +
+            "    }" +
+            "  ]" +
+            "}";
+        
DeletedMessagesVaultRequests.restoreMessagesForUserWithQuery(webAdminApi, USER, 
restoreBySubjectQuery);
+
+        // await the message to be restored
+        testIMAPClient.select(DefaultMailboxes.RESTORED_MESSAGES)
+            .awaitMessageCount(AWAIT, 1);
+    }
+
+}
diff --git 
a/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/dnsservice.xml
 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/dnsservice.xml
new file mode 100644
index 0000000000..6e4fbd2efb
--- /dev/null
+++ 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/dnsservice.xml
@@ -0,0 +1,25 @@
+<?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/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/domainlist.xml
 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/domainlist.xml
new file mode 100644
index 0000000000..fe17431a1e
--- /dev/null
+++ 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/domainlist.xml
@@ -0,0 +1,24 @@
+<?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/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/imapserver.xml
 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/imapserver.xml
new file mode 100644
index 0000000000..f7429d1ac3
--- /dev/null
+++ 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/imapserver.xml
@@ -0,0 +1,41 @@
+<?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.
+-->
+
+
+<imapservers>
+    <imapserver enabled="true">
+        <jmxName>imapserver</jmxName>
+        <bind>0.0.0.0:0</bind>
+        <connectionBacklog>200</connectionBacklog>
+        <tls socketTLS="false" startTLS="false">
+            <!-- To create a new keystore execute:
+            keytool -genkey -alias james -keyalg RSA -keystore 
/path/to/james/conf/keystore
+              -->
+            <keystore>file://conf/keystore</keystore>
+            <secret>james72laBalle</secret>
+            
<provider>org.bouncycastle.jce.provider.BouncyCastleProvider</provider>
+        </tls>
+        <connectionLimit>0</connectionLimit>
+        <connectionLimitPerIP>0</connectionLimitPerIP>
+        <plainAuthDisallowed>false</plainAuthDisallowed>
+        <gracefulShutdown>false</gracefulShutdown>
+    </imapserver>
+</imapservers>
diff --git 
a/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/jwt_publickey
 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/jwt_publickey
new file mode 100644
index 0000000000..53914e0533
--- /dev/null
+++ 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/jwt_publickey
@@ -0,0 +1,9 @@
+-----BEGIN PUBLIC KEY-----
+MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtlChO/nlVP27MpdkG0Bh
+16XrMRf6M4NeyGa7j5+1UKm42IKUf3lM28oe82MqIIRyvskPc11NuzSor8HmvH8H
+lhDs5DyJtx2qp35AT0zCqfwlaDnlDc/QDlZv1CoRZGpQk1Inyh6SbZwYpxxwh0fi
++d/4RpE3LBVo8wgOaXPylOlHxsDizfkL8QwXItyakBfMO6jWQRrj7/9WDhGf4Hi+
+GQur1tPGZDl9mvCoRHjFrD5M/yypIPlfMGWFVEvV5jClNMLAQ9bYFuOc7H1fEWw6
+U1LZUUbJW9/CH45YXz82CYqkrfbnQxqRb2iVbVjs/sHopHd1NTiCfUtwvcYJiBVj
+kwIDAQAB
+-----END PUBLIC KEY-----
diff --git 
a/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/listeners.xml
 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/listeners.xml
new file mode 100644
index 0000000000..ff2e517232
--- /dev/null
+++ 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/listeners.xml
@@ -0,0 +1,49 @@
+<?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.                                           
+ -->
+
+<listeners>
+  <listener>
+    
<class>org.apache.james.mailbox.cassandra.MailboxOperationLoggingListener</class>
+  </listener>
+  <listener>
+    
<class>org.apache.james.mailbox.quota.mailing.listeners.QuotaThresholdCrossingListener</class>
+    <group>QuotaThresholdCrossingListener-lower-threshold</group>
+    <configuration>
+      <thresholds>
+        <threshold>
+          <value>0.1</value>
+        </threshold>
+      </thresholds>
+      <name>first</name>
+    </configuration>
+  </listener>
+  <listener>
+    
<class>org.apache.james.mailbox.quota.mailing.listeners.QuotaThresholdCrossingListener</class>
+    <group>QuotaThresholdCrossingListener-upper-threshold</group>
+    <configuration>
+      <thresholds>
+        <threshold>
+          <value>0.2</value>
+        </threshold>
+      </thresholds>
+      <name>second</name>
+    </configuration>
+  </listener>
+</listeners>
\ No newline at end of file
diff --git 
a/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/lmtpserver.xml
 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/lmtpserver.xml
new file mode 100644
index 0000000000..f838adb5f0
--- /dev/null
+++ 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/lmtpserver.xml
@@ -0,0 +1,23 @@
+<?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.                                           
+ -->
+
+<lmtpservers>
+
+</lmtpservers>
diff --git 
a/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/mailetcontainer.xml
 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/mailetcontainer.xml
new file mode 100644
index 0000000000..166cf259ce
--- /dev/null
+++ 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/mailetcontainer.xml
@@ -0,0 +1,117 @@
+<?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="false">
+
+    <context>
+        <postmaster>postmaster</postmaster>
+    </context>
+
+    <spooler>
+        <threads>20</threads>
+        <errorRepository>postgres://var/mail/error/</errorRepository>
+    </spooler>
+
+    <processors>
+        <processor state="root" enableJmx="false">
+            <mailet match="All" class="PostmasterAlias"/>
+            <mailet match="RelayLimit=30" class="Null"/>
+            <mailet match="All" class="ToProcessor">
+                <processor>transport</processor>
+            </mailet>
+        </processor>
+
+        <processor state="error" enableJmx="false">
+            <mailet match="All" class="Bounce">
+                <onMailetException>ignore</onMailetException>
+            </mailet>
+            <mailet match="All" class="ToRepository">
+                <repositoryPath>postgres://var/mail/error/</repositoryPath>
+                <onMailetException>ignore</onMailetException>
+            </mailet>
+        </processor>
+
+
+        <processor state="transport" enableJmx="false">
+            <matcher name="relay-allowed" 
match="org.apache.james.mailetcontainer.impl.matchers.Or">
+                <matcher match="SMTPAuthSuccessful"/>
+                <matcher match="SMTPIsAuthNetwork"/>
+                <matcher match="SentByMailet"/>
+                <matcher match="org.apache.james.jmap.mailet.SentByJmap"/>
+            </matcher>
+
+            <mailet match="All" class="RemoveMimeHeader">
+                <name>bcc</name>
+            </mailet>
+            <mailet match="All" class="RecipientRewriteTable" />
+            <mailet match="RecipientIsLocal" class="Sieve">
+                <onMailetException>ignore</onMailetException>
+            </mailet>
+            <mailet match="RecipientIsLocal" class="LocalDelivery"/>
+            <mailet match="HostIsLocal" class="ToProcessor">
+                <processor>local-address-error</processor>
+                <notice>550 - Requested action not taken: no such user 
here</notice>
+            </mailet>
+
+            <mailet match="relay-allowed" class="RemoteDelivery">
+                <outgoingQueue>outgoing</outgoingQueue>
+                <delayTime>5000, 100000, 500000</delayTime>
+                <maxRetries>3</maxRetries>
+                <maxDnsProblemRetries>0</maxDnsProblemRetries>
+                <deliveryThreads>10</deliveryThreads>
+                <sendpartial>true</sendpartial>
+                <bounceProcessor>bounces</bounceProcessor>
+            </mailet>
+            <mailet match="All" class="ToProcessor">
+                <processor>relay-denied</processor>
+            </mailet>
+        </processor>
+
+        <processor state="local-address-error" enableJmx="false">
+            <mailet match="All" class="Bounce">
+                <attachment>none</attachment>
+            </mailet>
+            <mailet match="All" class="ToRepository">
+                
<repositoryPath>postgres://var/mail/address-error/</repositoryPath>
+            </mailet>
+        </processor>
+
+        <processor state="relay-denied" enableJmx="false">
+            <mailet match="All" class="Bounce">
+                <attachment>none</attachment>
+            </mailet>
+            <mailet match="All" class="ToRepository">
+                
<repositoryPath>postgres://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="false">
+            <mailet match="All" class="DSNBounce">
+                <passThrough>false</passThrough>
+            </mailet>
+        </processor>
+
+    </processors>
+
+</mailetcontainer>
+
+
diff --git 
a/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/mailrepositorystore.xml
 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/mailrepositorystore.xml
new file mode 100644
index 0000000000..689745af60
--- /dev/null
+++ 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/mailrepositorystore.xml
@@ -0,0 +1,31 @@
+<?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.postgres.PostgresMailRepository">
+            <protocols>
+                <protocol>postgres</protocol>
+            </protocols>
+            <config FIFO="false" CACHEKEYS="true"/>
+        </mailrepository>
+    </mailrepositories>
+</mailrepositorystore>
diff --git 
a/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/managesieveserver.xml
 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/managesieveserver.xml
new file mode 100644
index 0000000000..f136a432b8
--- /dev/null
+++ 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/managesieveserver.xml
@@ -0,0 +1,32 @@
+<?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.                                           
+ -->
+ 
+<!--
+   This template file can be used as example for James Server configuration
+   DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS
+-->
+ 
+<!-- See http://james.apache.org/server/3/config.html for usage -->
+
+<managesieveservers>
+
+</managesieveservers>
+
+
diff --git 
a/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/pop3server.xml
 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/pop3server.xml
new file mode 100644
index 0000000000..bec385ae30
--- /dev/null
+++ 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/pop3server.xml
@@ -0,0 +1,23 @@
+<?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.                                           
+ -->
+
+
+<pop3servers>
+</pop3servers>
diff --git 
a/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/smtpserver.xml
 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/smtpserver.xml
new file mode 100644
index 0000000000..2fd612d961
--- /dev/null
+++ 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/smtpserver.xml
@@ -0,0 +1,54 @@
+<?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>
+        <auth>
+            <announce>never</announce>
+            <requireSSL>false</requireSSL>
+            <plainAuthEnabled>true</plainAuthEnabled>
+        </auth>
+        <authorizedAddresses>0.0.0.0/0</authorizedAddresses>
+        <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>
+        <gracefulShutdown>false</gracefulShutdown>
+    </smtpserver>
+</smtpservers>
+
+
diff --git 
a/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/webadmin.properties
 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/webadmin.properties
new file mode 100644
index 0000000000..78a176aabd
--- /dev/null
+++ 
b/server/protocols/webadmin-integration-test/postgres-webadmin-integration-test/src/test/resources/webadmin.properties
@@ -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.
+
+#  This template file can be used as example for James Server configuration
+#  DO NOT USE IT AS SUCH AND ADAPT IT TO YOUR NEEDS
+
+# Read https://james.apache.org/server/config-webadmin.html for further details
+
+enabled=true
+port=0
+host=127.0.0.1
+
+extensions.routes=org.apache.james.webadmin.dropwizard.MetricsRoutes
\ No newline at end of file


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]


Reply via email to