james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nor...@apache.org
Subject svn commit: r882496 - /james/server/trunk/core-function/src/test/java/org/apache/james/management/impl/SpoolManagementTest.java
Date Fri, 20 Nov 2009 10:58:24 GMT
Author: norman
Date: Fri Nov 20 10:58:23 2009
New Revision: 882496

URL: http://svn.apache.org/viewvc?rev=882496&view=rev
Log:
Fix SpoolManagementTest

Modified:
    james/server/trunk/core-function/src/test/java/org/apache/james/management/impl/SpoolManagementTest.java

Modified: james/server/trunk/core-function/src/test/java/org/apache/james/management/impl/SpoolManagementTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/core-function/src/test/java/org/apache/james/management/impl/SpoolManagementTest.java?rev=882496&r1=882495&r2=882496&view=diff
==============================================================================
--- james/server/trunk/core-function/src/test/java/org/apache/james/management/impl/SpoolManagementTest.java
(original)
+++ james/server/trunk/core-function/src/test/java/org/apache/james/management/impl/SpoolManagementTest.java
Fri Nov 20 10:58:23 2009
@@ -21,25 +21,21 @@
 
 package org.apache.james.management.impl;
 
-import org.apache.avalon.cornerstone.services.store.Store;
+import java.util.HashMap;
+
+import javax.mail.MessagingException;
+
+import junit.framework.TestCase;
+
 import org.apache.avalon.framework.container.ContainerUtil;
 import org.apache.james.management.SpoolFilter;
 import org.apache.james.management.SpoolManagementException;
-import org.apache.james.management.impl.SpoolManagement;
-import org.apache.james.test.mock.avalon.MockLogger;
-import org.apache.james.test.mock.avalon.MockServiceManager;
 import org.apache.james.test.mock.avalon.MockStore;
 import org.apache.james.test.mock.james.InMemorySpoolRepository;
-import org.apache.mailet.base.test.FakeMimeMessage;
+import org.apache.mailet.Mail;
 import org.apache.mailet.base.test.FakeMail;
+import org.apache.mailet.base.test.FakeMimeMessage;
 import org.apache.mailet.base.test.MailUtil;
-import org.apache.mailet.Mail;
-
-import javax.mail.MessagingException;
-
-import java.util.HashMap;
-
-import junit.framework.TestCase;
 
 /**
  * Tests the SpoolManagement
@@ -54,8 +50,11 @@
 
     protected void setUp() throws Exception {
         m_spoolManagement = new SpoolManagement();
-        ContainerUtil.enableLogging(m_spoolManagement, new MockLogger());
-        ContainerUtil.service(m_spoolManagement, setUpServiceManager());
+        m_mockSpoolRepository = new InMemorySpoolRepository();
+        m_mockStore = new MockStore();
+        m_mockStore.add("outgoing", m_mockSpoolRepository);
+        m_spoolManagement.setStore(m_mockStore);
+        
     }
 
     protected void tearDown() throws Exception {
@@ -65,15 +64,6 @@
         super.tearDown();
     }
 
-    private MockServiceManager setUpServiceManager() {
-        MockServiceManager serviceManager = new MockServiceManager();
-        m_mockStore = new MockStore();
-        serviceManager.put(Store.ROLE, m_mockStore);
-        m_mockSpoolRepository = new InMemorySpoolRepository();
-        m_mockStore.add("outgoing", m_mockSpoolRepository);
-        return serviceManager;
-    }
-
     public void testListSpoolItemsDontFilter() throws SpoolManagementException, MessagingException
{
         String[] mailList = m_spoolManagement.listSpoolItems(OUTGOING_SPOOL, SpoolFilter.ERRORMAIL_FILTER);
         assertEquals("emtpy spool", 0, mailList.length); // no mail in spool
@@ -122,7 +112,7 @@
         assertEquals("find first mail", 1, mailList.length);
         assertTrue("finds only default mail", mailList[0].indexOf(messageID1) >= 0);
 
-        HashMap headerMap = new HashMap();
+        HashMap<String,String> headerMap = new HashMap<String,String>();
         headerMap.put("TestHeader", "(.*)1");
         headerMap.put("to", "test2@james.apache.org");
         SpoolFilter matchableFilterWith2Headers = new SpoolFilter(null, headerMap);
@@ -130,7 +120,7 @@
         assertEquals("find one mail", 1, mailList.length);
         assertTrue("finds only default mail", mailList[0].indexOf(messageID1) >= 0);
 
-        headerMap = new HashMap();
+        headerMap = new HashMap<String,String>();
         headerMap.put("TestHeader", "(.*)1");
         headerMap.put("UNmatchABLE", "test2@james.apache.org");
         SpoolFilter unmatchableFilterWith2Headers = new SpoolFilter(null, headerMap);



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