| 1 package org.objectweb.celtix.systest.routing; 2 import java.io.File ; 3 import java.net.URL ; 4 5 import javax.xml.ws.WebServiceException; 6 7 import org.objectweb.celtix.Bus; 8 import org.objectweb.celtix.BusException; 9 import org.objectweb.celtix.routing.RouterManager; 10 import org.objectweb.celtix.systest.common.TestServerBase; 11 import org.objectweb.celtix.testutil.common.TestUtil; 12 13 public class RouterServer extends TestServerBase { 14 private static final String CELTIX_ROUTER_TMP = new String ("/celtix-router-tmp"); 15 private Bus bus; 16 17 public RouterServer(String [] args) { 18 URL routerConfigFileUrl = RouterServer.class.getResource("router_config.xml"); 19 System.setProperty("celtix.config.file", routerConfigFileUrl.toString()); 20 try { 21 bus = Bus.init(args); 22 } catch (BusException be) { 23 throw new WebServiceException("Could not initialize bus", be); 24 } 25 } 26 27 protected void run() { 28 RouterManager rm = new RouterManager(bus); 29 rm.init(); 30 } 31 32 private void cleanup() { 33 TestUtil.deleteDir(new File (System.getProperty("user.dir"), 34 CELTIX_ROUTER_TMP)); 35 } 36 37 public boolean stopInProcess() throws Exception { 38 System.clearProperty("celtix.config.file"); 39 tearDown(); 40 return super.stopInProcess(); 41 } 42 43 public void tearDown() throws Exception { 45 cleanup(); 46 super.tearDown(); 47 } 48 } 49 | Popular Tags |