1 |
| |
2 |
| |
3 |
| |
4 |
| |
5 |
| |
6 |
| |
7 |
| package jtr.config; |
8 |
| |
9 |
| import java.io.Serializable; |
10 |
| import java.util.*; |
11 |
| |
12 |
| import jtr.config.enterprise.EnterpriseConfig; |
13 |
| import jtr.config.jms.JMSConfig; |
14 |
| import jtr.config.remote.Nodes; |
15 |
| import jtr.config.ws.WebServiceConfig; |
16 |
| import jtr.config.ws.Bindings; |
17 |
| import org.apache.log4j.Logger; |
18 |
| |
19 |
| |
20 |
| |
21 |
| |
22 |
| |
23 |
| |
24 |
| |
25 |
| |
26 |
| |
27 |
| |
28 |
| public class TestConfig implements Serializable { |
29 |
| |
30 |
| |
31 |
| |
32 |
1
| public TestConfig() {
|
33 |
1
| runners = new Vector<RunnerConfig>();
|
34 |
1
| enterpriseConfig = new HashMap<String,EnterpriseConfig>();
|
35 |
1
| jmsConfig = new HashMap<String,JMSConfig>();
|
36 |
1
| wsConfig = new HashMap<String,WebServiceConfig>();
|
37 |
| } |
38 |
| |
39 |
1
| public void setFactories(Factories f) {
|
40 |
1
| factories = f;
|
41 |
| } |
42 |
| |
43 |
2
| public Factories getFactories() {
|
44 |
2
| return factories;
|
45 |
| } |
46 |
| |
47 |
1
| public void setNodes(Nodes n) {
|
48 |
1
| nodes = n;
|
49 |
| } |
50 |
| |
51 |
1
| public Nodes getNodes() {
|
52 |
1
| return nodes;
|
53 |
| } |
54 |
| |
55 |
| |
56 |
| |
57 |
| |
58 |
0
| public void addWebService(WebServiceConfig ws) {
|
59 |
0
| wsConfig.put(ws.getUniqueName(), ws);
|
60 |
| } |
61 |
| |
62 |
| |
63 |
| |
64 |
| |
65 |
| |
66 |
| |
67 |
| |
68 |
| |
69 |
| |
70 |
6
| public void addRunner(final RunnerConfig runner) {
|
71 |
6
| runners.add(runner);
|
72 |
6
| runner.setParent(this);
|
73 |
6
| runners.trimToSize();
|
74 |
| } |
75 |
| |
76 |
| |
77 |
| |
78 |
| |
79 |
| |
80 |
| |
81 |
2
| public Vector<RunnerConfig> getRunners() {
|
82 |
2
| return runners;
|
83 |
| } |
84 |
| |
85 |
| |
86 |
| |
87 |
| |
88 |
| |
89 |
| |
90 |
| |
91 |
| |
92 |
2
| public void addEnterprise(final EnterpriseConfig enterprise) {
|
93 |
2
| enterpriseConfig.put(enterprise.getUniqueName(), enterprise);
|
94 |
| } |
95 |
| |
96 |
| |
97 |
| |
98 |
| |
99 |
| |
100 |
| |
101 |
| |
102 |
| |
103 |
| |
104 |
10023
| public EnterpriseConfig getEnterprise(String uniqueName) {
|
105 |
10021
| return (EnterpriseConfig) enterpriseConfig.get(uniqueName);
|
106 |
| } |
107 |
| |
108 |
| |
109 |
| |
110 |
| |
111 |
| |
112 |
| |
113 |
2
| public int getEpochs() {
|
114 |
2
| return epochs;
|
115 |
| } |
116 |
| |
117 |
| |
118 |
| |
119 |
| |
120 |
| |
121 |
| |
122 |
| |
123 |
1
| public void setEpochs(int epochs) {
|
124 |
1
| this.epochs = epochs;
|
125 |
| } |
126 |
| |
127 |
| |
128 |
| |
129 |
| |
130 |
| |
131 |
| |
132 |
| |
133 |
| |
134 |
| |
135 |
1
| public int getOverallRuns() {
|
136 |
1
| int res = 0;
|
137 |
1
| for(RunnerConfig rc : runners) {
|
138 |
6
| res = res + rc.getRuns()*rc.getCount();
|
139 |
| } |
140 |
1
| return res;
|
141 |
| } |
142 |
| |
143 |
| |
144 |
| |
145 |
| |
146 |
| |
147 |
| |
148 |
| |
149 |
| |
150 |
0
| public void setEnterprise(String enterprise) {
|
151 |
0
| this.enterprise = enterprise;
|
152 |
| } |
153 |
| |
154 |
| |
155 |
| |
156 |
| |
157 |
| |
158 |
| |
159 |
| |
160 |
6033
| public String getEnterprise() {
|
161 |
6029
| return enterprise;
|
162 |
| } |
163 |
| |
164 |
| |
165 |
| |
166 |
| |
167 |
| |
168 |
| |
169 |
| |
170 |
| |
171 |
0
| public void setJms(String id) {
|
172 |
0
| jms = id;
|
173 |
| } |
174 |
| |
175 |
| |
176 |
| |
177 |
| |
178 |
| |
179 |
| |
180 |
| |
181 |
16052
| public String getJms() {
|
182 |
16053
| return jms;
|
183 |
| } |
184 |
| |
185 |
| |
186 |
| |
187 |
| |
188 |
| |
189 |
0
| public void setBinding(String binding) {
|
190 |
0
| this.binding = binding;
|
191 |
| } |
192 |
| |
193 |
| |
194 |
| |
195 |
| |
196 |
| |
197 |
10054
| public String getBinding() {
|
198 |
10054
| return binding;
|
199 |
| } |
200 |
| |
201 |
| |
202 |
| |
203 |
| |
204 |
| |
205 |
1
| public void setBindings(Bindings bindings) {
|
206 |
1
| this.bindings = bindings;
|
207 |
| } |
208 |
| |
209 |
| |
210 |
| |
211 |
| |
212 |
| |
213 |
6014
| public Bindings getBindings() {
|
214 |
6014
| return bindings;
|
215 |
| } |
216 |
| |
217 |
| |
218 |
| |
219 |
| |
220 |
| |
221 |
0
| public void setWebservice(String ws) {
|
222 |
0
| webservice = ws;
|
223 |
| } |
224 |
| |
225 |
| |
226 |
| |
227 |
| |
228 |
| |
229 |
16068
| public String getWebservice() {
|
230 |
16068
| return webservice;
|
231 |
| } |
232 |
| |
233 |
| |
234 |
| |
235 |
| |
236 |
| |
237 |
| |
238 |
| |
239 |
1
| public void addJmsConfig(JMSConfig jmsc) {
|
240 |
1
| jmsConfig.put(jmsc.getUniqueName(), jmsc);
|
241 |
| } |
242 |
| |
243 |
| |
244 |
| |
245 |
| |
246 |
| |
247 |
| |
248 |
| |
249 |
| |
250 |
| |
251 |
14
| public JMSConfig getJmsConfig(String key) {
|
252 |
14
| return (JMSConfig) jmsConfig.get(key);
|
253 |
| } |
254 |
| |
255 |
| |
256 |
| |
257 |
| |
258 |
| |
259 |
| |
260 |
0
| public Collection getJmsConfigs() {
|
261 |
0
| return jmsConfig.values();
|
262 |
| } |
263 |
| |
264 |
| |
265 |
| |
266 |
| |
267 |
| |
268 |
| |
269 |
0
| public WebServiceConfig getWebserviceConfig(String key) {
|
270 |
0
| return (WebServiceConfig) wsConfig.get(key);
|
271 |
| } |
272 |
| |
273 |
| |
274 |
| |
275 |
| |
276 |
0
| public String toString() {
|
277 |
0
| Iterator iter;
|
278 |
0
| String res = "";
|
279 |
0
| res = res + "Test Configuration: \nruns: " + epochs + " ";
|
280 |
0
| if (enterprise != null) {
|
281 |
0
| res = res + "defaultEnterprise: " + enterprise + " ";
|
282 |
| } else { |
283 |
0
| res = res + "defaultEnterprise: null ";
|
284 |
| } |
285 |
0
| if (jms != null) {
|
286 |
0
| res = res + "defaultJMS: " + jms + "\n";
|
287 |
| } else { |
288 |
0
| res = res + "defaultJMS: null\n";
|
289 |
| } |
290 |
0
| if (runners != null) {
|
291 |
0
| iter = runners.iterator();
|
292 |
0
| while (iter.hasNext()) {
|
293 |
0
| res = res + iter.next().toString() + "\n";
|
294 |
| } |
295 |
| } |
296 |
0
| if (enterpriseConfig != null) {
|
297 |
0
| iter = enterpriseConfig.values().iterator();
|
298 |
0
| while (iter.hasNext()) {
|
299 |
0
| res = res + iter.next().toString();
|
300 |
| } |
301 |
| } |
302 |
0
| if (jmsConfig != null) {
|
303 |
0
| iter = jmsConfig.values().iterator();
|
304 |
0
| while (iter.hasNext()) {
|
305 |
0
| res = res + iter.next().toString();
|
306 |
| } |
307 |
| } |
308 |
0
| logger.debug(res);
|
309 |
0
| return res;
|
310 |
| } |
311 |
| |
312 |
| private Factories factories; |
313 |
| private Nodes nodes; |
314 |
| private Vector<RunnerConfig> runners; |
315 |
| |
316 |
| private int epochs = 1; |
317 |
| private String enterprise; |
318 |
| private String jms; |
319 |
| private String webservice; |
320 |
| private String binding; |
321 |
| private HashMap<String,EnterpriseConfig> enterpriseConfig; |
322 |
| private HashMap<String,JMSConfig> jmsConfig; |
323 |
| private Bindings bindings; |
324 |
| private HashMap<String,WebServiceConfig> wsConfig; |
325 |
| private static Logger logger = Logger.getLogger(TestConfig.class); |
326 |
| } |