james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r1027932 - in /james/server/trunk: core-function/src/test/java/org/apache/james/transport/ mailetcontainer-library/ mailetcontainer-library/src/test/ mailetcontainer-library/src/test/java/ mailetcontainer-library/src/test/java/org/ mailetco...
Date Wed, 27 Oct 2010 12:20:20 GMT
Author: norman
Date: Wed Oct 27 12:20:19 2010
New Revision: 1027932

URL: http://svn.apache.org/viewvc?rev=1027932&view=rev
Log:
move JamesMailetLoaderTest to the right module

Added:
    james/server/trunk/mailetcontainer-library/src/test/
    james/server/trunk/mailetcontainer-library/src/test/java/
    james/server/trunk/mailetcontainer-library/src/test/java/org/
    james/server/trunk/mailetcontainer-library/src/test/java/org/apache/
    james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/
    james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/mailetcontainer/
    james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/mailetcontainer/lib/
    james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/mailetcontainer/lib/JamesMailetLoaderTest.java
      - copied, changed from r1026947, james/server/trunk/core-function/src/test/java/org/apache/james/transport/JamesMailetLoaderTest.java
    james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/mailetcontainer/lib/MailetLoaderTestMailet.java
      - copied, changed from r1026947, james/server/trunk/mailets/src/test/java/org/apache/james/transport/mailets/MailetLoaderTestMailet.java
    james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/mailetcontainer/lib/MockMailet.java
Removed:
    james/server/trunk/core-function/src/test/java/org/apache/james/transport/JamesMailetLoaderTest.java
    james/server/trunk/mailets/src/test/java/org/apache/james/transport/mailets/MailetLoaderTestMailet.java
    james/server/trunk/mailets/src/test/java/org/apache/james/transport/mailets/smime/MailetLoaderTestSMIMEMailet.java
Modified:
    james/server/trunk/mailetcontainer-library/pom.xml

Modified: james/server/trunk/mailetcontainer-library/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/pom.xml?rev=1027932&r1=1027931&r2=1027932&view=diff
==============================================================================
--- james/server/trunk/mailetcontainer-library/pom.xml (original)
+++ james/server/trunk/mailetcontainer-library/pom.xml Wed Oct 27 12:20:19 2010
@@ -69,5 +69,17 @@
       <groupId>org.apache.james</groupId>
       <artifactId>james-server-dnsservice-api</artifactId>
     </dependency>
+    
+    <dependency>
+      <groupId>junit</groupId>
+      <artifactId>junit</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.james</groupId>
+      <artifactId>james-server-core-library</artifactId>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
   </dependencies>
 </project>

Copied: james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/mailetcontainer/lib/JamesMailetLoaderTest.java
(from r1026947, james/server/trunk/core-function/src/test/java/org/apache/james/transport/JamesMailetLoaderTest.java)
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/mailetcontainer/lib/JamesMailetLoaderTest.java?p2=james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/mailetcontainer/lib/JamesMailetLoaderTest.java&p1=james/server/trunk/core-function/src/test/java/org/apache/james/transport/JamesMailetLoaderTest.java&r1=1026947&r2=1027932&rev=1027932&view=diff
==============================================================================
--- james/server/trunk/core-function/src/test/java/org/apache/james/transport/JamesMailetLoaderTest.java
(original)
+++ james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/mailetcontainer/lib/JamesMailetLoaderTest.java
Wed Oct 27 12:20:19 2010
@@ -19,21 +19,30 @@
 
 
 
-package org.apache.james.transport;
+package org.apache.james.mailetcontainer.lib;
 
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.List;
 
+import javax.mail.MessagingException;
+
+import org.apache.commons.configuration.DefaultConfigurationBuilder;
+import org.apache.commons.logging.impl.SimpleLog;
+import org.apache.james.services.MockJSR250Loader;
+import org.apache.mailet.Mailet;
+import org.apache.mailet.MailetConfig;
+
 
 import junit.framework.TestCase;
 
 
