1 /****************************************************************
2 * Licensed to the Apache Software Foundation (ASF) under one *
3 * or more contributor license agreements. See the NOTICE file *
4 * distributed with this work for additional information *
5 * regarding copyright ownership. The ASF licenses this file *
6 * to you under the Apache License, Version 2.0 (the *
7 * "License"); you may not use this file except in compliance *
8 * with the License. You may obtain a copy of the License at *
9 * *
10 * http://www.apache.org/licenses/LICENSE-2.0 *
11 * *
12 * Unless required by applicable law or agreed to in writing, *
13 * software distributed under the License is distributed on an *
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY *
15 * KIND, either express or implied. See the License for the *
16 * specific language governing permissions and limitations *
17 * under the License. *
18 ****************************************************************/
19
20 package org.apache.james.jspf;
21
22 import org.apache.james.jspf.core.DNSService;
23 import org.apache.james.jspf.tester.SPFYamlTestDescriptor;
24
25 import java.io.IOException;
26 import java.util.Iterator;
27 import java.util.List;
28
29 import junit.framework.Test;
30 import junit.framework.TestSuite;
31
32 public class MailZoneYamlTest extends AbstractYamlTest {
33
34 private static final String YAMLFILE2 = "mailzone-tests.yml";
35
36 /**
37 * @param name
38 * @throws IOException
39 */
40 public MailZoneYamlTest(String name) throws IOException {
41 super(name);
42 }
43
44 protected MailZoneYamlTest(SPFYamlTestDescriptor def, String test) {
45 super(def, test);
46 }
47
48 protected MailZoneYamlTest(SPFYamlTestDescriptor def) {
49 super(def);
50 }
51
52 protected String getFilename() {
53 return YAMLFILE2;
54 }
55
56 public static Test suite() throws IOException {
57 return new MailZoneSuite();
58 }
59
60 protected DNSService getDNSService() {
61 DNSService dns = super.getDNSService();
62 // Remove record limits for this test
63 dns.setRecordLimit(0);
64 return dns;
65 }
66
67 static class MailZoneSuite extends TestSuite {
68
69 public MailZoneSuite() throws IOException {
70 super();
71 List tests = SPFYamlTestDescriptor.loadTests(YAMLFILE2);
72 Iterator i = tests.iterator();
73 while (i.hasNext()) {
74 SPFYamlTestDescriptor o = (SPFYamlTestDescriptor) i.next();
75 Iterator ttt = o.getTests().keySet().iterator();
76 while (ttt.hasNext()) {
77 addTest(new MailZoneYamlTest(o,(String) ttt.next()));
78 }
79 }
80 }
81
82 }
83
84 }