You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by ro...@apache.org on 2018/01/23 15:46:35 UTC

[1/3] james-project git commit: MAILBOX-323 Avoid non prepared query recycling

Repository: james-project
Updated Branches:
  refs/heads/master 0ae36b298 -> 6c72ae84a


MAILBOX-323 Avoid non prepared query recycling

We should rather rely on a more generic prepared query.


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

Branch: refs/heads/master
Commit: c43e97457b6b15db3efbe9851f6a89987604d171
Parents: 0ae36b2
Author: benwa <bt...@linagora.com>
Authored: Mon Jan 22 18:32:01 2018 +0700
Committer: benwa <bt...@linagora.com>
Committed: Mon Jan 22 18:32:01 2018 +0700

----------------------------------------------------------------------
 .../quota/CassandraPerUserMaxQuotaManager.java     | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/c43e9745/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraPerUserMaxQuotaManager.java
----------------------------------------------------------------------
diff --git a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraPerUserMaxQuotaManager.java b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraPerUserMaxQuotaManager.java
index c5b5e7f..5a6a1b3 100644
--- a/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraPerUserMaxQuotaManager.java
+++ b/mailbox/cassandra/src/main/java/org/apache/james/mailbox/cassandra/quota/CassandraPerUserMaxQuotaManager.java
@@ -36,7 +36,6 @@ import org.apache.james.mailbox.quota.MaxQuotaManager;
 import com.datastax.driver.core.PreparedStatement;
 import com.datastax.driver.core.ResultSet;
 import com.datastax.driver.core.Session;