-public class JamesMailetLoaderTest { // extends TestCase {
- /*
+public class JamesMailetLoaderTest extends TestCase {
+
     private JamesMailetLoader m_jamesMailetLoader  = new JamesMailetLoader();
     private JamesMailetLoaderConfiguration m_conf = new JamesMailetLoaderConfiguration();
 
+    @SuppressWarnings("serial")
     private class JamesMailetLoaderConfiguration extends DefaultConfigurationBuilder {
         private List<String> m_packageNames = new ArrayList<String>();
         
@@ -43,13 +52,12 @@ public class JamesMailetLoaderTest { // 
         public void init() {
             for (Iterator<String> iterator = m_packageNames.iterator(); iterator.hasNext();)
{
                 String packageName = (String) iterator.next();
-                addProperty("mailetpackage", packageName);
+                addProperty("mailetpackages.mailetpackage", packageName);
             }
         }
 
         public void addStandardPackages() {
-            add("org.apache.james.transport.mailets");
-            add("org.apache.james.transport.mailets.smime");
+            add(JamesMailetLoaderTest.class.getPackage().getName());
         }
 
         public void add(String packageName) {
@@ -62,25 +70,29 @@ public class JamesMailetLoaderTest { // 
         m_conf.init();
         m_jamesMailetLoader.setLog(new SimpleLog("Test"));
         m_jamesMailetLoader.configure(m_conf);
-        m_jamesMailetLoader.setLoaderService(new FakeLoader());
+        m_jamesMailetLoader.setFactory(new MockJSR250Loader());
     }
 
-    private void assetIsNullMailet(Mailet mailet) {
-        assertNotNull("Null mailet loaded", mailet);
-        assertTrue("Null mailet is expected class", mailet instanceof org.apache.james.transport.mailets.Null);
+    private void assetIsMockMailet(Mailet mailet) {
+        assertNotNull("MockMailet mailet loaded", mailet);
+        assertTrue("MockMailet mailet is expected class", mailet instanceof MockMailet);
     }
 
 
-    public void testUsingEmtpyConfig() throws Exception {
-        setUpLoader();
+    public void testUsingEmtpyConfig() {
+        try {
+            setUpLoader();
+            fail("Should throw exception");
+        } catch (Exception e) {
+        }
     }
 
     public void testFullQualifiedUsingFakeConfig() throws Exception {
         m_conf.add("none.existing.package"); // has to be here so the Loader won't choke
         setUpLoader();
 
-        Mailet mailet = m_jamesMailetLoader.getMailet("org.apache.james.transport.mailets.Null",
null);
-        assetIsNullMailet(mailet);
+        Mailet mailet = m_jamesMailetLoader.getMailet(MockMailet.class.getName(), null);
+        assetIsMockMailet(mailet);
     }
 
     public void testStandardMailets() throws Exception {
@@ -88,12 +100,12 @@ public class JamesMailetLoaderTest { // 
         setUpLoader();
 
         // use standard package
-        Mailet mailetNull1 = m_jamesMailetLoader.getMailet("Null", null);
-        assetIsNullMailet(mailetNull1);
+        Mailet mailetNull1 = m_jamesMailetLoader.getMailet(MockMailet.class.getSimpleName(),
null);
+        assetIsMockMailet(mailetNull1);
 
         // use full qualified package in parallel
-        Mailet mailetNull2 = m_jamesMailetLoader.getMailet("org.apache.james.transport.mailets.Null",
null);
-        assetIsNullMailet(mailetNull2);
+        Mailet mailetNull2 = m_jamesMailetLoader.getMailet(MockMailet.class.getName(), null);
+        assetIsMockMailet(mailetNull2);
 
     }
 
@@ -103,8 +115,6 @@ public class JamesMailetLoaderTest { // 
 
         checkTestMailet("MailetLoaderTestMailet");
         
-        checkTestMailet("MailetLoaderTestSMIMEMailet");
-
     }
 
     private void checkTestMailet(String mailetName) throws MessagingException {
@@ -119,5 +129,5 @@ public class JamesMailetLoaderTest { // 
         MailetConfig mailetConfig = mailetLoaderTestMailet.getMailetConfig();
         assertEquals("init was called w/ right config", "testMailetValue", mailetConfig.getInitParameter("testMailetKey"));
     }
-*/
+
 }

Copied: james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/mailetcontainer/lib/MailetLoaderTestMailet.java
(from r1026947, james/server/trunk/mailets/src/test/java/org/apache/james/transport/mailets/MailetLoaderTestMailet.java)
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/mailetcontainer/lib/MailetLoaderTestMailet.java?p2=james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/mailetcontainer/lib/MailetLoaderTestMailet.java&p1=james/server/trunk/mailets/src/test/java/org/apache/james/transport/mailets/MailetLoaderTestMailet.java&r1=1026947&r2=1027932&rev=1027932&view=diff
==============================================================================
--- james/server/trunk/mailets/src/test/java/org/apache/james/transport/mailets/MailetLoaderTestMailet.java
(original)
+++ james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/mailetcontainer/lib/MailetLoaderTestMailet.java
Wed Oct 27 12:20:19 2010
@@ -19,7 +19,7 @@
 
 
 
-package org.apache.james.transport.mailets;
+package org.apache.james.mailetcontainer.lib;
 
 import org.apache.mailet.base.GenericMailet;
 import org.apache.mailet.Mail;

Added: james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/mailetcontainer/lib/MockMailet.java
URL: http://svn.apache.org/viewvc/james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/mailetcontainer/lib/MockMailet.java?rev=1027932&view=auto
==============================================================================
--- james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/mailetcontainer/lib/MockMailet.java
(added)
+++ james/server/trunk/mailetcontainer-library/src/test/java/org/apache/james/mailetcontainer/lib/MockMailet.java
Wed Oct 27 12:20:19 2010
@@ -0,0 +1,35 @@
+/****************************************************************
+ * Licensed to the Apache Software Foundation (ASF) under one   *
+ * or more contributor license agreements.  See the NOTICE file *
+ * distributed with this work for additional information        *
+ * regarding copyright ownership.  The ASF licenses this file   *
+ * to you under the Apache License, Version 2.0 (the            *
+ * "License"); you may not use this file except in compliance   *
+ * with the License.  You may obtain a copy of the License at   *
+ *                                                              *
+ *   http://www.apache.org/licenses/LICENSE-2.0                 *
+ *                                                              *
+ * Unless required by applicable law or agreed to in writing,   *
+ * software distributed under the License is distributed on an  *
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY       *
+ * KIND, either express or implied.  See the License for the    *
+ * specific language governing permissions and limitations      *
+ * under the License.                                           *
+ ****************************************************************/
+
+
+package org.apache.james.mailetcontainer.lib;
+
+import javax.mail.MessagingException;
+
+import org.apache.mailet.Mail;
+import org.apache.mailet.base.GenericMailet;
+
+public class MockMailet extends GenericMailet{
+
+    @Override
+    public void service(Mail arg0) throws MessagingException {
+        
+    }
+
+}



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