Search in sources :

Example 36 with RequestableVariable

use of com.twinsoft.convertigo.beans.variables.RequestableVariable in project convertigo by convertigo.

the class TransactionWithVariables method getAllChildren.

@Override
public List<DatabaseObject> getAllChildren() {
    List<DatabaseObject> rep = super.getAllChildren();
    List<RequestableVariable> variables = getVariablesList();
    for (Variable variable : variables) {
        rep.add(variable);
    }
    List<TestCase> testCases = getTestCasesList();
    for (TestCase testCase : testCases) {
        rep.add(testCase);
    }
    return rep;
}
Also used : RequestableHttpVariable(com.twinsoft.convertigo.beans.variables.RequestableHttpVariable) TestCaseVariable(com.twinsoft.convertigo.beans.variables.TestCaseVariable) RequestableVariable(com.twinsoft.convertigo.beans.variables.RequestableVariable) RequestableHttpMultiValuedVariable(com.twinsoft.convertigo.beans.variables.RequestableHttpMultiValuedVariable) RequestableVariable(com.twinsoft.convertigo.beans.variables.RequestableVariable)

Example 37 with RequestableVariable

use of com.twinsoft.convertigo.beans.variables.RequestableVariable in project convertigo by convertigo.

the class TransactionWithVariables method insertObjectsInScope.

@Override
protected void insertObjectsInScope() throws EngineException {
    super.insertObjectsInScope();
    // Insert variables into the scripting context: first insert the explicit
    // (declared) variables (with or not default values), and then insert the
    // variables (that may eventually be the same).
    String variableName;
    Object variableValue;
    Object variableValueToPrint;
    int variableVisibility;
    Scriptable jsObject;
    checkSubLoaded();
    for (RequestableVariable variable : vVariables) {
        variableName = variable.getName();
        variableVisibility = variable.getVisibility();
        if (variableName.startsWith("__"))
            continue;
        if (variables.containsKey(variableName))
            continue;
        variableValue = getVariableValue(variableName);
        jsObject = ((variableValue == null) ? null : org.mozilla.javascript.Context.toObject(variableValue, scope));
        scope.put(variableName, scope, jsObject);
        variableValueToPrint = Visibility.Logs.printValue(variableVisibility, variableValue);
        if ((variableValue != null) && (variableValue instanceof String))
            Engine.logBeans.debug("(TransactionWithVariables) Declared but not provided transaction variable " + variableName + "=\"" + variableValueToPrint + "\" added to the scripting scope");
        else
            Engine.logBeans.debug("(TransactionWithVariables) Declared but not provided transaction variable " + variableName + "=" + variableValueToPrint + " added to the scripting scope");
    }
    for (String variableName2 : variables.keySet()) {
        if (variableName2.startsWith("__"))
            continue;
        variableVisibility = getVariableVisibility(variableName2);
        variableValue = getVariableValue(variableName2);
        jsObject = ((variableValue == null) ? null : org.mozilla.javascript.Context.toObject(variableValue, scope));
        scope.put(variableName2, scope, jsObject);
        variableValueToPrint = Visibility.Logs.printValue(variableVisibility, variableValue);
        if ((variableValue != null) && (variableValue instanceof String))
            Engine.logBeans.debug("(TransactionWithVariables) Provided transaction variable " + variableName2 + "=\"" + variableValueToPrint + "\" added (or overridden) to the scripting scope");
        else
            Engine.logBeans.debug("(TransactionWithVariables) Provided transaction variable " + variableName2 + "=" + variableValueToPrint + " added (or overridden) to the scripting scope");
    }
}
Also used : RequestableVariable(com.twinsoft.convertigo.beans.variables.RequestableVariable) Scriptable(org.mozilla.javascript.Scriptable)

Example 38 with RequestableVariable

use of com.twinsoft.convertigo.beans.variables.RequestableVariable in project convertigo by convertigo.

the class TransactionWithVariables method generateXsdRequestData.

