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;
}
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");
}
}
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;
}
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;
}
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.");
}
}
}
}
Aggregations