Search in sources :

Example 86 with Definition

use of javax.wsdl.Definition in project cxf by apache.

the class WSDLToCorbaBindingTypeTest method testComplexRestriction.

@Test
public void testComplexRestriction() throws Exception {
    try {
        URI fileName = getClass().getResource("/wsdl/complexRestriction.wsdl").toURI();
        generator.setWsdlFile(new File(fileName).getAbsolutePath());
        generator.addInterfaceName("TypeTestPortType");
        Definition model = generator.generateCORBABinding();
        Document document = writer.getDocument(model);
        Element typemap = getElementNode(document, "corba:typeMapping");
        assertNotNull(typemap);
        assertEquals(1, typemap.getElementsByTagName("corba:struct").getLength());
    } finally {
        new File("complexRestriction-corba.wsdl").deleteOnExit();
    }
}
Also used : Element(org.w3c.dom.Element) Definition(javax.wsdl.Definition) Document(org.w3c.dom.Document) URI(java.net.URI) File(java.io.File) Test(org.junit.Test)

Example 87 with Definition

use of javax.wsdl.Definition in project cxf by apache.

the class WSDLToCorbaBindingTypeTest method testAnonymousReturnParam.

@Test
public void testAnonymousReturnParam() throws Exception {
    try {
        String fileName = getClass().getResource("/wsdl/factory_pattern.wsdl").toString();
        generator.setWsdlFile(fileName);
        generator.addInterfaceName("Number");
        Definition model = generator.generateCORBABinding();
        Document document = writer.getDocument(model);
        Element typemap = getElementNode(document, "corba:typeMapping");
        assertNotNull(typemap);
        assertEquals(3, typemap.getElementsByTagName("corba:struct").getLength());
    } finally {
        new File("factory_pattern-corba.wsdl").deleteOnExit();
    }
}
Also used : Element(org.w3c.dom.Element) Definition(javax.wsdl.Definition) Document(org.w3c.dom.Document) File(java.io.File) Test(org.junit.Test)

Example 88 with Definition

use of javax.wsdl.Definition 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 89 with Definition

use of javax.wsdl.Definition in project cxf by apache.

the class WSDLToCorbaBindingTypeTest method testListType.

@Test
public void testListType() throws Exception {
    try {
        URI fileName = getClass().getResource("/wsdl/listType.wsdl").toURI();
        generator.setWsdlFile(new File(fileName).getAbsolutePath());
        generator.addInterfaceName("TypeTestPortType");
        Definition model = generator.generateCORBABinding();
        Document document = writer.getDocument(model);
        Element typemap = getElementNode(document, "corba:typeMapping");
        assertNotNull(typemap);
        assertEquals(1, typemap.getElementsByTagName("corba:enum").getLength());
        assertEquals(1, typemap.getElementsByTagName("corba:sequence").getLength());
    } finally {
        new File("listType-corba.wsdl").deleteOnExit();
    }
}
Also used : Element(org.w3c.dom.Element) Definition(javax.wsdl.Definition) Document(org.w3c.dom.Document) URI(java.net.URI) File(java.io.File) Test(org.junit.Test)

Example 90 with Definition

use of javax.wsdl.Definition in project cxf by apache.

the class WSDLToCorbaBindingTypeTest method testImportSchemaInTypes.

@Test
public void testImportSchemaInTypes() throws Exception {
    try {
        URI fileName = getClass().getResource("/wsdl/importType.wsdl").toURI();
        generator.setWsdlFile(new File(fileName).getAbsolutePath());
        generator.addInterfaceName("TypeTestPortType");
        Definition model = generator.generateCORBABinding();
        Document document = writer.getDocument(model);
        Element typemap = getElementNode(document, "corba:typeMapping");
        assertNotNull(typemap);
        assertEquals(1, typemap.getElementsByTagName("corba:enum").getLength());
        assertEquals(1, typemap.getElementsByTagName("corba:sequence").getLength());
    } finally {
        new File("importType-corba.wsdl").deleteOnExit();
    }
}
Also used : Element(org.w3c.dom.Element) Definition(javax.wsdl.Definition) Document(org.w3c.dom.Document) URI(java.net.URI) File(java.io.File) Test(org.junit.Test)

Aggregations

Definition (javax.wsdl.Definition)226 Test (org.junit.Test)113 QName (javax.xml.namespace.QName)61 File (java.io.File)52 Document (org.w3c.dom.Document)44 Element (org.w3c.dom.Element)40 HashMap (java.util.HashMap)36 WSDLReader (javax.wsdl.xml.WSDLReader)35 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)31 JBossWSTest (org.jboss.wsf.test.JBossWSTest)31 Service (javax.wsdl.Service)24 ExtensibilityElement (javax.wsdl.extensions.ExtensibilityElement)23 URL (java.net.URL)21 ArrayList (java.util.ArrayList)21 Port (javax.wsdl.Port)21 WSDLToIDLAction (org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction)21 Bus (org.apache.cxf.Bus)20 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)20 WSDLManager (org.apache.cxf.wsdl.WSDLManager)20 IOException (java.io.IOException)18