1   /*
2    * $Id: TestBean.java,v 1.8 2004/06/03 19:58:07 eelco12 Exp $
3    * $Revision: 1.8 $
4    * $Date: 2004/06/03 19:58:07 $
5    *
6    * ====================================================================
7    * Copyright (c) 2003, Open Edge B.V.
8    * All rights reserved.
9    * Redistribution and use in source and binary forms, with or without 
10   * modification, are permitted provided that the following conditions are met:
11   * Redistributions of source code must retain the above copyright notice, 
12   * this list of conditions and the following disclaimer. Redistributions 
13   * in binary form must reproduce the above copyright notice, this list of 
14   * conditions and the following disclaimer in the documentation and/or other 
15   * materials provided with the distribution. Neither the name of OpenEdge B.V. 
16   * nor the names of its contributors may be used to endorse or promote products 
17   * derived from this software without specific prior written permission.
18   * 
19   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
20   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
21   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
22   * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
23   * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
24   * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
25   * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
26   * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
27   * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
28   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 
29   * THE POSSIBILITY OF SUCH DAMAGE.
30   */
31  package nl.openedge.baritus.test;
32  
33  import java.util.ArrayList;
34  import java.util.Date;
35  import java.util.HashMap;
36  import java.util.List;
37  import java.util.Map;
38  
39  /***
40   * Test bean.
41   * 
42   * @author Eelco Hillenius
43   * @author Sander Hofstee
44   */
45  public class TestBean
46  {
47  	private String testTrimString;
48  	private String[] testTrimStringArray = new String[] { "" };
49  	
50  	private Integer testInteger1;
51  	private Integer testInteger2;
52  	
53  	private Long testLong1;
54  	private Long testLong2;
55  	
56  	private Double testDouble1;
57  	private Double testDouble2;
58  	
59  	private Date testDate1;
60  	private Date testDate2;
61  	
62  	private String[] testStringArray1 = null;
63  	
64  	private String[] testStringArray2 = new String[] 
65  	{
66  		"existing0", "existing1"	
67  	};
68  	
69  	private Integer[] testIntegerArray1 = new Integer[]
70  	{
71  	  new Integer(-1), new Integer(-1)
72  	};
73  	
74  	private Map testMap = new HashMap();
75  	
76  	// custom population tests
77  	private String uppercaseTest = null;
78  	private String ignore = "unchanged";
79  	private String ignoreByRegex = "unchanged (regex)";
80  	
81  	private String toValidate1;
82  	private String[] toValidate2 = new String[] 
83  	{
84  		"", ""
85  	};
86  	private String[] toValidate3 = new String[] 
87  	{
88  		"", ""
89  	};
90  	private String toValidate4 = "validValue";
91  	
92  	private List listProperty = new ArrayList();
93  	
94  	private List multiDimensionalList = new ArrayList();
95  	
96  	private Map multiDimensionalMap = new HashMap();
97  	
98  	private TestObject testObject = null;
99  
100 
101 	/***
102 	 * construct
103 	 */
104 	public TestBean()
105 	{
106 		multiDimensionalMap.put("one", new HashMap());
107 		multiDimensionalMap.put("two", new HashMap());
108 		
109 		List lOne0 = new ArrayList();
110 		List lOne1 = new ArrayList();
111 		List lOne2 = new ArrayList();
112 		List lOne = new ArrayList();
113 		lOne.add(lOne0);
114 		lOne.add(lOne1);
115 		lOne.add(lOne2);
116 		multiDimensionalList.add(lOne);
117 		
118 		List lTwo0 = new ArrayList();
119 		List lTwo = new ArrayList();
120 		lTwo.add(lTwo);
121 		multiDimensionalList.add(lTwo);
122 	}
123 
124 
125 	/***
126 	 * @return
127 	 */
128 	public Integer getTestInteger1()
129 	{
130 		return testInteger1;
131 	}
132 
133 	/***
134 	 * @param integer
135 	 */
136 	public void setTestInteger1(Integer integer)
137 	{
138 		testInteger1 = integer;
139 	}
140 
141 	/***
142 	 * @return
143 	 */
144 	public Integer getTestInteger2()
145 	{
146 		return testInteger2;
147 	}
148 
149 	/***
150 	 * @param integer
151 	 */
152 	public void setTestInteger2(Integer integer)
153 	{
154 		testInteger2 = integer;
155 	}
156 
157 	/***
158 	 * @return
159 	 */
160 	public Date getTestDate1()
161 	{
162 		return testDate1;
163 	}
164 
165 	/***
166 	 * @return
167 	 */
168 	public Date getTestDate2()
169 	{
170 		return testDate2;
171 	}
172 
173 	/***
174 	 * @return
175 	 */
176 	public Double getTestDouble1()
177 	{
178 		return testDouble1;
179 	}
180 
181 	/***
182 	 * @return
183 	 */
184 	public Double getTestDouble2()
185 	{
186 		return testDouble2;
187 	}
188 
189 	/***
190 	 * @return
191 	 */
192 	public Long getTestLong1()
193 	{
194 		return testLong1;
195 	}
196 
197 	/***
198 	 * @return
199 	 */
200 	public Long getTestLong2()
201 	{
202 		return testLong2;
203 	}
204 
205 	/***
206 	 * @param date
207 	 */
208 	public void setTestDate1(Date date)
209 	{
210 		testDate1 = date;
211 	}
212 
213 	/***
214 	 * @param date
215 	 */
216 	public void setTestDate2(Date date)
217 	{
218 		testDate2 = date;
219 	}
220 
221 	/***
222 	 * @param double1
223 	 */
224 	public void setTestDouble1(Double double1)
225 	{
226 		testDouble1 = double1;
227 	}
228 
229 	/***
230 	 * @param double1
231 	 */
232 	public void setTestDouble2(Double double1)
233 	{
234 		testDouble2 = double1;
235 	}
236 
237 	/***
238 	 * @param long1
239 	 */
240 	public void setTestLong1(Long long1)
241 	{
242 		testLong1 = long1;
243 	}
244 
245 	/***
246 	 * @param long1
247 	 */
248 	public void setTestLong2(Long long1)
249 	{
250 		testLong2 = long1;
251 	}
252 
253 	/***
254 	 * @return
255 	 */
256 	public String[] getTestStringArray1()
257 	{
258 		return testStringArray1;
259 	}
260 
261 	/***
262 	 * @param strings
263 	 */
264 	public void setTestStringArray1(String[] strings)
265 	{
266 		testStringArray1 = strings;
267 	}
268 
269 	/***
270 	 * @return
271 	 */
272 	public String[] getTestStringArray2()
273 	{
274 		return testStringArray2;
275 	}
276 
277 	/***
278 	 * @param strings
279 	 */
280 	public void setTestStringArray2(String[] strings)
281 	{
282 		testStringArray2 = strings;
283 	}
284 
285 	/***
286 	 * @return
287 	 */
288 	public Map getTestMap()
289 	{
290 		return testMap;
291 	}
292 
293 	/***
294 	 * @param map
295 	 */
296 	public void setTestMap(Map map)
297 	{
298 		testMap = map;
299 	}
300 
301 	/***
302 	 * @return
303 	 */
304 	public String getUppercaseTest()
305 	{
306 		return uppercaseTest;
307 	}
308 
309 	/***
310 	 * @param string
311 	 */
312 	public void setUppercaseTest(String string)
313 	{
314 		uppercaseTest = string;
315 	}
316 
317 	/***
318 	 * @return
319 	 */
320 	public String getIgnore()
321 	{
322 		return ignore;
323 	}
324 
325 	/***
326 	 * @param string
327 	 */
328 	public void setIgnore(String string)
329 	{
330 		ignore = string;
331 	}
332 
333 	/***
334 	 * @return
335 	 */
336 	public String getIgnoreByRegex()
337 	{
338 		return ignoreByRegex;
339 	}
340 
341 	/***
342 	 * @param string
343 	 */
344 	public void setIgnoreByRegex(String string)
345 	{
346 		ignoreByRegex = string;
347 	}
348 
349 	/***
350 	 * @return String
351 	 */
352 	public String getToValidate1()
353 	{
354 		return toValidate1;
355 	}
356 
357 	/***
358 	 * @param string
359 	 */
360 	public void setToValidate1(String string)
361 	{
362 		toValidate1 = string;
363 	}
364 
365 	/***
366 	 * @return
367 	 */
368 	public String[] getToValidate2()
369 	{
370 		return toValidate2;
371 	}
372 
373 	/***
374 	 * @param strings
375 	 */
376 	public void setToValidate2(String[] strings)
377 	{
378 		toValidate2 = strings;
379 	}
380 
381 	/***
382 	 * @return
383 	 */
384 	public String[] getToValidate3()
385 	{
386 		return toValidate3;
387 	}
388 
389 	/***
390 	 * @param strings
391 	 */
392 	public void setToValidate3(String[] strings)
393 	{
394 		toValidate3 = strings;
395 	}
396 	
397 	/***
398 	 * @return Returns the listProperty.
399 	 */
400 	public java.util.List getListProperty()
401 	{
402 		return listProperty;
403 	}
404 	/***
405 	 * @param listProperty The listProperty to set.
406 	 */
407 	public void setListProperty(java.util.List listProperty)
408 	{
409 		this.listProperty = listProperty;
410 	}
411 	
412 	public void setListProperty(int index, Object element)
413 	{
414 		listProperty.add(index, element);
415 	}
416 	
417 	public Object getListProperty(int index)
418 	{
419 		return listProperty.get(index);
420 	}
421 	/***
422 	 * @return
423 	 */
424 	public List getMultiDimensionalList()
425 	{
426 		return multiDimensionalList;
427 	}
428 
429 	/***
430 	 * @param list
431 	 */
432 	public void setMultiDimensionalList(List list)
433 	{
434 		multiDimensionalList = list;
435 	}
436 
437 	/***
438 	 * @return
439 	 */
440 	public Map getMultiDimensionalMap()
441 	{
442 		return multiDimensionalMap;
443 	}
444 
445 	/***
446 	 * @param map
447 	 */
448 	public void setMultiDimensionalMap(Map map)
449 	{
450 		multiDimensionalMap = map;
451 	}
452 
453 	/***
454 	 * @return
455 	 */
456 	public TestObject getTestObject()
457 	{
458 		return testObject;
459 	}
460 
461 	/***
462 	 * @param object
463 	 */
464 	public void setTestObject(TestObject object)
465 	{
466 		testObject = object;
467 	}
468 
469 	/***
470 	 * @return
471 	 */
472 	public String getToValidate4()
473 	{
474 		return toValidate4;
475 	}
476 
477 	/***
478 	 * @param string
479 	 */
480 	public void setToValidate4(String string)
481 	{
482 		toValidate4 = string;
483 	}
484 
485 	/***
486 	 * @return
487 	 */
488 	public String getTestTrimString()
489 	{
490 		return testTrimString;
491 	}
492 
493 	/***
494 	 * @param string
495 	 */
496 	public void setTestTrimString(String string)
497 	{
498 		testTrimString = string;
499 	}
500 
501 	/***
502 	 * @return
503 	 */
504 	public String[] getTestTrimStringArray()
505 	{
506 		return testTrimStringArray;
507 	}
508 
509 	/***
510 	 * @param strings
511 	 */
512 	public void setTestTrimStringArray(String[] strings)
513 	{
514 		testTrimStringArray = strings;
515 	}
516 
517     /***
518      * Get testIntegerArray1.
519      * @return Integer[] Returns the testIntegerArray1.
520      */
521     public Integer[] getTestIntegerArray1()
522     {
523         return testIntegerArray1;
524     }
525     /***
526      * Set testIntegerArray1.
527      * @param testIntegerArray1 testIntegerArray1 to set.
528      */
529     public void setTestIntegerArray1(Integer[] testIntegerArray1)
530     {
531         this.testIntegerArray1 = testIntegerArray1;
532     }
533 }