01: // Missing test cases:
02: // Test record creation
03: // Test any error-handling behavior we implement
04:
05: package CustomDNS.Tests;
06:
07: import net.espeak.infra.cci.exception.*;
08: import net.espeak.jesi.*;
09:
10: import ZoneRegistrarIntf;
11: import ZoneAuthorityIntf;
12:
13: import CustomDNS.Tests.CustomDNSTestCase;
14:
15: public class TestZoneController extends CustomDNSTestCase {
16:
17: private ZoneRegistrarIntf registrar = null;
18: private ZoneAuthorityIntf authority = null;
19:
20: public TestZoneController(String name) {
21: super (name);
22: }
23:
24: public void setUp() throws Exception {
25: ESConnection core = getESConnection();
26: ESQuery query = new ESQuery("Name == 'myzone.test'");
27: registrar = (ZoneRegistrarIntf) findService(core,
28: ZoneRegistrarIntf.class, query);
29: authority = (ZoneAuthorityIntf) findService(core,
30: ZoneAuthorityIntf.class, query);
31: }
32:
33: public void testSimpleRegistration() throws Exception {
34: // Try it with one value.
35: registrar.registerAddressForHost("test1.myzone.test",
36: "10.0.0.1");
37: String addr = authority.getAddressForHost("test1.myzone.test");
38: assertEquals(addr, "10.0.0.1");
39:
40: // Try it with another.
41: registrar.registerAddressForHost("test1.myzone.test",
42: "10.0.0.2");
43: addr = authority.getAddressForHost("test1.myzone.test");
44: assertEquals(addr, "10.0.0.2");
45: }
46: }
|