Search in sources :

Example 16 with WSDLToIDLAction

use of org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction in project cxf by apache.

the class WSDLToCorbaBindingTypeTest method testWsAddressingTypes.

@Test
public void testWsAddressingTypes() throws Exception {
    try {
        String fileName = getClass().getResource("/wsdl/wsaddressing_server.wsdl").toString();
        generator.setWsdlFile(fileName);
        generator.addInterfaceName("TestServer");
        Definition model = generator.generateCORBABinding();
        Document document = writer.getDocument(model);
        Element typemap = getElementNode(document, "corba:typeMapping");
        assertNotNull(typemap);
        assertEquals(1, typemap.getElementsByTagName("corba:object").getLength());
        WSDLToIDLAction idlgen = new WSDLToIDLAction();
        idlgen.setBindingName("TestServerCORBABinding");
        idlgen.setOutputFile("wsaddressing_server.idl");
        idlgen.generateIDL(model);
        File f = new File("wsaddressing_server.idl");
        assertTrue("wsaddressing_server.idl should be generated", f.exists());
    } finally {
        new File("wsaddressing_server.idl").deleteOnExit();
    }
}
Also used : WSDLToIDLAction(org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction) Element(org.w3c.dom.Element) Definition(javax.wsdl.Definition) Document(org.w3c.dom.Document) File(java.io.File) Test(org.junit.Test)

Example 17 with WSDLToIDLAction

use of org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction in project cxf by apache.

the class WSDLToCorbaBindingTypeTest method testNestedComplexTypes.

@Test
public void testNestedComplexTypes() throws Exception {
    try {
        String fileName = getClass().getResource("/wsdl/nested_complex.wsdl").toString();
        generator.setWsdlFile(fileName);
        generator.addInterfaceName("X");
        Definition model = generator.generateCORBABinding();
        Document document = writer.getDocument(model);
        Element typemap = getElementNode(document, "corba:typeMapping");
        assertNotNull(typemap);
        assertEquals(6, typemap.getElementsByTagName("corba:union").getLength());
        assertEquals(14, typemap.getElementsByTagName("corba:struct").getLength());
        assertEquals(1, typemap.getElementsByTagName("corba:enum").getLength());
        assertEquals(1, typemap.getElementsByTagName("corba:array").getLength());
        WSDLToIDLAction idlgen = new WSDLToIDLAction();
        idlgen.setBindingName("XCORBABinding");
        idlgen.setOutputFile("nested_complex.idl");
        idlgen.generateIDL(model);
        File f = new File("nested_complex.idl");
        assertTrue("nested_complex.idl should be generated", f.exists());
    } finally {
        new File("nested_complex.idl").deleteOnExit();
    }
}
Also used : WSDLToIDLAction(org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction) Element(org.w3c.dom.Element) Definition(javax.wsdl.Definition) Document(org.w3c.dom.Document) File(java.io.File) Test(org.junit.Test)

Example 18 with WSDLToIDLAction

use of org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction in project cxf by apache.

the class WSDLToCorbaBindingTypeTest method testNestedDerivedTypes.

@Test
public void testNestedDerivedTypes() throws Exception {
    try {
        String fileName = getClass().getResource("/wsdl/nested-derivedtypes.wsdl").toString();
        generator.setWsdlFile(fileName);
        generator.addInterfaceName("DerivedTypesPortType");
        Definition model = generator.generateCORBABinding();
        Document document = writer.getDocument(model);
        Element typemap = getElementNode(document, "corba:typeMapping");
        assertNotNull(typemap);
        assertEquals(6, typemap.getElementsByTagName("corba:union").getLength());
        assertEquals(58, typemap.getElementsByTagName("corba:struct").getLength());
        assertEquals(3, typemap.getElementsByTagName("corba:sequence").getLength());
        WSDLToIDLAction idlgen = new WSDLToIDLAction();
        idlgen.setBindingName("DerivedTypesCORBABinding");
        idlgen.setOutputFile("nested-derivedtypes.idl");
        idlgen.generateIDL(model);
        File f = new File("nested-derivedtypes.idl");
        assertTrue("nested-derivedtypes.idl should be generated", f.exists());
    } finally {
        new File("nested-derivedtypes.idl").deleteOnExit();
    }
}
Also used : WSDLToIDLAction(org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction) Element(org.w3c.dom.Element) Definition(javax.wsdl.Definition) Document(org.w3c.dom.Document) File(java.io.File) Test(org.junit.Test)

Example 19 with WSDLToIDLAction

use of org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction in project cxf by apache.

the class WSDLToCorbaBindingTypeTest method testNestedType.

@Test
public void testNestedType() throws Exception {
    try {
        String fileName = getClass().getResource("/wsdl/nested.wsdl").toString();
        generator.setWsdlFile(fileName);
        generator.addInterfaceName("TypeInheritancePortType");
        Definition model = generator.generateCORBABinding();
        Document document = writer.getDocument(model);
        Element typemap = getElementNode(document, "corba:typeMapping");
        assertNotNull(typemap);
        assertEquals(4, typemap.getElementsByTagName("corba:union").getLength());
        assertEquals(23, typemap.getElementsByTagName("corba:struct").getLength());
        assertEquals(1, typemap.getElementsByTagName("corba:anonstring").getLength());
        WSDLToIDLAction idlgen = new WSDLToIDLAction();
        idlgen.setBindingName("TypeInheritanceCORBABinding");
        idlgen.setOutputFile("nested.idl");
        idlgen.generateIDL(model);
        File f = new File("nested.idl");
        assertTrue("nested.idl should be generated", f.exists());
    } finally {
        new File("nested.idl").deleteOnExit();
    }
}
Also used : WSDLToIDLAction(org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction) Element(org.w3c.dom.Element) Definition(javax.wsdl.Definition) Document(org.w3c.dom.Document) File(java.io.File) Test(org.junit.Test)

