Search in sources :

Example 21 with OperationType

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

the class CorbaDSIServant method init.

public void init(ORB theOrb, POA poa, CorbaDestination dest, MessageObserver observer, CorbaTypeMap map) {
    orb = theOrb;
    servantPOA = poa;
    destination = dest;
    incomingObserver = observer;
    typeMap = map;
    // Get the list of interfaces that this servant will support
    try {
        BindingType bindType = destination.getBindingInfo().getExtensor(BindingType.class);
        if (bindType == null) {
            throw new CorbaBindingException("Unable to determine corba binding information");
        }
        List<String> bases = bindType.getBases();
        interfaces = new ArrayList<>();
        interfaces.add(bindType.getRepositoryID());
        for (Iterator<String> iter = bases.iterator(); iter.hasNext(); ) {
            interfaces.add(iter.next());
        }
    } catch (java.lang.Exception ex) {
        LOG.log(Level.SEVERE, "Couldn't initialize the corba DSI servant");
        throw new CorbaBindingException(ex);
    }
    // Build the list of CORBA operations and the WSDL operations they map to.  Note that
    // the WSDL operation name may not always match the CORBA operation name.
    BindingInfo bInfo = destination.getBindingInfo();
    Iterator<BindingOperationInfo> i = bInfo.getOperations().iterator();
    operationMap = new HashMap<>(bInfo.getOperations().size());
    while (i.hasNext()) {
        BindingOperationInfo bopInfo = i.next();
        OperationType opType = bopInfo.getExtensor(OperationType.class);
        if (opType != null) {
            operationMap.put(opType.getName(), bopInfo.getName());
        }
    }
}
Also used : CorbaBindingException(org.apache.cxf.binding.corba.CorbaBindingException) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) BindingType(org.apache.cxf.binding.corba.wsdl.BindingType) BindingInfo(org.apache.cxf.service.model.BindingInfo) OperationType(org.apache.cxf.binding.corba.wsdl.OperationType)

Example 22 with OperationType

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

the class CorbaConduitTest method testGetOperationExceptions.

@Test
public void testGetOperationExceptions() {
    CorbaConduit conduit = control.createMock(CorbaConduit.class);
    OperationType opType = control.createMock(OperationType.class);
    CorbaTypeMap typeMap = control.createMock(CorbaTypeMap.class);
    List<RaisesType> exlist = control.createMock(List.class);
    opType.getRaises();
    EasyMock.expectLastCall().andReturn(exlist);
    int i = 0;
    EasyMock.expect(exlist.size()).andReturn(i);
    RaisesType rType = control.createMock(RaisesType.class);
    EasyMock.expect(exlist.get(0)).andReturn(rType);
    control.replay();
    conduit.getOperationExceptions(opType, typeMap);
    assertEquals(exlist.size(), 0);
}
Also used : RaisesType(org.apache.cxf.binding.corba.wsdl.RaisesType) OperationType(org.apache.cxf.binding.corba.wsdl.OperationType) Test(org.junit.Test)

Example 23 with OperationType

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

the class CorbaConduitTest method testBuildExceptionListEmpty.

@Test
public void testBuildExceptionListEmpty() throws Exception {
    CorbaConduit conduit = setupCorbaConduit(false);
    Message msg = new MessageImpl();
    CorbaMessage message = new CorbaMessage(msg);
    OperationType opType = new OperationType();
    opType.setName("review_data");
    ExceptionList exList = conduit.getExceptionList(conduit.getOperationExceptions(opType, null), message, opType);
    assertNotNull("ExcepitonList is not null", exList != null);
    assertEquals("The list should be empty", exList.count(), 0);
}
Also used : Message(org.apache.cxf.message.Message) ExceptionList(org.omg.CORBA.ExceptionList) OperationType(org.apache.cxf.binding.corba.wsdl.OperationType) MessageImpl(org.apache.cxf.message.MessageImpl) Test(org.junit.Test)

Example 24 with OperationType

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

the class CorbaConduitTest method testClose.

@Test
public void testClose() throws Exception {
    Method m = CorbaConduit.class.getDeclaredMethod("buildRequest", new Class[] { CorbaMessage.class, OperationType.class });
    CorbaConduit conduit = EasyMock.createMockBuilder(CorbaConduit.class).addMockedMethod(m).createMock();
    org.omg.CORBA.Object obj = control.createMock(org.omg.CORBA.Object.class);
    CorbaMessage msg = control.createMock(CorbaMessage.class);
    EasyMock.expect(msg.get(CorbaConstants.CORBA_ENDPOINT_OBJECT)).andReturn(obj);
    Exchange exg = control.createMock(Exchange.class);
    EasyMock.expect(msg.getExchange()).andReturn(exg);
    BindingOperationInfo bopInfo = control.createMock(BindingOperationInfo.class);
    EasyMock.expect(exg.getBindingOperationInfo()).andReturn(bopInfo);
    OperationType opType = control.createMock(OperationType.class);
    bopInfo.getExtensor(OperationType.class);
    EasyMock.expectLastCall().andReturn(opType);
    conduit.buildRequest(msg, opType);
    EasyMock.expectLastCall();
    OutputStream os = control.createMock(OutputStream.class);
    EasyMock.expect(msg.getContent(OutputStream.class)).andReturn(os);
    os.close();
    EasyMock.expectLastCall();
    control.replay();
    conduit.close(msg);
    control.verify();
}
Also used : Exchange(org.apache.cxf.message.Exchange) BindingOperationInfo(org.apache.cxf.service.model.BindingOperationInfo) OutputStream(java.io.OutputStream) Method(java.lang.reflect.Method) OperationType(org.apache.cxf.binding.corba.wsdl.OperationType) Test(org.junit.Test)

Example 25 with OperationType

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

the class WSDLToCorbaBindingTest method setTestIdTest.

private void setTestIdTest(Binding binding) {
    BindingOperation bindingOp = binding.getBindingOperation("_set_test_id", "_set_test_id", "_set_test_idResponse");
    assertEquals("_set_test_id", bindingOp.getName());
    assertEquals(1, bindingOp.getExtensibilityElements().size());
    assertEquals(bindingOp.getBindingInput().getName(), "_set_test_id");
    assertEquals(bindingOp.getBindingOutput().getName(), "_set_test_idResponse");
    for (ExtensibilityElement extElement : getExtensibilityElements(bindingOp)) {
        if ("operation".equals(extElement.getElementType().getLocalPart())) {
            OperationType corbaOpType = (OperationType) extElement;
            assertEquals(corbaOpType.getName(), "_set_test_id");
            assertEquals(1, corbaOpType.getParam().size());
            assertEquals(corbaOpType.getParam().get(0).getName(), "_arg");
            assertEquals(corbaOpType.getParam().get(0).getMode().value(), "in");
            assertEquals(corbaOpType.getParam().get(0).getIdltype(), CorbaConstants.NT_CORBA_FLOAT);
        }
    }
}
Also used : BindingOperation(javax.wsdl.BindingOperation) OperationType(org.apache.cxf.binding.corba.wsdl.OperationType) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement)

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