Search in sources :

Example 1 with WsimportOptions

use of com.sun.tools.ws.wscompile.WsimportOptions in project metro-jax-ws by eclipse-ee4j.

the class WsimportOptionsTest method testParseArgument_jaxws1102.

/**
 * Test of parseArguments(String[]) method, of class WsimportOptions.
 */
public void testParseArgument_jaxws1102() throws Exception {
    WsimportOptions options = new WsimportOptions();
    SchemaCompiler sc = options.getSchemaCompiler();
    options.parseArguments(new String[0]);
    assertNull("ws encoding set", options.encoding);
    assertNull("xjc encoding set", sc.getOptions().encoding);
    options = new WsimportOptions();
    sc = options.getSchemaCompiler();
    String[] args = { "-encoding", "UTF-8" };
    options.parseArguments(args);
    assertNotNull("ws encoding not set", options.encoding);
    assertEquals("UTF-8", options.encoding);
    assertNotNull("xjc encoding not set", sc.getOptions().encoding);
    assertEquals("UTF-8", sc.getOptions().encoding);
    options = new WsimportOptions();
    sc = options.getSchemaCompiler();
    args = new String[] { "-encoding", "UTF-8", "-B-encoding", "UTF-16" };
    options.parseArguments(args);
    assertNotNull("ws encoding not set", options.encoding);
    assertEquals("UTF-8", options.encoding);
    assertNotNull("xjc encoding not set", sc.getOptions().encoding);
    assertEquals("UTF-16", sc.getOptions().encoding);
    options = new WsimportOptions();
    sc = options.getSchemaCompiler();
    args = new String[] { "-B-encoding", "UTF-16" };
    options.parseArguments(args);
    assertNull("ws encoding set", options.encoding);
    assertNotNull("xjc encoding not set", sc.getOptions().encoding);
    assertEquals("UTF-16", sc.getOptions().encoding);
}
Also used : WsimportOptions(com.sun.tools.ws.wscompile.WsimportOptions) SchemaCompiler(com.sun.tools.xjc.api.SchemaCompiler)

Example 2 with WsimportOptions

use of com.sun.tools.ws.wscompile.WsimportOptions in project metro-jax-ws by eclipse-ee4j.

the class WSDLParserTest method testParsePolicy15.

public void testParsePolicy15() throws Exception {
    final ErrorReceiverFilter errorReceiver = createErrorReceiver();
    final InputSource source = getResourceSource("policy15.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());
}
Also used : WSDLDocument(com.sun.tools.ws.wsdl.document.WSDLDocument) InputSource(org.xml.sax.InputSource) ErrorReceiverFilter(com.sun.tools.ws.wscompile.ErrorReceiverFilter) WsimportOptions(com.sun.tools.ws.wscompile.WsimportOptions) WSDLParser(com.sun.tools.ws.wsdl.parser.WSDLParser)

Example 3 with WsimportOptions

use of com.sun.tools.ws.wscompile.WsimportOptions in project metro-jax-ws by eclipse-ee4j.

the class WSDLParserTest method testParseEmpty.

public void testParseEmpty() throws Exception {
    final ErrorReceiverFilter errorReceiver = new ErrorReceiverFilter();
    final InputSource source = getResourceSource("empty.wsdl");
    final WsimportOptions options = new WsimportOptions();
    options.addWSDL(source);
    final WSDLParser instance = new WSDLParser(options, errorReceiver, null);
    final WSDLDocument wsdl = instance.parse();
    assertNull(wsdl);
    assertTrue(errorReceiver.hadError());
}
Also used : WSDLDocument(com.sun.tools.ws.wsdl.document.WSDLDocument) InputSource(org.xml.sax.InputSource) ErrorReceiverFilter(com.sun.tools.ws.wscompile.ErrorReceiverFilter) WsimportOptions(com.sun.tools.ws.wscompile.WsimportOptions) WSDLParser(com.sun.tools.ws.wsdl.parser.WSDLParser)

Example 4 with WsimportOptions

use of com.sun.tools.ws.wscompile.WsimportOptions in project metro-jax-ws by eclipse-ee4j.

the class WSDLParserTest method testParsePolicy12.

public void testParsePolicy12() throws Exception {
    final ErrorReceiverFilter errorReceiver = createErrorReceiver();
    final InputSource source = getResourceSource("policy12.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());
}
Also used : WSDLDocument(com.sun.tools.ws.wsdl.document.WSDLDocument) InputSource(org.xml.sax.InputSource) ErrorReceiverFilter(com.sun.tools.ws.wscompile.ErrorReceiverFilter) WsimportOptions(com.sun.tools.ws.wscompile.WsimportOptions) WSDLParser(com.sun.tools.ws.wsdl.parser.WSDLParser)

Example 5 with WsimportOptions

use of com.sun.tools.ws.wscompile.WsimportOptions in project metro-jax-ws by eclipse-ee4j.

the class WSDLParserTest method testParseSimpleSystemIdNull.

public void testParseSimpleSystemIdNull() throws Exception {
    final ErrorReceiverFilter errorReceiver = new ErrorReceiverFilter();
    final InputSource source = getResourceSource("simple.wsdl");
    source.setSystemId(null);
    final WsimportOptions options = new WsimportOptions();
    options.addWSDL(source);
    try {
        final WSDLParser instance = new WSDLParser(options, errorReceiver, null);
        final WSDLDocument wsdl = instance.parse();
        fail("Expected IllegalArgumentException, instead got " + wsdl);
    } catch (IllegalArgumentException e) {
    // expected
    }
}
Also used : WSDLDocument(com.sun.tools.ws.wsdl.document.WSDLDocument) InputSource(org.xml.sax.InputSource) ErrorReceiverFilter(com.sun.tools.ws.wscompile.ErrorReceiverFilter) WsimportOptions(com.sun.tools.ws.wscompile.WsimportOptions) WSDLParser(com.sun.tools.ws.wsdl.parser.WSDLParser)

Aggregations

WsimportOptions (com.sun.tools.ws.wscompile.WsimportOptions)9 ErrorReceiverFilter (com.sun.tools.ws.wscompile.ErrorReceiverFilter)7 WSDLDocument (com.sun.tools.ws.wsdl.document.WSDLDocument)7 WSDLParser (com.sun.tools.ws.wsdl.parser.WSDLParser)7 InputSource (org.xml.sax.InputSource)7 SchemaCompiler (com.sun.tools.xjc.api.SchemaCompiler)1