james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ieu...@apache.org
Subject svn commit: r1299461 - in /james/server/trunk/dnsservice-dnsjava: pom.xml src/test/java/org/apache/james/dnsservice/dnsjava/DNSJavaServiceTest.java
Date Sun, 11 Mar 2012 22:06:45 GMT
Author: ieugen
Date: Sun Mar 11 22:06:44 2012
New Revision: 1299461

URL: http://svn.apache.org/viewvc?rev=1299461&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/dnsservice-dnsjava/pom.xml
    james/server/trunk/dnsservice-dnsjava/src/test/java/org/apache/james/dnsservice/dnsjava/DNSJavaServiceTest.java

Modified: james/server/trunk/dnsservice-dnsjava/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/dnsservice-dnsjava/pom.xml?rev=1299461&r1=1299460&r2=1299461&view=diff
==============================================================================
--- james/server/trunk/dnsservice-dnsjava/pom.xml (original)
+++ james/server/trunk/dnsservice-dnsjava/pom.xml Sun Mar 11 22:06:44 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,68 +34,64 @@
 
     <properties>
         <!-- OSGI stuff -->
-        <james.osgi.export>
-            org.apache.james.dnsservice.*
-        </james.osgi.export>
-        <james.osgi.import>
-            *
-        </james.osgi.import>
+	<james.osgi.export>org.apache.james.dnsservice.*</james.osgi.export>
+	<james.osgi.import>*</james.osgi.import>
     </properties>
 
     <dependencies>
-        <dependency>
-            <groupId>org.apache.james</groupId>
-            <artifactId>james-server-dnsservice-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.james</groupId>
-            <artifactId>james-server-lifecycle-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>commons-configuration</groupId>
-            <artifactId>commons-configuration</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>slf4j-api</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>dnsjava</groupId>
-            <artifactId>dnsjava</artifactId>
-        </dependency>
-        <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-annotation_1.1_spec</artifactId>
-        </dependency>
-
-        <dependency>
-            <groupId>junit</groupId>
-            <artifactId>junit</artifactId>
-            <scope>test</scope>
-        </dependency>
+	<dependency>
+	    <groupId>org.apache.james</groupId>
+	    <artifactId>james-server-dnsservice-api</artifactId>
+	</dependency>
+	<dependency>
+	    <groupId>org.apache.james</groupId>
+	    <artifactId>james-server-lifecycle-api</artifactId>
+	</dependency>
+	<dependency>
+	    <groupId>commons-configuration</groupId>
+	    <artifactId>commons-configuration</artifactId>
+	</dependency>
+	<dependency>
+	    <groupId>org.slf4j</groupId>
+	    <artifactId>slf4j-api</artifactId>
+	</dependency>
+	<dependency>
+	    <groupId>dnsjava</groupId>
+	    <artifactId>dnsjava</artifactId>
+	</dependency>
+	<dependency>
+	    <groupId>org.apache.geronimo.specs</groupId>
+	    <artifactId>geronimo-annotation_1.1_spec</artifactId>
+	</dependency>
+
+	<dependency>
+	    <groupId>junit</groupId>
+	    <artifactId>junit</artifactId>
+	    <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/dnsservice-dnsjava/src/test/java/org/apache/james/dnsservice/dnsjava/DNSJavaServiceTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/dnsservice-dnsjava/src/test/java/org/apache/james/dnsservice/dnsjava/DNSJavaServiceTest.java?rev=1299461&r1=1299460&r2=1299461&view=diff
==============================================================================
--- james/server/trunk/dnsservice-dnsjava/src/test/java/org/apache/james/dnsservice/dnsjava/DNSJavaServiceTest.java
(original)
+++ james/server/trunk/dnsservice-dnsjava/src/test/java/org/apache/james/dnsservice/dnsjava/DNSJavaServiceTest.java
Sun Mar 11 22:06:44 2012
@@ -16,137 +16,132 @@
  * specific language governing permissions and limitations      *
  * under the License.                                           *
  ****************************************************************/
-
 package org.apache.james.dnsservice.dnsjava;
 
