Search in sources :

Example 6 with WSDLToJava

use of org.apache.cxf.tools.wsdlto.WSDLToJava in project cxf by apache.

the class CodeGenBugTest method testCXF1939.

@Test
public void testCXF1939() throws Exception {
    String[] args = new String[] { "-d", output.getCanonicalPath(), "-impl", "-server", "-client", "-autoNameResolution", getLocation("/wsdl2java_wsdl/cxf1939/hello_world.wsdl") };
    CommandInterfaceUtils.commandCommonMain();
    WSDLToJava w2j = new WSDLToJava(args);
    w2j.run(new ToolContext());
    assertNotNull(output);
    assertTrue(new File(output, "org/apache/cxf/w2j/hello_world_soap_http/Soap_PortImpl.java").exists());
    assertTrue(new File(output, "org/apache/cxf/w2j/hello_world_soap_http/SoapPortImpl.java").exists());
    assertTrue(new File(output, "org/apache/cxf/w2j/hello_world_soap_http/TestServiceName.java").exists());
    assertTrue(new File(output, "org/apache/cxf/w2j/hello_world_soap_http/TestServiceName1.java").exists());
}
Also used : WSDLToJava(org.apache.cxf.tools.wsdlto.WSDLToJava) ToolContext(org.apache.cxf.tools.common.ToolContext) File(java.io.File) AbstractCodeGenTest(org.apache.cxf.tools.wsdlto.AbstractCodeGenTest) Test(org.junit.Test)

Example 7 with WSDLToJava

use of org.apache.cxf.tools.wsdlto.WSDLToJava in project cxf by apache.

the class CodeGenBugTest method testDefaultNSWithPkg.

@Test
public void testDefaultNSWithPkg() throws Exception {
    String[] args = new String[] { "-d", output.getCanonicalPath(), "-p", "org.cxf", "-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 apache = new File(org, "apache");
    assertTrue(apache.exists());
    File cxf = new File(apache, "cxf");
    assertTrue(cxf.exists());
    File ws = new File(cxf, "ws");
    assertTrue(ws.exists());
    File address = new File(ws, "addressing");
    assertTrue(address.exists());
    File[] files = address.listFiles();
    assertEquals(11, files.length);
    cxf = new File(output, "org/cxf");
    assertTrue(cxf.exists());
    files = cxf.listFiles();
    assertEquals(5, files.length);
}
Also used : WSDLToJava(org.apache.cxf.tools.wsdlto.WSDLToJava) ToolContext(org.apache.cxf.tools.common.ToolContext) File(java.io.File) AbstractCodeGenTest(org.apache.cxf.tools.wsdlto.AbstractCodeGenTest) Test(org.junit.Test)

Example 8 with WSDLToJava

use of org.apache.cxf.tools.wsdlto.WSDLToJava in project cxf by apache.

the class CodeGenBugTest method testDefaultLoadNSMappingON.

@Test
public void testDefaultLoadNSMappingON() throws Exception {
    String[] args = new String[] { "-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 apache = new File(org, "apache");
    assertTrue(apache.exists());
    File cxf = new File(apache, "cxf");
    assertTrue(cxf.exists());
    File ws = new File(cxf, "ws");
    assertTrue(ws.exists());
    File address = new File(ws, "addressing");
    assertTrue(address.exists());
    File[] files = address.listFiles();
    assertEquals(11, files.length);
}
Also used : WSDLToJava(org.apache.cxf.tools.wsdlto.WSDLToJava) ToolContext(org.apache.cxf.tools.common.ToolContext) File(java.io.File) AbstractCodeGenTest(org.apache.cxf.tools.wsdlto.AbstractCodeGenTest) Test(org.junit.Test)

Example 9 with WSDLToJava

use of org.apache.cxf.tools.wsdlto.WSDLToJava in project cxf by apache.

the class CodeGenBugTest method testOverloadWithAction.

@Test
public void testOverloadWithAction() throws Exception {
    String[] args = new String[] { "-d", output.getCanonicalPath(), getLocation("/wsdl2java_wsdl/hello_world_overload.wsdl") };
    CommandInterfaceUtils.commandCommonMain();
    WSDLToJava w2j = new WSDLToJava(args);
    w2j.run(new ToolContext());
    assertNotNull(output);
    File f = new File(output, "org/apache/cxf/w2j/hello_world_soap_http/SayHi.java");
    assertTrue(f.exists());
}
Also used : WSDLToJava(org.apache.cxf.tools.wsdlto.WSDLToJava) ToolContext(org.apache.cxf.tools.common.ToolContext) File(java.io.File) AbstractCodeGenTest(org.apache.cxf.tools.wsdlto.AbstractCodeGenTest) Test(org.junit.Test)

Example 10 with WSDLToJava

use of org.apache.cxf.tools.wsdlto.WSDLToJava in project cxf by apache.

the class CodeGenBugTest method testCXF677.

@Test
public void testCXF677() throws Exception {
    String[] args = new String[] { "-d", output.getCanonicalPath(), "-b", getLocation("/wsdl2java_wsdl/hello-mime-binding.xml"), getLocation("/wsdl2java_wsdl/hello-mime.wsdl") };
    CommandInterfaceUtils.commandCommonMain();
    WSDLToJava w2j = new WSDLToJava(args);
    w2j.run(new ToolContext());
    String str1 = "SOAPBinding.ParameterStyle.BARE";
    String str2 = "javax.xml.ws.Holder";
    String str3 = "org.apache.cxf.mime.Address";
    String str4 = "http://cxf.apache.org/w2j/hello_world_mime/types";
    String file = TestFileUtils.getStringFromFile(new File(output.getCanonicalPath() + "/org/apache/cxf/w2j/hello_world_mime/Hello.java"));
    assertTrue(file.contains(str1));
    assertTrue(file.contains(str2));
    assertTrue(file.contains(str3));
    assertTrue(file.contains(str4));
}
Also used : WSDLToJava(org.apache.cxf.tools.wsdlto.WSDLToJava) ToolContext(org.apache.cxf.tools.common.ToolContext) File(java.io.File) AbstractCodeGenTest(org.apache.cxf.tools.wsdlto.AbstractCodeGenTest) Test(org.junit.Test)

Aggregations

ToolContext (org.apache.cxf.tools.common.ToolContext)17 WSDLToJava (org.apache.cxf.tools.wsdlto.WSDLToJava)17 File (java.io.File)14 AbstractCodeGenTest (org.apache.cxf.tools.wsdlto.AbstractCodeGenTest)14 Test (org.junit.Test)14 ToolException (org.apache.cxf.tools.common.ToolException)3 FileInputStream (java.io.FileInputStream)2 IOException (java.io.IOException)2 OutputStream (java.io.OutputStream)2 ArrayList (java.util.ArrayList)2 WSDLRuntimeException (org.apache.cxf.wsdl11.WSDLRuntimeException)2 BufferedReader (java.io.BufferedReader)1 DataOutputStream (java.io.DataOutputStream)1 FileNotFoundException (java.io.FileNotFoundException)1 FileOutputStream (java.io.FileOutputStream)1 FileReader (java.io.FileReader)1 FilenameFilter (java.io.FilenameFilter)1 InputStream (java.io.InputStream)1 PrintStream (java.io.PrintStream)1 URI (java.net.URI)1