1 24 25 package org.objectweb.cjdbc.scenario.basic; 26 27 import org.objectweb.cjdbc.controller.core.Controller; 28 import org.objectweb.cjdbc.controller.virtualdatabase.VirtualDatabase; 29 import org.objectweb.cjdbc.scenario.templates.Template; 30 import org.objectweb.cjdbc.scenario.tools.components.backend.DatabaseManager; 31 import org.objectweb.cjdbc.scenario.tools.components.controller.ControllerManager; 32 33 39 public class StartStopControllerScenario extends Template 40 { 41 42 45 protected void setUp() 46 { 47 48 } 49 50 53 protected void tearDown() 54 { 55 56 } 57 58 61 public void testStartStopWithBackends() 62 { 63 ControllerManager cm = new ControllerManager(); 64 DatabaseManager hm = new DatabaseManager(); 65 Controller controller = null; 66 try 67 { 68 hm.start("9001"); 69 hm.loaddatabase("9001"); 70 hm.start("9002"); 71 hm.loaddatabase("9002"); 72 controller = (Controller) (cm.start("25322").getProcess()); 73 cm.loaddatabase("25322", "hsqldb-raidb1.xml"); 74 VirtualDatabase vdb = controller.getVirtualDatabase("myDB"); 75 vdb.enableAllBackends(); 76 } 77 catch (Exception e) 78 { 79 System.out.println(e.getMessage()); 80 e.printStackTrace(); 81 fail("Could not start controller"); 82 } 83 finally 84 { 85 cm.stopAll(); 86 hm.stopAll(); 87 } 88 } 89 } 90 | Popular Tags |