Search in sources :

Example 11 with OperationType

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

the class WSDLToCorbaBindingTest method checkFixedTypeTwo.

private void checkFixedTypeTwo(BindingOperation bindingOperation, Map<String, CorbaType> mapType) {
    for (ExtensibilityElement extElement : getExtensibilityElements(bindingOperation)) {
        if ("operation".equals(extElement.getElementType().getLocalPart())) {
            OperationType corbaOpType = (OperationType) extElement;
            assertEquals(corbaOpType.getName(), "op_m");
            assertEquals(3, corbaOpType.getParam().size());
            assertEquals("X.PARAM.H", corbaOpType.getParam().get(0).getIdltype().getLocalPart());
            assertEquals("X.H", corbaOpType.getReturn().getIdltype().getLocalPart());
            Fixed fixed = (Fixed) mapType.get(corbaOpType.getReturn().getIdltype().getLocalPart());
            assertNotNull("Could not find the decimal type", fixed.getType());
            assertEquals("Fixed digits is incorrect for the return corba parameter", 10, fixed.getDigits());
            assertEquals("Fixed scale is incorrect for the return corba parameter", 2, fixed.getScale());
        }
    }
}
Also used : OperationType(org.apache.cxf.binding.corba.wsdl.OperationType) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement) Fixed(org.apache.cxf.binding.corba.wsdl.Fixed)

Example 12 with OperationType

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

the class WSDLToCorbaBindingTest method getStringAttributeTest.

private void getStringAttributeTest(Binding binding) {
    BindingOperation bindingOp = binding.getBindingOperation("_get_string_attribute", "_get_string_attribute", "_get_string_attributeResponse");
    assertEquals("_get_string_attribute", bindingOp.getName());
    assertEquals(1, bindingOp.getExtensibilityElements().size());
    assertEquals(bindingOp.getBindingInput().getName(), "_get_string_attribute");
    assertEquals(bindingOp.getBindingOutput().getName(), "_get_string_attributeResponse");
    for (ExtensibilityElement extElement : getExtensibilityElements(bindingOp)) {
        if ("operation".equals(extElement.getElementType().getLocalPart())) {
            OperationType corbaOpType = (OperationType) extElement;
            assertEquals(corbaOpType.getName(), "_get_string_attribute");
            assertEquals(corbaOpType.getReturn().getName(), "return");
            assertEquals(corbaOpType.getReturn().getIdltype(), CorbaConstants.NT_CORBA_STRING);
        }
    }
}
Also used : BindingOperation(javax.wsdl.BindingOperation) OperationType(org.apache.cxf.binding.corba.wsdl.OperationType) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement)

Example 13 with OperationType

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

the class WSDLToCorbaBindingTest method getTestIdTest.

private void getTestIdTest(Binding binding) {
    BindingOperation bindingOp = binding.getBindingOperation("_get_test_id", "_get_test_id", "_get_test_idResponse");
    assertEquals("_get_test_id", bindingOp.getName());
    assertEquals(1, bindingOp.getExtensibilityElements().size());
    assertEquals(bindingOp.getBindingInput().getName(), "_get_test_id");
    assertEquals(bindingOp.getBindingOutput().getName(), "_get_test_idResponse");
    for (ExtensibilityElement extElement : getExtensibilityElements(bindingOp)) {
        if ("operation".equals(extElement.getElementType().getLocalPart())) {
            OperationType corbaOpType = (OperationType) extElement;
            assertEquals(corbaOpType.getName(), "_get_test_id");
            assertEquals(corbaOpType.getReturn().getName(), "return");
            assertEquals(corbaOpType.getReturn().getIdltype(), CorbaConstants.NT_CORBA_FLOAT);
        }
    }
}
Also used : BindingOperation(javax.wsdl.BindingOperation) OperationType(org.apache.cxf.binding.corba.wsdl.OperationType) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement)

Example 14 with OperationType

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

the class WSDLToCorbaBindingTest method testArrayMapping.

