[jira] [Created] (JAMES-3349) [JMAP] Method level error handling

2020-07-29 Thread Jira
Nguyễn Việt Đức created JAMES-3349:
--

 Summary: [JMAP] Method level error handling
 Key: JAMES-3349
 URL: https://issues.apache.org/jira/browse/JAMES-3349
 Project: James Server
  Issue Type: Improvement
Reporter: Nguyễn Việt Đức


Once we handle GetMailboxes, we can start managing method level errors.

*https://jmap.io/spec-core.html#errors*
{code:java}
An error response looks like this:
[ "error", {
 "type": "unknownMethod"
}, "call-id" ]
The response name is error, and it MUST have a type property. Other properties 
may be present with further information; these are detailed in the error type 
descriptions where appropriate.
serverFail: An unexpected or unknown error occurred during the processing of 
the call. A description property should provide more details about the error. 
The method call made no changes to the server’s state. Attempting the same 
operation again is expected to fail again. Contacting the service administrator 
is likely necessary to resolve this problem if it is persistent.
unknownMethod: The server does not recognise this method name.
invalidArguments: One of the arguments is of the wrong type or is otherwise 
invalid, or a required argument is missing. A description property MAY be 
present to help debug with an explanation of what the problem was. This is a 
non-localised string, and it is not intended to be shown directly to end users.
accountNotFound: The accountId does not correspond to a valid account. {code}
See the error registry.

Handle these errors correctly with `Mailboxes/get`

*DOD* memory integration tests



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[jira] [Created] (JAMES-3350) Fasten integration tests

2020-07-29 Thread Benoit Tellier (Jira)
Benoit Tellier created JAMES-3350:
-

 Summary: Fasten integration tests
 Key: JAMES-3350
 URL: https://issues.apache.org/jira/browse/JAMES-3350
 Project: James Server
  Issue Type: Improvement
  Components: Build System
Reporter: Benoit Tellier


Here are the maven modules that takes the most time to test.

Some short term solutions and obvious fixes might help to get things slightly 
more acceptable.

{code:java}
[INFO] Apache James :: Mailbox :: Tools :: Indexer  SUCCESS [02:02 min]
[INFO] Apache James :: Server :: MailRepository :: Cassandra SUCCESS [02:13 min]
[INFO] Apache James :: Server :: Web Admin :: mailbox . SUCCESS [02:41 min]
[INFO] Apache James :: Server :: Cassandra/Ldap with RabbitMQ - guice injection 
SUCCESS [03:05 min]
[INFO] apache-james-backends-es ... SUCCESS [03:06 min]
[INFO] Apache James :: Server :: Web Admin server integration tests :: Memory 
SUCCESS [03:19 min]
[INFO] Apache James :: Server :: Mailets Integration Testing SUCCESS [03:30 min]
[INFO] Apache James :: Server :: Data :: Cassandra Persistence SUCCESS [04:18 
min]
[INFO] Apache James RabbitMQ backend .. SUCCESS [05:09 min]
[INFO] Apache James :: Server :: JMAP (draft) :: Cassandra Integration testing 
SUCCESS [05:11 min]
[INFO] Apache James :: Server :: Cassandra - guice injection SUCCESS [05:48 min]
[INFO] Apache James :: Server :: Blob :: Cassandra  SUCCESS [06:12 min]
[INFO] Apache James MPT Imap Mailbox - Cassandra .. SUCCESS [07:02 min]
[INFO] Apache James :: Server :: JMAP (draft) :: Memory Integration testing 
SUCCESS [07:54 min]
[INFO] Apache James :: Server :: JMAP (draft) :: RabbitMQ + Object Store + 
Cassandra Integration testing SUCCESS [08:37 min]
[INFO] Apache James :: Server :: Task :: Distributed .. SUCCESS [09:22 min]
[INFO] Apache James :: Mailbox :: Cassandra ... SUCCESS [10:17 min]
[INFO] Apache James :: Server :: Cassandra with RabbitMQ - guice injection 
SUCCESS [10:19 min]
[INFO] Apache James :: Server :: Web Admin server integration tests :: 
Distributed SUCCESS [11:51 min]
[INFO] Apache James :: Server :: Blob :: Object storage ... SUCCESS [12:31 min]
[INFO] Apache James :: Server :: Mail Queue :: RabbitMQ ... SUCCESS [15:17 min]
[INFO] Apache James :: Mailbox :: Event :: RabbitMQ implementation SUCCESS 
[28:36 min]

[INFO] 
[INFO] BUILD SUCCESS
[INFO] 
[INFO] Total time:  03:45 h
[INFO] Finished at: 2020-07-24T15:41:30Z
[INFO] 
{code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[james-project] 07/12: JAMES-3317 add deduplication propertie for blobstore in configuration

2020-07-29 Thread btellier
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 986002b275ee7c3dc689c85dcd17c5db9f8503e8
Author: Rémi Kowalski 
AuthorDate: Wed Jul 22 15:51:50 2020 +0200

JAMES-3317 add deduplication propertie for blobstore in configuration
---
 .../destination/conf/blob.properties   |  9 ++-
 .../destination/conf/blob.properties   |  7 ++
 .../destination/conf/blob.properties   |  7 ++
 .../cassandra/destination/conf/blob.properties |  9 ++-
 .../modules/blobstore/BlobStoreConfiguration.java  | 87 +-
 .../james/CassandraRabbitMQAwsS3JmapTestRule.java  |  5 +-
 .../james/CassandraRabbitMQJamesServerFixture.java |  5 +-
 .../james/CassandraRabbitMQSwiftJmapTestRule.java  |  5 +-
 .../java/org/apache/james/WithCacheExtension.java  |  5 +-
 .../org/apache/james/WithCassandraBlobStore.java   |  5 +-
 .../apache/james/WithScanningSearchExtension.java  |  5 +-
 .../BlobStoreCacheModulesChooserTest.java  | 10 ++-
 .../blobstore/BlobStoreConfigurationTest.java  | 63 ++--
 .../blobstore/BlobStoreModulesChooserTest.java | 14 +++-
 .../CassandraRabbitMQLdapJmapJamesServerTest.java  | 15 +++-
 .../rabbitmq/RabbitMQAwsS3SendMDNMethodTest.java   |  5 +-
 .../RabbitMQAwsS3SpamAssassinContractTest.java |  5 +-
 .../cucumber/awss3/RabbitMQAwsS3Stepdefs.java  |  5 +-
 .../distributed/DistributedAuthenticationTest.java |  5 +-
 .../distributed/DistributedEchoMethodTest.java |  5 +-
 .../DistributedMailboxGetMethodTest.java   |  5 +-
 .../distributed/DistributedSessionRouteTest.java   |  2 +-
 .../rabbitmq/ConsistencyTasksIntegrationTest.java  |  5 +-
 .../rabbitmq/FixingGhostMailboxTest.java   |  5 +-
 .../rabbitmq/RabbitMQAuthorizedEndpointsTest.java  |  5 +-
 .../RabbitMQEventDeadLettersIntegrationTest.java   |  5 +-
 ...stViewProjectionHealthCheckIntegrationTest.java |  5 +-
 .../rabbitmq/RabbitMQForwardIntegrationTest.java   |  5 +-
 .../rabbitmq/RabbitMQJmapExtension.java|  5 +-
 .../rabbitmq/RabbitMQJwtFilterIntegrationTest.java |  5 +-
 ...RabbitMQReindexingWithEventDeadLettersTest.java |  5 +-
 .../RabbitMQWebAdminServerIntegrationTest.java |  5 +-
 ...dminServerTaskSerializationIntegrationTest.java |  5 +-
 ...RabbitMQDeletedMessageVaultIntegrationTest.java |  5 +-
 ...LinshareBlobExportMechanismIntegrationTest.java |  5 +-
 35 files changed, 287 insertions(+), 61 deletions(-)

diff --git 
a/dockerfiles/run/guice/cassandra-ldap/destination/conf/blob.properties 
b/dockerfiles/run/guice/cassandra-ldap/destination/conf/blob.properties
index 90c5135..2ec4035 100644
--- a/dockerfiles/run/guice/cassandra-ldap/destination/conf/blob.properties
+++ b/dockerfiles/run/guice/cassandra-ldap/destination/conf/blob.properties
@@ -6,6 +6,13 @@
 # Optional, default is localFile
 blob.export.implementation=localFile
 
+# = ObjectStorage deduplication 

+# If you choose to enable deduplication, the mails with the same content will 
be stored only once.
+# Warning: Once this feature is enabled, there is no turning back as turning 
it off will lead to the deletion of all
+# the mails sharing the same content once one is deleted.
+# Mandatory, Allowed values are: true, false
+deduplication.enable=false
+
 # === Local File Blobs Exporting 

 # Optional, directory to store exported blob, directory path follows James 
file system format
 # default is file://var/blobExporting
@@ -23,4 +30,4 @@ blob.export.localFile.directory=file://var/blobExporting
 # For Example: It will be formalized to 'Authorization: Basic {Credential of 
UUID/password}'
 
 # blob.export.linshare.technical.account.uuid=Technical_Account_UUID
