Source code: com/arranger/jarl/test/ConfigCreatorTest.java
1 package com.arranger.jarl.test;
2
3 import junit.framework.TestCase;
4 import com.arranger.jarl.util.RandomUtil;
5
6 import java.io.FileWriter;
7
8 /**
9 * ConfigCreatorTest created on Feb 22, 2003
10 */
11 public class ConfigCreatorTest extends TestCase {
12
13 protected static final int NUM_WIDGETS = 100;
14 protected static final int START = 0;
15 protected static final int END = 1000;
16
17 public void createConfig() throws Exception {
18
19 StringBuffer buffer = new StringBuffer(0x1000);
20 for (int index = 0; index < NUM_WIDGETS; index++) {
21 buffer.append("<widget widgetDef=\"");
22 if (RandomUtil.inRange(.5)) {
23 buffer.append("circle");
24 } else {
25 buffer.append("circle2");
26 }
27 buffer.append("\" startTime=\"");
28 int start = RandomUtil.getRandom(END);
29 buffer.append(start);
30 buffer.append("\" endTime=\"");
31 int end = RandomUtil.getRandomRange(start, start + 200);
32 if (end == start) {
33 end += 10;
34 }
35 buffer.append(end);
36 buffer.append("\" />").append("\r\n");
37 }
38
39 FileWriter fileWriter = new FileWriter("out.xml");
40 fileWriter.write(buffer.toString());
41 fileWriter.close();
42 }
43
44 }