001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.pluto.testsuite;
018:
019: import java.io.Serializable;
020: import java.util.ArrayList;
021: import java.util.Collections;
022: import java.util.HashMap;
023: import java.util.List;
024: import java.util.Map;
025:
026: /**
027: * Configuration for <code>PortletTest</code>.
028: *
029: * @see TestConfigFactory
030: * @see PortletTest
031: *
032: * @version 1.0
033: * @since Sep 15, 2004
034: */
035: public class TestConfig implements Serializable {
036:
037: // Private Member Variables ------------------------------------------------
038:
039: /** PortletTest class name. */
040: private String testClassName;
041:
042: /** Test name. */
043: private String name = null;
044:
045: private String displayURI;
046:
047: private final Map initParameters = new HashMap();
048:
049: /**
050: * The action parameters list holding TestConfig.Parameter objects.
051: * We are not using Map to hold action parameters because parameters with
052: * the same name are allowed.
053: */
054: private final List actionParameters = new ArrayList();
055:
056: /**
057: * The render parameters list holding TestConfig.Parameter objects.
058: * We are not using Map to hold render parameters because parameters with
059: * the same name are allowed.
060: *
061: * FIXME: when is this field used?
062: */
063: private final List renderParameters = new ArrayList();
064:
065: // Constructor -------------------------------------------------------------
066:
067: /**
068: * Default constructor required by Digester.
069: */
070: public TestConfig() {
071: // Do nothing.
072: }
073:
074: // Public Methods ----------------------------------------------------------
075:
076: public String getTestClassName() {
077: return testClassName;
078: }
079:
080: public void setTestClassName(String testClassName) {
081: this .testClassName = testClassName;
082: }
083:
084: public String getName() {
085: return name;
086: }
087:
088: public void setName(String testName) {
089: this .name = testName;
090: }
091:
092: public String getDisplayURI() {
093: return displayURI;
094: }
095:
096: public void setDisplayURI(String displayURI) {
097: this .displayURI = displayURI;
098: }
099:
100: public void addInitParameter(String parameter, String value) {
101: initParameters.put(parameter, value);
102: }
103:
104: public Map getInitParameters() {
105: return Collections.unmodifiableMap(initParameters);
106: }
107:
108: public void addActionParameter(String name, String value) {
109: actionParameters.add(new Parameter(name, value));
110: }
111:
112: public List getActionParameters() {
113: return actionParameters;
114: }
115:
116: /**
117: * FIXME: why is this method required?
118: */
119: public void addRenderParameter(String name, String value) {
120: renderParameters.add(new Parameter(name, value));
121: }
122:
123: /**
124: * FIXME: when is this method used?
125: */
126: public List getRenderParameters() {
127: return renderParameters;
128: }
129:
130: public String toString() {
131: StringBuffer buffer = new StringBuffer();
132: buffer.append(getClass().getName());
133: buffer.append("[").append(getName()).append("]");
134: return buffer.toString();
135: }
136:
137: public static class Parameter {
138: private String name = null;
139: private String value = null;
140:
141: public Parameter(String name, String value) {
142: this .name = name;
143: this .value = value;
144: }
145:
146: public String getName() {
147: return name;
148: }
149:
150: public String getValue() {
151: return value;
152: }
153: }
154:
155: }
|