-# blob.export.linshare.technical.account.password=password
\ No newline at end of file
+# blob.export.linshare.technical.account.password=password
diff --git 
a/dockerfiles/run/guice/cassandra-rabbitmq-ldap/destination/conf/blob.properties
 
b/dockerfiles/run/guice/cassandra-rabbitmq-ldap/destination/conf/blob.properties
index 40aee03..6e5e8f8 100644
--- 
a/dockerfiles/run/guice/cassandra-rabbitmq-ldap/destination/conf/blob.properties
+++ 
b/dockerfiles/run/guice/cassandra-rabbitmq-ldap/destination/conf/blob.properties
@@ -5,6 +5,13 @@
 # Mandatory, allowed values are: cassandra, objectstorage
 implementation=objectstorage
 
+# = ObjectStorage deduplication 

+# If you choose to enable deduplication, the mails with the same content will 
be stored only once.
+# Warning: Once this feature is enabled, there is no turning back as turning 
it off will lead to the deletion of all
+# the mails sharing the same content once one is deleted.
+# Mandatory,

[james-project] 01/12: JAMES-2892 Request level error handling

2020-07-29 Thread btellier
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 62b20ec9676bf37223bc896eb608d20e233b7117
Author: LanKhuat 
AuthorDate: Fri Jul 17 16:46:04 2020 +0700

JAMES-2892 Request level error handling
---
 .../org/apache/james/jmap/json/Serializer.scala|  4 ++
 .../org/apache/james/jmap/model/Capability.scala   |  2 +
 .../apache/james/jmap/model/ProblemDetails.scala   | 29 
 .../james/jmap/model/RequestLevelErrorType.scala   | 31 
 .../org/apache/james/jmap/model/StatusCode.scala   | 27 +++
 .../apache/james/jmap/routes/JMAPApiRoutes.scala   | 65 +++--
 .../james/jmap/routes/JMAPApiRoutesTest.scala  | 82 --
 7 files changed, 212 insertions(+), 28 deletions(-)

diff --git 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/json/Serializer.scala
 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/json/Serializer.scala
index b31e0b5..d9e234a 100644
--- 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/json/Serializer.scala
+++ 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/json/Serializer.scala
@@ -236,12 +236,16 @@ class Serializer @Inject() (mailboxIdFactory: 
MailboxId.Factory) {
 
   private implicit def jsErrorWrites: Writes[JsError] = Json.writes[JsError]
 
+  private implicit val problemDetailsWrites: Writes[ProblemDetails] = 
Json.writes[ProblemDetails]
+
   def serialize(session: Session): JsValue = Json.toJson(session)
 
   def serialize(requestObject: RequestObject): JsValue = 
Json.toJson(requestObject)
 
   def serialize(responseObject: ResponseObject): JsValue = 
Json.toJson(responseObject)
 
+  def serialize(problemDetails: ProblemDetails): JsValue = 
Json.toJson(problemDetails)
+
   def serialize(mailbox: Mailbox)(implicit mailboxWrites: Writes[Mailbox]): 
JsValue = Json.toJson(mailbox)
 
   def serialize(mailboxGetResponse: MailboxGetResponse)(implicit 
mailboxWrites: Writes[Mailbox]): JsValue = Json.toJson(mailboxGetResponse)
diff --git 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/Capability.scala
 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/Capability.scala
index 6fd841c..8eaaefb 100644
--- 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/Capability.scala
+++ 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/Capability.scala
@@ -34,6 +34,8 @@ object CapabilityIdentifier {
   val JMAP_MAIL: CapabilityIdentifier = "urn:ietf:params:jmap:mail"
   val JAMES_QUOTA: CapabilityIdentifier = 
"urn:apache:james:params:jmap:mail:quota"
   val JAMES_SHARES: CapabilityIdentifier = 
"urn:apache:james:params:jmap:mail:shares"
+
+  val SUPPORTED_CAPABILITIES: Set[CapabilityIdentifier] = Set(JMAP_CORE, 
JMAP_MAIL, JAMES_QUOTA, JAMES_SHARES)
 }
 
 sealed trait CapabilityProperties
diff --git 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/ProblemDetails.scala
 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/ProblemDetails.scala
new file mode 100644
index 000..f617c86
--- /dev/null
+++ 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/ProblemDetails.scala
@@ -0,0 +1,29 @@
+/
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information*
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the*
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *  *
+ *   http://www.apache.org/licenses/LICENSE-2.0 *
+ *  *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY   *
+ * KIND, either express or implied.  See the License for the*
+ * specific language governing permissions and limitations  *
+ * under the License.   *
+ /
+package org.apache.james.jmap.model
+
+import org.apache.james.jmap.model.RequestLevelErrorType.ErrorTypeIdentifier
+import org.apache.james.jmap.model.StatusCode.ErrorStatus
+
+/**
+ * Problem Details for HTTP APIs within the JMAP context
+ * https://tools.ietf.org/html/rfc7807
+ * see https://jmap.io/spec-core.html#errors
+ */
+case class ProblemDetails(`type`: ErrorTypeIdentifi

[james-project] branch master updated (2de38df -> 89fb5f4)

2020-07-29 Thread btellier
This is an automated email from the ASF dual-hosted git repository.

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


from 2de38df  JAMES-3157 Fix support for bench profiles
 new 62b20ec  JAMES-2892 Request level error handling
 new 6867c94  JAMES-2892 use the same default capabilities everywhere
 new e1ae434  JAMES-3093 Port UserProvisioner from draft to jmap-rfc-8621
 new 98f9f18  JAMES-3093 Port MailboxProvisioner from draft to jmap-rfc-8621
 new d2c314e  JAMES-3093 User and mailboxes provisioning for JMAP-RFC-8621
 new 029fc19  JAMES-3093 Refactoring MailboxGetMethodContract with 
mailboxes provisioning
 new 986002b  JAMES-3317 add deduplication propertie for blobstore in 
configuration
 new d6ac26f  JAMES-3317 use Storage strategy from BlobStoreConfiguration 
when instantiating the blobstore
 new 03addb0  JAMES-3348 Add missing Sieve persistent class declarations
 new ab1a174  [REFACTORING] Default methods for GuiceModuleTestRule
 new 039bdea  [REFACTORING] Cleanup Text extractor overrides
 new 89fb5f4  [REFACTORING] Override cleanup for RabbitMQAwsS3Stepdefs

The 12 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../destination/conf/blob.properties   |   9 +-
 .../destination/conf/blob.properties   |   7 +
 .../destination/conf/blob.properties   |   7 +
 .../cassandra/destination/conf/blob.properties |   9 +-
 .../src/main/resources/META-INF/persistence.xml|   2 +
 server/container/cli-integration/pom.xml   |   6 -
 .../objectstorage/aws/s3/DockerAwsS3TestRule.java  |   4 -
 .../objectstorage/swift/DockerSwiftTestRule.java   |   4 -
 server/container/guice/cassandra-guice/pom.xml |   6 -
 .../AuthenticatedCassandraJamesServerTest.java |   3 -
 .../org/apache/james/CassandraJamesServerTest.java |   3 -
 .../apache/james/CassandraJmapJamesServerTest.java |   3 -
 .../james/DefaultCassandraJamesServerTest.java |   3 -
 .../java/org/apache/james/DockerCassandraRule.java |   4 -
 .../test/java/org/apache/james/DockerLdapRule.java |   4 -
 .../guice/cassandra-rabbitmq-guice/pom.xml |   6 -
 .../modules/blobstore/BlobStoreConfiguration.java  |  87 +++-
 .../modules/blobstore/BlobStoreModulesChooser.java |  45 +-
 .../james/CassandraRabbitMQAwsS3JmapTestRule.java  |   5 +-
 .../james/CassandraRabbitMQJamesServerFixture.java |   5 +-
 .../james/CassandraRabbitMQSwiftJmapTestRule.java  |   5 +-
 .../java/org/apache/james/WithCacheExtension.java  |   5 +-
 .../org/apache/james/WithCassandraBlobStore.java   |   5 +-
 .../apache/james/WithScanningSearchExtension.java  |   5 +-
 .../apache/james/modules/DockerRabbitMQRule.java   |   4 -
 .../BlobStoreCacheModulesChooserTest.java  |  10 +-
 .../blobstore/BlobStoreConfigurationTest.java  |  63 ++-
 .../blobstore/BlobStoreModulesChooserTest.java |  14 +-
 .../CassandraRabbitMQLdapJmapJamesServerTest.java  |  15 +-
 .../java/org/apache/james/GuiceModuleTestRule.java |   8 +-
 .../org/apache/james/TempFilesystemTestRule.java   |  12 -
 .../src/main/resources/META-INF/persistence.xml|   2 +
 server/container/guice/memory-guice/pom.xml|   6 -
 .../org/apache/james/MemoryJamesServerTest.java|   3 -
 .../java/org/apache/james/MemoryJmapTestRule.java  |   6 -
 .../memory/MemoryGetMessageListMethodTest.java |   5 +-
 .../rabbitmq/RabbitMQAwsS3SendMDNMethodTest.java   |   5 +-
 .../RabbitMQAwsS3SpamAssassinContractTest.java |   5 +-
 .../cucumber/awss3/RabbitMQAwsS3Stepdefs.java  |  11 +-
 .../distributed/DistributedAuthenticationTest.java |   5 +-
 .../distributed/DistributedEchoMethodTest.java |   5 +-
 .../DistributedMailboxGetMethodTest.java   |   5 +-
 ...dTest.java => DistributedProvisioningTest.java} |  12 +-
 .../distributed/DistributedSessionRouteTest.java   |   2 +-
 .../james/jmap/rfc8621/contract/Fixture.scala  |  14 +
 .../contract/MailboxGetMethodContract.scala| 577 +
 .../rfc8621/contract/ProvisioningContract.scala|  83 +++
 ...MethodTest.java => MemoryProvisioningTest.java} |   4 +-
 .../james/jmap/http/MailboxesProvisioner.scala |  81 +++
 .../apache/james/jmap/http/UserProvisioning.scala  |  64 +++
 .../org/apache/james/jmap/json/Serializer.scala|  16 +-
 .../org/apache/james/jmap/model/Capabilities.scala |  13 +-
 .../org/apache/james/jmap/model/Capability.scala   |  16 +-
 .../apache/james/jmap/model/ProblemDetails.scala   |  23 +-
 .../james/jmap/model/RequestLevelErrorType.scala   |  13 +-
 .../org/apache/james/jmap/model/StatusCode.scala   |  10 +-
 .../apache/james/jmap/routes/JMAPApiRoutes.scala   |  81 ++-
 .../james/jmap/http/MailboxesProvisionerTest.scala | 103 
 ..

