putValue(Action.SHORT_DESCRIPTION,
"Runs the current condition against the previous response and shows the result");
}
public void actionPerformed(ActionEvent e) {
SamplerTestStep previousStep = gotoStep.getTestCase().findPreviousStepOfType(gotoStep, SamplerTestStep.class);
if (previousStep == null) {
UISupport.showErrorMessage("Missing previous request step");
} else {
if (previousStep.getTestRequest().getResponse() == null
|| !XmlUtils.seemsToBeXml(previousStep.getTestRequest().getResponse().getContentAsXml())) {
UISupport
.showErrorMessage("Missing response in previous request step [" + previousStep.getName() + "]");
return;
}
try {
GotoCondition condition = gotoStep.getConditionAt(conditionList.getSelectedIndex());
WsdlTestRunContext context = new WsdlTestRunContext(gotoStep);
boolean evaluate = condition.evaluate(previousStep, context);
if (!evaluate) {
UISupport.showInfoMessage("Condition not true for current response in [" + previousStep.getName()
+ "]");
} else {
UISupport.showInfoMessage("Condition true for current response in [" + previousStep.getName() + "]");
}
} catch (Exception e1) {
UISupport.showErrorMessage("Error checking condition: " + e1.getMessage());
}
}