1 package hero.client.test; 2 3 import junit.framework.*; 4 5 import hero.interfaces.ProjectSession; 6 import hero.interfaces.ProjectSessionHome; 7 import hero.interfaces.ProjectSessionUtil; 8 import hero.interfaces.Constants; 9 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 = 44 "import hero.interfaces.BnProjectLocal;\n" 45 + "import hero.interfaces.BnNodeLocal;\n" 46 + "afterStart (Object b,Object n) {\n\n\n" 47 + "System.out.println(\"InteractiveBnNodee Hook test, node: \"+n.getName());" 48 + "}"; 49 lProject.addNodeInterHook("node1","interTest",hero.interfaces.Constants.Nd.AFTERSTART,Constants.Hook.BSINTERACTIVE,script); 50 lProject.addNodeInterHook("node4","interTest",hero.interfaces.Constants.Nd.AFTERSTART,Constants.Hook.BSINTERACTIVE,script); 51 int i=0; 52 for (i=0;i<100;i++){ 53 lProject.initProject("stressClone","stressClone"+i); 54 } 55 } 56 } 57 | Popular Tags |