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 ie...@apache.org on 2012/03/12 00:09:15 UTC

svn commit: r1299481 - in /james/server/trunk/data-jdbc: ./ src/test/java/org/apache/james/mailrepository/jdbc/ src/test/java/org/apache/james/rrt/jdbc/ src/test/java/org/apache/james/user/jdbc/

Author: ieugen
Date: Sun Mar 11 23:09:15 2012
New Revision: 1299481

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

- updated tests to juni 4.x style
- added @Override and reformated code

Issue #JAMES-1393 - Upgrate all test suites to junit 4.10

Modified:
    james/server/trunk/data-jdbc/pom.xml
    james/server/trunk/data-jdbc/src/test/java/org/apache/james/mailrepository/jdbc/JDBCDBFileMailRepositoryTest.java
    james/server/trunk/data-jdbc/src/test/java/org/apache/james/mailrepository/jdbc/JDBCMailRepositoryTest.java
    james/server/trunk/data-jdbc/src/test/java/org/apache/james/rrt/jdbc/JDBCRecipientRewriteTableTest.java
    james/server/trunk/data-jdbc/src/test/java/org/apache/james/user/jdbc/DefaultUsersJdbcRepositoryTest.java
    james/server/trunk/data-jdbc/src/test/java/org/apache/james/user/jdbc/JamesUsersJdbcRepositoryTest.java

Modified: james/server/trunk/data-jdbc/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/data-jdbc/pom.xml?rev=1299481&r1=1299480&r2=1299481&view=diff
==============================================================================
--- james/server/trunk/data-jdbc/pom.xml (original)
+++ james/server/trunk/data-jdbc/pom.xml Sun Mar 11 23:09:15 2012
@@ -21,10 +21,10 @@
     <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>
 
     <groupId>org.apache.james</groupId>
@@ -34,114 +34,114 @@
 
     <properties>
         <!-- OSGI stuff -->
-        <james.osgi.export>
-            org.apache.james.*,
-        </james.osgi.export>
-        <james.osgi.import>
-            *,
-            org.apache.commons.dbcp.*
-        </james.osgi.import>
+	<james.osgi.export>
+	    org.apache.james.*,
+	</james.osgi.export>
+	<james.osgi.import>
+	    *,
+	    org.apache.commons.dbcp.*
+	</james.osgi.import>
     </properties>
 
     <dependencies>
-        <dependency>
-            <groupId>org.apache.james</groupId>
-            <artifactId>james-server-util</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.james</groupId>
-            <artifactId>james-server-lifecycle-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.james</groupId>
-            <artifactId>james-server-filesystem-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-core</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.james</groupId>
-            <artifactId>james-server-data-library</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.james</groupId>
-            <artifactId>apache-mailet</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>commons-configuration</groupId>
-            <artifactId>commons-configuration</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>${javax.mail.groupId}</groupId>
-            <artifactId>${javax.mail.artifactId}</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-annotation_1.1_spec</artifactId>
-        </dependency>
+	<dependency>
+	    <groupId>org.apache.james</groupId>
+	    <artifactId>james-server-util</artifactId>
+	</dependency>
+	<dependency>
+	    <groupId>org.apache.james</groupId>
+	    <artifactId>james-server-lifecycle-api</artifactId>
+	</dependency>
+	<dependency>
+	    <groupId>org.apache.james</groupId>
+	    <artifactId>james-server-filesystem-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-core</artifactId>
+	</dependency>
+	<dependency>
+	    <groupId>org.apache.james</groupId>
+	    <artifactId>james-server-data-library</artifactId>
+	</dependency>
+	<dependency>
+	    <groupId>org.apache.james</groupId>
+	    <artifactId>apache-mailet</artifactId>
+	</dependency>
+	<dependency>
+	    <groupId>commons-configuration</groupId>
+	    <artifactId>commons-configuration</artifactId>
+	</dependency>
+	<dependency>
+	    <groupId>org.slf4j</groupId>
+	    <artifactId>slf4j-api</artifactId>
+	</dependency>
+	
+	<dependency>
+	    <groupId>${javax.mail.groupId}</groupId>
+	    <artifactId>${javax.mail.artifactId}</artifactId>
+	</dependency>
+	<dependency>
+	    <groupId>org.apache.geronimo.specs</groupId>
+	    <artifactId>geronimo-annotation_1.1_spec</artifactId>
+	</dependency>
 
         <!-- Test dependencies -->
