Author: ieugen
Date: Sun Mar 11 21:55:27 2012
New Revision: 1299458

URL: http://svn.apache.org/viewvc?rev=1299458&view=rev
Log:
JAMES-1393

- updated to managed version of  junit 4 (4.10)
- updated code to hbase 0.92 api
- updated tests to juni 4.x style

Added:
    james/server/trunk/data-hbase/src/test/resources/hadoop-metrics2.properties
      - copied unchanged from r1299343, 
james/mailbox/trunk/hbase/src/test/resources/hadoop-metrics2.properties
    james/server/trunk/data-hbase/src/test/resources/hdfs-site.xml
      - copied unchanged from r1299343, 
james/mailbox/trunk/hbase/src/test/resources/hdfs-site.xml
Modified:
    james/server/trunk/data-hbase/pom.xml
    
james/server/trunk/data-hbase/src/main/java/org/apache/james/domainlist/hbase/HBaseDomainList.java
    
james/server/trunk/data-hbase/src/main/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTable.java
    
james/server/trunk/data-hbase/src/main/java/org/apache/james/system/hbase/TablePool.java
    
james/server/trunk/data-hbase/src/main/java/org/apache/james/user/hbase/HBaseUsersRepository.java
    
james/server/trunk/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java
    
james/server/trunk/data-hbase/src/test/java/org/apache/james/user/hbase/HBaseUsersRepositoryTest.java

Modified: james/server/trunk/data-hbase/pom.xml
URL: 
http://svn.apache.org/viewvc/james/server/trunk/data-hbase/pom.xml?rev=1299458&r1=1299457&r2=1299458&view=diff
==============================================================================
--- james/server/trunk/data-hbase/pom.xml (original)
+++ james/server/trunk/data-hbase/pom.xml Sun Mar 11 21:55:27 2012
@@ -20,176 +20,180 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
     <modelVersion>4.0.0</modelVersion>
     <parent>
-        <artifactId>james-server</artifactId>
-        <groupId>org.apache.james</groupId>
-        <version>3.0-beta5-SNAPSHOT</version>
-        <relativePath>../pom.xml</relativePath>
+       <artifactId>james-server</artifactId>
+       <groupId>org.apache.james</groupId>
+       <version>3.0-beta5-SNAPSHOT</version>
+       <relativePath>../pom.xml</relativePath>
     </parent>
     <artifactId>james-server-data-hbase</artifactId>
     <name>Apache James Server HBase Data Persistence</name>
-    <properties>
-        <junit.version>4.8.2</junit.version>
-    </properties>
     <dependencies>