[james-project] 03/12: JAMES-3093 Port UserProvisioner from draft to jmap-rfc-8621

2020-07-29 Thread btellier
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 e1ae434403a20d977a4f1e46968975c6323fde14
Author: Rene Cordier 
AuthorDate: Tue Jul 21 16:56:03 2020 +0700

JAMES-3093 Port UserProvisioner from draft to jmap-rfc-8621
---
 .../apache/james/jmap/http/UserProvisioning.scala  |  64 +
 .../james/jmap/http/UserProvisioningTest.scala | 103 +
 2 files changed, 167 insertions(+)

diff --git 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/http/UserProvisioning.scala
 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/http/UserProvisioning.scala
new file mode 100644
index 000..95895e5
--- /dev/null
+++ 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/http/UserProvisioning.scala
@@ -0,0 +1,64 @@
+/
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information*
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the*
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *  *
+ *   http://www.apache.org/licenses/LICENSE-2.0 *
+ *  *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY   *
+ * KIND, either express or implied.  See the License for the*
+ * specific language governing permissions and limitations  *
+ * under the License.   *
+ /
+
+package org.apache.james.jmap.http
+
+import java.util.UUID
+
+import javax.inject.Inject
+import org.apache.james.core.Username
+import org.apache.james.mailbox.MailboxSession
+import org.apache.james.metrics.api.MetricFactory
+import 
org.apache.james.metrics.api.TimeMetric.ExecutionResult.DEFAULT_100_MS_THRESHOLD
+import org.apache.james.user.api.{AlreadyExistInUsersRepositoryException, 
UsersRepository, UsersRepositoryException}
+import reactor.core.scala.publisher.SMono
+
+class UserProvisioning @Inject() (usersRepository: UsersRepository, 
metricFactory: MetricFactory) {
+
+  def provisionUser(session: MailboxSession): SMono[Unit] =
+if (session != null && !usersRepository.isReadOnly) {
+  SMono.fromCallable(() => createAccountIfNeeded(session))
+.`then`
+} else {
+  SMono.empty
+}
+
+  private def createAccountIfNeeded(session: MailboxSession): Unit = {
+val timeMetric = metricFactory.timer("JMAP-RFC-8621-user-provisioning")
+try {
+  val username = session.getUser
+  if (needsAccountCreation(username)) {
+createAccount(username)
+  }
+} catch {
+  case exception: AlreadyExistInUsersRepositoryException => // Ignore
+  case exception: UsersRepositoryException => throw new 
RuntimeException(exception)
+} finally {
+  timeMetric.stopAndPublish.logWhenExceedP99(DEFAULT_100_MS_THRESHOLD)
+}
+  }
+
+  @throws[UsersRepositoryException]
+  private def createAccount(username: Username): Unit = 
usersRepository.addUser(username, generatePassword)
+
+  @throws[UsersRepositoryException]
+  private def needsAccountCreation(username: Username): Boolean = 
!usersRepository.contains(username)
+
+  private def generatePassword: String = UUID.randomUUID.toString
+}
diff --git 
a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/http/UserProvisioningTest.scala
 
b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/http/UserProvisioningTest.scala
new file mode 100644
index 000..ff799a0
--- /dev/null
+++ 
b/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/http/UserProvisioningTest.scala
@@ -0,0 +1,103 @@
+/
+ * 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 *
+ * 

[james-project] 02/12: JAMES-2892 use the same default capabilities everywhere

2020-07-29 Thread btellier
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 6867c94624466b4ed217be3d267b60456ad9fad7
Author: Raphael Ouazana 
AuthorDate: Thu Jul 23 17:13:29 2020 +0200

JAMES-2892 use the same default capabilities everywhere
---
 .../org/apache/james/jmap/json/Serializer.scala| 12 +++-
 .../org/apache/james/jmap/model/Capabilities.scala | 13 -
 .../org/apache/james/jmap/model/Capability.scala   | 18 +-
 .../apache/james/jmap/routes/JMAPApiRoutes.scala   |  2 +-
 .../apache/james/jmap/http/SessionRoutesTest.scala | 68 +-
 .../james/jmap/json/SessionSerializationTest.scala |  6 +-
 6 files changed, 106 insertions(+), 13 deletions(-)

diff --git 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/json/Serializer.scala
 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/json/Serializer.scala
index d9e234a..614c6fa 100644
--- 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/json/Serializer.scala
+++ 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/json/Serializer.scala
@@ -93,9 +93,13 @@ class Serializer @Inject() (mailboxIdFactory: 
MailboxId.Factory) {
   private implicit val urlWrites: Writes[URL] = url => JsString(url.toString)
   private implicit val coreCapabilityWrites: Writes[CoreCapabilityProperties] 
= Json.writes[CoreCapabilityProperties]
   private implicit val mailCapabilityWrites: Writes[MailCapabilityProperties] 
= Json.writes[MailCapabilityProperties]
+  private implicit val quotaCapabilityWrites: 
Writes[QuotaCapabilityProperties] = OWrites[QuotaCapabilityProperties](_ => 
Json.obj())
+  private implicit val sharesCapabilityWrites: 
Writes[SharesCapabilityProperties] = OWrites[SharesCapabilityProperties](_ => 
Json.obj())
 
   private implicit def setCapabilityWrites(implicit corePropertiesWriter: 
Writes[CoreCapabilityProperties],
-   mailCapabilityWrites: 
Writes[MailCapabilityProperties]): Writes[Set[_ <: Capability]] =
+   mailCapabilityWrites: 
Writes[MailCapabilityProperties],
+   quotaCapabilityWrites: 
Writes[QuotaCapabilityProperties],
+   sharesCapabilityWrites: 
Writes[SharesCapabilityProperties]): Writes[Set[_ <: Capability]] =
 (set: Set[_ <: Capability]) => {
   set.foldLeft(JsObject.empty)((jsObject, capability) => {
 capability match {
@@ -103,12 +107,16 @@ class Serializer @Inject() (mailboxIdFactory: 
MailboxId.Factory) {
 jsObject.+(capability.identifier.value, 
corePropertiesWriter.writes(capability.properties)))
   case capability: MailCapability => (
 jsObject.+(capability.identifier.value, 
mailCapabilityWrites.writes(capability.properties)))
+  case capability: QuotaCapability => (
+jsObject.+(capability.identifier.value, 
quotaCapabilityWrites.writes(capability.properties)))
+  case capability: SharesCapability => (
+jsObject.+(capability.identifier.value, 
sharesCapabilityWrites.writes(capability.properties)))
   case _ => jsObject
 }
   })
 }
 
-  private implicit val capabilitiesWrites: Writes[Capabilities] = capabilities 
=> setCapabilityWrites.writes(Set(capabilities.coreCapability, 
capabilities.mailCapability))
+  private implicit val capabilitiesWrites: Writes[Capabilities] = capabilities 
=> setCapabilityWrites.writes(capabilities.toSet)
 
   private implicit val accountIdWrites: Format[AccountId] = 
