Search in sources :

Example 31 with OperationType

use of org.apache.cxf.binding.corba.wsdl.OperationType in project cxf by apache.

the class WSDLToCorbaBindingTest method testCORBABindingGeneration.

@Test
public void testCORBABindingGeneration() throws Exception {
    String fileName = getClass().getResource("/wsdl/simpleList.wsdl").toString();
    generator.setWsdlFile(fileName);
    generator.addInterfaceName("BasePortType");
    Definition model = generator.generateCORBABinding();
    QName bName = new QName("http://schemas.apache.org/tests", "BaseCORBABinding", "tns");
    Binding binding = model.getBinding(bName);
    assertNotNull(binding);
    assertEquals("BaseCORBABinding", binding.getQName().getLocalPart());
    assertEquals("BasePortType", binding.getPortType().getQName().getLocalPart());
    assertEquals(1, binding.getExtensibilityElements().size());
    assertEquals(1, binding.getBindingOperations().size());
    for (ExtensibilityElement extElement : getExtensibilityElements(binding)) {
        if ("binding".equals(extElement.getElementType().getLocalPart())) {
            BindingType bindingType = (BindingType) extElement;
            assertEquals(bindingType.getRepositoryID(), "IDL:BasePortType:1.0");
        }
    }
    Iterator<?> j = binding.getBindingOperations().iterator();
    while (j.hasNext()) {
        BindingOperation bindingOperation = (BindingOperation) j.next();
        assertEquals(1, bindingOperation.getExtensibilityElements().size());
        assertEquals(bindingOperation.getBindingInput().getName(), "echoString");
        assertEquals(bindingOperation.getBindingOutput().getName(), "echoStringResponse");
        for (ExtensibilityElement extElement : getExtensibilityElements(bindingOperation)) {
            if ("operation".equals(extElement.getElementType().getLocalPart())) {
                OperationType corbaOpType = (OperationType) extElement;
                assertEquals(corbaOpType.getName(), "echoString");
                assertEquals(3, corbaOpType.getParam().size());
                assertEquals(corbaOpType.getReturn().getName(), "return");
                assertEquals(corbaOpType.getReturn().getIdltype(), CorbaConstants.NT_CORBA_STRING);
                assertEquals(corbaOpType.getParam().get(0).getName(), "x");
                assertEquals(corbaOpType.getParam().get(0).getMode().value(), "in");
                QName qname = new QName("http://schemas.apache.org/tests/corba/typemap/", "StringEnum1", "ns1");
                assertEquals(corbaOpType.getParam().get(0).getIdltype(), qname);
            }
        }
    }
}
Also used : WSDLToCorbaBinding(org.apache.cxf.tools.corba.processors.wsdl.WSDLToCorbaBinding) Binding(javax.wsdl.Binding) BindingOperation(javax.wsdl.BindingOperation) QName(javax.xml.namespace.QName) BindingType(org.apache.cxf.binding.corba.wsdl.BindingType) Definition(javax.wsdl.Definition) OperationType(org.apache.cxf.binding.corba.wsdl.OperationType) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement) Test(org.junit.Test)

Aggregations

OperationType (org.apache.cxf.binding.corba.wsdl.OperationType)31 ExtensibilityElement (javax.wsdl.extensions.ExtensibilityElement)14 BindingOperation (javax.wsdl.BindingOperation)11 QName (javax.xml.namespace.QName)9 Test (org.junit.Test)9 ParamType (org.apache.cxf.binding.corba.wsdl.ParamType)8 BindingOperationInfo (org.apache.cxf.service.model.BindingOperationInfo)8 ArgType (org.apache.cxf.binding.corba.wsdl.ArgType)6 BindingType (org.apache.cxf.binding.corba.wsdl.BindingType)5 Binding (javax.wsdl.Binding)4 Definition (javax.wsdl.Definition)4 CorbaStreamWriter (org.apache.cxf.binding.corba.runtime.CorbaStreamWriter)4 Fixed (org.apache.cxf.binding.corba.wsdl.Fixed)4 Exchange (org.apache.cxf.message.Exchange)4 WSDLToCorbaBinding (org.apache.cxf.tools.corba.processors.wsdl.WSDLToCorbaBinding)4 ArrayList (java.util.ArrayList)3 XMLStreamWriter (javax.xml.stream.XMLStreamWriter)3 RaisesType (org.apache.cxf.binding.corba.wsdl.RaisesType)3 File (java.io.File)2 OutputStream (java.io.OutputStream)2