
pl.pragmatists.concordion.rest.RequestCommand Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of concordion-rest-extension Show documentation
Show all versions of concordion-rest-extension Show documentation
Set of non-official extensions to Concordion (http://concordion.org/). It provides support for writing executable specifications for REST services.
The newest version!
package pl.pragmatists.concordion.rest;
import org.concordion.api.AbstractCommand;
import org.concordion.api.CommandCall;
import org.concordion.api.CommandCallList;
import org.concordion.api.Element;
import org.concordion.api.Evaluator;
import org.concordion.api.ResultRecorder;
import org.concordion.api.listener.ExecuteEvent;
import org.concordion.api.listener.ExecuteListener;
import org.concordion.internal.util.Announcer;
import pl.pragmatists.concordion.rest.RestExtension.Config;
public class RequestCommand extends AbstractCommand {
private Announcer listeners = Announcer.to(ExecuteListener.class);
private Config config;
public RequestCommand(Config config) {
this.config = config;
}
@Override
public void execute(CommandCall commandCall, Evaluator evaluator, ResultRecorder resultRecorder) {
RequestExecutor request = RequestExecutor.newExecutor(evaluator, config);
CommandCallList childCommands = commandCall.getChildren();
childCommands.setUp(evaluator, resultRecorder);
childCommands.execute(evaluator, resultRecorder);
request.resolvePlaceholders(evaluator);
request.execute();
announceExecuteCompleted(commandCall.getElement());
childCommands.verify(evaluator, resultRecorder);
}
private void announceExecuteCompleted(Element element) {
listeners.announce().executeCompleted(new ExecuteEvent(element));
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy