use of org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction in project cxf by apache.
the class WSDLToCorbaBindingTypeTest method testNestedInterfaceTypes.
@Test
public void testNestedInterfaceTypes() throws Exception {
try {
String fileName = getClass().getResource("/wsdl/nested_interfaces.wsdl").toString();
generator.setWsdlFile(fileName);
generator.addInterfaceName("C.C1");
Definition model = generator.generateCORBABinding();
Document document = writer.getDocument(model);
Element typemap = getElementNode(document, "corba:typeMapping");
assertNotNull(typemap);
assertEquals(1, typemap.getElementsByTagName("corba:anonstring").getLength());
assertEquals(9, typemap.getElementsByTagName("corba:struct").getLength());
WSDLToIDLAction idlgen = new WSDLToIDLAction();
idlgen.setBindingName("C.C1CORBABinding");
idlgen.setOutputFile("nested_interfaces.idl");
idlgen.generateIDL(model);
File f = new File("nested_interfaces.idl");
assertTrue("nested_interfaces.idl should be generated", f.exists());
} finally {
new File("nested_interfaces.idl").deleteOnExit();
}
}
use of org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction in project cxf by apache.
the class WSDLToCorbaBindingTypeTest method testNillableType.
@Test
public void testNillableType() throws Exception {
try {
String fileName = getClass().getResource("/wsdl/nillable.wsdl").toString();
generator.setWsdlFile(fileName);
generator.addInterfaceName("NillablePortType");
Definition model = generator.generateCORBABinding();
Document document = writer.getDocument(model);
Element typemap = getElementNode(document, "corba:typeMapping");
assertNotNull(typemap);
assertEquals(2, typemap.getElementsByTagName("corba:union").getLength());
assertEquals(1, typemap.getElementsByTagName("corba:struct").getLength());
TypeMappingType mapType = (TypeMappingType) model.getExtensibilityElements().get(0);
WSDLToIDLAction idlgen = new WSDLToIDLAction();
idlgen.setBindingName("NillableCORBABinding");
idlgen.setOutputFile("nillable.idl");
idlgen.generateIDL(model);
Union un = (Union) mapType.getStructOrExceptionOrUnion().get(2);
assertEquals("Name is incorrect for Union Type", "long_nil", un.getName());
assertEquals("Type is incorrect for Union Type", "PEl", un.getType().getLocalPart());
Unionbranch unbranch = un.getUnionbranch().get(0);
assertEquals("Name is incorrect for UnionBranch Type", "value", unbranch.getName());
assertEquals("Type is incorrect for UnionBranch Type", "long", unbranch.getIdltype().getLocalPart());
File f = new File("nillable.idl");
assertTrue("nillable.idl should be generated", f.exists());
} finally {
new File("nillable.idl").deleteOnExit();
}
}
use of org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction in project cxf by apache.
the class WSDLToCorbaBindingTypeTest method testWsAddressingBankType.
@Test
public void testWsAddressingBankType() throws Exception {
try {
String fileName = getClass().getResource("/wsdl/wsaddressing_account.wsdl").toString();
generator.setWsdlFile(fileName);
generator.addInterfaceName("Account");
Definition model = generator.generateCORBABinding();
Document document = writer.getDocument(model);
Element typemap = getElementNode(document, "corba:typeMapping");
assertNotNull(typemap);
assertEquals(1, typemap.getElementsByTagName("corba:object").getLength());
WSDLToIDLAction idlgen = new WSDLToIDLAction();
idlgen.setBindingName("AccountCORBABinding");
idlgen.setOutputFile("wsaddressing_account.idl");
idlgen.generateIDL(model);
File f = new File("wsaddressing_account.idl");
assertTrue("wsaddressing_account.idl should be generated", f.exists());
} finally {
new File("wsaddressing_account.idl").deleteOnExit();
}
}
use of org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction in project cxf by apache.
the class WSDLToIDLGenerationTest method setUp.
@Before
public void setUp() {
System.setProperty("WSDLTOIDLGeneration", "false");
idlgen = new WSDLToIDLAction();
idloutput = new ByteArrayOutputStream();
}
use of org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction in project cxf by apache.
the class WSDLToCorbaBindingTest method testSequenceType.
@Test
public void testSequenceType() throws Exception {
try {
String fileName = getClass().getResource("/wsdl/sequencetype.wsdl").toString();
generator.setWsdlFile(fileName);
generator.addInterfaceName("IACC.Server");
Definition model = generator.generateCORBABinding();
Document document = writer.getDocument(model);
Element typemap = getElementNode(document, "corba:typeMapping");
assertNotNull(typemap);
assertEquals(2, typemap.getElementsByTagName("corba:sequence").getLength());
assertEquals(5, typemap.getElementsByTagName("corba:exception").getLength());
assertEquals(70, typemap.getElementsByTagName("corba:struct").getLength());
WSDLToIDLAction idlgen = new WSDLToIDLAction();
idlgen.setBindingName("IACC.ServerCORBABinding");
idlgen.setOutputFile("sequencetype.idl");
idlgen.generateIDL(model);
File f = new File("sequencetype.idl");
assertTrue("sequencetype.idl should be generated", f.exists());
} finally {
new File("sequencetype.idl").deleteOnExit();
}
}
Aggregations