Package com.eviware.soapui.SoapUIExtensionClassLoader

Examples of com.eviware.soapui.SoapUIExtensionClassLoader.SoapUIClassLoaderState


     * @param sessionName
     * @return hermes.Hermes
     * @throws NamingException
     */
    public static Hermes getHermes(WsdlProject project, String sessionName) throws NamingException {
        SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();
        try {
            Context ctx = hermesContext(project);

            Hermes hermes = (Hermes) ctx.lookup(sessionName);
            return hermes;
        } catch (NamingException ne) {
            UISupport
                    .showErrorMessage("Hermes configuration is not valid. Please check that 'Hermes Config' project property is set to path of proper hermes-config.xml file");
            SoapUI.logError(ne, "Error when trying to find JMS session");
            throw new NamingException("Session name '" + sessionName
                    + "' does not exist in Hermes configuration or path to Hermes config ( " + project.getHermesConfig()
                    + " )is not valid!");
        } catch (MalformedURLException mue) {
            SoapUI.logError(mue);
        } catch (IOException ioe) {
            SoapUI.logError(ioe);
        } finally {
            state.restore();
        }
        return null;
    }
View Full Code Here


    private SchemaTypeLoader soapSchema;
    private XmlObject soapSchemaXml;
    private XmlObject soapEncodingXml;

    private SoapVersion12() {
        SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();

        try {
            // soapSchemaXml = XmlObject.Factory.parse( SoapUI.class
            // .getResource(
            // "/com/eviware/soapui/resources/xsds/soapEnvelope12.xsd" ) );
            soapSchemaXml = XmlUtils.createXmlObject(SoapUI.class
                    .getResource("/com/eviware/soapui/resources/xsds/soapEnvelope12.xsd"));
            soapSchema = XmlBeans.loadXsd(new XmlObject[]{soapSchemaXml});
            // soapEncodingXml = XmlObject.Factory.parse( SoapUI.class
            // .getResource(
            // "/com/eviware/soapui/resources/xsds/soapEncoding12.xsd" ) );
            soapEncodingXml = XmlUtils.createXmlObject(SoapUI.class
                    .getResource("/com/eviware/soapui/resources/xsds/soapEncoding12.xsd"));
        } catch (Exception e) {
            SoapUI.logError(e);
        } finally {
            state.restore();
        }
    }
View Full Code Here

    public String expand(PropertyExpansionContext context, String content) {
        return expand(context, content, false);
    }

    public String expand(PropertyExpansionContext context, String content, boolean entitize) {
        SoapUIClassLoaderState clState = SoapUIExtensionClassLoader.ensure();

        try {

            if (StringUtils.isNullOrEmpty(content)) {
                return content;
            }

            int ix = content.indexOf("${");
            if (ix == -1) {
                return content;
            }

            StringBuffer buf = new StringBuffer();
            int lastIx = 0;
            while (ix != -1) {
                if (ix > lastIx && content.charAt(ix - 1) == '$') {
                    buf.append(content.substring(lastIx, ix - 1));
                    lastIx = ix;
                    ix = content.indexOf("${", lastIx + 1);
                    continue;
                }

                if (ix > lastIx) {
                    buf.append(content.substring(lastIx, ix));
                }

                int ix2 = content.indexOf('}', ix + 2);
                if (ix2 == -1) {
                    break;
                }

                // check for nesting
                int ix3 = content.lastIndexOf("${", ix2);
                if (ix3 != ix) {
                    // buf.append( content.substring( ix, ix3 ));
                    content = content.substring(0, ix3) + expand(context, content.substring(ix3, ix2 + 1))
                            + content.substring(ix2 + 1);

                    lastIx = ix;
                    continue;
                }

                String propertyName = content.substring(ix + 2, ix2);
                String propertyValue = null;

                if (StringUtils.hasContent(propertyName)) {
                    boolean globalOverrideEnabled = SoapUI.getSettings().getBoolean(GlobalPropertySettings.ENABLE_OVERRIDE);

                    for (int c = 0; c < propertyResolvers.size() && propertyValue == null; c++) {
                        propertyValue = propertyResolvers.get(c).resolveProperty(context, propertyName,
                                globalOverrideEnabled);
                    }
                }

                // found a value?
                if (propertyValue != null) {
                    if (!content.equals(propertyValue)) {
                        propertyValue = expand(context, propertyValue);
                    }

                    if (entitize) {
                        propertyValue = XmlUtils.entitize(propertyValue);
                    }

                    TestCase testCase = ModelSupport.getModelItemTestCase(context.getModelItem());
                    if (debuggingMode && testCase != null) {
                        StringToStringMap props = debuggingExpandedProperties.get(testCase.getId());
                        if (props == null) {
                            props = new StringToStringMap();
                        }
                        props.put(propertyName, propertyValue);
                        debuggingExpandedProperties.put(testCase.getId(), props);
                    }
                    buf.append(propertyValue);
                } else {
                    // if( log.isEnabledFor( Priority.WARN ))
                    // log.warn( "Missing property value for [" + propertyName + "]"
                    // );

                    // buf.append( "${" ).append( propertyName ).append( '}' );
                }

                lastIx = ix2 + 1;
                ix = content.indexOf("${", lastIx);
            }

            if (lastIx < content.length()) {
                buf.append(content.substring(lastIx));
            }

            return buf.toString();
        } finally {
            clState.restore();
        }
    }
