use of com.sun.tools.ws.wscompile.ErrorReceiverFilter in project metro-jax-ws by eclipse-ee4j.
the class WSDLParserTest method createErrorReceiver.
private static ErrorReceiverFilter createErrorReceiver() {
class Listener extends WsimportListener {
ConsoleErrorReporter cer = new ConsoleErrorReporter(System.err);
@Override
public void generatedFile(String fileName) {
message(fileName);
}
@Override
public void message(String msg) {
System.out.println(msg);
}
@Override
public void error(SAXParseException exception) {
cer.error(exception);
}
@Override
public void fatalError(SAXParseException exception) {
cer.fatalError(exception);
}
@Override
public void warning(SAXParseException exception) {
cer.warning(exception);
}
@Override
public void debug(SAXParseException exception) {
cer.debug(exception);
}
@Override
public void info(SAXParseException exception) {
cer.info(exception);
}
public void enableDebugging() {
cer.enableDebugging();
}
}
final Listener listener = new Listener();
ErrorReceiverFilter errorReceiver = new ErrorReceiverFilter(listener) {
public void info(SAXParseException exception) {
super.info(exception);
}
public void warning(SAXParseException exception) {
super.warning(exception);
}
@Override
public void pollAbort() throws AbortException {
if (listener.isCanceled()) {
throw new AbortException();
}
}
@Override
public void debug(SAXParseException exception) {
listener.debug(exception);
}
};
return errorReceiver;
}
use of com.sun.tools.ws.wscompile.ErrorReceiverFilter in project metro-jax-ws by eclipse-ee4j.
the class WSDLParserTest method testParseSimple.
public void testParseSimple() throws Exception {
final ErrorReceiverFilter errorReceiver = createErrorReceiver();
final InputSource source = getResourceSource("simple.wsdl");
final WsimportOptions options = new WsimportOptions();
options.addWSDL(source);
final WSDLParser instance = new WSDLParser(options, errorReceiver, null);
final WSDLDocument wsdl = instance.parse();
assertNotNull(wsdl);
assertFalse(errorReceiver.hadError());
}
use of com.sun.tools.ws.wscompile.ErrorReceiverFilter in project metro-jax-ws by eclipse-ee4j.
the class WSDLParserTest method testParseUsingPolicy.
public void testParseUsingPolicy() throws Exception {
final ErrorReceiverFilter errorReceiver = createErrorReceiver();
final InputSource source = getResourceSource("usingpolicy.wsdl");
final WsimportOptions options = new WsimportOptions();
options.addWSDL(source);
final WSDLParser instance = new WSDLParser(options, errorReceiver, null);
final WSDLDocument wsdl = instance.parse();
assertNotNull(wsdl);
assertFalse(errorReceiver.hadError());
}
Aggregations