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 no...@apache.org on 2009/10/30 16:40:51 UTC
svn commit: r831337 - in
/james/server/trunk/smtpserver-function/src/test/java/org/apache/james:
smtpserver/ test/mock/
Author: norman
Date: Fri Oct 30 15:40:51 2009
New Revision: 831337
URL: http://svn.apache.org/viewvc?rev=831337&view=rev
Log:
Add tests for avalon - guice wrapper
Added:
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/AvalonAsyncSMTPServerTest.java
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/AvalonSMTPServerTest.java
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/test/mock/DummyDataSourceSelector.java
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/test/mock/DummyVirtualUserTableStore.java
Modified:
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/AsyncSMTPServerTest.java
james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
Modified: james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/AsyncSMTPServerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/AsyncSMTPServerTest.java?rev=831337&r1=831336&r2=831337&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/AsyncSMTPServerTest.java (original)
+++ james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/AsyncSMTPServerTest.java Fri Oct 30 15:40:51 2009
@@ -32,6 +32,8 @@
import org.apache.james.services.MailServer;
import org.apache.james.smtpserver.integration.SMTPServerDNSServiceAdapter;
import org.apache.james.smtpserver.mina.AvalonAsyncSMTPServer;
+import org.apache.james.test.mock.DummyDataSourceSelector;
+import org.apache.james.test.mock.DummyVirtualUserTableStore;
import org.apache.james.test.mock.avalon.MockLogger;
import org.apache.james.test.mock.avalon.MockStore;
import org.apache.james.test.mock.james.MockFileSystem;
@@ -82,34 +84,7 @@
// Disable superclass test because this doesn't work with MINA yet.
// TODO try to understand and fix it.
}
-
- private class DummyVirtualUserTableStore implements VirtualUserTableStore {
-
- public VirtualUserTable getTable(String name) {
- // TODO Auto-generated method stub
- return null;
- }
-
- }
- private class DummyDataSourceSelector implements DataSourceSelector {
-
- public boolean isSelectable(Object arg0) {
- // TODO Auto-generated method stub
- return false;
- }
-
- public void release(Object arg0) {
- // TODO Auto-generated method stub
-
- }
-
- public Object select(Object arg0) throws ServiceException {
- // TODO Auto-generated method stub
- return null;
- }
-
- }
-
+
}
Added: james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/AvalonAsyncSMTPServerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/AvalonAsyncSMTPServerTest.java?rev=831337&view=auto
==============================================================================
--- james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/AvalonAsyncSMTPServerTest.java (added)
+++ james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/AvalonAsyncSMTPServerTest.java Fri Oct 30 15:40:51 2009
@@ -0,0 +1,51 @@
+/****************************************************************
+ * 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.smtpserver;
+
+import org.apache.avalon.framework.container.ContainerUtil;
+import org.apache.james.api.kernel.mock.FakeLoader;
+import org.apache.james.smtpserver.mina.AvalonAsyncSMTPServer;
+import org.apache.james.test.mock.avalon.MockLogger;
+
+public class AvalonAsyncSMTPServerTest extends AsyncSMTPServerTest{
+
+ private AvalonAsyncSMTPServer smtpserver;
+
+ @Override
+ protected void finishSetUp(SMTPTestConfiguration testConfiguration)
+ throws Exception {
+ testConfiguration.init();
+ ContainerUtil.configure(smtpserver, testConfiguration);
+ ContainerUtil.initialize(smtpserver);
+ m_mailServer.setMaxMessageSizeBytes(m_testConfiguration.getMaxMessageSize()*1024);
+
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ FakeLoader loader = setUpServiceManager();
+ smtpserver = new AvalonAsyncSMTPServer();
+ ContainerUtil.enableLogging(smtpserver, new MockLogger());
+ ContainerUtil.service(smtpserver, loader);
+ m_testConfiguration = new SMTPTestConfiguration(m_smtpListenerPort);
+
+ }
+
+
+}
Added: james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/AvalonSMTPServerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/AvalonSMTPServerTest.java?rev=831337&view=auto
==============================================================================
--- james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/AvalonSMTPServerTest.java (added)
+++ james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/AvalonSMTPServerTest.java Fri Oct 30 15:40:51 2009
@@ -0,0 +1,50 @@
+/****************************************************************
+ * 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.smtpserver;
+
+import org.apache.avalon.framework.container.ContainerUtil;
+import org.apache.james.api.kernel.mock.FakeLoader;
+import org.apache.james.test.mock.avalon.MockLogger;
+
+public class AvalonSMTPServerTest extends SMTPServerTest{
+
+ private AvalonSMTPServer smtpserver;
+
+ @Override
+ protected void finishSetUp(SMTPTestConfiguration testConfiguration)
+ throws Exception {
+ testConfiguration.init();
+ ContainerUtil.configure(smtpserver, testConfiguration);
+ ContainerUtil.initialize(smtpserver);
+ m_mailServer.setMaxMessageSizeBytes(m_testConfiguration.getMaxMessageSize()*1024);
+
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ FakeLoader loader = setUpServiceManager();
+ smtpserver = new AvalonSMTPServer();
+ ContainerUtil.enableLogging(smtpserver, new MockLogger());
+ ContainerUtil.service(smtpserver, loader);
+ m_testConfiguration = new SMTPTestConfiguration(m_smtpListenerPort);
+
+ }
+
+
+}
Modified: james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java?rev=831337&r1=831336&r2=831337&view=diff
==============================================================================
--- james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java (original)
+++ james/server/trunk/smtpserver-function/src/test/java/org/apache/james/smtpserver/SMTPServerTest.java Fri Oct 30 15:40:51 2009
@@ -38,6 +38,7 @@
import junit.framework.TestCase;
+import org.apache.avalon.cornerstone.services.datasources.DataSourceSelector;
import org.apache.avalon.cornerstone.services.sockets.SocketManager;
import org.apache.avalon.cornerstone.services.store.Store;
import org.apache.avalon.cornerstone.services.threads.ThreadManager;
@@ -48,11 +49,14 @@
import org.apache.james.api.dnsservice.DNSService;
import org.apache.james.api.kernel.mock.FakeLoader;
import org.apache.james.api.user.UsersRepository;
+import org.apache.james.api.vut.VirtualUserTableStore;
import org.apache.james.services.FileSystem;
import org.apache.james.services.MailServer;
import org.apache.james.smtpserver.integration.SMTPServerDNSServiceAdapter;
import org.apache.james.socket.JamesConnectionManager;
import org.apache.james.socket.SimpleConnectionManager;
+import org.apache.james.test.mock.DummyDataSourceSelector;
+import org.apache.james.test.mock.DummyVirtualUserTableStore;
import org.apache.james.test.mock.avalon.MockLogger;
import org.apache.james.test.mock.avalon.MockSocketManager;
import org.apache.james.test.mock.avalon.MockStore;
@@ -201,6 +205,7 @@
m_smtpServer.setProtocolHandlerFactory(m_smtpServer);
m_smtpServer.setSocketManager(socketManager);
m_smtpServer.setThreadManager(threadManager);
+
ContainerUtil.service(m_smtpServer, m_serviceManager);
m_testConfiguration = new SMTPTestConfiguration(m_smtpListenerPort);
@@ -248,6 +253,8 @@
dnsAdapter = new SMTPServerDNSServiceAdapter();
dnsAdapter.setDNSService(m_dnsServer);
m_serviceManager.put("org.apache.james.smtpserver.protocol.DNSService", dnsAdapter);
+ m_serviceManager.put(VirtualUserTableStore.ROLE, new DummyVirtualUserTableStore());
+ m_serviceManager.put(DataSourceSelector.ROLE, new DummyDataSourceSelector());
return m_serviceManager;
}
Added: james/server/trunk/smtpserver-function/src/test/java/org/apache/james/test/mock/DummyDataSourceSelector.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/test/java/org/apache/james/test/mock/DummyDataSourceSelector.java?rev=831337&view=auto
==============================================================================
--- james/server/trunk/smtpserver-function/src/test/java/org/apache/james/test/mock/DummyDataSourceSelector.java (added)
+++ james/server/trunk/smtpserver-function/src/test/java/org/apache/james/test/mock/DummyDataSourceSelector.java Fri Oct 30 15:40:51 2009
@@ -0,0 +1,42 @@
+package org.apache.james.test.mock;
+
+import org.apache.avalon.cornerstone.services.datasources.DataSourceSelector;
+/****************************************************************
+ * 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. *
+ ****************************************************************/
+import org.apache.avalon.framework.service.ServiceException;
+
+public class DummyDataSourceSelector implements DataSourceSelector {
+
+ public boolean isSelectable(Object arg0) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ public void release(Object arg0) {
+ // TODO Auto-generated method stub
+
+ }
+
+ public Object select(Object arg0) throws ServiceException {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
+
Added: james/server/trunk/smtpserver-function/src/test/java/org/apache/james/test/mock/DummyVirtualUserTableStore.java
URL: http://svn.apache.org/viewvc/james/server/trunk/smtpserver-function/src/test/java/org/apache/james/test/mock/DummyVirtualUserTableStore.java?rev=831337&view=auto
==============================================================================
--- james/server/trunk/smtpserver-function/src/test/java/org/apache/james/test/mock/DummyVirtualUserTableStore.java (added)
+++ james/server/trunk/smtpserver-function/src/test/java/org/apache/james/test/mock/DummyVirtualUserTableStore.java Fri Oct 30 15:40:51 2009
@@ -0,0 +1,31 @@
+/****************************************************************
+ * 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.test.mock;
+
+import org.apache.james.api.vut.VirtualUserTable;
+import org.apache.james.api.vut.VirtualUserTableStore;
+
+public class DummyVirtualUserTableStore implements VirtualUserTableStore {
+
+ public VirtualUserTable getTable(String name) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org