Json.valueFormat[AccountId]
   private implicit def identifierMapWrite[Any](implicit idWriter: 
Writes[AccountId]): Writes[Map[CapabilityIdentifier, Any]] =
diff --git 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/Capabilities.scala
 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/Capabilities.scala
index ac0a7d4..9fe910f 100644
--- 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/Capabilities.scala
+++ 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/model/Capabilities.scala
@@ -19,6 +19,7 @@
 package org.apache.james.jmap.model
 
 import eu.timepit.refined.auto._
+import org.apache.james.jmap.model.CapabilityIdentifier.CapabilityIdentifier
 
 object DefaultCapabilities {
   val CORE_CAPABILITY = CoreCapability(
@@ -43,9 +44,15 @@ object DefaultCapabilities {
 )
   )
 
-  val SUPPORTED = Capabilities(CORE_CAPABILITY, MAIL_CAPABILITY)
+  val QUOTA_CAPABILITY = QuotaCapability()
+
+  val SHARES_CAPABILITY = SharesCapability()
+
+  val SUPPORTED = Capabilities(CORE_CAPABILITY, MAIL_CAPABILITY, 
QUOTA_CAPABILITY, SHARES_CAPABILITY)
 }
 
-case class Capabilities(coreCapability: CoreCapability, mailCapability: 
MailCapability) {
-  def toSet : Set[Capability] = Set(coreCapability,

[james-project] 06/12: JAMES-3093 Refactoring MailboxGetMethodContract with mailboxes provisioning

2020-07-29 Thread btellier
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 029fc19ea6abafbd774537733859100721299c40
Author: Rene Cordier 
AuthorDate: Fri Jul 24 11:39:35 2020 +0700

JAMES-3093 Refactoring MailboxGetMethodContract with mailboxes provisioning
---
 .../contract/MailboxGetMethodContract.scala| 563 ++---
 1 file changed, 256 insertions(+), 307 deletions(-)

diff --git 
a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxGetMethodContract.scala
 
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxGetMethodContract.scala
index 3d1029f..19b2e37 100644
--- 
a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxGetMethodContract.scala
+++ 
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/MailboxGetMethodContract.scala
@@ -43,6 +43,8 @@ import org.apache.james.utils.DataProbeImpl
 import org.hamcrest.Matchers._
 import org.junit.jupiter.api.{BeforeEach, Tag, Test}
 
+import scala.jdk.CollectionConverters._
+
 object MailboxGetMethodContract {
   private val ARGUMENTS: String = "methodResponses[0][1]"
   private val FIRST_MAILBOX: String = ARGUMENTS + ".list[0]"
@@ -51,143 +53,6 @@ object MailboxGetMethodContract {
   private val LOOKUP: String = Right.Lookup.asCharacter.toString
   private val READ: String = Right.Read.asCharacter.toString
   private val ADMINISTER: String = Right.Administer.asCharacter.toString
-
-  private val GET_ALL_MAILBOXES_REQUEST_NULL_PROPERTIES: String =
-"""{
-|  "using": [
-|"urn:ietf:params:jmap:core",
-|"urn:ietf:params:jmap:mail"],
-|  "methodCalls": [[
-|  "Mailbox/get",
-|  {
-|"accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
-|"properties": null,
-|"ids": null
-|  },
-|  "c1"]]
-|}""".stripMargin
-
-  private val GET_ALL_MAILBOXES_REQUEST_EMPTY_PROPERTIES: String =
-"""{
-|  "using": [
-|"urn:ietf:params:jmap:core",
-|"urn:ietf:params:jmap:mail"],
-|  "methodCalls": [[
-|  "Mailbox/get",
-|  {
-|"accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
-|"properties": [],
-|"ids": null
-|  },
-|  "c1"]]
-|}""".stripMargin
-
-  private val GET_ALL_MAILBOXES_REQUEST_NAME_AND_ID_PROPERTIES: String =
-"""{
-|  "using": [
-|"urn:ietf:params:jmap:core",
-|"urn:ietf:params:jmap:mail"],
-|  "methodCalls": [[
-|  "Mailbox/get",
-|  {
-|"accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
-|"properties": ["id", "name"],
-|"ids": null
-|  },
-|  "c1"]]
-|}""".stripMargin
-
-  private val GET_ALL_MAILBOXES_REQUEST_NAME_PROPERTIES: String =
-"""{
-|  "using": [
-|"urn:ietf:params:jmap:core",
-|"urn:ietf:params:jmap:mail"],
-|  "methodCalls": [[
-|  "Mailbox/get",
-|  {
-|"accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
-|"properties": ["name"],
-|"ids": null
-|  },
-|  "c1"]]
-|}""".stripMargin
-
-  private val GET_ALL_MAILBOXES_REQUEST_INVALID_PROPERTIES: String =
-"""{
-|  "using": [
-|"urn:ietf:params:jmap:core",
-|"urn:ietf:params:jmap:mail"],
-|  "methodCalls": [[
-|  "Mailbox/get",
-|  {
-|"accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
-|"properties": ["invalidProperty"],
-|"ids": null
-|  },
-|  "c1"]]
-|}""".stripMargin
-
-  private val GET_ALL_MAILBOXES_REQUEST_WITH_QUOTA: String =
-"""{
-|  "using": [
-|"urn:ietf:params:jmap:core",
-|"urn:ietf:params:jmap:mail",
-|"urn:apache:james:params:jmap:mail:quota"],
-|  "methodCalls": [[
-|  "Mailbox/get",
-|  {
-|"accountId": 
"29883977c13473ae7cb7678ef767cbfbaffc8a44a6e463d971d23a65c1dc4af6",
-|"ids": null
-|  },
-|  "c1"]]
-|}""".stripMargin
-
-  private val GET_ALL_MAILBOXES_REQUEST_WITH_SHARES: String =
-"""{
-|  "using": [
-|"urn:ietf:params:jmap:core",
-|"urn:ietf:params:jmap:mail",
-|"urn:apache:james:params:jmap:mail:shares"],
-|  "methodCalls": [[
-|  "Mailbox/get",
-|  {
-|"accountId": 
"29883977c13

[james-project] 04/12: JAMES-3093 Port MailboxProvisioner from draft to jmap-rfc-8621

2020-07-29 Thread btellier
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 98f9f18c9e77e33ed6d62ebe8b189817166fcc68
Author: Rene Cordier 
AuthorDate: Tue Jul 21 17:21:04 2020 +0700

JAMES-3093 Port MailboxProvisioner from draft to jmap-rfc-8621
---
 .../james/jmap/http/MailboxesProvisioner.scala |  81 
 .../james/jmap/http/MailboxesProvisionerTest.scala | 103 +
 2 files changed, 184 insertions(+)

diff --git 
a/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/http/MailboxesProvisioner.scala
 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/http/MailboxesProvisioner.scala
new file mode 100644
index 000..2690ee5
--- /dev/null
+++ 
b/server/protocols/jmap-rfc-8621/src/main/scala/org/apache/james/jmap/http/MailboxesProvisioner.scala
@@ -0,0 +1,81 @@
+/
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information*
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the*
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *  *
+ *   http://www.apache.org/licenses/LICENSE-2.0 *
+ *  *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY   *
+ * KIND, either express or implied.  See the License for the*
+ * specific language governing permissions and limitations  *
+ * under the License.   *
+ /
+
+package org.apache.james.jmap.http
+
+import java.util.Optional
+
+import javax.inject.Inject
+import org.apache.james.core.Username
+import org.apache.james.mailbox.exception.{MailboxException, 
MailboxExistsException}
+import org.apache.james.mailbox.model.{MailboxId, MailboxPath}
+import org.apache.james.mailbox.{DefaultMailboxes, MailboxManager, 
MailboxSession, SubscriptionManager}
+import org.apache.james.metrics.api.MetricFactory
+import org.slf4j.{Logger, LoggerFactory}
+import reactor.core.scala.publisher.{SFlux, SMono}
+import reactor.core.scheduler.Schedulers
+
+import scala.jdk.CollectionConverters._
+
+class MailboxesProvisioner @Inject() (mailboxManager: MailboxManager,
+  subscriptionManager: SubscriptionManager,
+  metricFactory: MetricFactory) {
+  private val LOGGER: Logger = 
LoggerFactory.getLogger(classOf[MailboxesProvisioner])
+
+  def createMailboxesIfNeeded(session: MailboxSession): SMono[Unit] =
+
metricFactory.decorateSupplierWithTimerMetric("JMAP-RFC-8621-mailboxes-provisioning",
 () =>
+  createDefaultMailboxes(session.getUser))
+
+
+  private def createDefaultMailboxes(username: Username): SMono[Unit] = {
+val session: MailboxSession = mailboxManager.createSystemSession(username)
+
+SFlux.fromIterable(DefaultMailboxes.DEFAULT_MAILBOXES.asScala)
+  .map(toMailboxPath(session))
+  .filterWhen((mailboxPath: MailboxPath) => 
mailboxDoesntExist(mailboxPath, session))
+  .concatMap((mailboxPath: MailboxPath) => SMono.fromCallable(() => 
createMailbox(mailboxPath, session))
+.subscribeOn(Schedulers.elastic))
+  .`then`
+  }
+
+  private def mailboxDoesntExist(mailboxPath: MailboxPath, session: 
MailboxSession): SMono[Boolean] = {
+try {
+  SMono(mailboxManager.mailboxExists(mailboxPath, session))
+.map(exist => !exist)
+} catch {
+  case exception: MailboxException => SMono.raiseError(exception)
+}
+  }
+
+  private def toMailboxPath(session: MailboxSession): String => MailboxPath =
+(mailbox: String) => MailboxPath.forUser(session.getUser, mailbox)
+
+  private def createMailbox(mailboxPath: MailboxPath, session: 
MailboxSession): Unit = {
+try {
+  val mailboxId: Optional[MailboxId] = 
mailboxManager.createMailbox(mailboxPath, session)
+  if (mailboxId.isPresent) {
+subscriptionManager.subscribe(session, mailboxPath.getName)
+  }
+  LOGGER.info("Provisioning {}. {} created.", mailboxPath, mailboxId)
+} catch {
+  case e: MailboxExistsException => LOGGER.info("Mailbox {} have been 
created concurrently", mailboxPath)
+  case e: MailboxException => throw new RuntimeException(e)
+}
+  }
+}
diff --git 
a/server/protocols/jmap-rfc-8621/src/test/scala/org/apache/james/jmap/http/M

[james-project] 10/12: [REFACTORING] Default methods for GuiceModuleTestRule

2020-07-29 Thread btellier
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 ab1a174c690e85a8cb2e38faf89c9419cf3e36df
Author: Benoit Tellier 
AuthorDate: Tue Jul 28 16:58:51 2020 +0700

[REFACTORING] Default methods for GuiceModuleTestRule

This allows a quick audit of which class implements which methods
---
 .../modules/objectstorage/aws/s3/DockerAwsS3TestRule.java|  4 
 .../modules/objectstorage/swift/DockerSwiftTestRule.java |  4 
 .../src/test/java/org/apache/james/DockerCassandraRule.java  |  4 
 .../src/test/java/org/apache/james/DockerLdapRule.java   |  4 
 .../java/org/apache/james/modules/DockerRabbitMQRule.java|  4 
 .../src/test/java/org/apache/james/GuiceModuleTestRule.java  |  8 ++--
 .../test/java/org/apache/james/TempFilesystemTestRule.java   | 12 
 7 files changed, 6 insertions(+), 34 deletions(-)

diff --git 
a/server/container/guice/blob-objectstorage-guice/src/test/java/org/apache/james/modules/objectstorage/aws/s3/DockerAwsS3TestRule.java
 
b/server/container/guice/blob-objectstorage-guice/src/test/java/org/apache/james/modules/objectstorage/aws/s3/DockerAwsS3TestRule.java
index 097de25..9690b46 100644
--- 
a/server/container/guice/blob-objectstorage-guice/src/test/java/org/apache/james/modules/objectstorage/aws/s3/DockerAwsS3TestRule.java
+++ 
b/server/container/guice/blob-objectstorage-guice/src/test/java/org/apache/james/modules/objectstorage/aws/s3/DockerAwsS3TestRule.java
@@ -82,10 +82,6 @@ public class DockerAwsS3TestRule implements 
GuiceModuleTestRule {
 }
 
 @Override
-public void await() {
-}
-
-@Override
 public Module getModule() {
 BucketName defaultBucketName = 
BucketName.of(UUID.randomUUID().toString());
 AwsS3AuthConfiguration authConfiguration = 
AwsS3AuthConfiguration.builder()
diff --git 
a/server/container/guice/blob-objectstorage-guice/src/test/java/org/apache/james/modules/objectstorage/swift/DockerSwiftTestRule.java
 
b/server/container/guice/blob-objectstorage-guice/src/test/java/org/apache/james/modules/objectstorage/swift/DockerSwiftTestRule.java
index bc3ffde..520d828 100644
--- 
a/server/container/guice/blob-objectstorage-guice/src/test/java/org/apache/james/modules/objectstorage/swift/DockerSwiftTestRule.java
+++ 
b/server/container/guice/blob-objectstorage-guice/src/test/java/org/apache/james/modules/objectstorage/swift/DockerSwiftTestRule.java
@@ -76,10 +76,6 @@ public class DockerSwiftTestRule implements 
GuiceModuleTestRule {
 }
 
 @Override
-public void await() {
-}
-
-@Override
 public Module getModule() {
 SwiftKeystone2ObjectStorage.Configuration authConfiguration = 
SwiftKeystone2ObjectStorage.configBuilder()
 .credentials(Credentials.of("demo"))
diff --git 
a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/DockerCassandraRule.java
 
b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/DockerCassandraRule.java
index 6ed7d39..27c5463 100644
--- 
a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/DockerCassandraRule.java
+++ 
b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/DockerCassandraRule.java
@@ -42,10 +42,6 @@ public class DockerCassandraRule implements 
GuiceModuleTestRule {
 }
 
 @Override
-public void await() {
-}
-
-@Override
 public Module getModule() {
 return Modules.combine(binder -> 
binder.bind(ClusterConfiguration.class)
 
.toInstance(DockerCassandra.configurationBuilder(cassandraContainer.getHost())
diff --git 
a/server/container/guice/cassandra-ldap-guice/src/test/java/org/apache/james/DockerLdapRule.java
 
b/server/container/guice/cassandra-ldap-guice/src/test/java/org/apache/james/DockerLdapRule.java
index 4a397cb..0c96b67 100644
--- 
a/server/container/guice/cassandra-ldap-guice/src/test/java/org/apache/james/DockerLdapRule.java
+++ 
b/server/container/guice/cassandra-ldap-guice/src/test/java/org/apache/james/DockerLdapRule.java
@@ -36,10 +36,6 @@ public class DockerLdapRule implements GuiceModuleTestRule {
 }
 
 @Override
-public void await() {
-}
-
-@Override
 public Statement apply(Statement statement, Description description) {
 return statement;
 }
diff --git 
a/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/modules/DockerRabbitMQRule.java
 
b/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/modules/DockerRabbitMQRule.java
index b107e2c..7834db7 100644
--- 
a/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/modules/DockerRabbitMQRule.java
+++ 
b/server/container/guice/cassandra-rabbitmq-guice/src/test/java/org/apache/james/modules/DockerRabbitMQRule.java
@@ -43,10 +43,6 @@ public class DockerRabbitMQRule implements 

[james-project] 08/12: JAMES-3317 use Storage strategy from BlobStoreConfiguration when instantiating the blobstore

2020-07-29 Thread btellier
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 d6ac26ff738d4bef849fc4511a13ae50a6c6a71b
Author: Rémi Kowalski 
AuthorDate: Wed Jul 22 16:05:29 2020 +0200

JAMES-3317 use Storage strategy from BlobStoreConfiguration when 
instantiating the blobstore
---
 .../modules/blobstore/BlobStoreModulesChooser.java | 45 +-
 src/site/xdoc/server/config-blobstore.xml  |  9 +
 2 files changed, 44 insertions(+), 10 deletions(-)

diff --git 
a/server/container/guice/cassandra-rabbitmq-guice/src/main/java/org/apache/james/modules/blobstore/BlobStoreModulesChooser.java
 
b/server/container/guice/cassandra-rabbitmq-guice/src/main/java/org/apache/james/modules/blobstore/BlobStoreModulesChooser.java
index c0cdcc2..323f6c5 100644
--- 
a/server/container/guice/cassandra-rabbitmq-guice/src/main/java/org/apache/james/modules/blobstore/BlobStoreModulesChooser.java
+++ 
b/server/container/guice/cassandra-rabbitmq-guice/src/main/java/org/apache/james/modules/blobstore/BlobStoreModulesChooser.java
@@ -29,6 +29,8 @@ import 
org.apache.james.blob.objectstorage.ObjectStorageBlobStore;
 import org.apache.james.modules.mailbox.CassandraBlobStoreDependenciesModule;
 import org.apache.james.modules.objectstorage.ObjectStorageDependenciesModule;
 import org.apache.james.server.blob.deduplication.DeDuplicationBlobStore;
+import org.apache.james.server.blob.deduplication.PassThroughBlobStore;
+import org.apache.james.server.blob.deduplication.StorageStrategy;
 
 import com.google.common.annotations.VisibleForTesting;
 import com.google.common.collect.ImmutableList;
@@ -37,20 +39,16 @@ import com.google.inject.Module;
 import com.google.inject.name.Names;
 
 public class BlobStoreModulesChooser {
-static class CassandraDeclarationModule extends AbstractModule {
+static class CassandraDumbBlobStoreDeclarationModule extends 
AbstractModule {
 @Override
 protected void configure() {
 install(new CassandraBlobStoreDependenciesModule());
 
 bind(DumbBlobStore.class).to(CassandraDumbBlobStore.class);
-
-bind(BlobStore.class)
-.annotatedWith(Names.named(CachedBlobStore.BACKEND))
-.to(DeDuplicationBlobStore.class);
 }
 }
 
-static class ObjectStorageDeclarationModule extends AbstractModule {
+static class ObjectStorageDumdBlobStoreDeclarationModule extends 
AbstractModule {
 @Override
 protected void configure() {
 install(new ObjectStorageDependenciesModule());
@@ -63,13 +61,40 @@ public class BlobStoreModulesChooser {
 
 @VisibleForTesting
 public static List chooseModules(BlobStoreConfiguration 
choosingConfiguration) {
-switch (choosingConfiguration.getImplementation()) {
+ImmutableList.Builder moduleBuilder = 
ImmutableList.builder().add(
+
chooseDumBlobStoreModule(choosingConfiguration.getImplementation()));
+
+//TODO JAMES-3028 add the storage policy module for all implementation 
and unbind the ObjectStorageBlobStore
+if (choosingConfiguration.getImplementation() == 
BlobStoreConfiguration.BlobStoreImplName.CASSANDRA) {
+moduleBuilder.add(
+
chooseStoragePolicyModule(choosingConfiguration.storageStrategy()));
+}
+return moduleBuilder.build();
+}
+
+public static Module 
chooseDumBlobStoreModule(BlobStoreConfiguration.BlobStoreImplName 
implementation) {
+switch (implementation) {
 case CASSANDRA:
-return ImmutableList.of(new CassandraDeclarationModule());
+return new CassandraDumbBlobStoreDeclarationModule();
 case OBJECTSTORAGE:
-return ImmutableList.of(new ObjectStorageDeclarationModule());
+return new ObjectStorageDumdBlobStoreDeclarationModule();
+default:
+throw new RuntimeException("Unsupported blobStore 
implementation " + implementation);
+}
+}
+
+private static Module chooseStoragePolicyModule(StorageStrategy 
storageStrategy) {
+switch (storageStrategy) {
+case DEDUPLICATION:
+return binder -> binder.bind(BlobStore.class)
+.annotatedWith(Names.named(CachedBlobStore.BACKEND))
+.to(DeDuplicationBlobStore.class);
+case PASSTHROUGH:
+return binder -> binder.bind(BlobStore.class)
+.annotatedWith(Names.named(CachedBlobStore.BACKEND))
+.to(PassThroughBlobStore.class);
 default:
-throw new RuntimeException("Unsuported blobStore 
implementation " + choosingConfiguration.getImplementation());
+throw new RuntimeException("Unknown storage strategy " + 
storageStrategy.name());
 }
 }
 }
diff --git a/src/

[james-project] 11/12: [REFACTORING] Cleanup Text extractor overrides

2020-07-29 Thread btellier
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 039bdeab526af6d5849fa3ee29688988afda0ad4
Author: Benoit Tellier 
AuthorDate: Wed Jul 29 11:39:02 2020 +0700

[REFACTORING] Cleanup Text extractor overrides

Mosts are not needed and allows guice wiring simplifications and dependency 
cleanups
---
 server/container/cli-integration/pom.xml   |  6 --
 server/container/guice/cassandra-guice/pom.xml |  6 --
 .../apache/james/AuthenticatedCassandraJamesServerTest.java|  3 ---
 .../test/java/org/apache/james/CassandraJamesServerTest.java   |  3 ---
 .../java/org/apache/james/DefaultCassandraJamesServerTest.java |  3 ---
 server/container/guice/cassandra-rabbitmq-guice/pom.xml|  6 --
 server/container/guice/memory-guice/pom.xml|  6 --
 .../src/test/java/org/apache/james/MemoryJamesServerTest.java  |  3 ---
 .../src/test/java/org/apache/james/MemoryJmapTestRule.java |  6 --
 .../james/jmap/memory/MemoryGetMessageListMethodTest.java  |  5 +
 .../RabbitMQLinshareBlobExportMechanismIntegrationTest.java|  3 ---
 .../webadmin-integration-test-common/pom.xml   | 10 --
 12 files changed, 1 insertion(+), 59 deletions(-)

diff --git a/server/container/cli-integration/pom.xml 
b/server/container/cli-integration/pom.xml
index 8084fda..ccb62bf 100644
--- a/server/container/cli-integration/pom.xml
+++ b/server/container/cli-integration/pom.xml
@@ -33,12 +33,6 @@
 
 
 ${james.groupId}
-apache-james-mailbox-scanning-search
-test-jar
-test
-
-
-${james.groupId}
 james-server-cli
 test
 
diff --git a/server/container/guice/cassandra-guice/pom.xml 
b/server/container/guice/cassandra-guice/pom.xml
index 01c7a62..7413af1 100644
--- a/server/container/guice/cassandra-guice/pom.xml
+++ b/server/container/guice/cassandra-guice/pom.xml
@@ -81,12 +81,6 @@
 
 
 ${james.groupId}
-apache-james-mailbox-scanning-search
-test-jar
-test
-
-
-${james.groupId}
 
james-server-mailbox-plugin-deleted-messages-vault-guice
 
 
diff --git 
a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/AuthenticatedCassandraJamesServerTest.java
 
b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/AuthenticatedCassandraJamesServerTest.java
index 58a6b35..79a8049 100644
--- 
a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/AuthenticatedCassandraJamesServerTest.java
+++ 
b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/AuthenticatedCassandraJamesServerTest.java
@@ -24,8 +24,6 @@ import static 
org.assertj.core.api.Assertions.assertThatThrownBy;
 
 import org.apache.james.backends.cassandra.DockerCassandra;
 import 
org.apache.james.backends.cassandra.init.configuration.ClusterConfiguration;
-import org.apache.james.mailbox.extractor.TextExtractor;
-import org.apache.james.mailbox.store.search.PDFTextExtractor;
 import org.apache.james.modules.TestJMAPServerModule;
 import org.junit.jupiter.api.Nested;
 import org.junit.jupiter.api.Test;
@@ -89,7 +87,6 @@ class AuthenticatedCassandraJamesServerTest {
 .extension(cassandraExtension)
 .disableAutoStart()
 .server(configuration -> 
CassandraJamesServerMain.createServer(configuration)
-.overrideWith(binder -> 
binder.bind(TextExtractor.class).to(PDFTextExtractor.class))
 .overrideWith(new TestJMAPServerModule())
 .overrideWith(DOMAIN_LIST_CONFIGURATION_MODULE))
 .overrideServerModule(binder -> 
binder.bind(ClusterConfiguration.class)
diff --git 
a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java
 
b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java
index 699ca01..d614d17 100644
--- 
a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java
+++ 
b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJamesServerTest.java
@@ -21,8 +21,6 @@ package org.apache.james;
 
 import static org.assertj.core.api.Assertions.assertThat;
 
-import org.apache.james.mailbox.extractor.TextExtractor;
-import org.apache.james.mailbox.store.search.PDFTextExtractor;
 import org.apache.james.modules.ConfigurationProbe;
 import org.apache.james.modules.TestJMAPServerModule;
 import org.junit.jupiter.api.Test;
@@ -34,7 +32,6 @@ class CassandraJamesServerTest implements JamesServerContract 
{
 .extension(new DockerElasticSearchExtension())
 .extension(new CassandraExtension())

[james-project] 09/12: JAMES-3348 Add missing Sieve persistent class declarations

2020-07-29 Thread btellier
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 03addb01736738f54bf7c9e0bbb9c3ec43a37419
Author: Benoit Tellier 
AuthorDate: Tue Jul 28 16:30:14 2020 +0700

JAMES-3348 Add missing Sieve persistent class declarations
---
 server/app/src/main/resources/META-INF/persistence.xml  | 2 ++
 .../guice/jpa-guice/src/main/resources/META-INF/persistence.xml | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/server/app/src/main/resources/META-INF/persistence.xml 
b/server/app/src/main/resources/META-INF/persistence.xml
index 6f68e20..405b5b5 100644
--- a/server/app/src/main/resources/META-INF/persistence.xml
+++ b/server/app/src/main/resources/META-INF/persistence.xml
@@ -36,6 +36,8 @@
 org.apache.james.mailrepository.jpa.JPAUrl
 org.apache.james.user.jpa.model.JPAUser
 org.apache.james.rrt.jpa.model.JPARecipientRewrite
+org.apache.james.sieve.jpa.model.JPASieveQuota
+org.apache.james.sieve.jpa.model.JPASieveScript
 
org.apache.james.mailbox.jpa.quota.model.MaxDomainMessageCount
 
org.apache.james.mailbox.jpa.quota.model.MaxDomainStorage
 
org.apache.james.mailbox.jpa.quota.model.MaxGlobalMessageCount
diff --git 
a/server/container/guice/jpa-guice/src/main/resources/META-INF/persistence.xml 
b/server/container/guice/jpa-guice/src/main/resources/META-INF/persistence.xml
index 2b89b96..e847af4 100644
--- 
a/server/container/guice/jpa-guice/src/main/resources/META-INF/persistence.xml
+++ 
b/server/container/guice/jpa-guice/src/main/resources/META-INF/persistence.xml
@@ -35,6 +35,8 @@
 org.apache.james.mailrepository.jpa.JPAUrl
 org.apache.james.user.jpa.model.JPAUser
 org.apache.james.rrt.jpa.model.JPARecipientRewrite
+org.apache.james.sieve.jpa.model.JPASieveQuota
+org.apache.james.sieve.jpa.model.JPASieveScript
 
 
org.apache.james.mailbox.jpa.quota.model.MaxDomainMessageCount
 
org.apache.james.mailbox.jpa.quota.model.MaxDomainStorage


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



[james-project] 12/12: [REFACTORING] Override cleanup for RabbitMQAwsS3Stepdefs

2020-07-29 Thread btellier
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 89fb5f4df08da90b4ba0b321224e3be9f6b110a3
Author: Benoit Tellier 
AuthorDate: Wed Jul 29 11:40:01 2020 +0700

[REFACTORING] Override cleanup for RabbitMQAwsS3Stepdefs
---
 .../test/java/org/apache/james/CassandraJmapJamesServerTest.java| 3 ---
 .../james/jmap/rabbitmq/cucumber/awss3/RabbitMQAwsS3Stepdefs.java   | 6 --
 2 files changed, 9 deletions(-)

diff --git 
a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapJamesServerTest.java
 
b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapJamesServerTest.java
index 97efb6b..2abb9d5 100644
--- 
a/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapJamesServerTest.java
+++ 
b/server/container/guice/cassandra-guice/src/test/java/org/apache/james/CassandraJmapJamesServerTest.java
@@ -20,8 +20,6 @@
 package org.apache.james;
 
 import org.apache.james.jmap.draft.JmapJamesServerContract;
-import org.apache.james.mailbox.extractor.TextExtractor;
-import org.apache.james.mailbox.store.search.PDFTextExtractor;
 import org.apache.james.modules.TestJMAPServerModule;
 import org.junit.jupiter.api.extension.RegisterExtension;
 
@@ -31,7 +29,6 @@ class CassandraJmapJamesServerTest implements 
JmapJamesServerContract {
 .extension(new DockerElasticSearchExtension())
 .extension(new CassandraExtension())
 .server(configuration -> 
CassandraJamesServerMain.createServer(configuration)
-.overrideWith(binder -> 
binder.bind(TextExtractor.class).to(PDFTextExtractor.class))
 .overrideWith(new TestJMAPServerModule())
 .overrideWith(DOMAIN_LIST_CONFIGURATION_MODULE))
 .build();
diff --git 
a/server/protocols/jmap-draft-integration-testing/rabbitmq-jmap-draft-integration-testing/src/test/java/org/apache/james/jmap/rabbitmq/cucumber/awss3/RabbitMQAwsS3Stepdefs.java
 
b/server/protocols/jmap-draft-integration-testing/rabbitmq-jmap-draft-integration-testing/src/test/java/org/apache/james/jmap/rabbitmq/cucumber/awss3/RabbitMQAwsS3Stepdefs.java
index f9f60e9..e588f66 100644
--- 
a/server/protocols/jmap-draft-integration-testing/rabbitmq-jmap-draft-integration-testing/src/test/java/org/apache/james/jmap/rabbitmq/cucumber/awss3/RabbitMQAwsS3Stepdefs.java
+++ 
b/server/protocols/jmap-draft-integration-testing/rabbitmq-jmap-draft-integration-testing/src/test/java/org/apache/james/jmap/rabbitmq/cucumber/awss3/RabbitMQAwsS3Stepdefs.java
@@ -23,8 +23,6 @@ import java.util.Arrays;
 
 import javax.inject.Inject;
 
-import org.apache.activemq.store.PersistenceAdapter;
-import org.apache.activemq.store.memory.MemoryPersistenceAdapter;
 import org.apache.james.CassandraRabbitMQJamesConfiguration;
 import org.apache.james.CassandraRabbitMQJamesServerMain;
 import org.apache.james.CleanupTasksPerformer;
@@ -34,8 +32,6 @@ import org.apache.james.SearchConfiguration;
 import org.apache.james.jmap.draft.methods.integration.cucumber.ImapStepdefs;
 import org.apache.james.jmap.draft.methods.integration.cucumber.MainStepdefs;
 import org.apache.james.mailbox.cassandra.ids.CassandraMessageId;
-import org.apache.james.mailbox.extractor.TextExtractor;
-import org.apache.james.mailbox.store.extractor.DefaultTextExtractor;
 import org.apache.james.modules.DockerRabbitMQRule;
 import org.apache.james.modules.TestDockerESMetricReporterModule;
 import org.apache.james.modules.TestJMAPServerModule;
@@ -95,8 +91,6 @@ public class RabbitMQAwsS3Stepdefs {
 .overrideWith(swiftServer.getModule())
 .overrideWith(elasticSearch.getModule())
 .overrideWith(cassandraServer.getModule())
-.overrideWith(binder -> 
binder.bind(TextExtractor.class).to(DefaultTextExtractor.class))
-.overrideWith((binder) -> 
binder.bind(PersistenceAdapter.class).to(MemoryPersistenceAdapter.class))
 .overrideWith(binder -> Multibinder.newSetBinder(binder, 
CleanupTasksPerformer.CleanupTask.class).addBinding().to(CassandraTruncateTableTask.class))
 .overrideWith((binder -> 
binder.bind(CleanupTasksPerformer.class).asEagerSingleton()));
 mainStepdefs.awaitMethod = () -> 
elasticSearch.getDockerEs().flushIndices();


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



[james-project] 05/12: JAMES-3093 User and mailboxes provisioning for JMAP-RFC-8621

2020-07-29 Thread btellier
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 d2c314e5096058f04fadfbffee00732519d7949c
Author: Rene Cordier 
AuthorDate: Wed Jul 22 17:17:00 2020 +0700

JAMES-3093 User and mailboxes provisioning for JMAP-RFC-8621
---
 .../distributed/DistributedProvisioningTest.java   | 53 ++
 .../james/jmap/rfc8621/contract/Fixture.scala  | 14 
 .../contract/MailboxGetMethodContract.scala| 14 
 .../rfc8621/contract/ProvisioningContract.scala| 83 ++
 .../rfc8621/memory/MemoryProvisioningTest.java | 38 ++
 .../apache/james/jmap/routes/JMAPApiRoutes.scala   | 16 +++--
 .../james/jmap/routes/JMAPApiRoutesTest.scala  | 14 ++--
 7 files changed, 209 insertions(+), 23 deletions(-)

diff --git 
a/server/protocols/jmap-rfc-8621-integration-tests/distributed-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/distributed/DistributedProvisioningTest.java
 
b/server/protocols/jmap-rfc-8621-integration-tests/distributed-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/distributed/DistributedProvisioningTest.java
new file mode 100644
index 000..f86bad6
--- /dev/null
+++ 
b/server/protocols/jmap-rfc-8621-integration-tests/distributed-jmap-rfc-8621-integration-tests/src/test/java/org/apache/james/jmap/rfc8621/distributed/DistributedProvisioningTest.java
@@ -0,0 +1,53 @@
+/
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information*
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the*
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *  *
+ *   http://www.apache.org/licenses/LICENSE-2.0 *
+ *  *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY   *
+ * KIND, either express or implied.  See the License for the*
+ * specific language governing permissions and limitations  *
+ * under the License.   *
+ /
+
+package org.apache.james.jmap.rfc8621.distributed;
+
+import org.apache.james.CassandraExtension;
+import org.apache.james.CassandraRabbitMQJamesConfiguration;
+import org.apache.james.CassandraRabbitMQJamesServerMain;
+import org.apache.james.DockerElasticSearchExtension;
+import org.apache.james.JamesServerBuilder;
+import org.apache.james.JamesServerExtension;
+import org.apache.james.jmap.rfc8621.contract.ProvisioningContract;
+import org.apache.james.modules.AwsS3BlobStoreExtension;
+import org.apache.james.modules.RabbitMQExtension;
+import org.apache.james.modules.TestJMAPServerModule;
+import org.apache.james.modules.blobstore.BlobStoreConfiguration;
+import org.junit.jupiter.api.extension.RegisterExtension;
+
+public class DistributedProvisioningTest implements ProvisioningContract {
+@RegisterExtension
+static JamesServerExtension testExtension = new 
JamesServerBuilder(tmpDir ->
+CassandraRabbitMQJamesConfiguration.builder()
+.workingDirectory(tmpDir)
+.configurationFromClasspath()
+.blobStore(BlobStoreConfiguration.builder()
+.objectStorage()
+.disableCache()
+.deduplication())
+.build())
+.extension(new DockerElasticSearchExtension())
+.extension(new CassandraExtension())
+.extension(new RabbitMQExtension())
+.extension(new AwsS3BlobStoreExtension())
+.server(configuration -> 
CassandraRabbitMQJamesServerMain.createServer(configuration)
+.overrideWith(new TestJMAPServerModule()))
+.build();
+}
diff --git 
a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/Fixture.scala
 
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/Fixture.scala
index 799f8f9..7022a76 100644
--- 
a/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/rfc8621/contract/Fixture.scala
+++ 
b/server/protocols/jmap-rfc-8621-integration-tests/jmap-rfc-8621-integration-tests-common/src/main/scala/org/apache/james/jmap/

[jira] [Closed] (JAMES-3348) Problems with sieve: missing persistant class declaration

2020-07-29 Thread Benoit Tellier (Jira)


 [ 
https://issues.apache.org/jira/browse/JAMES-3348?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benoit Tellier closed JAMES-3348.
-
Resolution: Fixed

> Problems with sieve: missing persistant class declaration
> -
>
> Key: JAMES-3348
> URL: https://issues.apache.org/jira/browse/JAMES-3348
> Project: James Server
>  Issue Type: Improvement
>  Components: data, jpa
>Reporter: Benoit Tellier
>Priority: Major
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> As reported by David in 
> https://www.mail-archive.com/server-dev@james.apache.org/msg67980.html
> JPA products fails to load sieve related data:
> {code:java}
> 14:31:44.887 [ERROR] o.a.j.t.m.j.d.SieveExecutor - Cannot evaluate Sieve 
> script 
> for user 
> org.apache.openjpa.persistence.ArgumentException: There is no query with the 
> name "findActiveByUsername" defined for any of the known persistent classes: 
> {code}
> We are missing the following persistant class declarations:
> {code:java}
> org.apache.james.sieve.jpa.model.JPASieveQuota
> org.apache.james.sieve.jpa.model.JPASieveScript
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[jira] [Commented] (JAMES-3348) Problems with sieve: missing persistant class declaration

2020-07-29 Thread Benoit Tellier (Jira)


[ 
https://issues.apache.org/jira/browse/JAMES-3348?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17167619#comment-17167619
 ] 

Benoit Tellier commented on JAMES-3348:
---

https://github.com/apache/james-project/pull/242 is merged

> Problems with sieve: missing persistant class declaration
> -
>
> Key: JAMES-3348
> URL: https://issues.apache.org/jira/browse/JAMES-3348
> Project: James Server
>  Issue Type: Improvement
>  Components: data, jpa
>Reporter: Benoit Tellier
>Priority: Major
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> As reported by David in 
> https://www.mail-archive.com/server-dev@james.apache.org/msg67980.html
> JPA products fails to load sieve related data:
> {code:java}
> 14:31:44.887 [ERROR] o.a.j.t.m.j.d.SieveExecutor - Cannot evaluate Sieve 
> script 
> for user 
> org.apache.openjpa.persistence.ArgumentException: There is no query with the 
> name "findActiveByUsername" defined for any of the known persistent classes: 
> {code}
> We are missing the following persistant class declarations:
> {code:java}
> org.apache.james.sieve.jpa.model.JPASieveQuota
> org.apache.james.sieve.jpa.model.JPASieveScript
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[jira] [Closed] (JAMES-3317) Configuration option: choosing between PassThroughBlobStore & DeDuplicatingBlobStore

2020-07-29 Thread Benoit Tellier (Jira)


 [ 
https://issues.apache.org/jira/browse/JAMES-3317?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benoit Tellier closed JAMES-3317.
-
Resolution: Fixed

https://github.com/linagora/james-project/pull/3610 solved this

> Configuration option: choosing between PassThroughBlobStore & 
> DeDuplicatingBlobStore
> 
>
> Key: JAMES-3317
> URL: https://issues.apache.org/jira/browse/JAMES-3317
> Project: James Server
>  Issue Type: New Feature
>  Components: Blob
>Reporter: Rémi Kowalski
>Priority: Major
> Fix For: 3.6.0
>
>
> As an operator, I want to be able to choose between the PassThrough blob 
> Store and de deduplicating one.
> h2. DOD
> I am able to start a Distributed server with a PassThrough blob store.
> IMAP APPENDing 2 time the same mail to "bob" on top of such a server should 
> result in the body being stored 2 times (so 4 objects in the blobStore).
> h2. How
> Add a {{duplication.enable}} option within {{blobstore.properties}} (default 
> to false)
> BlobStoreConfiguration will allow a {{duplicationEnabled()}} method call.
> BlobStoreModulesChooser need bind either PassThroughBlobStore or 
> DeDuplicatingBlobStore depending on {{duplicationEnabled()}} result.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[jira] [Closed] (JAMES-3093) Backport from jmap-draft to jmap CORS, auth mechanisms and user & mailbox provisioning

2020-07-29 Thread Benoit Tellier (Jira)


 [ 
https://issues.apache.org/jira/browse/JAMES-3093?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benoit Tellier closed JAMES-3093.
-
Resolution: Fixed

https://github.com/linagora/james-project/pull/3604 solved this

> Backport from jmap-draft to jmap CORS, auth mechanisms and user & mailbox 
> provisioning
> --
>
> Key: JAMES-3093
> URL: https://issues.apache.org/jira/browse/JAMES-3093
> Project: James Server
>  Issue Type: Sub-task
>Reporter: René Cordier
>Priority: Major
>
> You need to backport from `jmap-draft` to `jmap` those following items:
> * authentication mechanisms (the simple auth mechanism would have probably 
> been backported already for the session)
> * CORS
> * user and mailbox provisioning
> *DoD*: successful port with corresponding passing tests



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[jira] [Closed] (JAMES-2892) Implement level error-handling protocol

2020-07-29 Thread Benoit Tellier (Jira)


 [ 
https://issues.apache.org/jira/browse/JAMES-2892?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Benoit Tellier closed JAMES-2892.
-
Fix Version/s: 3.6.0
   Resolution: Fixed

https://github.com/linagora/james-project/pull/3594 implemented this

> Implement level error-handling protocol
> ---
>
> Key: JAMES-2892
> URL: https://issues.apache.org/jira/browse/JAMES-2892
> Project: James Server
>  Issue Type: Sub-task
>  Components: JMAP
>Reporter: Benoit Tellier
>Assignee: Antoine Duprat
>Priority: Major
> Fix For: 3.6.0
>
>
> See https://jmap.io/spec-core.html#errors notes about Request-Level Errors:
> When an HTTP error response is returned to the client, the server SHOULD 
> return a JSON “problem details” object as the response body, as per 
> [RFC7807](https://tools.ietf.org/html/rfc7807).
> The following problem types are defined:
>  - urn:ietf:params:jmap:error:unknownCapability The client included a 
> capability in the “using” property of the request that the server does not 
> support.
>  - urn:ietf:params:jmap:error:notJSON The content type of the request was not 
> application/json or the request did not parse as I-JSON.
>  - urn:ietf:params:jmap:error:notRequest The request parsed as JSON but did 
> not match the type signature of the Request object.
>  - urn:ietf:params:jmap:error:limit The request was not processed as it would 
> have exceeded one of the request limits defined on the capability object, 
> such as maxSizeRequest, maxCallsInRequest, or maxConcurrentRequests. A 
> “limit” property MUST also be present on the “problem details” object, 
> containing the name of the limit being applied.
> *Example*
> {code:java}
> {
>   "type": "urn:ietf:params:jmap:error:unknownCapability",
>   "status": 400,
>   "detail": "The Request object used capability
> 'https://example.com/apis/foobar', which is not supported
> by this server."
> }
> {code}
> *DOD*:
>  - Ommitting the content-type, accept header, sending non json payload, 
> invalid json payload, or violating limits should result in the right error. 
> You will write *memory integration tests* demonstrating these protocol errors.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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



[jira] [Created] (JAMES-3351) JMAP authentication rework

2020-07-29 Thread Lan Khuat (Jira)
Lan Khuat created JAMES-3351:


 Summary: JMAP authentication rework
 Key: JAMES-3351
 URL: https://issues.apache.org/jira/browse/JAMES-3351
 Project: James Server
  Issue Type: Improvement
Reporter: Lan Khuat


We mandate at least one authentication strategy to return a valid result. 
However, this means that if one authentication strategy is valid then others 
can be invalid, or both are valid but come from different identities.


To avoid this complication, if one of the authentication method is attenpted 
with wrong credentials the authentication will fail. We should not allow more 
than one set of credentials.

*DOD:* 
 * Rework authentication strategies.


 * Write a JMAP-Draft and JMAP-RFC-8621 integration test, exercising several 
authentication strategies, and demonstrating that if any of them fails, then 
the request is rejected.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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