use of org.apache.cxf.tools.wsdlto.WSDLToJava in project cxf by apache.
the class CodeGenBugTest method testCXF3105.
@Test
public void testCXF3105() throws Exception {
String[] args = new String[] { "-d", output.getCanonicalPath(), "-impl", "-server", "-client", "-b", getLocation("/wsdl2java_wsdl/cxf3105/ws-binding.xml"), getLocation("/wsdl2java_wsdl/cxf3105/cxf3105.wsdl") };
CommandInterfaceUtils.commandCommonMain();
WSDLToJava w2j = new WSDLToJava(args);
w2j.run(new ToolContext());
assertNotNull(output);
File f = new File(output, "org/apache/cxf/testcase/cxf3105/Login.java");
assertTrue(f.exists());
String contents = IOUtils.readStringFromStream(new FileInputStream(f));
assertTrue(contents.contains("Loginrequesttype loginRequest"));
assertTrue(contents.contains("<Loginresponsetype> loginResponse"));
}
use of org.apache.cxf.tools.wsdlto.WSDLToJava in project cxf by apache.
the class CodeGenBugTest method testCommandLine.
@Test
public void testCommandLine() throws Exception {
String[] args = new String[] { "-compile", "-d", output.getCanonicalPath(), "-classdir", output.getCanonicalPath() + "/classes", "-p", "org.cxf", "-p", "http://apache.org/hello_world_soap_http/types=org.apache.types", "-server", "-impl", getLocation("/wsdl2java_wsdl/hello_world.wsdl") };
CommandInterfaceUtils.commandCommonMain();
WSDLToJava w2j = new WSDLToJava(args);
w2j.run(new ToolContext());
Class<?> clz = classLoader.loadClass("org.cxf.Greeter");
assertTrue("Generate " + clz.getName() + "error", clz.isInterface());
}
use of org.apache.cxf.tools.wsdlto.WSDLToJava in project cxf by apache.
the class CodeGenBugTest method testCXF1662.
@Test
public void testCXF1662() throws Exception {
String[] args = new String[] { "-d", output.getCanonicalPath(), "-p", "org.cxf", getLocation("/wsdl2java_wsdl/cxf1662/test.wsdl") };
try {
CommandInterfaceUtils.commandCommonMain();
WSDLToJava w2j = new WSDLToJava(args);
w2j.run(new ToolContext());
} catch (ToolException tex) {
assertTrue(tex.getMessage().contains(" -p option cannot be used when " + "wsdl contains mutiple schemas"));
}
String[] args2 = new String[] { "-d", output.getCanonicalPath(), "-p", "org.cxf", getLocation("/wsdl2java_wsdl/cxf1662/test2.wsdl") };
try {
CommandInterfaceUtils.commandCommonMain();
WSDLToJava w2j = new WSDLToJava(args2);
w2j.run(new ToolContext());
} catch (ToolException tex) {
assertNull(tex);
}
assertNotNull(output);
File file = new File(output, "org/cxf/package-info.java");
assertTrue(file.exists());
String str = TestFileUtils.getStringFromFile(file);
assertTrue(str.contains("http://child/xsd"));
}
use of org.apache.cxf.tools.wsdlto.WSDLToJava in project cxf by apache.
the class CodeGenBugTest method testDefaultLoadNSMappingOFF.
@Test
public void testDefaultLoadNSMappingOFF() throws Exception {
String[] args = new String[] { "-dns", "false", "-d", output.getCanonicalPath(), "-noAddressBinding", getLocation("/wsdl2java_wsdl/basic_callback.wsdl") };
CommandInterfaceUtils.commandCommonMain();
WSDLToJava w2j = new WSDLToJava(args);
w2j.run(new ToolContext());
assertNotNull(output);
File org = new File(output, "org");
assertTrue(org.exists());
File w3 = new File(org, "w3");
assertTrue(w3.exists());
File p2005 = new File(w3, "_2005");
assertTrue(p2005.exists());
File p08 = new File(p2005, "_08");
assertTrue(p08.exists());
File address = new File(p08, "addressing");
assertTrue(address.exists());
File[] files = address.listFiles();
assertEquals(11, files.length);
}
use of org.apache.cxf.tools.wsdlto.WSDLToJava in project cxf by apache.
the class CodeGenBugTest method testExcludeNSWithPackageName.
@Test
public void testExcludeNSWithPackageName() throws Exception {
String[] args = new String[] { "-d", output.getCanonicalPath(), "-nexclude", "http://apache.org/test/types=com.iona", "-nexclude", "http://apache.org/Invoice", "-compile", "-classdir", output.getCanonicalPath() + "/classes", getLocation("/wsdl2java_wsdl/hello_world_exclude.wsdl") };
CommandInterfaceUtils.commandCommonMain();
WSDLToJava w2j = new WSDLToJava(args);
w2j.run(new ToolContext());
assertNotNull(output);
File com = new File(output, "com");
assertFalse("Generated file has been excluded", com.exists());
File iona = new File(com, "iona");
assertFalse("Generated file has been excluded", iona.exists());
File implFile = new File(output, "org/apache/cxf/w2j/hello_world_soap_http/Greeter.java");
String str = TestFileUtils.getStringFromFile(implFile);
assertTrue(str.contains("com.iona.BareDocumentResponse"));
File org = new File(output, "org");
File apache = new File(org, "apache");
File invoice = new File(apache, "Invoice");
assertFalse("Generated file has been excluded", invoice.exists());
}
Aggregations