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 MailZoneAsynchronousYamlTest extends MailZoneYamlTest {
33
34 private static final String YAMLFILE2 = "mailzone-tests.yml";
35
36 /**
37 * @param name
38 * @throws IOException
39 */
40 public MailZoneAsynchronousYamlTest(String name) throws IOException {
41 super(name);
42 }
43
44 protected MailZoneAsynchronousYamlTest(SPFYamlTestDescriptor def, String test) {
45 super(def, test);
46 }
47
48 protected MailZoneAsynchronousYamlTest(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 MailZoneAsynchronousSuite();
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
68 protected int getDnsServiceMockStyle() {
69 return FAKE_SERVER;
70 }
71
72 protected int getSpfExecutorType() {
73 return STAGED_EXECUTOR_DNSJNIO;
74 }
75
76 static class MailZoneAsynchronousSuite extends TestSuite {
77
78 public MailZoneAsynchronousSuite() throws IOException {
79 super();
80 List tests = SPFYamlTestDescriptor.loadTests(YAMLFILE2);
81 Iterator i = tests.iterator();
82 while (i.hasNext()) {
83 SPFYamlTestDescriptor o = (SPFYamlTestDescriptor) i.next();
84 addTest(new MailZoneAsynchronousYamlTest(o));
85 }
86 }
87
88 }
89
90 }