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 ba...@apache.org on 2008/08/11 17:36:32 UTC

svn commit: r684782 - in /james/server/trunk: domain-api/src/main/java/org/apache/james/api/domainlist/SimpleDomainList.java remotemanager-function/src/test/java/org/apache/james/remotemanager/RemoteManagerTest.java

Author: bago
Date: Mon Aug 11 08:36:31 2008
New Revision: 684782

URL: http://svn.apache.org/viewvc?rev=684782&view=rev
Log:
Created a SimpleDomainList as the most basic implementation for DomainList.
Mainly intended for testing support.
Removed XMLDomainList dependency from the RemoteManager

Added:
    james/server/trunk/domain-api/src/main/java/org/apache/james/api/domainlist/SimpleDomainList.java   (with props)
Modified:
    james/server/trunk/remotemanager-function/src/test/java/org/apache/james/remotemanager/RemoteManagerTest.java

Added: james/server/trunk/domain-api/src/main/java/org/apache/james/api/domainlist/SimpleDomainList.java
URL: http://svn.apache.org/viewvc/james/server/trunk/domain-api/src/main/java/org/apache/james/api/domainlist/SimpleDomainList.java?rev=684782&view=auto
==============================================================================
--- james/server/trunk/domain-api/src/main/java/org/apache/james/api/domainlist/SimpleDomainList.java (added)
+++ james/server/trunk/domain-api/src/main/java/org/apache/james/api/domainlist/SimpleDomainList.java Mon Aug 11 08:36:31 2008
@@ -0,0 +1,57 @@
+/****************************************************************
+ * 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.api.domainlist;
+
+
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * Simplest implementation for ManageableDomainList
+ */
+public class SimpleDomainList implements ManageableDomainList {
+    List domains = new LinkedList();
+
+    public boolean containsDomain(String domain) {
+        return domains.contains(domain);
+    }
+
+    public List getDomains() {
+        return domains;
+    }
+
+    public void setAutoDetect(boolean autodetect) {
+        // ignore
+    }
+
+    public void setAutoDetectIP(boolean autodetectIP) {
+        // ignore
+    }
+
+    public boolean addDomain(String domain) {
+        if (domains.contains(domain)) return false;
+        return domains.add(domain);
+    }
+
+    public boolean removeDomain(String domain) {
+        return domains.remove(domain);
+    }
+}
\ No newline at end of file

Propchange: james/server/trunk/domain-api/src/main/java/org/apache/james/api/domainlist/SimpleDomainList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: james/server/trunk/domain-api/src/main/java/org/apache/james/api/domainlist/SimpleDomainList.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: james/server/trunk/remotemanager-function/src/test/java/org/apache/james/remotemanager/RemoteManagerTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/remotemanager-function/src/test/java/org/apache/james/remotemanager/RemoteManagerTest.java?rev=684782&r1=684781&r2=684782&view=diff
==============================================================================
--- james/server/trunk/remotemanager-function/src/test/java/org/apache/james/remotemanager/RemoteManagerTest.java (original)
+++ james/server/trunk/remotemanager-function/src/test/java/org/apache/james/remotemanager/RemoteManagerTest.java Mon Aug 11 08:36:31 2008
@@ -28,10 +28,11 @@
 import org.apache.commons.net.telnet.TelnetClient;
 import org.apache.james.api.dnsservice.AbstractDNSServer;
 import org.apache.james.api.dnsservice.DNSService;
+import org.apache.james.api.domainlist.DomainList;
+import org.apache.james.api.domainlist.SimpleDomainList;
 import org.apache.james.api.user.UsersRepository;
 import org.apache.james.api.user.UsersStore;
 import org.apache.james.api.vut.management.VirtualUserTableManagementService;
-import org.apache.james.domain.XMLDomainList;
 import org.apache.james.impl.vut.VirtualUserTableManagement;
 import org.apache.james.management.DomainListManagement;
 import org.apache.james.management.DomainListManagementService;
@@ -184,9 +185,7 @@
         vutManagement.setDefaultVirtualUserTable(new MockVirtualUserTableManagementImpl());
         serviceManager.put(VirtualUserTableManagementService.ROLE, vutManagement);
         
-        XMLDomainList xml = new XMLDomainList();
-        ContainerUtil.enableLogging(xml, new MockLogger());
-        ContainerUtil.service(xml, serviceManager);
+        DomainList xml = new SimpleDomainList();
         
         DomainListManagement domManagement = new DomainListManagement();
         domManagement.setDomainList(xml);



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