-import org.apache.commons.configuration.DefaultConfigurationBuilder;
-import org.apache.james.dnsservice.dnsjava.DNSJavaService;
-import org.slf4j.LoggerFactory;
-import org.xbill.DNS.Cache;
-import org.xbill.DNS.DClass;
-import org.xbill.DNS.Lookup;
-import org.xbill.DNS.Message;
-import org.xbill.DNS.Name;
-import org.xbill.DNS.RRset;
-import org.xbill.DNS.Record;
-import org.xbill.DNS.Resolver;
-import org.xbill.DNS.SOARecord;
-import org.xbill.DNS.SetResponse;
-import org.xbill.DNS.Zone;
-
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collection;
+import org.apache.commons.configuration.DefaultConfigurationBuilder;
+import org.junit.After;
+import static org.junit.Assert.*;
+import org.junit.Before;
+import org.junit.Test;
+import org.slf4j.LoggerFactory;
+import org.xbill.DNS.*;
 
-import junit.framework.TestCase;
-
-public class DNSJavaServiceTest extends TestCase {
+public class DNSJavaServiceTest {
 
     private TestableDNSServer dnsServer;
     private Cache defaultCache;
     private Resolver defaultResolver;
     private Name[] defaultSearchPaths;
 
+    @Test
     public void testNoMX() throws Exception {
-        dnsServer.setResolver(null);
-        dnsServer.setCache(new ZoneCache("dnstest.com."));
-        // a.setSearchPath(new String[] { "searchdomain.com." });
-        Collection<String> records = dnsServer.findMXRecords("nomx.dnstest.com.");
-        assertEquals(1, records.size());
-        assertEquals("nomx.dnstest.com.", records.iterator().next());
+	dnsServer.setResolver(null);
+	dnsServer.setCache(new ZoneCache("dnstest.com."));
+	// a.setSearchPath(new String[] { "searchdomain.com." });
+	Collection<String> records = dnsServer.findMXRecords("nomx.dnstest.com.");
+	assertEquals(1, records.size());
+	assertEquals("nomx.dnstest.com.", records.iterator().next());
     }
 
+    @Test
     public void testBadMX() throws Exception {
-        dnsServer.setResolver(null);
-        dnsServer.setCache(new ZoneCache("dnstest.com."));
-        // a.setSearchPath(new String[] { "searchdomain.com." });
-        Collection<String> records = dnsServer.findMXRecords("badmx.dnstest.com.");
-        assertEquals(1, records.size());
-        assertEquals("badhost.dnstest.com.", records.iterator().next());
-        // Iterator<HostAddress> it =
-        // dnsServer.getSMTPHostAddresses("badmx.dnstest.com.");
-        // assertFalse(it.hasNext());
+	dnsServer.setResolver(null);
+	dnsServer.setCache(new ZoneCache("dnstest.com."));
+	// a.setSearchPath(new String[] { "searchdomain.com." });
+	Collection<String> records = dnsServer.findMXRecords("badmx.dnstest.com.");
+	assertEquals(1, records.size());
+	assertEquals("badhost.dnstest.com.", records.iterator().next());
+	// Iterator<HostAddress> it =
+	// dnsServer.getSMTPHostAddresses("badmx.dnstest.com.");
+	// assertFalse(it.hasNext());
     }
 
+    @Test
     public void testINARecords() throws Exception {
-        // Zone z = loadZone("pippo.com.");
-        dnsServer.setResolver(null);
-        dnsServer.setCache(new ZoneCache("pippo.com."));
-        // dnsServer.setLookupper(new ZoneLookupper(z));
-        Collection<String> records = dnsServer.findMXRecords("www.pippo.com.");
-        assertEquals(1, records.size());
-        assertEquals("pippo.com.inbound.mxlogic.net.", records.iterator().next());
+	// Zone z = loadZone("pippo.com.");
+	dnsServer.setResolver(null);
+	dnsServer.setCache(new ZoneCache("pippo.com."));
+	// dnsServer.setLookupper(new ZoneLookupper(z));
+	Collection<String> records = dnsServer.findMXRecords("www.pippo.com.");
+	assertEquals(1, records.size());
+	assertEquals("pippo.com.inbound.mxlogic.net.", records.iterator().next());
     }
 
+    @Test
     public void testMXCatches() throws Exception {
-        // Zone z = loadZone("test-zone.com.");
-        dnsServer.setResolver(null);
-        dnsServer.setCache(new ZoneCache("test-zone.com."));
-        // dnsServer.setLookupper(new ZoneLookupper(z));
-        Collection<String> res = dnsServer.findMXRecords("test-zone.com.");
-        try {
-            res.add(new String());
-            fail("MX Collection should not be modifiable");
-        } catch (UnsupportedOperationException e) {
-        }
-        assertEquals(1, res.size());
-        assertEquals("mail.test-zone.com.", res.iterator().next());
+	// Zone z = loadZone("test-zone.com.");
+	dnsServer.setResolver(null);
+	dnsServer.setCache(new ZoneCache("test-zone.com."));
+	// dnsServer.setLookupper(new ZoneLookupper(z));
+	Collection<String> res = dnsServer.findMXRecords("test-zone.com.");
+	try {
+	    res.add(new String());
+	    fail("MX Collection should not be modifiable");
+	} catch (UnsupportedOperationException e) {
+	}
+	assertEquals(1, res.size());
+	assertEquals("mail.test-zone.com.", res.iterator().next());
     }
 
-
     /**
      * Test for JAMES-1251
      */
+    @Test
     public void testTwoMXSamePrio() throws Exception {
-        dnsServer.setResolver(null);
-        dnsServer.setCache(new ZoneCache("two-mx.sameprio."));
-        // a.setSearchPath(new String[] { "searchdomain.com." });
-        Collection<String> records = dnsServer.findMXRecords("two-mx.sameprio.");
-        assertEquals(2, records.size());
-        assertTrue(records.contains("mx1.two-mx.sameprio."));
-        assertTrue(records.contains("mx2.two-mx.sameprio."));
+	dnsServer.setResolver(null);
+	dnsServer.setCache(new ZoneCache("two-mx.sameprio."));
+	// a.setSearchPath(new String[] { "searchdomain.com." });
+	Collection<String> records = dnsServer.findMXRecords("two-mx.sameprio.");
+	assertEquals(2, records.size());
+	assertTrue(records.contains("mx1.two-mx.sameprio."));
+	assertTrue(records.contains("mx2.two-mx.sameprio."));
     }
 
+    @Test
     public void testThreeMX() throws Exception {
-        dnsServer.setResolver(null);
-        dnsServer.setCache(new ZoneCache("three-mx.bar."));
-        // a.setSearchPath(new String[] { "searchdomain.com." });
-        ArrayList<String> records = new ArrayList<String>(dnsServer.findMXRecords("three-mx.bar."));
-        assertEquals(3, records.size());
-        assertTrue(records.contains("mx1.three-mx.bar."));
-        assertTrue(records.contains("mx2.three-mx.bar."));
-        assertEquals("mx3.three-mx.bar.", records.get(2));
+	dnsServer.setResolver(null);
+	dnsServer.setCache(new ZoneCache("three-mx.bar."));
+	// a.setSearchPath(new String[] { "searchdomain.com." });
+	ArrayList<String> records = new ArrayList<String>(dnsServer.findMXRecords("three-mx.bar."));
+	assertEquals(3, records.size());
+	assertTrue(records.contains("mx1.three-mx.bar."));
+	assertTrue(records.contains("mx2.three-mx.bar."));
+	assertEquals("mx3.three-mx.bar.", records.get(2));
 
     }
 
-    
     /**
      * Test for JAMES-1251
      */
+    @Test
     public void testTwoMXDifferentPrio() throws Exception {
-        dnsServer.setResolver(null);
-        dnsServer.setCache(new ZoneCache("two-mx.differentprio."));
-        // a.setSearchPath(new String[] { "searchdomain.com." });
-        Collection<String> records = dnsServer.findMXRecords("two-mx.differentprio.");
-        assertEquals(2, records.size());
-        assertTrue(records.contains("mx1.two-mx.differentprio."));
-        assertTrue(records.contains("mx2.two-mx.differentprio."));
-        
+	dnsServer.setResolver(null);
+	dnsServer.setCache(new ZoneCache("two-mx.differentprio."));
+	// a.setSearchPath(new String[] { "searchdomain.com." });
+	Collection<String> records = dnsServer.findMXRecords("two-mx.differentprio.");
+	assertEquals(2, records.size());
+	assertTrue(records.contains("mx1.two-mx.differentprio."));
+	assertTrue(records.contains("mx2.two-mx.differentprio."));
+
     }
 
     /**
      * Test for JAMES-1251
      */
+    @Test
     public void testOneMX() throws Exception {
-        dnsServer.setResolver(null);
-        dnsServer.setCache(new ZoneCache("one-mx.bar."));
-        // a.setSearchPath(new String[] { "searchdomain.com." });
-        Collection<String> records = dnsServer.findMXRecords("one-mx.bar.");
-        assertEquals(1, records.size());
-        assertTrue(records.contains("mx1.one-mx.bar."));
-        
+	dnsServer.setResolver(null);
+	dnsServer.setCache(new ZoneCache("one-mx.bar."));
+	// a.setSearchPath(new String[] { "searchdomain.com." });
+	Collection<String> records = dnsServer.findMXRecords("one-mx.bar.");
+	assertEquals(1, records.size());
+	assertTrue(records.contains("mx1.one-mx.bar."));
+
     }
     /*
      * public void testCNAMEasMXrecords() throws Exception { // Zone z =
@@ -156,137 +151,158 @@ public class DNSJavaServiceTest extends 
      * records = dnsServer.getSMTPHostAddresses("brandilyncollins.com.");
      * //assertEquals(true, records.hasNext()); }
      */
-    protected void setUp() throws Exception {
-        dnsServer = new TestableDNSServer();
-        DefaultConfigurationBuilder db = new DefaultConfigurationBuilder();
-
-        db.load(new ByteArrayInputStream("<dnsserver><autodiscover>true</autodiscover><authoritative>false</authoritative></dnsserver>".getBytes()));
-        dnsServer.setLog(LoggerFactory.getLogger("MockLog"));
-        dnsServer.configure(db);
-        dnsServer.init();
-
-        defaultCache = Lookup.getDefaultCache(DClass.IN);
-        defaultResolver = Lookup.getDefaultResolver();
-        defaultSearchPaths = Lookup.getDefaultSearchPath();
-        Lookup.setDefaultCache(null, DClass.IN);
-        Lookup.setDefaultResolver(null);
-        Lookup.setDefaultSearchPath(new Name[] {});
-    }
-
-    protected void tearDown() throws Exception {
-        dnsServer.setCache(null);
-        dnsServer = null;
-        Lookup.setDefaultCache(defaultCache, DClass.IN);
-        Lookup.setDefaultResolver(defaultResolver);
-        Lookup.setDefaultSearchPath(defaultSearchPaths);
+
+    @Before
+    public void setUp() throws Exception {
+	dnsServer = new TestableDNSServer();
+	DefaultConfigurationBuilder db = new DefaultConfigurationBuilder();
+
+	db.load(new ByteArrayInputStream("<dnsserver><autodiscover>true</autodiscover><authoritative>false</authoritative></dnsserver>".
+		getBytes()));
+	dnsServer.setLog(LoggerFactory.getLogger("MockLog"));
+	dnsServer.configure(db);
+	dnsServer.init();
+
+	defaultCache = Lookup.getDefaultCache(DClass.IN);
+	defaultResolver = Lookup.getDefaultResolver();
+	defaultSearchPaths = Lookup.getDefaultSearchPath();
+	Lookup.setDefaultCache(null, DClass.IN);
+	Lookup.setDefaultResolver(null);
+	Lookup.setDefaultSearchPath(new Name[]{});
+    }
+
+    @After
+    public void tearDown() throws Exception {
+	dnsServer.setCache(null);
+	dnsServer = null;
+	Lookup.setDefaultCache(defaultCache, DClass.IN);
+	Lookup.setDefaultResolver(defaultResolver);
+	Lookup.setDefaultSearchPath(defaultSearchPaths);
     }
 
     private Zone loadZone(String zoneName) throws IOException {
-        String zoneFilename = zoneName + "zone";
-        URL zoneResource = getClass().getResource(zoneFilename);
-        assertNotNull("test resource for zone could not be loaded: " + zoneFilename, zoneResource);
-        String zoneFile = zoneResource.getFile();
-        Zone zone = new Zone(Name.fromString(zoneName), zoneFile);
-        return zone;
+	String zoneFilename = zoneName + "zone";
+	URL zoneResource = getClass().getResource(zoneFilename);
+	assertNotNull("test resource for zone could not be loaded: " + zoneFilename, zoneResource);
+	String zoneFile = zoneResource.getFile();
+	Zone zone = new Zone(Name.fromString(zoneName), zoneFile);
+	return zone;
     }
 
     private final class ZoneCache extends Cache {
 
-        Zone z = null;
+	Zone z = null;
 
-        public ZoneCache(String string) throws IOException {
-            z = loadZone(string);
-        }
-
-        public SetResponse addMessage(Message arg0) {
-            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing
purpose");
-        }
-
-        public synchronized void addNegative(Name arg0, int arg1, SOARecord arg2, int arg3)
{
-            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing
purpose");
-        }
-
-        public synchronized void addRecord(Record arg0, int arg1, Object arg2) {
-            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing
purpose");
-        }
-
-        public synchronized void addRRset(RRset arg0, int arg1) {
-            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing
purpose");
-        }
-
-        public synchronized void clearCache() {
-            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing
purpose");
-        }
-
-        public RRset[] findAnyRecords(Name arg0, int arg1) {
-            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing
purpose");
-        }
-
-        public RRset[] findRecords(Name arg0, int arg1) {
-            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing
purpose");
-        }
-
-        public void flushName(Name arg0) {
-            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing
purpose");
-        }
-
-        public void flushSet(Name arg0, int arg1) {
-            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing
purpose");
-        }
-
-        public int getDClass() {
-            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing
purpose");
-        }
-
-        public int getMaxCache() {
-            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing
purpose");
-        }
-
-        public int getMaxEntries() {
-            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing
purpose");
-        }
-
-        public int getMaxNCache() {
-            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing
purpose");
-        }
-
-        public int getSize() {
-            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing
purpose");
-        }
-
-        protected synchronized SetResponse lookup(Name arg0, int arg1, int arg2) {
-            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing
purpose");
-        }
-
-        public SetResponse lookupRecords(Name arg0, int arg1, int arg2) {
-            System.out.println("Cache.lookupRecords " + arg0 + "," + arg1 + "," + arg2);
-            return z.findRecords(arg0, arg1);
-            // return super.lookupRecords(arg0, arg1, arg2);
-        }
-
-        public void setMaxCache(int arg0) {
-            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing
purpose");
-        }
-
-        public void setMaxEntries(int arg0) {
-            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing
purpose");
-        }
-
-        public void setMaxNCache(int arg0) {
-            throw new UnsupportedOperationException("ZoneCache is a mock used only for testing
purpose");
-        }
+	public ZoneCache(String string) throws IOException {
+	    z = loadZone(string);
+	}
+
+	@Override
+	public SetResponse addMessage(Message arg0) {
+	    throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+	}
+
+	@Override
+	public synchronized void addNegative(Name arg0, int arg1, SOARecord arg2, int arg3) {
+	    throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+	}
+
+	@Override
+	public synchronized void addRecord(Record arg0, int arg1, Object arg2) {
+	    throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+	}
+
+	@Override
+	public synchronized void addRRset(RRset arg0, int arg1) {
+	    throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+	}
+
+	@Override
+	public synchronized void clearCache() {
+	    throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+	}
+
+	@Override
+	public RRset[] findAnyRecords(Name arg0, int arg1) {
+	    throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+	}
+
+	@Override
+	public RRset[] findRecords(Name arg0, int arg1) {
+	    throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+	}
+
+	@Override
+	public void flushName(Name arg0) {
+	    throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+	}
+
+	@Override
+	public void flushSet(Name arg0, int arg1) {
+	    throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+	}
+
+	@Override
+	public int getDClass() {
+	    throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+	}
+
+	@Override
+	public int getMaxCache() {
+	    throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+	}
+
+	@Override
+	public int getMaxEntries() {
+	    throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+	}
+
+	@Override
+	public int getMaxNCache() {
+	    throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+	}
+
+	@Override
+	public int getSize() {
+	    throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+	}
+
+	@Override
+	protected synchronized SetResponse lookup(Name arg0, int arg1, int arg2) {
+	    throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+	}
+
+	@Override
+	public SetResponse lookupRecords(Name arg0, int arg1, int arg2) {
+	    System.out.println("Cache.lookupRecords " + arg0 + "," + arg1 + "," + arg2);
+	    return z.findRecords(arg0, arg1);
+	    // return super.lookupRecords(arg0, arg1, arg2);
+	}
+
+	@Override
+	public void setMaxCache(int arg0) {
+	    throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+	}
+
+	@Override
+	public void setMaxEntries(int arg0) {
+	    throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+	}
+
+	@Override
+	public void setMaxNCache(int arg0) {
+	    throw new UnsupportedOperationException("ZoneCache is a mock used only for testing purpose");
+	}
     }
 
     private final class TestableDNSServer extends DNSJavaService {
 
-        public void setResolver(Resolver r) {
-            resolver = r;
-        }
-
-
-        public void setCache(Cache c) {
-            cache = c;
-        }
+	public void setResolver(Resolver r) {
+	    resolver = r;
+	}
+
+	public void setCache(Cache c) {
+	    cache = c;
+	}
     }
-
 }



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