Search in sources :

Example 6 with WSDLToIDLAction

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

the class WSDLToCorbaBindingTypeTest method testNestedInterfaceTypes.

@Test
public void testNestedInterfaceTypes() throws Exception {
    try {
        String fileName = getClass().getResource("/wsdl/nested_interfaces.wsdl").toString();
        generator.setWsdlFile(fileName);
        generator.addInterfaceName("C.C1");
        Definition model = generator.generateCORBABinding();
        Document document = writer.getDocument(model);
        Element typemap = getElementNode(document, "corba:typeMapping");
        assertNotNull(typemap);
        assertEquals(1, typemap.getElementsByTagName("corba:anonstring").getLength());
        assertEquals(9, typemap.getElementsByTagName("corba:struct").getLength());
        WSDLToIDLAction idlgen = new WSDLToIDLAction();
        idlgen.setBindingName("C.C1CORBABinding");
        idlgen.setOutputFile("nested_interfaces.idl");
        idlgen.generateIDL(model);
        File f = new File("nested_interfaces.idl");
        assertTrue("nested_interfaces.idl should be generated", f.exists());
    } finally {
        new File("nested_interfaces.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 7 with WSDLToIDLAction

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

the class WSDLToCorbaBindingTypeTest method testNillableType.

@Test
public void testNillableType() throws Exception {
    try {
        String fileName = getClass().getResource("/wsdl/nillable.wsdl").toString();
        generator.setWsdlFile(fileName);
        generator.addInterfaceName("NillablePortType");
        Definition model = generator.generateCORBABinding();
        Document document = writer.getDocument(model);
        Element typemap = getElementNode(document, "corba:typeMapping");
        assertNotNull(typemap);
        assertEquals(2, typemap.getElementsByTagName("corba:union").getLength());
        assertEquals(1, typemap.getElementsByTagName("corba:struct").getLength());
        TypeMappingType mapType = (TypeMappingType) model.getExtensibilityElements().get(0);
        WSDLToIDLAction idlgen = new WSDLToIDLAction();
        idlgen.setBindingName("NillableCORBABinding");
        idlgen.setOutputFile("nillable.idl");
        idlgen.generateIDL(model);
        Union un = (Union) mapType.getStructOrExceptionOrUnion().get(2);
        assertEquals("Name is incorrect for Union Type", "long_nil", un.getName());
        assertEquals("Type is incorrect for Union Type", "PEl", un.getType().getLocalPart());
        Unionbranch unbranch = un.getUnionbranch().get(0);
        assertEquals("Name is incorrect for UnionBranch Type", "value", unbranch.getName());
        assertEquals("Type is incorrect for UnionBranch Type", "long", unbranch.getIdltype().getLocalPart());
        File f = new File("nillable.idl");
        assertTrue("nillable.idl should be generated", f.exists());
    } finally {
        new File("nillable.idl").deleteOnExit();
    }
}
Also used : WSDLToIDLAction(org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction) Element(org.w3c.dom.Element) Definition(javax.wsdl.Definition) TypeMappingType(org.apache.cxf.binding.corba.wsdl.TypeMappingType) Document(org.w3c.dom.Document) File(java.io.File) Union(org.apache.cxf.binding.corba.wsdl.Union) Unionbranch(org.apache.cxf.binding.corba.wsdl.Unionbranch) Test(org.junit.Test)

Example 8 with WSDLToIDLAction

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

the class WSDLToCorbaBindingTypeTest method testWsAddressingBankType.

@Test
public void testWsAddressingBankType() throws Exception {
    try {
        String fileName = getClass().getResource("/wsdl/wsaddressing_account.wsdl").toString();
        generator.setWsdlFile(fileName);
        generator.addInterfaceName("Account");
        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("AccountCORBABinding");
        idlgen.setOutputFile("wsaddressing_account.idl");
        idlgen.generateIDL(model);
        File f = new File("wsaddressing_account.idl");
        assertTrue("wsaddressing_account.idl should be generated", f.exists());
    } finally {
        new File("wsaddressing_account.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 9 with WSDLToIDLAction

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

the class WSDLToIDLGenerationTest method setUp.

@Before
public void setUp() {
    System.setProperty("WSDLTOIDLGeneration", "false");
    idlgen = new WSDLToIDLAction();
    idloutput = new ByteArrayOutputStream();
}
Also used : WSDLToIDLAction(org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction) ByteArrayOutputStream(java.io.ByteArrayOutputStream) Before(org.junit.Before)

Example 10 with WSDLToIDLAction

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

the class WSDLToCorbaBindingTest method testSequenceType.

@Test
public void testSequenceType() throws Exception {
    try {
        String fileName = getClass().getResource("/wsdl/sequencetype.wsdl").toString();
        generator.setWsdlFile(fileName);
        generator.addInterfaceName("IACC.Server");
        Definition model = generator.generateCORBABinding();
        Document document = writer.getDocument(model);
        Element typemap = getElementNode(document, "corba:typeMapping");
        assertNotNull(typemap);
        assertEquals(2, typemap.getElementsByTagName("corba:sequence").getLength());
        assertEquals(5, typemap.getElementsByTagName("corba:exception").getLength());
        assertEquals(70, typemap.getElementsByTagName("corba:struct").getLength());
        WSDLToIDLAction idlgen = new WSDLToIDLAction();
        idlgen.setBindingName("IACC.ServerCORBABinding");
        idlgen.setOutputFile("sequencetype.idl");
        idlgen.generateIDL(model);
        File f = new File("sequencetype.idl");
        assertTrue("sequencetype.idl should be generated", f.exists());
    } finally {
        new File("sequencetype.idl").deleteOnExit();
    }
}
Also used : WSDLToIDLAction(org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement) Element(org.w3c.dom.Element) Definition(javax.wsdl.Definition) Document(org.w3c.dom.Document) 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