1 package org.objectweb.celtix.routing; 2 3 import java.io.File ; 4 import java.util.List ; 5 6 import javax.xml.namespace.QName ; 7 import org.objectweb.celtix.routing.configuration.DestinationType; 8 import org.objectweb.celtix.routing.configuration.RouteType; 9 import org.objectweb.celtix.routing.configuration.SourceType; 10 import org.objectweb.celtix.testutil.common.TestUtil; 11 import org.objectweb.celtix.tools.WSDLToJava; 12 import org.objectweb.celtix.tools.common.ToolConstants; 13 import org.objectweb.celtix.tools.common.toolspec.ToolRunner; 14 15 public final class RouteTypeUtil { 16 private RouteTypeUtil() { 17 } 19 20 public static RouteType createRouteType(String routeName, 21 QName srcService, String srcPort, 22 QName destService, String destPort) { 23 SourceType st = new SourceType(); 24 st.setService(srcService); 25 st.setPort(srcPort); 26 27 DestinationType dt = new DestinationType(); 28 dt.setPort(destPort); 29 dt.setService(destService); 30 31 RouteType rt = new RouteType(); 32 rt.setName(routeName); 33 34 List <SourceType> sList = rt.getSource(); 35 sList.add(st); 36 List <DestinationType> dList = rt.getDestination(); 37 dList.add(dt); 38 39 return rt; 40 } 41 42 public static void invokeWSDLToJava(String wsdlUrl, File srcDir, File classDir) throws Exception { 45 String [] args = new String []{"-compile", 46 "-d", srcDir.getCanonicalPath(), 47 "-classdir", classDir.getCanonicalPath(), 48 wsdlUrl}; 49 50 ToolRunner.runTool(WSDLToJava.class, 51 WSDLToJava.class.getResourceAsStream(ToolConstants.TOOLSPECS_BASE 52 + "wsdl2java.xml"), 53 false, 54 args); 55 } 56 57 public static boolean deleteDir(File dir) { 58 return TestUtil.deleteDir(dir); 59 } 60 61 public static String getClassPath(ClassLoader loader) { 62 return TestUtil.getClassPath(loader); 63 } 64 } 65 | Popular Tags |