james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e...@apache.org
Subject svn commit: r1154673 - /james/server/trunk/hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java
Date Sun, 07 Aug 2011 08:43:59 GMT
Author: eric
Date: Sun Aug  7 08:43:58 2011
New Revision: 1154673

URL: http://svn.apache.org/viewvc?rev=1154673&view=rev
Log:
Launch cluster in RRT test class to debug failing tests (JAMES-1273)

Modified:
    james/server/trunk/hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java

Modified: james/server/trunk/hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java?rev=1154673&r1=1154672&r2=1154673&view=diff
==============================================================================
--- james/server/trunk/hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java
(original)
+++ james/server/trunk/hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java
Sun Aug  7 08:43:58 2011
@@ -19,13 +19,42 @@
 package org.apache.james.rrt.hbase;
 
 import org.apache.commons.configuration.DefaultConfigurationBuilder;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hbase.HBaseTestingUtility;
+import org.apache.hadoop.hbase.MiniHBaseCluster;
 import org.apache.james.rrt.api.RecipientRewriteTableException;
 import org.apache.james.rrt.lib.AbstractRecipientRewriteTable;
 import org.apache.james.rrt.lib.AbstractRecipientRewriteTableTest;
+import org.apache.james.system.hbase.TablePool;
+import org.apache.log4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class HBaseRecipientRewriteTableTest extends AbstractRecipientRewriteTableTest {
 
+    private static Logger logger = Logger.getLogger(HBaseRecipientRewriteTableTest.class);
+    
+    private static MiniHBaseCluster hbaseCluster;
+    
+    public void setUp() throws Exception {
+        super.setUp();
+        HBaseTestingUtility htu = new HBaseTestingUtility();
+        htu.getConfiguration().setBoolean("dfs.support.append", true);
+        try {
+            hbaseCluster = htu.startMiniCluster();
+        } 
+        catch (Exception e) {
+            logger.error("Exception when starting HBase Mini Cluster", e);
+        }
+        TablePool.getInstance(getConfiguration());
+    }
+    
+    public void tearDown() throws Exception {
+        super.tearDown();
+       if (hbaseCluster != null) {
+           hbaseCluster.shutdown();
+       }
+    }
+    
     @Override
     protected AbstractRecipientRewriteTable getRecipientRewriteTable() throws Exception {
         HBaseRecipientRewriteTable rrt = new HBaseRecipientRewriteTable();
@@ -80,4 +109,11 @@ public class HBaseRecipientRewriteTableT
         }
     }
 
+    public static Configuration getConfiguration() {
+        if (hbaseCluster == null) {
+            throw new IllegalStateException("Please instanciate HBaseTestingUtility before
invoking this method");
+        }
+        return hbaseCluster.getConfiguration();
+    }
+
 }



---------------------------------------------------------------------
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