use of org.apache.cxf.tools.wsdlto.frontend.jaxws.JAXWSContainer in project cxf by apache.
the class ValidatorTest method testXMLFormat.
@Test
public void testXMLFormat() throws Exception {
processor = new JAXWSContainer(null);
env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl2java_wsdl/xml_format_root.wsdl"));
processor.setContext(env);
try {
processor.execute();
fail("xml_format_root.wsdl is not a valid wsdl, should throws exception here");
} catch (Exception e) {
String expected = "Binding(Greeter_XMLBinding):BindingOperation" + "({http://apache.org/xml_http_bare}sayHi)-input: empty value of rootNode attribute, " + "the value should be {http://apache.org/xml_http_bare}sayHi";
assertEquals(expected, e.getMessage().trim());
}
}
use of org.apache.cxf.tools.wsdlto.frontend.jaxws.JAXWSContainer in project cxf by apache.
the class JavaToJSProcessorTest method testDocLitUseClassPathFlag.
@Test
public void testDocLitUseClassPathFlag() throws Exception {
File classFile = new java.io.File(output.getCanonicalPath() + "/classes");
classFile.mkdir();
System.setProperty("java.class.path", getClassPath() + classFile.getCanonicalPath() + File.separatorChar);
env.put(ToolConstants.CFG_COMPILE, ToolConstants.CFG_COMPILE);
env.put(ToolConstants.CFG_CLASSDIR, output.getCanonicalPath() + "/classes");
env.put(FrontEndProfile.class, PluginLoader.getInstance().getFrontEndProfile("jaxws"));
env.put(DataBindingProfile.class, PluginLoader.getInstance().getDataBindingProfile("jaxb"));
env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
env.put(ToolConstants.CFG_PACKAGENAME, "org.apache.cxf.classpath");
env.put(ToolConstants.CFG_CLASSDIR, output.getCanonicalPath() + "/classes");
env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl/hello_world_doc_lit.wsdl"));
JAXWSContainer w2jProcessor = new JAXWSContainer(null);
w2jProcessor.setContext(env);
w2jProcessor.execute();
System.setProperty("java.class.path", "");
// test flag
String[] args = new String[] { "-o", "java2wsdl.js", "-jsutils", "-cp", classFile.getCanonicalPath(), "-d", output.getPath(), "org.apache.cxf.classpath.Greeter" };
JavaToJS.main(args);
File jsFile = new File(output, "java2wsdl.js");
assertTrue("Generate JS Fail", jsFile.exists());
}
use of org.apache.cxf.tools.wsdlto.frontend.jaxws.JAXWSContainer in project cxf by apache.
the class JavaToProcessorTest method testDocLitUseClassPathFlag.
@Test
public void testDocLitUseClassPathFlag() throws Exception {
File classFile = new java.io.File(output.getCanonicalPath() + "/classes");
classFile.mkdir();
System.setProperty("java.class.path", getClassPath() + classFile.getCanonicalPath() + File.separatorChar);
env.put(ToolConstants.CFG_COMPILE, ToolConstants.CFG_COMPILE);
env.put(ToolConstants.CFG_CLASSDIR, output.getCanonicalPath() + "/classes");
env.put(FrontEndProfile.class, PluginLoader.getInstance().getFrontEndProfile("jaxws"));
env.put(DataBindingProfile.class, PluginLoader.getInstance().getDataBindingProfile("jaxb"));
env.put(ToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
env.put(ToolConstants.CFG_PACKAGENAME, "org.apache.cxf.classpath");
env.put(ToolConstants.CFG_CLASSDIR, output.getCanonicalPath() + "/classes");
env.put(ToolConstants.CFG_WSDLURL, getLocation("/wsdl/hello_world_doc_lit.wsdl"));
JAXWSContainer w2jProcessor = new JAXWSContainer(null);
w2jProcessor.setContext(env);
w2jProcessor.execute();
String tns = "http://apache.org/sepecifiedTns";
String serviceName = "cxfService";
String portName = "cxfPort";
System.setProperty("java.class.path", "");
// test flag
String[] args = new String[] { "-o", "java2wsdl.wsdl", "-cp", classFile.getCanonicalPath(), "-t", tns, "-servicename", serviceName, "-portname", portName, "-soap12", "-d", output.getPath(), "-wsdl", "org.apache.cxf.classpath.Greeter" };
JavaToWS.main(args);
File wsdlFile = new File(output, "java2wsdl.wsdl");
assertTrue("Generate Wsdl Fail", wsdlFile.exists());
Definition def = wsdlHelper.getDefinition(wsdlFile);
Service wsdlService = def.getService(new QName(tns, serviceName));
assertNotNull("Generate WSDL Service Error", wsdlService);
Port wsdlPort = wsdlService.getPort(portName);
assertNotNull("Generate service port error ", wsdlPort);
}
Aggregations