use of org.apache.cxf.tools.common.ToolContext in project cxf by apache.
the class AbstractGeneratorTest method testKeep.
@Test
public void testKeep() throws Exception {
gen = new DummyGenerator();
util = new FileWriterUtil(output.toString(), null);
context = new ToolContext();
context.put(ToolConstants.CFG_OUTPUTDIR, output.toString());
gen.setEnvironment(context);
Writer writer = util.getWriter(packageName, className + ".java");
writer.write("hello world");
writer.flush();
writer.close();
context.put(ToolConstants.CFG_GEN_NEW_ONLY, "keep");
assertNull(gen.parseOutputName(packageName, className));
}
use of org.apache.cxf.tools.common.ToolContext in project cxf by apache.
the class InterfaceMapperTest method testMapWithUniqueWsdlLoc.
@Test
public void testMapWithUniqueWsdlLoc() 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");
context.put(ToolConstants.CFG_WSDLLOCATION, "/foo/blah.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("/foo/blah.wsdl", intf.getLocation());
}
use of org.apache.cxf.tools.common.ToolContext in project cxf by apache.
the class WSDLToService method execute.
public void execute(boolean exitOnFinish) {
WSDLToServiceProcessor processor = new WSDLToServiceProcessor();
try {
super.execute(exitOnFinish);
if (!hasInfoOption()) {
ToolContext env = new ToolContext();
env.setParameters(getParametersMap(getArrayKeys()));
if (isVerboseOn()) {
env.put(ToolConstants.CFG_VERBOSE, Boolean.TRUE);
}
env.put(ToolConstants.CFG_CMD_ARG, getArgument());
validate(env);
processor.setEnvironment(env);
processor.process();
}
} catch (ToolException ex) {
if (ex.getCause() instanceof BadUsageException) {
printUsageException(TOOL_NAME, (BadUsageException) ex.getCause());
}
err.println();
err.println("WSDLToService Error : " + ex.getMessage());
if (isVerboseOn()) {
ex.printStackTrace(err);
}
} catch (Exception ex) {
err.println();
err.println("WSDLToService Error : " + ex.getMessage());
if (isVerboseOn()) {
ex.printStackTrace(err);
}
} finally {
tearDown();
}
}
use of org.apache.cxf.tools.common.ToolContext in project cxf by apache.
the class WSDLToSoap method execute.
public void execute(boolean exitOnFinish) {
WSDLToSoapProcessor processor = new WSDLToSoapProcessor();
try {
super.execute(exitOnFinish);
if (!hasInfoOption()) {
ToolContext env = new ToolContext();
env.setParameters(getParametersMap(getArrayKeys()));
if (isVerboseOn()) {
env.put(ToolConstants.CFG_VERBOSE, Boolean.TRUE);
}
env.put(ToolConstants.CFG_CMD_ARG, getArgument());
validate(env);
setEnvParamDefValues(env);
processor.setEnvironment(env);
processor.process();
}
} catch (ToolException ex) {
if (ex.getCause() instanceof BadUsageException) {
printUsageException(TOOL_NAME, (BadUsageException) ex.getCause());
}
err.println();
err.println("WSDLToSoap Error : " + ex.getMessage());
if (isVerboseOn()) {
ex.printStackTrace(err);
}
} catch (Exception ex) {
err.println();
err.println("WSDLToSoap Error : " + ex.getMessage());
if (isVerboseOn()) {
ex.printStackTrace(err);
}
} finally {
tearDown();
}
}
use of org.apache.cxf.tools.common.ToolContext in project cxf by apache.
the class WSDLToXML method execute.
public void execute(boolean exitOnFinish) {
WSDLToXMLProcessor processor = new WSDLToXMLProcessor();
try {
super.execute(exitOnFinish);
if (!hasInfoOption()) {
ToolContext env = new ToolContext();
env.setParameters(getParametersMap(getArrayKeys()));
if (isVerboseOn()) {
env.put(ToolConstants.CFG_VERBOSE, Boolean.TRUE);
}
env.put(ToolConstants.CFG_CMD_ARG, getArgument());
validate(env);
setEnvParamDefValues(env);
processor.setEnvironment(env);
processor.process();
}
} catch (ToolException ex) {
if (ex.getCause() instanceof BadUsageException) {
printUsageException(TOOL_NAME, (BadUsageException) ex.getCause());
}
err.println();
err.println("WSDLToXML Error: " + ex.getMessage());
if (isVerboseOn()) {
ex.printStackTrace(err);
}
} catch (Exception ex) {
err.println();
err.println("WSDLToXML Error: " + ex.getMessage());
if (isVerboseOn()) {
ex.printStackTrace(err);
}
} finally {
tearDown();
}
}
Aggregations