Example 20 with WSDLToIDLAction

use of org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction in project cxf by apache.

the class WSDLToCorbaBindingTypeTest method testAnonType.

// tests anonymous arrays and sequences
@Test
public void testAnonType() throws Exception {
    try {
        String fileName = getClass().getResource("/wsdl/atype.wsdl").toString();
        generator.setWsdlFile(fileName);
        generator.addInterfaceName("X");
        Definition model = generator.generateCORBABinding();
        Document document = writer.getDocument(model);
        Element typemap = getElementNode(document, "corba:typeMapping");
        assertNotNull(typemap);
        assertEquals(3, typemap.getElementsByTagName("corba:anonsequence").getLength());
        assertEquals(2, typemap.getElementsByTagName("corba:anonarray").getLength());
        assertEquals(1, typemap.getElementsByTagName("corba:array").getLength());
        assertEquals(2, typemap.getElementsByTagName("corba:struct").getLength());
        TypeMappingType mapType = (TypeMappingType) model.getExtensibilityElements().get(0);
        Map<String, CorbaType> tmap = new HashMap<>();
        for (CorbaType type : mapType.getStructOrExceptionOrUnion()) {
            tmap.put(type.getName(), type);
        }
        WSDLToIDLAction idlgen = new WSDLToIDLAction();
        idlgen.setBindingName("XCORBABinding");
        idlgen.setOutputFile("atype.idl");
        idlgen.generateIDL(model);
        Array arr = (Array) tmap.get("X.A");
        assertNotNull(arr);
        assertEquals("ElementType is incorrect for Array Type", "X._5_A", arr.getElemtype().getLocalPart());
        Anonarray arr2 = (Anonarray) tmap.get("X._5_A");
        assertNotNull(arr2);
        assertEquals("ElementType is incorrect for Anon Array Type", "X._4_A", arr2.getElemtype().getLocalPart());
        Anonarray arr3 = (Anonarray) tmap.get("X._4_A");
        assertNotNull(arr3);
        assertEquals("ElementType is incorrect for Anon Array Type", "X._1_A", arr3.getElemtype().getLocalPart());
        Anonsequence seq = (Anonsequence) tmap.get("X._1_A");
        assertNotNull(seq);
        assertEquals("ElementType is incorrect for Anon Sequence Type", "X._2_A", seq.getElemtype().getLocalPart());
        Anonsequence seq2 = (Anonsequence) tmap.get("X._2_A");
        assertNotNull(seq2);
        assertEquals("ElementType is incorrect for Anon Sequence Type", "X._3_A", seq2.getElemtype().getLocalPart());
        Anonsequence seq3 = (Anonsequence) tmap.get("X._3_A");
        assertNotNull(seq3);
        assertEquals("ElementType is incorrect for Anon Sequence Type", "long", seq3.getElemtype().getLocalPart());
        File f = new File("atype.idl");
        assertTrue("atype.idl should be generated", f.exists());
    } finally {
        new File("atype.idl").deleteOnExit();
    }
}
Also used : WSDLToIDLAction(org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction) HashMap(java.util.HashMap) Element(org.w3c.dom.Element) Definition(javax.wsdl.Definition) TypeMappingType(org.apache.cxf.binding.corba.wsdl.TypeMappingType) Document(org.w3c.dom.Document) Array(org.apache.cxf.binding.corba.wsdl.Array) CorbaType(org.apache.cxf.binding.corba.wsdl.CorbaType) Anonarray(org.apache.cxf.binding.corba.wsdl.Anonarray) Anonsequence(org.apache.cxf.binding.corba.wsdl.Anonsequence) File(java.io.File) Test(org.junit.Test)

Aggregations

WSDLToIDLAction (org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction)22 File (java.io.File)21 Definition (javax.wsdl.Definition)21 Test (org.junit.Test)21 Document (org.w3c.dom.Document)16 Element (org.w3c.dom.Element)16 ExtensibilityElement (javax.wsdl.extensions.ExtensibilityElement)6 TypeMappingType (org.apache.cxf.binding.corba.wsdl.TypeMappingType)6 CorbaType (org.apache.cxf.binding.corba.wsdl.CorbaType)4 Struct (org.apache.cxf.binding.corba.wsdl.Struct)3 Union (org.apache.cxf.binding.corba.wsdl.Union)3 Binding (javax.wsdl.Binding)2 BindingOperation (javax.wsdl.BindingOperation)2 QName (javax.xml.namespace.QName)2 Anonstring (org.apache.cxf.binding.corba.wsdl.Anonstring)2 BindingType (org.apache.cxf.binding.corba.wsdl.BindingType)2 OperationType (org.apache.cxf.binding.corba.wsdl.OperationType)2 ParamType (org.apache.cxf.binding.corba.wsdl.ParamType)2 WSDLToCorbaBinding (org.apache.cxf.tools.corba.processors.wsdl.WSDLToCorbaBinding)2 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1