use of org.apache.cxf.tools.common.ToolContext in project cxf by apache.
the class ParameterProcessorTest method testAddParameter.
@Test
public void testAddParameter() throws Exception {
ParameterProcessor processor = new ParameterProcessor(new ToolContext());
JavaMethod method = new JavaMethod();
JavaParameter p1 = new JavaParameter("request", String.class.getName(), null);
p1.setStyle(JavaType.Style.IN);
processor.addParameter(null, method, p1);
JavaParameter p2 = new JavaParameter("request", String.class.getName(), null);
p2.setStyle(JavaType.Style.OUT);
processor.addParameter(null, method, p2);
assertEquals(1, method.getParameters().size());
assertEquals(JavaType.Style.INOUT, method.getParameters().get(0).getStyle());
}
use of org.apache.cxf.tools.common.ToolContext in project cxf by apache.
the class InterfaceMapperTest method testMap.
@Test
public void testMap() throws Exception {
InterfaceInfo interfaceInfo = new InterfaceInfo(new ServiceInfo(), new QName("http://apache.org/hello_world_soap_http", "interfaceTest"));
ToolContext context = new ToolContext();
context.put(ToolConstants.CFG_WSDLURL, "http://localhost/?wsdl");
JavaInterface intf = new InterfaceMapper(context).map(interfaceInfo);
assertNotNull(intf);
assertEquals("interfaceTest", intf.getWebServiceName());
assertEquals("InterfaceTest", intf.getName());
assertEquals("http://apache.org/hello_world_soap_http", intf.getNamespace());
assertEquals("org.apache.hello_world_soap_http", intf.getPackageName());
assertEquals("http://localhost/?wsdl", intf.getLocation());
}
use of org.apache.cxf.tools.common.ToolContext in project cxf by apache.
the class JavaToWSTest method setUpResource.
@Before
public void setUpResource() throws Exception {
super.setUp();
env = new ToolContext();
cp = System.getProperty("java.class.path");
URL url = getClass().getResource(".");
output = new File(url.toURI());
System.setProperty("java.class.path", getClassPath());
output = new File(output, "/generated/");
FileUtils.mkDir(output);
classDir = new File(output, "/classes/");
FileUtils.mkDir(classDir);
}
use of org.apache.cxf.tools.common.ToolContext in project cxf by apache.
the class JAXRSContainerTest method testCodeGenInterfacesCustomPackage.
@Test
public void testCodeGenInterfacesCustomPackage() {
try {
JAXRSContainer container = new JAXRSContainer(null);
ToolContext context = new ToolContext();
context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/bookstore.xml"));
context.put(WadlToolConstants.CFG_PACKAGENAME, "custom.books");
context.put(WadlToolConstants.CFG_COMPILE, "true");
container.setContext(context);
container.execute();
assertNotNull(output.list());
verifyFiles("java", true, false, "superbooks", "custom.books", 11, true);
verifyFiles("class", true, false, "superbooks", "custom.books", 11, true);
} catch (Exception e) {
e.printStackTrace();
fail();
}
}
use of org.apache.cxf.tools.common.ToolContext in project cxf by apache.
the class JAXRSContainerTest method testCodeGenInterfacesMultipleInXmlReps.
@Test
public void testCodeGenInterfacesMultipleInXmlReps() {
try {
JAXRSContainer container = new JAXRSContainer(null);
ToolContext context = new ToolContext();
context.put(WadlToolConstants.CFG_OUTPUTDIR, output.getCanonicalPath());
context.put(WadlToolConstants.CFG_WADLURL, getLocation("/wadl/bookstore.xml"));
context.put(WadlToolConstants.CFG_COMPILE, "true");
context.put(WadlToolConstants.CFG_MULTIPLE_XML_REPS, "true");
container.setContext(context);
container.execute();
assertNotNull(output.list());
verifyFiles("java", true, false, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 11, true);
verifyFiles("class", true, false, "superbooks", "org.apache.cxf.jaxrs.model.wadl", 11, true);
} catch (Exception e) {
e.printStackTrace();
fail();
}
}
Aggregations