01: package hero.client.test;
02:
03: import junit.framework.*;
04:
05: import hero.interfaces.ProjectSession;
06: import hero.interfaces.ProjectSessionHome;
07: import hero.interfaces.ProjectSessionUtil;
08: import hero.interfaces.Constants;
09: import hero.hook.Hook;
10:
11: public class Clone extends TestCase {
12: private ProjectSessionHome projectSessionh;
13:
14: public Clone(String testname) {
15: super (testname);
16: }
17:
18: public static TestSuite suite() {
19:
20: return new TestSuite(DbInit.class);
21: }
22:
23: public void setUp() throws Exception {
24: }
25:
26: public void testClone() throws Exception {
27: ProjectSessionHome lHome = ProjectSessionUtil.getHome();
28: ProjectSession lProject = lHome.create();
29: lProject.initProject("stressClone");
30: lProject.addNode("node1", Constants.Nd.AND_JOIN_NODE);
31: lProject.addNode("node2", Constants.Nd.AND_JOIN_NODE);
32: lProject.addNode("node3", Constants.Nd.AND_JOIN_NODE);
33: lProject.addNode("node4", Constants.Nd.AND_JOIN_NODE);
34: lProject.addNode("node5", Constants.Nd.AND_JOIN_NODE);
35: lProject.addEdge("node1", "node2");
36: lProject.addEdge("node1", "node3");
37: lProject.addEdge("node2", "node4");
38: lProject.addEdge("node3", "node4");
39: lProject.addEdge("node4", "node5");
40: lProject.setNodeRole("node1", "admin");
41: lProject.setNodeRole("node4", "admin");
42: lProject.setNodeRole("node5", "admin");
43: String script = "import hero.interfaces.BnProjectLocal;\n"
44: + "import hero.interfaces.BnNodeLocal;\n"
45: + "afterStart (Object b,Object n) {\n\n\n"
46: + "System.out.println(\"InteractiveBnNodee Hook test, node: \"+n.getName());"
47: + "}";
48: lProject.addNodeInterHook("node1", "interTest",
49: hero.interfaces.Constants.Nd.AFTERSTART,
50: Constants.Hook.BSINTERACTIVE, script);
51: lProject.addNodeInterHook("node4", "interTest",
52: hero.interfaces.Constants.Nd.AFTERSTART,
53: Constants.Hook.BSINTERACTIVE, script);
54: int i = 0;
55: for (i = 0; i < 100; i++) {
56: lProject.initProject("stressClone", "stressClone" + i);
57: }
58: }
59: }
|