use of javax.wsdl.Definition in project cxf by apache.
the class WSDLToIDLTest method testBindingGenDefault.
@Test
public void testBindingGenDefault() throws Exception {
String[] cmdArgs = { "-corba", "-i", "BasePortType", "-d", output.getRoot().toString(), getClass().getResource("/wsdl/simpleList.wsdl").toString() };
String error = execute(cmdArgs);
assertNull("WSDLToIDL Failed", error);
File f = new File(output.getRoot(), "simpleList-corba.wsdl");
assertTrue("simpleList-corba.wsdl should be generated", f.exists());
WSDLToProcessor proc = new WSDLToProcessor();
try {
proc.parseWSDL(f.getAbsolutePath());
Definition model = proc.getWSDLDefinition();
assertNotNull("WSDL Definition Should not be Null", model);
QName bindingName = new QName("http://schemas.apache.org/tests", "BaseCORBABinding");
assertNotNull("Binding Node not found in WSDL", model.getBinding(bindingName));
} catch (Exception e) {
fail("WSDLToCORBA generated an invalid simpleList-corba.wsdl");
}
}
use of javax.wsdl.Definition in project cxf by apache.
the class WSDLToIDLTest method testBindingGenSpecifiedFile.
@Test
public void testBindingGenSpecifiedFile() throws Exception {
String[] cmdArgs = { "-corba", "-i", "BasePortType", "-w", "simpleList-corba_gen.wsdl", "-d", output.getRoot().toString(), getClass().getResource("/wsdl/simpleList.wsdl").toString() };
String error = execute(cmdArgs);
assertNull("WSDLToIDL Failed", error);
File f = new File(output.getRoot(), "simpleList-corba_gen.wsdl");
assertTrue("simpleList-corba_gen.wsdl should be generated", f.exists());
WSDLToProcessor proc = new WSDLToProcessor();
try {
proc.parseWSDL(f.toString());
Definition model = proc.getWSDLDefinition();
assertNotNull("WSDL Definition Should not be Null", model);
QName bindingName = new QName("http://schemas.apache.org/tests", "BaseCORBABinding");
assertNotNull("Binding Node not found in WSDL", model.getBinding(bindingName));
} catch (Exception e) {
fail("WSDLToIDL generated an invalid simpleList-corba.wsdl");
}
}
use of javax.wsdl.Definition in project cxf by apache.
the class WSDLToCorbaBindingTest method testComplexContentStructType.
@Test
public void testComplexContentStructType() throws Exception {
try {
String fileName = getClass().getResource("/wsdl/content.wsdl").toString();
generator.setWsdlFile(fileName);
generator.addInterfaceName("ContentPortType");
Definition model = generator.generateCORBABinding();
Document document = writer.getDocument(model);
Element typemap = getElementNode(document, "corba:typeMapping");
// assertNotNull(typemap);
assertEquals(1, typemap.getElementsByTagName("corba:union").getLength());
assertEquals(6, typemap.getElementsByTagName("corba:struct").getLength());
WSDLToIDLAction idlgen = new WSDLToIDLAction();
idlgen.setBindingName("ContentCORBABinding");
idlgen.setOutputFile("content.idl");
idlgen.generateIDL(model);
File f = new File("content.idl");
assertTrue("content.idl should be generated", f.exists());
} finally {
new File("content.idl").deleteOnExit();
}
}
use of javax.wsdl.Definition in project cxf by apache.
the class WSDLToCorbaBindingTest method testFixedBindingGeneration.
@Test
public void testFixedBindingGeneration() throws Exception {
String fileName = getClass().getResource("/wsdl/fixed.wsdl").toString();
generator.setWsdlFile(fileName);
generator.addInterfaceName("Y");
Definition model = generator.generateCORBABinding();
Document document = writer.getDocument(model);
Element typemap = getElementNode(document, "corba:typeMapping");
assertEquals(1, typemap.getElementsByTagName("corba:sequence").getLength());
assertEquals(5, typemap.getElementsByTagName("corba:fixed").getLength());
Element bindingElement = getElementNode(document, "binding");
assertEquals(5, bindingElement.getElementsByTagName("corba:operation").getLength());
QName bName = new QName("http://schemas.apache.org/idl/fixed.idl", "YCORBABinding", "tns");
Binding binding = model.getBinding(bName);
TypeMappingType mapType = (TypeMappingType) model.getExtensibilityElements().get(0);
Map<String, CorbaType> tmap = new HashMap<>();
for (CorbaType type : mapType.getStructOrExceptionOrUnion()) {
tmap.put(type.getName(), type);
}
Iterator<?> j = binding.getBindingOperations().iterator();
while (j.hasNext()) {
BindingOperation bindingOperation = (BindingOperation) j.next();
assertEquals("YCORBABinding", binding.getQName().getLocalPart());
assertEquals(1, bindingOperation.getExtensibilityElements().size());
checkFixedTypeOne(bindingOperation, tmap);
bindingOperation = (BindingOperation) j.next();
checkSequenceType(bindingOperation, tmap);
bindingOperation = (BindingOperation) j.next();
checkFixedTypeTwo(bindingOperation, tmap);
bindingOperation = (BindingOperation) j.next();
checkFixedTypeThree(bindingOperation, tmap);
bindingOperation = (BindingOperation) j.next();
checkFixedTypeFour(bindingOperation, tmap);
}
}
use of javax.wsdl.Definition in project cxf by apache.
the class WSDLToCorbaBindingTest method testMultipartCORBABindingGeneration.
@Test
public void testMultipartCORBABindingGeneration() throws Exception {
String fileName = getClass().getResource("/wsdl/multipart.wsdl").toString();
generator.setWsdlFile(fileName);
generator.addInterfaceName("Test.MultiPart");
Definition model = generator.generateCORBABinding();
QName bName = new QName("http://schemas.apache.org/tests", "Test.MultiPartCORBABinding", "tns");
Binding binding = model.getBinding(bName);
assertNotNull(binding);
assertEquals("Test.MultiPartCORBABinding", binding.getQName().getLocalPart());
assertEquals("Test.MultiPart", binding.getPortType().getQName().getLocalPart());
assertEquals(1, binding.getExtensibilityElements().size());
assertEquals(32, binding.getBindingOperations().size());
List<ExtensibilityElement> extElements = getExtensibilityElements(binding);
ExtensibilityElement extElement = extElements.get(0);
if ("binding".equals(extElement.getElementType().getLocalPart())) {
BindingType bindingType = (BindingType) extElement;
assertEquals(bindingType.getRepositoryID(), "IDL:Test/MultiPart:1.0");
}
getStringAttributeTest(binding);
getTestIdTest(binding);
setTestIdTest(binding);
testVoidTest(binding);
testPrimitiveTypeTest(binding, "test_short", CorbaConstants.NT_CORBA_SHORT);
testPrimitiveTypeTest(binding, "test_long", CorbaConstants.NT_CORBA_LONG);
testPrimitiveTypeTest(binding, "test_longlong", CorbaConstants.NT_CORBA_LONGLONG);
testPrimitiveTypeTest(binding, "test_ushort", CorbaConstants.NT_CORBA_USHORT);
testPrimitiveTypeTest(binding, "test_ulong", CorbaConstants.NT_CORBA_ULONG);
testPrimitiveTypeTest(binding, "test_ulonglong", CorbaConstants.NT_CORBA_ULONGLONG);
testPrimitiveTypeTest(binding, "test_float", CorbaConstants.NT_CORBA_FLOAT);
testPrimitiveTypeTest(binding, "test_double", CorbaConstants.NT_CORBA_DOUBLE);
testPrimitiveTypeTest(binding, "test_octet", CorbaConstants.NT_CORBA_OCTET);
testPrimitiveTypeTest(binding, "test_boolean", CorbaConstants.NT_CORBA_BOOLEAN);
testPrimitiveTypeTest(binding, "test_char", CorbaConstants.NT_CORBA_CHAR);
testPrimitiveTypeTest(binding, "test_integer", CorbaConstants.NT_CORBA_LONGLONG);
testPrimitiveTypeTest(binding, "test_nonNegativeInteger", CorbaConstants.NT_CORBA_ULONGLONG);
testPrimitiveTypeTest(binding, "test_positiveInteger", CorbaConstants.NT_CORBA_ULONGLONG);
testPrimitiveTypeTest(binding, "test_negativeInteger", CorbaConstants.NT_CORBA_LONGLONG);
testPrimitiveTypeTest(binding, "test_normalizedString", CorbaConstants.NT_CORBA_STRING);
testPrimitiveTypeTest(binding, "test_token", CorbaConstants.NT_CORBA_STRING);
testPrimitiveTypeTest(binding, "test_language", CorbaConstants.NT_CORBA_STRING);
testPrimitiveTypeTest(binding, "test_Name", CorbaConstants.NT_CORBA_STRING);
testPrimitiveTypeTest(binding, "test_NCName", CorbaConstants.NT_CORBA_STRING);
testPrimitiveTypeTest(binding, "test_ID", CorbaConstants.NT_CORBA_STRING);
testPrimitiveTypeTest(binding, "test_anyURI", CorbaConstants.NT_CORBA_STRING);
testPrimitiveTypeTest(binding, "test_nick_name", CorbaConstants.NT_CORBA_STRING);
}
Aggregations