01: /****************************************************************
02: * Licensed to the Apache Software Foundation (ASF) under one *
03: * or more contributor license agreements. See the NOTICE file *
04: * distributed with this work for additional information *
05: * regarding copyright ownership. The ASF licenses this file *
06: * to you under the Apache License, Version 2.0 (the *
07: * "License"); you may not use this file except in compliance *
08: * with the License. You may obtain a copy of the License at *
09: * *
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: ****************************************************************/package org.apache.james.remotemanager;
19:
20: import org.apache.avalon.framework.configuration.DefaultConfiguration;
21: import org.apache.james.test.util.Util;
22:
23: public class RemoteManagerTestConfiguration extends
24: DefaultConfiguration {
25:
26: private int m_remoteManagerListenerPort;
27: private Integer m_connectionLimit = null;
28: private String m_loginName = "testLogin";
29: private String m_loginPassword = "testPassword";
30:
31: public RemoteManagerTestConfiguration(int smtpListenerPort) {
32: super ("smptserver");
33:
34: m_remoteManagerListenerPort = smtpListenerPort;
35: }
36:
37: public void setConnectionLimit(int iConnectionLimit) {
38: m_connectionLimit = new Integer(iConnectionLimit);
39: }
40:
41: public String getLoginName() {
42: return m_loginName;
43: }
44:
45: public void setLoginName(String loginName) {
46: m_loginName = loginName;
47: }
48:
49: public String getLoginPassword() {
50: return m_loginPassword;
51: }
52:
53: public void setLoginPassword(String loginPassword) {
54: m_loginPassword = loginPassword;
55: }
56:
57: public void init() {
58:
59: setAttribute("enabled", true);
60:
61: addChild(Util.getValuedConfiguration("port", ""
62: + m_remoteManagerListenerPort));
63: if (m_connectionLimit != null)
64: addChild(Util.getValuedConfiguration("connectionLimit", ""
65: + m_connectionLimit.intValue()));
66:
67: DefaultConfiguration handlerConfig = new DefaultConfiguration(
68: "handler");
69: handlerConfig.addChild(Util.getValuedConfiguration("helloName",
70: "myMailServer"));
71: handlerConfig.addChild(Util.getValuedConfiguration(
72: "connectiontimeout", "360000"));
73:
74: DefaultConfiguration adminAccounts = new DefaultConfiguration(
75: "administrator_accounts");
76:
77: DefaultConfiguration account = new DefaultConfiguration(
78: "account");
79:
80: account.setAttribute("login", m_loginName);
81: account.setAttribute("password", m_loginPassword);
82:
83: adminAccounts.addChild(account);
84: handlerConfig.addChild(adminAccounts);
85:
86: // handlerConfig.addChild(Util.getValuedConfiguration("prompt", ">"));
87:
88: handlerConfig.addChild(Util
89: .createRemoteManagerHandlerChainConfiguration());
90: addChild(handlerConfig);
91: }
92:
93: }
|