-import com.datastax.driver.core.Statement;
 
 public class CassandraPerUserMaxQuotaManager implements MaxQuotaManager {
 
@@ -47,8 +46,7 @@ public class CassandraPerUserMaxQuotaManager implements MaxQuotaManager {
     private final PreparedStatement getMaxMessageStatement;
     private final PreparedStatement setDefaultMaxStorageStatement;
     private final PreparedStatement setDefaultMaxMessageStatement;
-    private final Statement getDefaultMaxStorageStatement;
-    private final Statement getDefaultMaxMessageStatement;
+    private final PreparedStatement getDefaultMaxStatement;
 
     @Inject
     public CassandraPerUserMaxQuotaManager(Session session) {
@@ -65,12 +63,9 @@ public class CassandraPerUserMaxQuotaManager implements MaxQuotaManager {
         this.getMaxMessageStatement = session.prepare(select(CassandraMaxQuota.MESSAGE_COUNT)
             .from(CassandraMaxQuota.TABLE_NAME)
             .where(eq(CassandraMaxQuota.QUOTA_ROOT, bindMarker())));
-        this.getDefaultMaxMessageStatement = select(CassandraDefaultMaxQuota.VALUE)
+        this.getDefaultMaxStatement = session.prepare(select(CassandraDefaultMaxQuota.VALUE)
             .from(CassandraDefaultMaxQuota.TABLE_NAME)
-            .where(eq(CassandraDefaultMaxQuota.TYPE, CassandraDefaultMaxQuota.MESSAGE));
-        this.getDefaultMaxStorageStatement = select(CassandraDefaultMaxQuota.VALUE)
-            .from(CassandraDefaultMaxQuota.TABLE_NAME)
-            .where(eq(CassandraDefaultMaxQuota.TYPE, CassandraDefaultMaxQuota.STORAGE));
+            .where(eq(CassandraDefaultMaxQuota.TYPE, bindMarker(CassandraDefaultMaxQuota.TYPE))));
         this.setDefaultMaxMessageStatement = session.prepare(insertInto(CassandraDefaultMaxQuota.TABLE_NAME)
             .value(CassandraDefaultMaxQuota.TYPE, CassandraDefaultMaxQuota.MESSAGE)
             .value(CassandraDefaultMaxQuota.VALUE, bindMarker()));
@@ -101,7 +96,8 @@ public class CassandraPerUserMaxQuotaManager implements MaxQuotaManager {
 
     @Override
     public long getDefaultMaxStorage() throws MailboxException {
-        ResultSet resultSet = session.execute(getDefaultMaxStorageStatement);
+        ResultSet resultSet = session.execute(getDefaultMaxStatement.bind()
+            .setString(CassandraDefaultMaxQuota.TYPE, CassandraDefaultMaxQuota.STORAGE));
         if (resultSet.isExhausted()) {
             return Quota.UNLIMITED;
         }
@@ -110,7 +106,8 @@ public class CassandraPerUserMaxQuotaManager implements MaxQuotaManager {
 
     @Override
     public long getDefaultMaxMessage() throws MailboxException {
-        ResultSet resultSet = session.execute(getDefaultMaxMessageStatement);
+        ResultSet resultSet = session.execute(getDefaultMaxStatement.bind()
+            .setString(CassandraDefaultMaxQuota.TYPE, CassandraDefaultMaxQuota.MESSAGE));
         if (resultSet.isExhausted()) {
             return Quota.UNLIMITED;
         }


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


[3/3] james-project git commit: Merge remote-tracking branch 'benoit/MAILBOX-323'

Posted by ro...@apache.org.
Merge remote-tracking branch 'benoit/MAILBOX-323'


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

Branch: refs/heads/master
Commit: 6c72ae84a40e7e09a5ae07d6cc6f1e2dde075f1a
Parents: 1eb4cc6 c43e974
Author: Raphael Ouazana <ra...@linagora.com>
Authored: Tue Jan 23 16:45:55 2018 +0100
Committer: Raphael Ouazana <ra...@linagora.com>
Committed: Tue Jan 23 16:45:55 2018 +0100

----------------------------------------------------------------------
 .../quota/CassandraPerUserMaxQuotaManager.java     | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)
----------------------------------------------------------------------



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


[2/3] james-project git commit: JAMES-2313 Split CassandraSharingTest to improve CI stability

Posted by ro...@apache.org.
JAMES-2313 Split CassandraSharingTest to improve CI stability


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

Branch: refs/heads/master
Commit: 1eb4cc6a22a1ae760f5d080584729a469fd64913
Parents: 0ae36b2
Author: benwa <bt...@linagora.com>
Authored: Tue Jan 23 16:26:07 2018 +0700
Committer: benwa <bt...@linagora.com>
Committed: Tue Jan 23 16:26:07 2018 +0700

----------------------------------------------------------------------
 .../cucumber/CassandraMailboxSharingTest.java   | 53 +++++++++++++++++
 .../cucumber/CassandraMessageSharingTest.java   | 54 +++++++++++++++++
 .../cucumber/CassandraSharingTest.java          | 61 --------------------
 3 files changed, 107 insertions(+), 61 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/1eb4cc6a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraMailboxSharingTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraMailboxSharingTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraMailboxSharingTest.java
new file mode 100644
index 0000000..ab6ec60
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraMailboxSharingTest.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.cassandra.cucumber;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+
+import cucumber.api.CucumberOptions;
+import cucumber.api.junit.Cucumber;
+
+@RunWith(Cucumber.class)
+@CucumberOptions(features = {
+    "classpath:cucumber/sharing/SharingParentMailboxWithAndWithoutChildren.feature",
+    "classpath:cucumber/sharing/SharingChildrenWithoutSharingParent.feature",
+    "classpath:cucumber/sharing/SharingMailboxWithOtherDomain.feature",
+    "classpath:cucumber/sharing/MailboxCreationAndSharing.feature",
+    "classpath:cucumber/sharing/MailboxDeletionAndSharing.feature",
+    "classpath:cucumber/sharing/MoveMailboxAndSharing.feature",
+    "classpath:cucumber/sharing/RenamingMailboxAndSharing.feature" },
+    glue = { "org.apache.james.jmap.methods.integration", "org.apache.james.jmap.cassandra.cucumber" },
+    tags = {"~@Ignore"},
+    strict = true)
+public class CassandraMailboxSharingTest {
+
+    @BeforeClass
+    public static void init() {
+        CucumberCassandraSingleton.cassandraServer.start();
+    }
+
+    @AfterClass
+    public static void after() {
+        CucumberCassandraSingleton.cassandraServer.stop();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/1eb4cc6a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraMessageSharingTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraMessageSharingTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraMessageSharingTest.java
new file mode 100644
index 0000000..bbfaab9
--- /dev/null
+++ b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraMessageSharingTest.java
@@ -0,0 +1,54 @@
+/****************************************************************
+ * 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.cassandra.cucumber;
+
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.runner.RunWith;
+
+import cucumber.api.CucumberOptions;
+import cucumber.api.junit.Cucumber;
+
+@RunWith(Cucumber.class)
+@CucumberOptions(features = {
+    "classpath:cucumber/sharing/GetMessageAndSharing.feature",
+    "classpath:cucumber/sharing/SetMessagesOnSharedMailbox.feature",
+    "classpath:cucumber/sharing/DownloadAndSharing.feature",
+    "classpath:cucumber/sharing/KeywordsConsistencyOnDelegationMailbox.feature",
+    "classpath:cucumber/sharing/GetMessageListAndSharing.feature",
+    "classpath:cucumber/sharing/MoveMessageAndSharing.feature",
+    "classpath:cucumber/sharing/SetFlagAndSharing.feature",
+    "classpath:cucumber/sharing/CopyAndSharing.feature" },
+    glue = { "org.apache.james.jmap.methods.integration", "org.apache.james.jmap.cassandra.cucumber" },
+    tags = {"~@Ignore"},
+    strict = true)
+public class CassandraMessageSharingTest {
+
+    @BeforeClass
+    public static void init() {
+        CucumberCassandraSingleton.cassandraServer.start();
+    }
+
+    @AfterClass
+    public static void after() {
+        CucumberCassandraSingleton.cassandraServer.stop();
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/james-project/blob/1eb4cc6a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraSharingTest.java
----------------------------------------------------------------------
diff --git a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraSharingTest.java b/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraSharingTest.java
deleted file mode 100644
index 06a43bd..0000000
--- a/server/protocols/jmap-integration-testing/cassandra-jmap-integration-testing/src/test/java/org/apache/james/jmap/cassandra/cucumber/CassandraSharingTest.java
+++ /dev/null
@@ -1,61 +0,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.                                           *
- ****************************************************************/
-
-package org.apache.james.jmap.cassandra.cucumber;
-
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
-import org.junit.runner.RunWith;
-
-import cucumber.api.CucumberOptions;
-import cucumber.api.junit.Cucumber;
-
-@RunWith(Cucumber.class)
-@CucumberOptions(features = {
-    "classpath:cucumber/sharing/SharingParentMailboxWithAndWithoutChildren.feature",
-    "classpath:cucumber/sharing/SharingChildrenWithoutSharingParent.feature",
-    "classpath:cucumber/sharing/GetMessageAndSharing.feature",
-    "classpath:cucumber/sharing/SharingMailboxWithOtherDomain.feature",
-    "classpath:cucumber/sharing/MailboxCreationAndSharing.feature",
-    "classpath:cucumber/sharing/MailboxDeletionAndSharing.feature",
-    "classpath:cucumber/sharing/SetMessagesOnSharedMailbox.feature",
-    "classpath:cucumber/sharing/DownloadAndSharing.feature",
-    "classpath:cucumber/sharing/KeywordsConsistencyOnDelegationMailbox.feature",
-    "classpath:cucumber/sharing/GetMessageListAndSharing.feature",
-    "classpath:cucumber/sharing/MoveMessageAndSharing.feature",
-    "classpath:cucumber/sharing/MoveMailboxAndSharing.feature",
-    "classpath:cucumber/sharing/SetFlagAndSharing.feature",
-    "classpath:cucumber/sharing/RenamingMailboxAndSharing.feature",
-    "classpath:cucumber/sharing/CopyAndSharing.feature" },
-    glue = { "org.apache.james.jmap.methods.integration", "org.apache.james.jmap.cassandra.cucumber" },
-    tags = {"~@Ignore"},
-    strict = true)
-public class CassandraSharingTest {
-
-    @BeforeClass
-    public static void init() {
-        CucumberCassandraSingleton.cassandraServer.start();
-    }
-
-    @AfterClass
-    public static void after() {
-        CucumberCassandraSingleton.cassandraServer.stop();
-    }
-
-}


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