@Override
public String generateXsdRequestData() throws Exception {
    String prefix = getXsdTypePrefix();
    String xsdRequestData = null;
    RequestableVariable variable = null;
    xsdRequestData = "  <xsd:complexType name=\"" + prefix + getName() + "RequestData\">\n";
    // xsdRequestData += 	"    <xsd:annotation>\n";
    // xsdRequestData += 	"      <xsd:documentation>"+ XMLUtils.getCDataXml(getComment()) +"</xsd:documentation>\n";
    // xsdRequestData += 	"    </xsd:annotation>\n";
    xsdRequestData += "    <xsd:sequence>\n";
    for (int i = 0; i < numberOfVariables(); i++) {
        variable = (RequestableVariable) getVariable(i);
        if (variable.isWsdl()) {
            if (variable.isMultiValued()) {
                xsdRequestData += "      <xsd:element minOccurs=\"1\" maxOccurs=\"1\" name=\"" + variable.getName() + "\" >\n";
                xsdRequestData += "        <xsd:annotation>\n";
                xsdRequestData += "          <xsd:documentation>" + XMLUtils.getCDataXml(variable.getComment()) + "</xsd:documentation>\n";
                xsdRequestData += "          <xsd:appinfo>" + StringEscapeUtils.escapeXml(variable.getDescription()) + "</xsd:appinfo>\n";
                xsdRequestData += "        </xsd:annotation>\n";
                xsdRequestData += "        <xsd:complexType>\n";
                xsdRequestData += "          <xsd:sequence>\n";
                xsdRequestData += "            <xsd:element minOccurs=\"0\" maxOccurs=\"unbounded\" name=\"item\" type=\"" + variable.getSchemaType() + "\" />\n";
                xsdRequestData += "          </xsd:sequence>\n";
                xsdRequestData += "        </xsd:complexType>\n";
                xsdRequestData += "      </xsd:element>\n";
            } else {
                xsdRequestData += "      <xsd:element minOccurs=\"1\" maxOccurs=\"1\" name=\"" + variable.getName() + "\" type=\"" + variable.getSchemaType() + "\">\n";
                xsdRequestData += "        <xsd:annotation>\n";
                xsdRequestData += "          <xsd:documentation>" + XMLUtils.getCDataXml(variable.getComment()) + "</xsd:documentation>\n";
                xsdRequestData += "          <xsd:appinfo>" + StringEscapeUtils.escapeXml(variable.getDescription()) + "</xsd:appinfo>\n";
                xsdRequestData += "        </xsd:annotation>\n";
                xsdRequestData += "      </xsd:element>\n";
            }
        }
    }
    xsdRequestData += "    </xsd:sequence>\n";
    xsdRequestData += "  </xsd:complexType>\n";
    return xsdRequestData;
}
Also used : RequestableVariable(com.twinsoft.convertigo.beans.variables.RequestableVariable)

Example 39 with RequestableVariable

use of com.twinsoft.convertigo.beans.variables.RequestableVariable in project convertigo by convertigo.

the class Sequence method clone.

@Override
public Sequence clone() throws CloneNotSupportedException {
    Sequence clonedObject = (Sequence) super.clone();
    clonedObject.variables = new HashMap<String, Object>();
    clonedObject.cloneNumber = ++cloneNumber;
    clonedObject.vVariables = new ArrayList<RequestableVariable>();
    clonedObject.vTestCases = new ArrayList<TestCase>();
    clonedObject.vAllVariables = null;
    clonedObject.nbAsyncThreadRunning = 0;
    clonedObject.xpathApi = null;
    clonedObject.stepHttpState = null;
    clonedObject.transactionSessionId = null;
    clonedObject.copies = null;
    clonedObject.loadedSteps = new HashMap<Long, Step>(10);
    clonedObject.executedSteps = null;
    clonedObject.childrenSteps = null;
    clonedObject.workerElementMap = null;
    clonedObject.vSteps = new ArrayList<Step>();
    clonedObject.vAllSteps = null;
    clonedObject.currentStep = null;
    clonedObject.currentChildStep = 0;
    clonedObject.stepContextNames = new ArrayList<String>();
    clonedObject.arborting = false;
    clonedObject.skipSteps = false;
    clonedObject.sequenceListeners = new EventListenerList();
    clonedObject.stepListeners = new EventListenerList();
    return clonedObject;
}
Also used : RequestableVariable(com.twinsoft.convertigo.beans.variables.RequestableVariable) XmlSchemaSequence(org.apache.ws.commons.schema.XmlSchemaSequence) BranchStep(com.twinsoft.convertigo.beans.steps.BranchStep) XMLCopyStep(com.twinsoft.convertigo.beans.steps.XMLCopyStep) EventListenerList(javax.swing.event.EventListenerList)

