Search in sources :

Example 66 with ToolContext

use of org.apache.cxf.tools.common.ToolContext in project cxf by apache.

the class WSDLValidator method executeForMaven.

public boolean executeForMaven() {
    super.execute(false);
    ToolContext env = getContext();
    env.setParameters(getParametersMap(getArrayKeys()));
    env.put(ToolConstants.CFG_VALIDATE_WSDL, "all");
    env.put(ToolConstants.CFG_CMD_ARG, getArgument());
    WSDL11Validator wsdlValidator = new WSDL11Validator(null, env, getBus());
    return wsdlValidator.isValid();
}
Also used : ToolContext(org.apache.cxf.tools.common.ToolContext) WSDL11Validator(org.apache.cxf.tools.validator.internal.WSDL11Validator)

Example 67 with ToolContext

use of org.apache.cxf.tools.common.ToolContext in project cxf by apache.

the class WSDLValidator method execute.

public void execute(boolean exitOnFinish) {
    try {
        super.execute(exitOnFinish);
        if (!hasInfoOption()) {
            ToolContext env = getContext();
            env.setParameters(getParametersMap(getArrayKeys()));
            env.put(ToolConstants.CFG_VALIDATE_WSDL, "all");
            env.put(ToolConstants.CFG_CMD_ARG, getArgument());
            WSDL11Validator wsdlValidator = new WSDL11Validator(null, env, getBus());
            if (wsdlValidator.isValid()) {
                System.out.println("Passed Validation : Valid WSDL ");
            }
        }
    } catch (ToolException ex) {
        err.println("WSDLValidator Error : " + ex.getMessage());
        if (ex.getCause() instanceof BadUsageException) {
            printUsageException(TOOL_NAME, (BadUsageException) ex.getCause());
        }
        err.println();
        if (isVerboseOn()) {
            err.println("[+] Verbose turned on");
            err.println();
            ex.printStackTrace(err);
        }
    } catch (Exception ex) {
        err.println("WSDLValidator Error : " + ex.getMessage());
        err.println();
        if (isVerboseOn()) {
            err.println("[+] Verbose turned on");
            err.println();
            ex.printStackTrace(err);
        }
    }
}
Also used : BadUsageException(org.apache.cxf.tools.common.toolspec.parser.BadUsageException) ToolContext(org.apache.cxf.tools.common.ToolContext) WSDL11Validator(org.apache.cxf.tools.validator.internal.WSDL11Validator) ToolException(org.apache.cxf.tools.common.ToolException) ToolException(org.apache.cxf.tools.common.ToolException) BadUsageException(org.apache.cxf.tools.common.toolspec.parser.BadUsageException)

Example 68 with ToolContext

use of org.apache.cxf.tools.common.ToolContext in project cxf by apache.

the class JavaToJSProcessorTest method startUp.

@Before
public void startUp() throws Exception {
    env = new ToolContext();
    classPath = System.getProperty("java.class.path");
    System.setProperty("java.class.path", getClassPath());
    if (System.getProperty("java.version").startsWith("9")) {
        System.setProperty("org.apache.cxf.common.util.Compiler-fork", "true");
    }
}
Also used : ToolContext(org.apache.cxf.tools.common.ToolContext) Before(org.junit.Before)

Example 69 with ToolContext

use of org.apache.cxf.tools.common.ToolContext in project cxf by apache.

the class JavaToProcessorTest method startUp.

@Before
public void startUp() throws Exception {
    env = new ToolContext();
    env.put(ToolConstants.CFG_WSDL, ToolConstants.CFG_WSDL);
    classPath = System.getProperty("java.class.path");
    System.setProperty("java.class.path", getClassPath());
    if (System.getProperty("java.version").startsWith("9")) {
        System.setProperty("org.apache.cxf.common.util.Compiler-fork", "true");
    }
}
Also used : ToolContext(org.apache.cxf.tools.common.ToolContext) Before(org.junit.Before)

Aggregations

ToolContext (org.apache.cxf.tools.common.ToolContext)69 Test (org.junit.Test)45 URISyntaxException (java.net.URISyntaxException)35 File (java.io.File)23 ToolException (org.apache.cxf.tools.common.ToolException)13 BadUsageException (org.apache.cxf.tools.common.toolspec.parser.BadUsageException)7 WADLToJava (org.apache.cxf.tools.wadlto.WADLToJava)5 BufferedReader (java.io.BufferedReader)4 Method (java.lang.reflect.Method)4 URLClassLoader (java.net.URLClassLoader)4 QName (javax.xml.namespace.QName)4 Before (org.junit.Before)4 FileReader (java.io.FileReader)3 URI (java.net.URI)3 LinkedHashSet (java.util.LinkedHashSet)3 JavaInterface (org.apache.cxf.tools.common.model.JavaInterface)3 Artifact (org.apache.maven.artifact.Artifact)3 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)3 IOException (java.io.IOException)2 Writer (java.io.Writer)2