use of org.apache.cxf.binding.corba.wsdl.OperationType in project cxf by apache.
the class CorbaConduitTest method testBuildRequest.
@Test
public void testBuildRequest() throws Exception {
CorbaConduit conduit = setupCorbaConduit(false);
CorbaMessage message = control.createMock(CorbaMessage.class);
Exchange exchange = control.createMock(Exchange.class);
EasyMock.expect(message.getExchange());
EasyMock.expectLastCall().andReturn(exchange);
ServiceInfo service = control.createMock(ServiceInfo.class);
EasyMock.expect(exchange.get(ServiceInfo.class)).andReturn(service);
List<CorbaTypeMap> list = control.createMock(List.class);
CorbaTypeMap typeMap = control.createMock(CorbaTypeMap.class);
EasyMock.expect(service.getExtensors(CorbaTypeMap.class)).andReturn(list);
OperationType opType = control.createMock(OperationType.class);
conduit.getArguments(message);
EasyMock.expectLastCall().andReturn(null);
conduit.getReturn(message);
EasyMock.expectLastCall().andReturn(null);
conduit.getExceptionList(conduit.getOperationExceptions(opType, typeMap), message, opType);
EasyMock.expectLastCall().andReturn(null);
conduit.getRequest(message, "Hello", null, null, null);
EasyMock.expectLastCall();
}
use of org.apache.cxf.binding.corba.wsdl.OperationType in project cxf by apache.
the class CorbaConduitTest method testBuildExceptionListWithExceptions.
@Test
public void testBuildExceptionListWithExceptions() throws Exception {
CorbaConduit conduit = setupCorbaConduit(false);
Message msg = new MessageImpl();
CorbaMessage message = new CorbaMessage(msg);
TestUtils testUtils = new TestUtils();
CorbaDestination destination = testUtils.getExceptionTypesTestDestination();
EndpointInfo endpointInfo2 = destination.getEndPointInfo();
QName name = new QName("http://schemas.apache.org/idl/except", "review_data", "");
BindingOperationInfo bInfo = destination.getBindingInfo().getOperation(name);
OperationType opType = bInfo.getExtensor(OperationType.class);
CorbaTypeMap typeMap = null;
List<TypeMappingType> corbaTypes = endpointInfo2.getService().getDescription().getExtensors(TypeMappingType.class);
if (corbaTypes != null) {
typeMap = CorbaUtils.createCorbaTypeMap(corbaTypes);
}
ExceptionList exList = conduit.getExceptionList(conduit.getOperationExceptions(opType, typeMap), message, opType);
assertNotNull("ExceptionList is not null", exList != null);
assertNotNull("TypeCode is not null", exList.item(0) != null);
assertEquals("ID should be equal", exList.item(0).id(), "IDL:BadRecord:1.0");
assertEquals("ID should be equal", exList.item(0).name(), "BadRecord");
assertEquals("ID should be equal", exList.item(0).member_count(), 2);
assertEquals("ID should be equal", exList.item(0).member_name(0), "reason");
assertNotNull("Member type is not null", exList.item(0).member_type(0) != null);
}
use of org.apache.cxf.binding.corba.wsdl.OperationType in project cxf by apache.
the class AttributeVisitor method generateCorbaOperation.
/**
* Generates a corba:operation in the corba:binding container within a wsdl:binding.
*
* Only one (or none) corba parameter and only one (or none) corba return parameter are supported.
*
* @param op is the wsdl operation to bind.
* @param param is the corba parameter, none if null.
* @param arg is the corba return parameter, none if null.
* @return the generated corba:operation.
*/
private OperationType generateCorbaOperation(Operation op, ParamType param, ArgType arg) {
final OperationType operation;
try {
operation = (OperationType) extReg.createExtension(BindingOperation.class, CorbaConstants.NE_CORBA_OPERATION);
} catch (WSDLException ex) {
throw new RuntimeException(ex);
}
operation.setName(op.getName());
if (param != null) {
operation.getParam().add(param);
}
if (arg != null) {
operation.setReturn(arg);
}
return operation;
}
use of org.apache.cxf.binding.corba.wsdl.OperationType in project cxf by apache.
the class AttributeVisitor method generateSetter.
private void generateSetter(AST typeNode, AST nameNode) {
// generate wrapped doc element in parameter
XmlSchemaElement inParameters = generateWrappedDocElement(typeNode, SETTER_PREFIX + nameNode.toString(), PARAM_NAME);
// generate wrapped doc element out parameter
XmlSchemaElement outParameters = generateWrappedDocElement(null, SETTER_PREFIX + nameNode.toString() + RESULT_POSTFIX, RETURN_PARAM_NAME);
// generate input message
Message inMsg = generateMessage(inParameters, SETTER_PREFIX + nameNode.toString());
// generate output message
Message outMsg = generateMessage(outParameters, SETTER_PREFIX + nameNode.toString() + RESPONSE_POSTFIX);
// generate operation
String name = SETTER_PREFIX + nameNode.toString();
Operation op = generateOperation(name, inMsg, outMsg);
// generate corba return param
ParamType corbaParam = generateCorbaParam(typeNode);
// generate corba operation
OperationType corbaOp = generateCorbaOperation(op, corbaParam, null);
// generate binding
generateCorbaBindingOperation(binding, op, corbaOp);
}
use of org.apache.cxf.binding.corba.wsdl.OperationType in project cxf by apache.
the class AttributeVisitor method generateGetter.
private void generateGetter(AST typeNode, AST nameNode) {
// generate wrapped doc element in parameter
XmlSchemaElement inParameters = generateWrappedDocElement(null, GETTER_PREFIX + nameNode.toString(), PARAM_NAME);
// generate wrapped doc element out parameter
XmlSchemaElement outParameters = generateWrappedDocElement(typeNode, GETTER_PREFIX + nameNode.toString() + RESULT_POSTFIX, RETURN_PARAM_NAME);
// generate input message
Message inMsg = generateMessage(inParameters, GETTER_PREFIX + nameNode.toString());
// generate output message
Message outMsg = generateMessage(outParameters, GETTER_PREFIX + nameNode.toString() + RESPONSE_POSTFIX);
// generate operation
String name = GETTER_PREFIX + nameNode.toString();
Operation op = generateOperation(name, inMsg, outMsg);
// generate corba return param
ArgType corbaReturn = generateCorbaReturnParam(typeNode);
// generate corba operation
OperationType corbaOp = generateCorbaOperation(op, null, corbaReturn);
// generate binding
generateCorbaBindingOperation(binding, op, corbaOp);
}
Aggregations