-        <dependency>
-            <groupId>org.apache.james</groupId>
-            <artifactId>james-server-lifecycle-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.james</groupId>
-            <artifactId>james-server-dnsservice-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.james</groupId>
-            <artifactId>james-server-data-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.james</groupId>
-            <artifactId>james-server-data-library</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>commons-configuration</groupId>
-            <artifactId>commons-configuration</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>commons-codec</groupId>
-            <artifactId>commons-codec</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>commons-io</groupId>
-            <artifactId>commons-io</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.hbase</groupId>
-            <artifactId>hbase</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.jruby</groupId>
-                    <artifactId>jruby-complete</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>org.slf4j</groupId>
-                    <artifactId>slf4j-log4j12</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>log4j</groupId>
-                    <artifactId>log4j</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>commons-logging</groupId>
-                    <artifactId>commons-logging</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.hadoop</groupId>
-            <artifactId>hadoop-core</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>commons-logging</groupId>
-                    <artifactId>commons-logging</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
+       <dependency>
+           <groupId>org.apache.james</groupId>
+           <artifactId>james-server-lifecycle-api</artifactId>
+       </dependency>
+       <dependency>
+           <groupId>org.apache.james</groupId>
+           <artifactId>james-server-dnsservice-api</artifactId>
+       </dependency>
+       <dependency>
+           <groupId>org.apache.james</groupId>
+           <artifactId>james-server-data-api</artifactId>
+       </dependency>
+       <dependency>
+           <groupId>org.apache.james</groupId>
+           <artifactId>james-server-data-library</artifactId>
+       </dependency>
+       <dependency>
+           <groupId>commons-configuration</groupId>
+           <artifactId>commons-configuration</artifactId>
+       </dependency>
+       <dependency>
+           <groupId>org.slf4j</groupId>
+           <artifactId>slf4j-api</artifactId>
+       </dependency>
+       <dependency>
+           <groupId>commons-codec</groupId>
+           <artifactId>commons-codec</artifactId>
+       </dependency>
+       <dependency>
+           <groupId>commons-io</groupId>
+           <artifactId>commons-io</artifactId>
+       </dependency>
+       <dependency>
+           <groupId>org.apache.hbase</groupId>
+           <artifactId>hbase</artifactId>
+           <exclusions>
+               <exclusion>
+                   <groupId>org.jruby</groupId>
+                   <artifactId>jruby-complete</artifactId>
+               </exclusion>
+               <exclusion>
+                   <groupId>org.slf4j</groupId>
+                   <artifactId>slf4j-log4j12</artifactId>
+               </exclusion>
+               <exclusion>
+                   <groupId>log4j</groupId>
+                   <artifactId>log4j</artifactId>
+               </exclusion>
+               <exclusion>
+                   <groupId>commons-logging</groupId>
+                   <artifactId>commons-logging</artifactId>
+               </exclusion>
+           </exclusions>
+       </dependency>
+       <dependency>
+           <groupId>org.apache.hadoop</groupId>
+           <artifactId>hadoop-core</artifactId>
+           <exclusions>
+               <exclusion>
+                   <groupId>commons-logging</groupId>
+                   <artifactId>commons-logging</artifactId>
+               </exclusion>
+           </exclusions>
+       </dependency>
         <!-- Test dependencies -->
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-            <version>${junit.version}</version>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.james</groupId>
-            <artifactId>james-server-data-library</artifactId>
-            <type>test-jar</type>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.derby</groupId>
-            <artifactId>derby</artifactId>
-            <scope>test</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.james</groupId>
-            <artifactId>james-server-dnsservice-api</artifactId>
-            <scope>test</scope>
-            <type>test-jar</type>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.hbase</groupId>
-            <artifactId>hbase</artifactId>
-            <type>test-jar</type>
-            <scope>test</scope>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.jruby</groupId>
-                    <artifactId>jruby-complete</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.hadoop</groupId>
-            <artifactId>hadoop-test</artifactId>
-            <scope>test</scope>
-        </dependency>
+       <dependency>
+           <groupId>junit</groupId>
+           <artifactId>junit</artifactId>
+           <scope>test</scope>
+       </dependency>
+       <dependency>
+           <groupId>org.apache.james</groupId>
+           <artifactId>james-server-data-library</artifactId>
+           <type>test-jar</type>
+           <scope>test</scope>
+       </dependency>
+       <dependency>
+           <groupId>org.apache.derby</groupId>
+           <artifactId>derby</artifactId>
+           <scope>test</scope>
+       </dependency>
+       <dependency>
+           <groupId>org.apache.james</groupId>
+           <artifactId>james-server-dnsservice-api</artifactId>
+           <scope>test</scope>
+           <type>test-jar</type>
+       </dependency>
+       <dependency>
+           <groupId>org.apache.james</groupId>
+           <artifactId>apache-james-mailbox-hbase</artifactId>
+           <version>0.5-SNAPSHOT</version>
+           <classifier>tests</classifier>
+       </dependency>
+       <dependency>
+           <groupId>org.apache.hbase</groupId>
+           <artifactId>hbase</artifactId>
+           <type>test-jar</type>
+           <scope>test</scope>
+           <exclusions>
+               <exclusion>
+                   <groupId>org.jruby</groupId>
+                   <artifactId>jruby-complete</artifactId>
+               </exclusion>
+           </exclusions>
+       </dependency>
+       <dependency>
+           <groupId>org.apache.hadoop</groupId>
+           <artifactId>hadoop-test</artifactId>
+           <scope>test</scope>
+       </dependency>
     </dependencies>
     <build>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-jar-plugin</artifactId>
+       <plugins>
+           <plugin>
+               <groupId>org.apache.maven.plugins</groupId>
+               <artifactId>maven-jar-plugin</artifactId>
                 <!--
                     Inherit configuration from parent pom.
                 -->
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>jar</goal>
+               <executions>
+                   <execution>
+                       <goals>
+                           <goal>jar</goal>
                             <!--
                                 Allow tests to be used by other modules.
                                 Parent pom build failure prevents inheritance.
                             -->