Example 40 with RequestableVariable

use of com.twinsoft.convertigo.beans.variables.RequestableVariable in project convertigo by convertigo.

the class DownloadHttpTransaction method parseInputDocument.

@Override
public void parseInputDocument(Context context) throws EngineException {
    super.parseInputDocument(context);
    currentFolder = folder;
    currentFilename = filename;
    for (RequestableVariable v : getAllVariables()) {
        if (v.getName().equals(DynamicHttpVariable.__download_folder.name())) {
            RequestableHttpVariable var = (RequestableHttpVariable) v;
            Object o = var.getDefaultValue();
            if (o != null && o instanceof String) {
                currentFolder = (String) o;
            }
        } else if (v.getName().equals(DynamicHttpVariable.__download_filename.name())) {
            RequestableHttpVariable var = (RequestableHttpVariable) v;
            Object o = var.getDefaultValue();
            if (o != null && o instanceof String) {
                currentFilename = (String) o;
            }
        }
    }
    NodeList nl = context.inputDocument.getElementsByTagName("download-folder");
    if (nl.getLength() == 1) {
        Element elt = (Element) nl.item(0);
        String val = elt.getAttribute("value");
        if (StringUtils.isNotBlank(val)) {
            if (getAccessibility() == Accessibility.Private) {
                currentFolder = val;
            } else {
                Engine.logBeans.error("(DownloadHttpTransaction) The transaction isn't Private, the download-folder cannot be override.");
            }
        }
    }
    nl = context.inputDocument.getElementsByTagName("download-filename");
    int len = nl.getLength();
    if (len > 0) {
        Element elt = (Element) nl.item(0);
        String val = elt.getAttribute("value");
        if (StringUtils.isNotBlank(val)) {
            if (getAccessibility() == Accessibility.Private) {
                currentFilename = val;
            } else {
                Engine.logBeans.error("(DownloadHttpTransaction) The transaction isn't Private, the download-folder cannot be override.");
            }
        }
    }
}
Also used : RequestableHttpVariable(com.twinsoft.convertigo.beans.variables.RequestableHttpVariable) NodeList(org.w3c.dom.NodeList) XmlSchemaElement(org.apache.ws.commons.schema.XmlSchemaElement) Element(org.w3c.dom.Element) RequestableVariable(com.twinsoft.convertigo.beans.variables.RequestableVariable)

Aggregations

RequestableVariable (com.twinsoft.convertigo.beans.variables.RequestableVariable)57 EngineException (com.twinsoft.convertigo.engine.EngineException)24 DatabaseObject (com.twinsoft.convertigo.beans.core.DatabaseObject)14 Sequence (com.twinsoft.convertigo.beans.core.Sequence)11 Element (org.w3c.dom.Element)11 RequestableHttpVariable (com.twinsoft.convertigo.beans.variables.RequestableHttpVariable)10 DatabaseObjectTreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.DatabaseObjectTreeObject)8 TreeObject (com.twinsoft.convertigo.eclipse.views.projectexplorer.model.TreeObject)8 StepVariable (com.twinsoft.convertigo.beans.variables.StepVariable)7 TestCaseVariable (com.twinsoft.convertigo.beans.variables.TestCaseVariable)7 Variable (com.twinsoft.convertigo.beans.core.Variable)6 Shell (org.eclipse.swt.widgets.Shell)6 TransactionWithVariables (com.twinsoft.convertigo.beans.core.TransactionWithVariables)5 RequestableMultiValuedVariable (com.twinsoft.convertigo.beans.variables.RequestableMultiValuedVariable)5 ProjectExplorerView (com.twinsoft.convertigo.eclipse.views.projectexplorer.ProjectExplorerView)5 Cursor (org.eclipse.swt.graphics.Cursor)5 Display (org.eclipse.swt.widgets.Display)5 XMLVector (com.twinsoft.convertigo.beans.common.XMLVector)4 RequestableObject (com.twinsoft.convertigo.beans.core.RequestableObject)4 XmlSchemaElement (org.apache.ws.commons.schema.XmlSchemaElement)4