use of org.apache.cxf.javascript.fortest.GenericGenericClass in project cxf by apache.
the class GenericAegisTest method testGenerateJavascript.
// the claim is that code generation makes this go boom.
@Test
public void testGenerateJavascript() throws Exception {
// Create our service implementation
GenericGenericClass<String> impl = new GenericGenericClass<String>();
// Create our Server
ServerFactoryBean svrFactory = new ServerFactoryBean();
// we sure can't get a .class for the interface, can we?
svrFactory.setServiceClass(impl.getClass());
svrFactory.setAddress("http://localhost:" + PORT + "/aegisgeneric");
svrFactory.setServiceBean(impl);
Server server = svrFactory.create();
ServiceInfo serviceInfo = ((EndpointImpl) server.getEndpoint()).getEndpointInfo().getService();
Collection<SchemaInfo> schemata = serviceInfo.getSchemas();
BasicNameManager nameManager = BasicNameManager.newNameManager(serviceInfo);
NamespacePrefixAccumulator prefixManager = new NamespacePrefixAccumulator(serviceInfo.getXmlSchemaCollection());
for (SchemaInfo schema : schemata) {
SchemaJavascriptBuilder builder = new SchemaJavascriptBuilder(serviceInfo.getXmlSchemaCollection(), prefixManager, nameManager);
String allThatJavascript = builder.generateCodeForSchema(schema.getSchema());
assertNotNull(allThatJavascript);
}
ServiceJavascriptBuilder serviceBuilder = new ServiceJavascriptBuilder(serviceInfo, null, prefixManager, nameManager);
serviceBuilder.walk();
String serviceJavascript = serviceBuilder.getCode();
assertNotNull(serviceJavascript);
}
Aggregations