james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [4/4] james-project git commit: JAMES-2366 Fix HBase getAllMappings
Date Wed, 18 Apr 2018 11:43:07 GMT
JAMES-2366 Fix HBase getAllMappings


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

Branch: refs/heads/master
Commit: 117ccbba4ed88cc34b80c9fc7d8942d0e632aec1
Parents: aeda0ff
Author: Raphael Ouazana <raphael.ouazana@linagora.com>
Authored: Tue Apr 17 16:57:46 2018 +0200
Committer: benwa <btellier@linagora.com>
Committed: Wed Apr 18 18:42:25 2018 +0700

----------------------------------------------------------------------
 .../apache/james/rrt/hbase/HBaseRecipientRewriteTable.java    | 5 ++++-
 .../james/rrt/hbase/HBaseRecipientRewriteTableTest.java       | 7 -------
 .../src/main/java/org/apache/james/rrt/lib/MappingsImpl.java  | 5 +++++
 3 files changed, 9 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/117ccbba/server/data/data-hbase/src/main/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTable.java
----------------------------------------------------------------------
diff --git a/server/data/data-hbase/src/main/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTable.java
b/server/data/data-hbase/src/main/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTable.java
index dd9b042..7e019b5 100644
--- a/server/data/data-hbase/src/main/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTable.java
+++ b/server/data/data-hbase/src/main/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTable.java
@@ -44,6 +44,8 @@ import org.apache.james.system.hbase.TablePool;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import com.google.common.base.Splitter;
+
 /**
  * Implementation of the RecipientRewriteTable for a HBase persistence.
  */
@@ -54,6 +56,7 @@ public class HBaseRecipientRewriteTable extends AbstractRecipientRewriteTable
{
      */
     private static final Logger log = LoggerFactory.getLogger(HBaseRecipientRewriteTable.class.getName());
     private static final String ROW_SEPARATOR = "@";
+    private static final String COLUMN_SEPARATOR = ";";
 
     @Override
     protected void addMappingInternal(String user, Domain domain, Mapping mapping) throws
RecipientRewriteTableException {
@@ -129,7 +132,7 @@ public class HBaseRecipientRewriteTable extends AbstractRecipientRewriteTable
{
                                     Optional.ofNullable(
                                         map.get(email))
                                         .orElse(MappingsImpl.empty()))
-                                .add(Bytes.toString(keyValue.getRow()))
+                                .addAll(Splitter.on(COLUMN_SEPARATOR).split(Bytes.toString(keyValue.getValue())))
                                 .build();
                         map.put(email, mappings);
                     }

http://git-wip-us.apache.org/repos/asf/james-project/blob/117ccbba/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java
----------------------------------------------------------------------
diff --git a/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java
b/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java
index 81e2c59..d425db9 100644
--- a/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java
+++ b/server/data/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java
@@ -28,7 +28,6 @@ import org.apache.james.system.hbase.TablePool;
 import org.apache.james.user.hbase.def.HUsersRepository;
 import org.junit.After;
 import org.junit.Before;
-import org.junit.Ignore;
 
 /**
  * Tests for the HBase RecipientRewriteTable implementation.
@@ -61,10 +60,4 @@ public class HBaseRecipientRewriteTableTest extends AbstractRecipientRewriteTabl
         rrt.configure(new DefaultConfigurationBuilder());
         return rrt;
     }
-
-    @Ignore("JAMES-2376 HBASE RRT getAllMappings is buggy")
-    @Override
-    public void getAllMappingsShouldListAllEntries() {
-
-    }
 }

http://git-wip-us.apache.org/repos/asf/james-project/blob/117ccbba/server/data/data-library/src/main/java/org/apache/james/rrt/lib/MappingsImpl.java
----------------------------------------------------------------------
diff --git a/server/data/data-library/src/main/java/org/apache/james/rrt/lib/MappingsImpl.java
b/server/data/data-library/src/main/java/org/apache/james/rrt/lib/MappingsImpl.java
index 23c3a3d..ada8ac0 100644
--- a/server/data/data-library/src/main/java/org/apache/james/rrt/lib/MappingsImpl.java
+++ b/server/data/data-library/src/main/java/org/apache/james/rrt/lib/MappingsImpl.java
@@ -113,6 +113,11 @@ public class MappingsImpl implements Mappings, Serializable {
             return this;
         }
         
+        public Builder addAll(Iterable<String> mappings) {
+            mappings.forEach(this::add);
+            return this;
+        }
+        
         public MappingsImpl build() {
             return new MappingsImpl(mappings.build()
                 .stream()


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


Mime
View raw message