View Full Code Here

    private SchemaType soapFaultType;

    public final static SoapVersion11 instance = new SoapVersion11();

    private SoapVersion11() {
        SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();

        try {
            XmlOptions options = new XmlOptions();
            options.setCompileNoValidation();
            options.setCompileNoPvrRule();
            options.setCompileDownloadUrls();
            options.setCompileNoUpaRule();
            options.setValidateTreatLaxAsSkip();

            // soapSchemaXml = XmlObject.Factory.parse(
            // SoapUI.class.getResource(
            // "/com/eviware/soapui/resources/xsds/soapEnvelope.xsd" ), options );
            soapSchemaXml = XmlUtils.createXmlObject(
                    SoapUI.class.getResource("/com/eviware/soapui/resources/xsds/soapEnvelope.xsd"), options);
            soapSchema = XmlBeans.loadXsd(new XmlObject[]{soapSchemaXml});

            soapEnvelopeType = soapSchema.findDocumentType(envelopeQName);
            soapFaultType = soapSchema.findDocumentType(faultQName);

            // soapEncodingXml = XmlObject.Factory.parse(
            // SoapUI.class.getResource(
            // "/com/eviware/soapui/resources/xsds/soapEncoding.xsd" ), options );
            soapEncodingXml = XmlUtils.createXmlObject(
                    SoapUI.class.getResource("/com/eviware/soapui/resources/xsds/soapEncoding.xsd"), options);
        } catch (Exception e) {
            SoapUI.logError(e);
        } finally {
            state.restore();
        }
    }
View Full Code Here

        }
        for (String name : runnerGlobalProperties.keySet()) {
            PropertyExpansionUtils.getGlobalProperties().setPropertyValue(name, runnerGlobalProperties.get(name));
        }

        SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();

        try {
            return runRunner();
        } finally {
            state.restore();
        }
    }
View Full Code Here

    }

    public void actionPerformed(ActionEvent e) {
        // required by IDE plugins
        if (SwingActionDelegate.switchClassloader) {
            SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();

            try {
                ((SoapUIMultiAction) mapping.getAction()).perform(targets, mapping.getParam());
            } catch (Throwable t) {
                SoapUI.logError(t);
            } finally {
                state.restore();
            }
        } else {
            try {
                ((SoapUIMultiAction) mapping.getAction()).perform(targets, mapping.getParam());
            } catch (Throwable t) {
View Full Code Here

    public SoapUIActionMapping<T> getMapping() {
        return mapping;
    }

    public void actionPerformed(ActionEvent event) {
        SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();

        try {
            mapping.getAction().perform(target, param == null ? mapping.getParam() : param);
        } catch (Exception exception) {
            SoapUI.logError(exception);
        } finally {
            state.restore();
        }
    }
View Full Code Here

    public SoapUIAction<?> getSoapUIAction() {
        return getAction();
    }

    public static void invoke(Runnable action) {
        SoapUIClassLoaderState state = SoapUIExtensionClassLoader.ensure();

        try {
            action.run();
        } catch (Throwable t) {
            SoapUI.logError(t);
        } finally {
            state.restore();
        }
    }
View Full Code Here

TOP

Related Classes of com.eviware.soapui.SoapUIExtensionClassLoader.SoapUIClassLoaderState

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.