@Test
public void testArrayMapping() throws Exception {
    try {
        String fileName = getClass().getResource("/wsdl/array.wsdl").toString();
        generator.setWsdlFile(fileName);
        generator.addInterfaceName("X");
        Definition model = generator.generateCORBABinding();
        QName bName = new QName("http://schemas.apache.org/idl/anon.idl", "XCORBABinding", "tns");
        Binding binding = model.getBinding(bName);
        assertNotNull(binding);
        assertEquals("XCORBABinding", binding.getQName().getLocalPart());
        assertEquals("X", 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:X:1.0");
            }
        }
        Iterator<?> j = binding.getBindingOperations().iterator();
        while (j.hasNext()) {
            BindingOperation bindingOperation = (BindingOperation) j.next();
            assertEquals(1, bindingOperation.getExtensibilityElements().size());
            assertEquals(bindingOperation.getBindingInput().getName(), "op_a");
            assertEquals(bindingOperation.getBindingOutput().getName(), "op_aResponse");
            for (ExtensibilityElement extElement : getExtensibilityElements(bindingOperation)) {
                if ("operation".equals(extElement.getElementType().getLocalPart())) {
                    OperationType corbaOpType = (OperationType) extElement;
                    assertEquals(corbaOpType.getName(), "op_a");
                    assertEquals(1, corbaOpType.getParam().size());
                    assertNotNull(corbaOpType.getReturn());
                    ParamType paramtype = corbaOpType.getParam().get(0);
                    assertEquals(paramtype.getName(), "part1");
                    QName idltype = new QName("http://schemas.apache.org/idl/anon.idl/corba/typemap/", "ArrayType", "ns1");
                    assertEquals(paramtype.getIdltype(), idltype);
                    assertEquals(paramtype.getMode().toString(), "IN");
                }
            }
        }
        // See if an IDL is able to produce from this CORBA Binding.
        WSDLToIDLAction idlgen = new WSDLToIDLAction();
        idlgen.setBindingName("XCORBABinding");
        idlgen.setOutputFile("array.idl");
        idlgen.generateIDL(model);
        File f = new File("array.idl");
        assertTrue("array.idl should be generated", f.exists());
    } finally {
        new File("array.idl").deleteOnExit();
    }
}
Also used : WSDLToCorbaBinding(org.apache.cxf.tools.corba.processors.wsdl.WSDLToCorbaBinding) Binding(javax.wsdl.Binding) WSDLToIDLAction(org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction) 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) File(java.io.File) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement) ParamType(org.apache.cxf.binding.corba.wsdl.ParamType) Test(org.junit.Test)

Example 15 with OperationType

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

the class WSDLToCorbaBindingTest method checkFixedTypeThree.

private void checkFixedTypeThree(BindingOperation bindingOperation, Map<String, CorbaType> mapType) {
    for (ExtensibilityElement extElement : getExtensibilityElements(bindingOperation)) {
        if ("operation".equals(extElement.getElementType().getLocalPart())) {
            OperationType corbaOpType = (OperationType) extElement;
            assertEquals(corbaOpType.getName(), "op_n");
            assertEquals(3, corbaOpType.getParam().size());
            assertEquals("fixed_1", corbaOpType.getParam().get(0).getIdltype().getLocalPart());
            assertEquals("Z.H", corbaOpType.getReturn().getIdltype().getLocalPart());
            Fixed fixed = (Fixed) mapType.get(corbaOpType.getReturn().getIdltype().getLocalPart());
            assertNotNull("Could not find the decimal type", fixed.getType());
            assertEquals("Fixed digits is incorrect for the return corba parameter", 8, fixed.getDigits());
            assertEquals("Fixed scale is incorrect for the return corba parameter", 6, fixed.getScale());
        }
    }
}
Also used : OperationType(org.apache.cxf.binding.corba.wsdl.OperationType) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement) Fixed(org.apache.cxf.binding.corba.wsdl.Fixed)

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