1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.james.jspf;
21
22 import org.apache.james.jspf.core.Logger;
23 import org.apache.james.jspf.impl.Log4JLogger;
24 import org.apache.james.jspf.tester.SPFYamlTestDescriptor;
25
26 import java.io.IOException;
27 import java.util.Iterator;
28 import java.util.List;
29
30 import junit.framework.Test;
31 import junit.framework.TestSuite;
32 import junit.textui.TestRunner;
33
34 public class RFC4408AsynchronousYamlTest extends RFC4408YamlTest {
35
36 private static final String YAMLFILE2 = "rfc4408-tests.yml";
37
38
39
40
41 public RFC4408AsynchronousYamlTest(String name) throws IOException {
42 super(name);
43 }
44
45 protected RFC4408AsynchronousYamlTest(SPFYamlTestDescriptor def) {
46 super(def);
47 }
48
49 protected RFC4408AsynchronousYamlTest(SPFYamlTestDescriptor def, String test) {
50 super(def, test);
51 }
52
53 protected String getFilename() {
54 return YAMLFILE2;
55 }
56
57 public static Test suite() throws IOException {
58 return new RFC4408AsynchronousSuite();
59 }
60
61 protected int getDnsServiceMockStyle() {
62 return FAKE_SERVER;
63 }
64
65 protected int getSpfExecutorType() {
66 return STAGED_EXECUTOR_MULTITHREADED;
67 }
68
69 static class RFC4408AsynchronousSuite extends TestSuite {
70
71 public RFC4408AsynchronousSuite() throws IOException {
72 super();
73 List tests = SPFYamlTestDescriptor.loadTests(YAMLFILE2);
74 Iterator i = tests.iterator();
75 while (i.hasNext()) {
76 SPFYamlTestDescriptor o = (SPFYamlTestDescriptor) i.next();
77 addTest(new RFC4408AsynchronousYamlTest(o));
78 }
79 }
80
81 }
82
83 protected void setLogger(Logger logger) {
84 this.log = logger;
85 }
86
87
88
89
90
91
92
93
94 public static void main(String[] args) throws Throwable {
95 Logger l = new Log4JLogger(org.apache.log4j.Logger.getLogger("ROOT"));
96
97 List tests = SPFYamlTestDescriptor.loadTests(YAMLFILE2);
98 Iterator i = tests.iterator();
99 while (i.hasNext()) {
100 SPFYamlTestDescriptor o = (SPFYamlTestDescriptor) i.next();
101 Iterator ttt = o.getTests().keySet().iterator();
102 while (ttt.hasNext()) {
103 RFC4408AsynchronousYamlTest t = new RFC4408AsynchronousYamlTest(o,(String) ttt.next());
104 t.setLogger(l);
105 TestRunner.run(t);
106 }
107 }
108 }
109
110 }