1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 package org.apache.mailet.base.test;
21
22 import org.apache.mailet.MailetConfig;
23 import org.apache.mailet.MailetContext;
24
25 import java.util.Iterator;
26 import java.util.Properties;
27
28
29
30
31 public class FakeMailetConfig extends Properties implements MailetConfig {
32
33 public String mailetName;
34 public MailetContext mc;
35
36 public FakeMailetConfig() {
37 this("A Mailet", new FakeMailContext());
38 }
39
40 public FakeMailetConfig(String mailetName, MailetContext mc) {
41 super();
42 this.mailetName = mailetName;
43 this.mc = mc;
44 }
45
46 public FakeMailetConfig(String mailetName, MailetContext mc, Properties arg0) {
47 super(arg0);
48 this.mailetName = mailetName;
49 this.mc = mc;
50 }
51
52 public String getInitParameter(String name) {
53 return getProperty(name);
54 }
55
56 public Iterator getInitParameterNames() {
57 return keySet().iterator();
58 }
59
60 public MailetContext getMailetContext() {
61 return mc;
62 }
63
64 public String getMailetName() {
65 return mailetName;
66 }
67
68
69 public Object setProperty(String key, String value) {
70 String oldValue = getProperty(key);
71 String newValue = value;
72
73 if (oldValue != null) {
74 newValue = oldValue + "," + value;
75 }
76 return super.setProperty(key, newValue);
77 }
78 }