-        <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>commons-dbcp</groupId>
-            <artifactId>commons-dbcp</artifactId>
-            <scope>runtime</scope>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.derby</groupId>
-            <artifactId>derby</artifactId>
-            <scope>runtime</scope>
-        </dependency>
-
-        <dependency>
-            <groupId>org.apache.james</groupId>
-            <artifactId>james-server-filesystem-api</artifactId>
-            <type>test-jar</type>
-            <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>commons-dbcp</groupId>
+	    <artifactId>commons-dbcp</artifactId>
+	    <scope>runtime</scope>
+	</dependency>
+	<dependency>
+	    <groupId>org.apache.derby</groupId>
+	    <artifactId>derby</artifactId>
+	    <scope>runtime</scope>
+	</dependency>
+
+	<dependency>
+	    <groupId>org.apache.james</groupId>
+	    <artifactId>james-server-filesystem-api</artifactId>
+	    <type>test-jar</type>
+	    <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>
-        </plugins>
+			    <goal>test-jar</goal>
+			</goals>
+		    </execution>
+		</executions>
+	    </plugin>
+	</plugins>
     </build>
 </project>

Modified: james/server/trunk/data-jdbc/src/test/java/org/apache/james/mailrepository/jdbc/JDBCDBFileMailRepositoryTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/data-jdbc/src/test/java/org/apache/james/mailrepository/jdbc/JDBCDBFileMailRepositoryTest.java?rev=1299481&r1=1299480&r2=1299481&view=diff
==============================================================================
--- james/server/trunk/data-jdbc/src/test/java/org/apache/james/mailrepository/jdbc/JDBCDBFileMailRepositoryTest.java (original)
+++ james/server/trunk/data-jdbc/src/test/java/org/apache/james/mailrepository/jdbc/JDBCDBFileMailRepositoryTest.java Sun Mar 11 23:09:15 2012
@@ -21,6 +21,7 @@ package org.apache.james.mailrepository.
 
 public class JDBCDBFileMailRepositoryTest extends JDBCMailRepositoryTest {
 
+    @Override
     protected String getType() {
         return "dbfile";
     }

Modified: james/server/trunk/data-jdbc/src/test/java/org/apache/james/mailrepository/jdbc/JDBCMailRepositoryTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/data-jdbc/src/test/java/org/apache/james/mailrepository/jdbc/JDBCMailRepositoryTest.java?rev=1299481&r1=1299480&r2=1299481&view=diff
==============================================================================
--- james/server/trunk/data-jdbc/src/test/java/org/apache/james/mailrepository/jdbc/JDBCMailRepositoryTest.java (original)
+++ james/server/trunk/data-jdbc/src/test/java/org/apache/james/mailrepository/jdbc/JDBCMailRepositoryTest.java Sun Mar 11 23:09:15 2012
@@ -27,7 +27,6 @@ import org.apache.derby.jdbc.EmbeddedDri
 import org.apache.james.filesystem.api.mock.MockFileSystem;
 import org.apache.james.mailrepository.AbstractMailRepositoryTest;
 import org.apache.james.mailrepository.api.MailRepository;
-import org.apache.james.mailrepository.jdbc.JDBCMailRepository;
 import org.slf4j.LoggerFactory;
 
 public class JDBCMailRepositoryTest extends AbstractMailRepositoryTest {
@@ -38,6 +37,7 @@ public class JDBCMailRepositoryTest exte
      * @throws ConfigurationException
      * @throws Exception
      */
+    @Override
     protected MailRepository getMailRepository() throws Exception {
         MockFileSystem fs = new MockFileSystem();
         DataSource datasource = getDataSource();

Modified: james/server/trunk/data-jdbc/src/test/java/org/apache/james/rrt/jdbc/JDBCRecipientRewriteTableTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/data-jdbc/src/test/java/org/apache/james/rrt/jdbc/JDBCRecipientRewriteTableTest.java?rev=1299481&r1=1299480&r2=1299481&view=diff
==============================================================================
--- james/server/trunk/data-jdbc/src/test/java/org/apache/james/rrt/jdbc/JDBCRecipientRewriteTableTest.java (original)
+++ james/server/trunk/data-jdbc/src/test/java/org/apache/james/rrt/jdbc/JDBCRecipientRewriteTableTest.java Sun Mar 11 23:09:15 2012
@@ -23,7 +23,6 @@ import org.apache.commons.dbcp.BasicData
 import org.apache.derby.jdbc.EmbeddedDriver;
 import org.apache.james.filesystem.api.mock.MockFileSystem;
 import org.apache.james.rrt.api.RecipientRewriteTableException;
-import org.apache.james.rrt.jdbc.JDBCRecipientRewriteTable;
 import org.apache.james.rrt.lib.AbstractRecipientRewriteTable;
 import org.apache.james.rrt.lib.AbstractRecipientRewriteTableTest;
 import org.slf4j.LoggerFactory;
@@ -36,73 +35,77 @@ public class JDBCRecipientRewriteTableTe
     /**
      * @see org.apache.james.rrt.lib.AbstractRecipientRewriteTableTest#getRecipientRewriteTable()
      */
+    @Override
     protected AbstractRecipientRewriteTable getRecipientRewriteTable() throws Exception {
-        JDBCRecipientRewriteTable virtualUserTable = new JDBCRecipientRewriteTable();
-        virtualUserTable.setLog(LoggerFactory.getLogger("MockLog"));
-        virtualUserTable.setDataSource(getDataSource());
-        virtualUserTable.setFileSystem(new MockFileSystem());
-        DefaultConfigurationBuilder defaultConfiguration = new DefaultConfigurationBuilder();
-        defaultConfiguration.addProperty("[@destinationURL]", "db://maildb/RecipientRewriteTable");
-        defaultConfiguration.addProperty("sqlFile", "file://conf/sqlResources.xml");
-        virtualUserTable.configure(defaultConfiguration);
-        virtualUserTable.init();
-        return virtualUserTable;
+	JDBCRecipientRewriteTable localVirtualUserTable = new JDBCRecipientRewriteTable();
+	localVirtualUserTable.setLog(LoggerFactory.getLogger("MockLog"));
+	localVirtualUserTable.setDataSource(getDataSource());
+	localVirtualUserTable.setFileSystem(new MockFileSystem());
+	DefaultConfigurationBuilder defaultConfiguration = new DefaultConfigurationBuilder();
+	defaultConfiguration.addProperty("[@destinationURL]", "db://maildb/RecipientRewriteTable");
+	defaultConfiguration.addProperty("sqlFile", "file://conf/sqlResources.xml");
+	localVirtualUserTable.configure(defaultConfiguration);
+	localVirtualUserTable.init();
+	return localVirtualUserTable;
     }
 
     private BasicDataSource getDataSource() {
-        BasicDataSource ds = new BasicDataSource();
-        ds.setDriverClassName(EmbeddedDriver.class.getName());
-        ds.setUrl("jdbc:derby:target/testdb;create=true");
-        ds.setUsername("james");
-        ds.setPassword("james");
-        return ds;
+	BasicDataSource ds = new BasicDataSource();
+	ds.setDriverClassName(EmbeddedDriver.class.getName());
+	ds.setUrl("jdbc:derby:target/testdb;create=true");
+	ds.setUsername("james");
+	ds.setPassword("james");
+	return ds;
     }
 
     /**
      * @see org.apache.james.rrt.lib.AbstractRecipientRewriteTableTest#addMapping(java.lang.String,
      *      java.lang.String, java.lang.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;
-            }
-        } catch (RecipientRewriteTableException ex) {
-            return false;
-        }
-        return true;
+    @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;
+	    }
+	} catch (RecipientRewriteTableException ex) {
+	    return false;
+	}
+	return true;
     }
 
     /**
      * @see org.apache.james.rrt.lib.AbstractRecipientRewriteTableTest#removeMapping(java.lang.String,
      *      java.lang.String, java.lang.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;
-            }
-        } catch (RecipientRewriteTableException ex) {
-            return false;
-        }
-        return true;
+    @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;
+	    }
+	} catch (RecipientRewriteTableException ex) {
+	    return false;
+	}
+	return true;
     }
-
 }

Modified: james/server/trunk/data-jdbc/src/test/java/org/apache/james/user/jdbc/DefaultUsersJdbcRepositoryTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/data-jdbc/src/test/java/org/apache/james/user/jdbc/DefaultUsersJdbcRepositoryTest.java?rev=1299481&r1=1299480&r2=1299481&view=diff
==============================================================================
--- james/server/trunk/data-jdbc/src/test/java/org/apache/james/user/jdbc/DefaultUsersJdbcRepositoryTest.java (original)
+++ james/server/trunk/data-jdbc/src/test/java/org/apache/james/user/jdbc/DefaultUsersJdbcRepositoryTest.java Sun Mar 11 23:09:15 2012
@@ -44,6 +44,7 @@ public class DefaultUsersJdbcRepositoryT
      * @return the user repository
      * @throws Exception
      */
+    @Override
     protected UsersRepository getUsersRepository() throws Exception {
         DefaultUsersJdbcRepository res = new DefaultUsersJdbcRepository();
         String tableString = "defusers";

Modified: james/server/trunk/data-jdbc/src/test/java/org/apache/james/user/jdbc/JamesUsersJdbcRepositoryTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/data-jdbc/src/test/java/org/apache/james/user/jdbc/JamesUsersJdbcRepositoryTest.java?rev=1299481&r1=1299480&r2=1299481&view=diff
==============================================================================
--- james/server/trunk/data-jdbc/src/test/java/org/apache/james/user/jdbc/JamesUsersJdbcRepositoryTest.java (original)
+++ james/server/trunk/data-jdbc/src/test/java/org/apache/james/user/jdbc/JamesUsersJdbcRepositoryTest.java Sun Mar 11 23:09:15 2012
@@ -44,6 +44,7 @@ public class JamesUsersJdbcRepositoryTes
      * @return the user repository
      * @throws Exception
      */
+    @Override
     protected UsersRepository getUsersRepository() throws Exception {
         JamesUsersJdbcRepository res = new JamesUsersJdbcRepository();
         String tableString = "jamesusers";



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