Exemplo n.º 1
0
  public WsdlGroovyScriptTestStep(
      WsdlTestCase testCase, TestStepConfig config, boolean forLoadTest) {
    super(testCase, config, true, forLoadTest);

    if (!forLoadTest) {
      okIcon = UISupport.createImageIcon("/groovy_script.gif");
      setIcon(okIcon);
      failedIcon = UISupport.createImageIcon("/groovy_script_failed.gif");
    }

    if (config.getConfig() == null) {
      if (!forLoadTest) saveScript(config);
    } else {
      readConfig(config);
    }

    addProperty(
        new DefaultTestStepProperty(
            "result",
            true,
            new DefaultTestStepProperty.PropertyHandlerAdapter() {

              public String getValue(DefaultTestStepProperty property) {
                return scriptResult == null ? null : scriptResult.toString();
              }
            },
            this));

    addProperty(new TestStepBeanProperty("script", false, this, "script", this));

    scriptEngine = SoapUIScriptEngineRegistry.create(this);
    scriptEngine.setScript(getScript());
    if (forLoadTest && !isDisabled())
      try {
        scriptEngine.compile();
      } catch (Exception e) {
        SoapUI.logError(e);
      }
  }
Exemplo n.º 2
0
  public GroovySecurityScan(
      TestStep testStep, SecurityScanConfig config, ModelItem parent, String icon) {

    super(testStep, config, parent, icon);
    if (config.getConfig() == null) {
      groovyscc = GroovySecurityScanConfig.Factory.newInstance();
      groovyscc.setExecuteScript(ScriptConfig.Factory.newInstance());
      groovyscc.getExecuteScript().setLanguage("groovy");
      groovyscc.getExecuteScript().setStringValue("");
      config.setConfig(groovyscc);
    } else {
      groovyscc = (GroovySecurityScanConfig) config.getConfig();
      if (groovyscc.getExecuteScript() == null) {
        groovyscc.setExecuteScript(ScriptConfig.Factory.newInstance());
        groovyscc.getExecuteScript().setLanguage("groovy");
        groovyscc.getExecuteScript().setStringValue("");
      }
    }

    scriptEngine = SoapUIScriptEngineRegistry.create(this);

    getExecutionStrategy().setImmutable(true);
  }