Skip to content

Commit

Permalink
added proper shutdown of the executor service; added completion message;
Browse files Browse the repository at this point in the history
renamed execution blocking component back to scenario player; updated
changelog
  • Loading branch information
build-failure committed Oct 10, 2016
1 parent 0b7d3bd commit d574541
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 17 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]
### Changed
- bridged java util logging to unify logging output

### Added
- introduced mode option and stepwise/pausable interactive playback mode

## [1.5.0]
### Added
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/website/automate/jwebrobot/JWebRobot.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import website.automate.jwebrobot.loader.ScenarioFile;
import website.automate.jwebrobot.loader.ScenarioLoader;
import website.automate.jwebrobot.player.ConsoleListener;
import website.automate.jwebrobot.player.ExecutionStagnator;
import website.automate.jwebrobot.player.ScenarioPlayer;

public class JWebRobot {

Expand Down Expand Up @@ -47,7 +47,7 @@ public static void main(String[] args) {

if(configurationProperties.isInteractive()){
consoleListener = ConsoleListener.getInstance();
consoleListener.getPlayer().executeCommand(ExecutionStagnator.STOP);
consoleListener.getPlayer().executeCommand(ScenarioPlayer.STOP);
}

JWebRobot jWebRobot = injector.getInstance(JWebRobot.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import website.automate.jwebrobot.expression.ConditionalExpressionEvaluator;
import website.automate.jwebrobot.listener.ExecutionEventListeners;
import website.automate.jwebrobot.mapper.action.AbstractActionMapper;
import website.automate.jwebrobot.player.ExecutionStagnator;
import website.automate.jwebrobot.player.ScenarioPlayer;
import website.automate.jwebrobot.validator.ContextValidators;
import website.automate.waml.io.model.Scenario;
import website.automate.waml.io.model.action.Action;
Expand All @@ -34,7 +34,7 @@ public class DefaultScenarioExecutor implements ScenarioExecutor {
private final ActionPreprocessor actionPreprocessor;
private final AbstractActionMapper abstractActionMapper;
private final ScenarioPatternFilter scenarioPatternFilter;
private final ExecutionStagnator executionStagnator;
private final ScenarioPlayer scenarioPlayer;

@Inject
public DefaultScenarioExecutor(
Expand All @@ -47,7 +47,7 @@ public DefaultScenarioExecutor(
ActionPreprocessor actionPreprocessor,
AbstractActionMapper abstractActionMapper,
ScenarioPatternFilter scenarioPatternFilter,
ExecutionStagnator scenarioPlayer
ScenarioPlayer scenarioPlayer
) {
this.webDriverProvider = webDriverProvider;
this.actionExecutorFactory = actionExecutorFactory;
Expand All @@ -58,7 +58,7 @@ public DefaultScenarioExecutor(
this.actionPreprocessor = actionPreprocessor;
this.abstractActionMapper = abstractActionMapper;
this.scenarioPatternFilter =scenarioPatternFilter;
this.executionStagnator = scenarioPlayer;
this.scenarioPlayer = scenarioPlayer;
}

@Override
Expand Down Expand Up @@ -121,7 +121,7 @@ public void runScenario(Scenario scenario, ScenarioExecutionContext scenarioExec
}

for (Action action : scenario.getSteps()) {
executionStagnator.pauseIfRequired();
scenarioPlayer.pauseIfRequired();

ActionExecutor<Action> actionExecutor = actionExecutorFactory.getInstance(action.getClass());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ public class ConsoleListener implements Runnable {

private static final String AVAILABLE_COMMANDS = "Next(N|n), Continue(C|c), Stop(S|s):";

private ExecutionStagnator player;
private ScenarioPlayer player;

@Inject
public ConsoleListener(ExecutionStagnator player) {
public ConsoleListener(ScenarioPlayer player) {
super();
this.player = player;
}
Expand Down Expand Up @@ -62,7 +62,7 @@ private void printAvailableCommands(){
}

private void printSuccessMessage(){
System.out.println("Execution completed. Enter any key to exit...");
System.out.println("Execution completed. Enter any key to exit:");
}

public static ConsoleListener getInstance(){
Expand All @@ -78,11 +78,11 @@ public static ConsoleListener getInstance(){
return INSTANCE;
}

public ExecutionStagnator getPlayer() {
public ScenarioPlayer getPlayer() {
return player;
}

public void setPlayer(ExecutionStagnator player) {
public void setPlayer(ScenarioPlayer player) {
this.player = player;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import com.google.inject.Singleton;

@Singleton
public class ExecutionStagnator {
public class ScenarioPlayer {

public static final char NEXT = 'n';
public static final char CONTINUE = 'c';
Expand Down Expand Up @@ -43,6 +43,6 @@ public char getCommand() {
}

public boolean isValid(char command){
return VALID_COMMANDS.contains(command);
return VALID_COMMANDS.contains(Character.toLowerCase(command));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import website.automate.jwebrobot.listener.ExecutionEventListeners;
import website.automate.jwebrobot.mapper.action.AbstractActionMapper;
import website.automate.jwebrobot.mapper.action.ActionMapperProvider;
import website.automate.jwebrobot.player.ExecutionStagnator;
import website.automate.jwebrobot.player.ScenarioPlayer;
import website.automate.jwebrobot.validator.ContextValidators;
import website.automate.waml.io.model.Scenario;

Expand All @@ -40,7 +40,7 @@ public class DefaultScenarioExecutorTest {
@Mock private ScenarioExecutionContext context;
@Mock private AbstractActionMapper abstractActionMapper;
@Mock private ScenarioPatternFilter scenarioPatternFilter;
@Mock private ExecutionStagnator executionStagnator;
@Mock private ScenarioPlayer scenarioPlayer;

private DefaultScenarioExecutor scenarioExecutor;

Expand All @@ -50,7 +50,7 @@ public void init(){
validator, conditionalExpressionEvaluator,
scenarioPreprocessor, actionPreprocessor, abstractActionMapper,
scenarioPatternFilter,
executionStagnator);
scenarioPlayer);

when(scenarioPreprocessor.preprocess(scenario, context)).thenReturn(preprocessedScenario);
}
Expand Down

0 comments on commit d574541

Please sign in to comment.