use of javax.wsdl.BindingOperation 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 (extElement.getElementType().getLocalPart().equals("operation")) {
OperationType corbaOpType = (OperationType) extElement;
assertEquals(corbaOpType.getName(), "_get_string_attribute");
assertEquals(corbaOpType.getReturn().getName(), "return");
assertEquals(corbaOpType.getReturn().getIdltype(), CorbaConstants.NT_CORBA_STRING);
}
}
}
use of javax.wsdl.BindingOperation in project cxf by apache.
the class WSDLToCorbaBindingTest method testPrimitiveTypeTest.
private void testPrimitiveTypeTest(Binding binding, String name, QName corbaType) {
BindingOperation bindingOp = binding.getBindingOperation(name, name, name + "Response");
assertEquals(name, bindingOp.getName());
assertEquals(1, bindingOp.getExtensibilityElements().size());
assertEquals(bindingOp.getBindingInput().getName(), name);
assertEquals(bindingOp.getBindingOutput().getName(), name + "Response");
for (ExtensibilityElement extElement : getExtensibilityElements(bindingOp)) {
if (extElement.getElementType().getLocalPart().equals("operation")) {
OperationType corbaOpType = (OperationType) extElement;
assertEquals(corbaOpType.getName(), name);
assertEquals(3, corbaOpType.getParam().size());
assertEquals(corbaOpType.getParam().get(0).getName(), "x");
assertEquals(corbaOpType.getParam().get(0).getMode().value(), "in");
assertEquals(corbaOpType.getParam().get(0).getIdltype(), corbaType);
assertEquals(corbaOpType.getReturn().getName(), "return");
assertEquals(corbaOpType.getReturn().getIdltype(), corbaType);
}
}
}
use of javax.wsdl.BindingOperation in project cxf by apache.
the class WSDLToCorbaBindingTest method testMixedArraysMapping.
@Test
public void testMixedArraysMapping() throws Exception {
try {
String fileName = getClass().getResource("/wsdl/arrays-mixed.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 (extElement.getElementType().getLocalPart().equals("binding")) {
BindingType bindingType = (BindingType) extElement;
assertEquals(bindingType.getRepositoryID(), "IDL:X:1.0");
}
}
Iterator<?> tm = model.getExtensibilityElements().iterator();
assertTrue(tm.hasNext());
TypeMappingType tmt = (TypeMappingType) tm.next();
CorbaTypeMap typeMap = CorbaUtils.createCorbaTypeMap(Arrays.asList(tmt));
assertNull("All nested anonymous types should have \"nested\" names", typeMap.getType("item"));
// Checkstyle forces me to split the method...
assertMixedArraysMappingEasyTypes(typeMap);
// elem types are no longer strings from now.
assertMixedArraysMappingDifficultSequences(typeMap);
assertMixedArraysMappingDifficultArrays(typeMap);
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 (extElement.getElementType().getLocalPart().equals("operation")) {
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/", "MixedArrayType", "ns1");
assertEquals(paramtype.getIdltype(), idltype);
assertEquals(paramtype.getMode().toString(), "IN");
} else if (extElement.getElementType().getLocalPart().equals("typeMapping")) {
System.out.println("x");
}
}
}
// 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();
}
}
use of javax.wsdl.BindingOperation 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 (extElement.getElementType().getLocalPart().equals("binding")) {
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 (extElement.getElementType().getLocalPart().equals("operation")) {
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();
}
}
use of javax.wsdl.BindingOperation 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 (extElement.getElementType().getLocalPart().equals("operation")) {
OperationType corbaOpType = (OperationType) extElement;
assertEquals(corbaOpType.getName(), "_get_test_id");
assertEquals(corbaOpType.getReturn().getName(), "return");
assertEquals(corbaOpType.getReturn().getIdltype(), CorbaConstants.NT_CORBA_FLOAT);
}
}
}
Aggregations