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());
}
}
}
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);
}
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);
}
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();
}
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);
}
}
}
Aggregations