use of org.apache.cxf.binding.corba.wsdl.Array in project cxf by apache.
the class WSDLToCorbaBindingTypeTest method testAnonType.
// tests anonymous arrays and sequences
@Test
public void testAnonType() throws Exception {
try {
String fileName = getClass().getResource("/wsdl/atype.wsdl").toString();
generator.setWsdlFile(fileName);
generator.addInterfaceName("X");
Definition model = generator.generateCORBABinding();
Document document = writer.getDocument(model);
Element typemap = getElementNode(document, "corba:typeMapping");
assertNotNull(typemap);
assertEquals(3, typemap.getElementsByTagName("corba:anonsequence").getLength());
assertEquals(2, typemap.getElementsByTagName("corba:anonarray").getLength());
assertEquals(1, typemap.getElementsByTagName("corba:array").getLength());
assertEquals(2, typemap.getElementsByTagName("corba:struct").getLength());
TypeMappingType mapType = (TypeMappingType) model.getExtensibilityElements().get(0);
Map<String, CorbaType> tmap = new HashMap<>();
for (CorbaType type : mapType.getStructOrExceptionOrUnion()) {
tmap.put(type.getName(), type);
}
WSDLToIDLAction idlgen = new WSDLToIDLAction();
idlgen.setBindingName("XCORBABinding");
idlgen.setOutputFile("atype.idl");
idlgen.generateIDL(model);
Array arr = (Array) tmap.get("X.A");
assertNotNull(arr);
assertEquals("ElementType is incorrect for Array Type", "X._5_A", arr.getElemtype().getLocalPart());
Anonarray arr2 = (Anonarray) tmap.get("X._5_A");
assertNotNull(arr2);
assertEquals("ElementType is incorrect for Anon Array Type", "X._4_A", arr2.getElemtype().getLocalPart());
Anonarray arr3 = (Anonarray) tmap.get("X._4_A");
assertNotNull(arr3);
assertEquals("ElementType is incorrect for Anon Array Type", "X._1_A", arr3.getElemtype().getLocalPart());
Anonsequence seq = (Anonsequence) tmap.get("X._1_A");
assertNotNull(seq);
assertEquals("ElementType is incorrect for Anon Sequence Type", "X._2_A", seq.getElemtype().getLocalPart());
Anonsequence seq2 = (Anonsequence) tmap.get("X._2_A");
assertNotNull(seq2);
assertEquals("ElementType is incorrect for Anon Sequence Type", "X._3_A", seq2.getElemtype().getLocalPart());
Anonsequence seq3 = (Anonsequence) tmap.get("X._3_A");
assertNotNull(seq3);
assertEquals("ElementType is incorrect for Anon Sequence Type", "long", seq3.getElemtype().getLocalPart());
File f = new File("atype.idl");
assertTrue("atype.idl should be generated", f.exists());
} finally {
new File("atype.idl").deleteOnExit();
}
}
Aggregations