use of org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction in project cxf by apache.
the class WSDLToCorbaBindingTypeTest method testWsAddressingAccountType.
@Test
public void testWsAddressingAccountType() throws Exception {
try {
String fileName = getClass().getResource("/wsdl/wsaddressing_bank.wsdl").toString();
generator.setWsdlFile(fileName);
generator.addInterfaceName("Bank");
Definition model = generator.generateCORBABinding();
Document document = writer.getDocument(model);
Element typemap = getElementNode(document, "corba:typeMapping");
assertNotNull(typemap);
assertEquals(1, DOMUtils.findAllElementsByTagNameNS(typemap, "http://cxf.apache.org/bindings/corba", "sequence").size());
assertEquals(2, DOMUtils.findAllElementsByTagNameNS(typemap, "http://cxf.apache.org/bindings/corba", "object").size());
WSDLToIDLAction idlgen = new WSDLToIDLAction();
idlgen.setBindingName("BankCORBABinding");
idlgen.setOutputFile("wsaddressing_bank.idl");
idlgen.generateIDL(model);
File f = new File("wsaddressing_bank.idl");
assertTrue("wsaddressing_bank.idl should be generated", f.exists());
} finally {
new File("wsaddressing_bank.idl").deleteOnExit();
}
}
use of org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction in project cxf by apache.
the class WSDLToCorbaBindingTypeTest method testTypeInheritance.
// tests Type Inheritance and attributes.
@Test
public void testTypeInheritance() throws Exception {
try {
String fileName = getClass().getResource("/wsdl/TypeInheritance.wsdl").toString();
generator.setWsdlFile(fileName);
generator.addInterfaceName("TypeInheritancePortType");
Definition model = generator.generateCORBABinding();
Document document = writer.getDocument(model);
Element typemap = getElementNode(document, "corba:typeMapping");
assertNotNull(typemap);
assertEquals(3, typemap.getElementsByTagName("corba:union").getLength());
assertEquals(1, typemap.getElementsByTagName("corba:anonstring").getLength());
assertEquals(17, typemap.getElementsByTagName("corba:struct").getLength());
TypeMappingType mapType = (TypeMappingType) model.getExtensibilityElements().get(0);
WSDLToIDLAction idlgen = new WSDLToIDLAction();
idlgen.setBindingName("TypeInheritanceCORBABinding");
idlgen.setOutputFile("typeInherit.idl");
idlgen.generateIDL(model);
List<CorbaType> types = mapType.getStructOrExceptionOrUnion();
for (int i = 0; i < types.size(); i++) {
CorbaType type = types.get(i);
if ("Type5SequenceStruct".equals(type.getName())) {
assertTrue("Name is incorrect for Type5SequenceStruct Type", type instanceof Struct);
assertEquals("Type is incorrect for AnonSequence Type", "Type5", type.getType().getLocalPart());
} else if ("attrib2Type".equals(type.getName())) {
assertTrue("Name is incorrect for attrib2Type Type", type instanceof Anonstring);
assertEquals("Type is incorrect for AnonString Type", "string", type.getType().getLocalPart());
} else if ("attrib2Type_nil".equals(type.getName())) {
assertTrue("Name is incorrect for Struct Type", type instanceof Union);
assertEquals("Type is incorrect for AnonSequence Type", "attrib2", type.getType().getLocalPart());
}
}
File f = new File("typeInherit.idl");
assertTrue("typeInherit.idl should be generated", f.exists());
} finally {
new File("typeInherit.idl").deleteOnExit();
}
}
Aggregations