-                            <goal>test-jar</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-surefire-plugin</artifactId>
-                <configuration>
-                    <forkMode>pertest</forkMode>
-                    <argLine>-Xms256m -Xmx512m</argLine>
-                    <testFailureIgnore>false</testFailureIgnore>
-                    <skip>false</skip>
-                    <includes>
-                        <include>**/*SuiteTest.java</include>
-                    </includes>
-                </configuration>
-            </plugin>
-        </plugins>
+                           <goal>test-jar</goal>
+                       </goals>
+                   </execution>
+               </executions>
+           </plugin>
+           <plugin>
+               <groupId>org.apache.maven.plugins</groupId>
+               <artifactId>maven-surefire-plugin</artifactId>
+               <configuration>
+                   <forkMode>pertest</forkMode>
+                   <argLine>-Xms256m -Xmx512m</argLine>
+                   <testFailureIgnore>false</testFailureIgnore>
+                   <skip>false</skip>
+                   <includes>
+                       <include>**/*SuiteTest.java</include>
+                   </includes>
+               </configuration>
+           </plugin>
+       </plugins>
     </build>
     <profiles>
-        <profile>
-            <id>noTest</id>
-            <activation>
-                <os><family>windows</family></os>
-            </activation>
-            <build>
-                <plugins>
-                    <plugin>
-                        <groupId>org.apache.maven.plugins</groupId>
-                        <artifactId>maven-surefire-plugin</artifactId>
-                        <configuration>
-                            <skipTests>true</skipTests>
-                        </configuration>
-                    </plugin>
-                </plugins>
-            </build>
-        </profile>
+       <profile>
+           <id>noTest</id>
+           <activation>
+               <os>
+                   <family>windows</family>
+               </os>
+           </activation>
+           <build>
+               <plugins>
+                   <plugin>
+                       <groupId>org.apache.maven.plugins</groupId>
+                       <artifactId>maven-surefire-plugin</artifactId>
+                       <configuration>
+                           <skipTests>true</skipTests>
+                       </configuration>
+                   </plugin>
+               </plugins>
+           </build>
+       </profile>
     </profiles>
 </project>

Modified: 
james/server/trunk/data-hbase/src/main/java/org/apache/james/domainlist/hbase/HBaseDomainList.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/data-hbase/src/main/java/org/apache/james/domainlist/hbase/HBaseDomainList.java?rev=1299458&r1=1299457&r2=1299458&view=diff
==============================================================================
--- 
james/server/trunk/data-hbase/src/main/java/org/apache/james/domainlist/hbase/HBaseDomainList.java
 (original)
+++ 
james/server/trunk/data-hbase/src/main/java/org/apache/james/domainlist/hbase/HBaseDomainList.java
 Sun Mar 11 21:55:27 2012
