MAILBOX-266 DeleteByQuery type should be void

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

Branch: refs/heads/master
Commit: d1d5712f932869c17a6d6f42c47a8edc9169eca2
Parents: 1d43ec8
Author: Benoit Tellier <btell...@linagora.com>
Authored: Wed Apr 6 15:06:53 2016 +0700
Committer: Benoit Tellier <btell...@linagora.com>
Committed: Wed Apr 6 16:18:46 2016 +0700

----------------------------------------------------------------------
 .../james/mailbox/elasticsearch/DeleteByQueryPerformer.java | 3 +--
 .../james/mailbox/elasticsearch/ElasticSearchIndexer.java   | 4 ++--
 .../mailbox/elasticsearch/ElasticSearchIndexerTest.java     | 3 +--
 ...ElasticSearchListeningMailboxMessageSearchIndexTest.java | 9 +++++----
 4 files changed, 9 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/d1d5712f/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/DeleteByQueryPerformer.java
----------------------------------------------------------------------
diff --git 
a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/DeleteByQueryPerformer.java
 
b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/DeleteByQueryPerformer.java
index 772432c..be81654 100644
--- 
a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/DeleteByQueryPerformer.java
+++ 
b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/DeleteByQueryPerformer.java
@@ -56,9 +56,8 @@ public class DeleteByQueryPerformer {
         this.batchSize = batchSize;
     }
 
-    public Void perform(QueryBuilder queryBuilder) {
+    public void perform(QueryBuilder queryBuilder) {
         executor.execute(() -> doDeleteByQuery(queryBuilder));
-        return null;
     }
 
     protected void doDeleteByQuery(QueryBuilder queryBuilder) {

http://git-wip-us.apache.org/repos/asf/james-project/blob/d1d5712f/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIndexer.java
----------------------------------------------------------------------
diff --git 
a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIndexer.java
 
b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIndexer.java
index 5f99fd6..85c46bc 100644
--- 
a/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIndexer.java
+++ 
b/mailbox/elasticsearch/src/main/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIndexer.java
@@ -86,8 +86,8 @@ public class ElasticSearchIndexer {
         return bulkRequestBuilder.get();
     }
     
-    public Void deleteAllMatchingQuery(QueryBuilder queryBuilder) {
-        return deleteByQueryPerformer.perform(queryBuilder);
+    public void deleteAllMatchingQuery(QueryBuilder queryBuilder) {
+        deleteByQueryPerformer.perform(queryBuilder);
     }
 
     private void checkArgument(String content) {

http://git-wip-us.apache.org/repos/asf/james-project/blob/d1d5712f/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIndexerTest.java
----------------------------------------------------------------------
diff --git 
a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIndexerTest.java
 
b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIndexerTest.java
index 2acca41..f5f2118 100644
--- 
a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIndexerTest.java
+++ 
b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/ElasticSearchIndexerTest.java
@@ -58,9 +58,8 @@ public class ElasticSearchIndexerTest {
         TestingClientProvider clientProvider = new TestingClientProvider(node);
         DeleteByQueryPerformer deleteByQueryPerformer = new 
DeleteByQueryPerformer(clientProvider.get(), 
Executors.newSingleThreadExecutor(), MINIMUM_BATCH_SIZE) {
             @Override
-            public Void perform(QueryBuilder queryBuilder) {
+            public void perform(QueryBuilder queryBuilder) {
                 doDeleteByQuery(queryBuilder);
-                return null;
             }
         };
         testee = new ElasticSearchIndexer(clientProvider.get(), 
deleteByQueryPerformer);

http://git-wip-us.apache.org/repos/asf/james-project/blob/d1d5712f/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/events/ElasticSearchListeningMailboxMessageSearchIndexTest.java
----------------------------------------------------------------------
diff --git 
a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/events/ElasticSearchListeningMailboxMessageSearchIndexTest.java
 
b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/events/ElasticSearchListeningMailboxMessageSearchIndexTest.java
index 79691d1..64bb04c 100644
--- 
a/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/events/ElasticSearchListeningMailboxMessageSearchIndexTest.java
+++ 
b/mailbox/elasticsearch/src/test/java/org/apache/james/mailbox/elasticsearch/events/ElasticSearchListeningMailboxMessageSearchIndexTest.java
@@ -40,6 +40,7 @@ import org.apache.james.mailbox.store.TestId;
 import org.apache.james.mailbox.store.mail.MessageMapperFactory;
 import org.apache.james.mailbox.store.mail.model.Mailbox;
 import org.apache.james.mailbox.store.mail.model.MailboxMessage;
+import org.easymock.EasyMock;
 import org.easymock.IMocksControl;
 import org.elasticsearch.ElasticsearchException;
 import org.elasticsearch.action.bulk.BulkResponse;
@@ -237,8 +238,8 @@ public class 
ElasticSearchListeningMailboxMessageSearchIndexTest {
         expectLastCall();
         expect(mailbox.getMailboxId()).andReturn(mailboxId);
 
-        expect(indexer.deleteAllMatchingQuery(anyObject(QueryBuilder.class)))
-            .andReturn(null);
+        indexer.deleteAllMatchingQuery(anyObject(QueryBuilder.class));
+        EasyMock.expectLastCall();
 
         control.replay();
         testee.deleteAll(session, mailbox);
@@ -256,8 +257,8 @@ public class 
ElasticSearchListeningMailboxMessageSearchIndexTest {
         expectLastCall();
         expect(mailbox.getMailboxId()).andReturn(mailboxId).times(2);
 
-        expect(indexer.deleteAllMatchingQuery(anyObject(QueryBuilder.class)))
-            .andThrow(new ElasticsearchException(""));
+        indexer.deleteAllMatchingQuery(anyObject(QueryBuilder.class));
+        EasyMock.expectLastCall().andThrow(new ElasticsearchException(""));
 
         control.replay();
         testee.deleteAll(session, mailbox);


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

Reply via email to