@@ -66,7 +66,7 @@ public class HBaseDomainList extends Abs
         } finally {
             if (table != null) {
                 try {
-                    TablePool.getInstance().putTable(table);
+                    table.close();
                 } catch (IOException e) {
                     // Do nothing, we can't get access to the HBaseSchema.
                 }
@@ -97,7 +97,7 @@ public class HBaseDomainList extends Abs
         } finally {
             if (table != null) {
                 try {
-                    TablePool.getInstance().putTable(table);
+                    table.close();
                 } catch (IOException e) {
                     // Do nothing, we can't get access to the HBaseSchema.
                 }
@@ -119,7 +119,7 @@ public class HBaseDomainList extends Abs
         } finally {
             if (table != null) {
                 try {
-                    TablePool.getInstance().putTable(table);
+                    table.close();
                 } catch (IOException e) {
                     // Do nothing, we can't get access to the HBaseSchema.
                 }
@@ -154,7 +154,7 @@ public class HBaseDomainList extends Abs
             }
             if (table != null) {
                 try {
-                    TablePool.getInstance().putTable(table);
+                    table.close();
                 } catch (IOException e) {
                     // Do nothing, we can't get access to the HBaseSchema.
                 }

Modified: 
james/server/trunk/data-hbase/src/main/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTable.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/data-hbase/src/main/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTable.java?rev=1299458&r1=1299457&r2=1299458&view=diff
==============================================================================
--- 
james/server/trunk/data-hbase/src/main/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTable.java
 (original)
+++ 
james/server/trunk/data-hbase/src/main/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTable.java
 Sun Mar 11 21:55:27 2012
@@ -87,7 +87,7 @@ public class HBaseRecipientRewriteTable 
         } finally {
             if (table != null) {
                 try {
-                    TablePool.getInstance().putTable(table);
+                    table.close();
                 } catch (IOException e) {
                     // Do nothing, we can't get access to the HBaseSchema.
                 }
@@ -146,7 +146,7 @@ public class HBaseRecipientRewriteTable 
             }
             if (table != null) {
                 try {
-                    TablePool.getInstance().putTable(table);
+                    table.close();
                 } catch (IOException e) {
                     // Do nothing, we can't get access to the HBaseSchema.
                 }
@@ -177,7 +177,7 @@ public class HBaseRecipientRewriteTable 
         } finally {
             if (table != null) {
                 try {
-                    TablePool.getInstance().putTable(table);
+                    table.close();
                 } catch (IOException e) {
                     // Do nothing, we can't get access to the HBaseSchema.
                 }
@@ -247,7 +247,7 @@ public class HBaseRecipientRewriteTable 
         } finally {
             if (table != null) {
                 try {
-                    TablePool.getInstance().putTable(table);
+                    table.close();
                 } catch (IOException e) {
                     // Do nothing, we can't get access to the HBaseSchema.
                 }
@@ -277,7 +277,7 @@ public class HBaseRecipientRewriteTable 
         } finally {
             if (table != null) {
                 try {
-                    TablePool.getInstance().putTable(table);
+                    table.close();
                 } catch (IOException e) {
                     // Do nothing, we can't get access to the HBaseSchema.
                 }

Modified: 
james/server/trunk/data-hbase/src/main/java/org/apache/james/system/hbase/TablePool.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/data-hbase/src/main/java/org/apache/james/system/hbase/TablePool.java?rev=1299458&r1=1299457&r2=1299458&view=diff
==============================================================================
--- 
james/server/trunk/data-hbase/src/main/java/org/apache/james/system/hbase/TablePool.java
 (original)
+++ 
james/server/trunk/data-hbase/src/main/java/org/apache/james/system/hbase/TablePool.java
 Sun Mar 11 21:55:27 2012
@@ -109,20 +109,6 @@ public class TablePool {    
     }
 
     /**
-     * Put back the table in the pool after usage.
-     * 
-     * With later HBase versions, we won't have to put back the table in the 
pool.
-     * See https://issues.apache.org/jira/browse/HBASE-4054
-     * 
-     * @param table
-     */
-    public void putTable(HTable table) {
-        if (table != null) {
-            htablePool.putTable(table);
-        }
-    }
-    
-    /**
      * Create a table if needed.
      * 
      * @param tableName

Modified: 
james/server/trunk/data-hbase/src/main/java/org/apache/james/user/hbase/HBaseUsersRepository.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/data-hbase/src/main/java/org/apache/james/user/hbase/HBaseUsersRepository.java?rev=1299458&r1=1299457&r2=1299458&view=diff
==============================================================================
--- 
james/server/trunk/data-hbase/src/main/java/org/apache/james/user/hbase/HBaseUsersRepository.java
 (original)
+++ 
james/server/trunk/data-hbase/src/main/java/org/apache/james/user/hbase/HBaseUsersRepository.java
 Sun Mar 11 21:55:27 2012
@@ -61,6 +61,7 @@ public class HBaseUsersRepository extend
     /**
      * @see 
org.apache.james.user.lib.AbstractUsersRepository#doConfigure(HierarchicalConfiguration)
      */
+    @Override
     public void doConfigure(HierarchicalConfiguration config) throws 
ConfigurationException {
         algo = config.getString("algorithm", "MD5");
         super.doConfigure(config);
@@ -114,7 +115,7 @@ public class HBaseUsersRepository extend
         } finally {
             if (table != null) {
                 try {
-                    TablePool.getInstance().putTable(table);
+                    table.close();
                 } catch (IOException e) {
                     // Do nothing, we can't get access to the HBaseSchema.
                 }
@@ -173,7 +174,7 @@ public class HBaseUsersRepository extend
             }
             if (table != null) {
                 try {
-                    TablePool.getInstance().putTable(table);
+                    table.close();
                 } catch (IOException e) {
                     // Do nothing, we can't get access to the HBaseSchema.
                 }
@@ -208,7 +209,7 @@ public class HBaseUsersRepository extend
             }
             if (table != null) {
                 try {
-                    TablePool.getInstance().putTable(table);
+                    table.close();
                 } catch (IOException e) {
                     // Do nothing, we can't get access to the HBaseSchema.
                 }
@@ -248,7 +249,7 @@ public class HBaseUsersRepository extend
         } finally {
             if (table != null) {
                 try {
-                    TablePool.getInstance().putTable(table);
+                    table.close();
                 } catch (IOException e) {
                     // Do nothing, we can't get access to the HBaseSchema.
                 }
@@ -283,7 +284,7 @@ public class HBaseUsersRepository extend
         } finally {
             if (table != null) {
                 try {
-                    TablePool.getInstance().putTable(table);
+                    table.close();
                 } catch (IOException e) {
                     // Do nothing, we can't get access to the HBaseSchema.
                 }

Modified: 
james/server/trunk/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java?rev=1299458&r1=1299457&r2=1299458&view=diff
==============================================================================
--- 
james/server/trunk/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java
 (original)
+++ 
james/server/trunk/data-hbase/src/test/java/org/apache/james/rrt/hbase/HBaseRecipientRewriteTableTest.java
 Sun Mar 11 21:55:27 2012
@@ -37,60 +37,63 @@ public class HBaseRecipientRewriteTableT
      * The Logger.
      */
     private static Logger logger = 
Logger.getLogger(HBaseRecipientRewriteTableTest.class);
-    
+
     /**
      * @see 
org.apache.james.rrt.lib.AbstractRecipientRewriteTableTest#getRecipientRewriteTable()
      */
     @Override
     protected AbstractRecipientRewriteTable getRecipientRewriteTable() throws 
Exception {
-        HBaseRecipientRewriteTable rrt = new HBaseRecipientRewriteTable();
-        rrt.setLog(LoggerFactory.getLogger("MockLog"));
-        rrt.configure(new DefaultConfigurationBuilder());
-        return rrt;
+       HBaseRecipientRewriteTable rrt = new HBaseRecipientRewriteTable();
+       rrt.setLog(LoggerFactory.getLogger("MockLog"));
+       rrt.configure(new DefaultConfigurationBuilder());
+       return rrt;
     }
 
     /**
      * @see 
org.apache.jŒames.rrt.lib.AbstractRecipientRewriteTableTest#addMapping(String, 
String, String, int)
      */
-    protected boolean addMapping(String user, String domain, String mapping, 
int type) throws RecipientRewriteTableException {
-        try {
-            if (type == ERROR_TYPE) {
-                virtualUserTable.addErrorMapping(user, domain, mapping);
-            } else if (type == REGEX_TYPE) {
-                virtualUserTable.addRegexMapping(user, domain, mapping);
-            } else if (type == ADDRESS_TYPE) {
-                virtualUserTable.addAddressMapping(user, domain, mapping);
-            } else if (type == ALIASDOMAIN_TYPE) {
-                virtualUserTable.addAliasDomainMapping(domain, mapping);
-            } else {
-                return false;
-            }
-            return true;
-        } catch (RecipientRewriteTableException e) {
-            return false;
-        }
+    @Override
+    protected boolean addMapping(String user, String domain, String mapping, 
int type) throws
+           RecipientRewriteTableException {
+       try {
+           if (type == ERROR_TYPE) {
+               virtualUserTable.addErrorMapping(user, domain, mapping);
+           } else if (type == REGEX_TYPE) {
+               virtualUserTable.addRegexMapping(user, domain, mapping);
+           } else if (type == ADDRESS_TYPE) {
+               virtualUserTable.addAddressMapping(user, domain, mapping);
+           } else if (type == ALIASDOMAIN_TYPE) {
+               virtualUserTable.addAliasDomainMapping(domain, mapping);
+           } else {
+               return false;
+           }
+           return true;
+       } catch (RecipientRewriteTableException e) {
+           return false;
+       }
     }
 
     /**
      * @see 
org.apache.james.rrt.lib.AbstractRecipientRewriteTableTest#removeMapping(String,
 String, String, int)
      */
-    protected boolean removeMapping(String user, String domain, String 
mapping, int type) throws RecipientRewriteTableException {
-        try {
-            if (type == ERROR_TYPE) {
-                virtualUserTable.removeErrorMapping(user, domain, mapping);
-            } else if (type == REGEX_TYPE) {
-                virtualUserTable.removeRegexMapping(user, domain, mapping);
-            } else if (type == ADDRESS_TYPE) {
-                virtualUserTable.removeAddressMapping(user, domain, mapping);
-            } else if (type == ALIASDOMAIN_TYPE) {
-                virtualUserTable.removeAliasDomainMapping(domain, mapping);
-            } else {
-                return false;
-            }
-            return true;
-        } catch (RecipientRewriteTableException e) {
-            return false;
-        }
+    @Override
+    protected boolean removeMapping(String user, String domain, String 
mapping, int type) throws
+           RecipientRewriteTableException {
+       try {
+           if (type == ERROR_TYPE) {
+               virtualUserTable.removeErrorMapping(user, domain, mapping);
+           } else if (type == REGEX_TYPE) {
+               virtualUserTable.removeRegexMapping(user, domain, mapping);
+           } else if (type == ADDRESS_TYPE) {
+               virtualUserTable.removeAddressMapping(user, domain, mapping);
+           } else if (type == ALIASDOMAIN_TYPE) {
+               virtualUserTable.removeAliasDomainMapping(domain, mapping);
+           } else {
+               return false;
+           }
+           return true;
+       } catch (RecipientRewriteTableException e) {
+           return false;
+       }
     }
-
 }

Modified: 
james/server/trunk/data-hbase/src/test/java/org/apache/james/user/hbase/HBaseUsersRepositoryTest.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/data-hbase/src/test/java/org/apache/james/user/hbase/HBaseUsersRepositoryTest.java?rev=1299458&r1=1299457&r2=1299458&view=diff
==============================================================================
--- 
james/server/trunk/data-hbase/src/test/java/org/apache/james/user/hbase/HBaseUsersRepositoryTest.java
 (original)
+++ 
james/server/trunk/data-hbase/src/test/java/org/apache/james/user/hbase/HBaseUsersRepositoryTest.java
 Sun Mar 11 21:55:27 2012
@@ -19,7 +19,6 @@
 package org.apache.james.user.hbase;
 
 import java.util.Iterator;
-
 import org.apache.commons.configuration.DefaultConfigurationBuilder;
 import org.apache.james.user.api.UsersRepository;
 import org.apache.james.user.api.UsersRepositoryException;
@@ -39,20 +38,19 @@ public class HBaseUsersRepositoryTest ex
     /**
      * @see org.apache.james.user.lib.AbstractUsersRepositoryTest#setUp()
      */
-    @Override
     @Before
-    protected void setUp() throws Exception {
-        super.setUp();
-        deleteAll();
+    @Override
+    public void setUp() throws Exception {
+       deleteAll();
     }
 
     /**
      * @see org.apache.james.user.lib.AbstractUsersRepositoryTest#tearDown()
      */
-    @Override
     @After
+    @Override
     protected void tearDown() throws Exception {
-        super.tearDown();
+       super.tearDown();
     }
 
     /**
@@ -62,21 +60,20 @@ public class HBaseUsersRepositoryTest ex
      * @throws Exception
      */
     private void deleteAll() throws UsersRepositoryException, Exception {
-        Iterator<String> it = getUsersRepository().list();
-        while (it.hasNext()) {
-            getUsersRepository().removeUser(it.next());
-        }
+       Iterator<String> it = getUsersRepository().list();
+       while (it.hasNext()) {
+           getUsersRepository().removeUser(it.next());
+       }
     }
-    
+
     /**
      * @see 
org.apache.james.user.lib.AbstractUsersRepositoryTest#getUsersRepository()
      */
     @Override
     protected UsersRepository getUsersRepository() throws Exception {
-        HBaseUsersRepository userRepository = new HBaseUsersRepository();
-        userRepository.setLog(LoggerFactory.getLogger("MockLog"));
-        userRepository.configure(new DefaultConfigurationBuilder());
-        return userRepository;
+       HBaseUsersRepository userRepository = new HBaseUsersRepository();
+       userRepository.setLog(LoggerFactory.getLogger("MockLog"));
+       userRepository.configure(new DefaultConfigurationBuilder());
+       return userRepository;
     }
-
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to