- Revision
- 1324
- Author
- mauro
- Date
- 2009-10-11 09:48:26 -0500 (Sun, 11 Oct 2009)
Log Message
Updated trader web example.
Modified Paths
- trunk/web/distribution/src/main/site/content/using-web-runner.html
- trunk/web/examples/trader-web/src/main/java/org/jbehave/web/examples/trader/scenarios/Stock.java
- trunk/web/examples/trader-web/src/main/java/org/jbehave/web/examples/trader/scenarios/TraderSteps.java
Added Paths
Removed Paths
Diff
Modified: trunk/web/distribution/src/main/site/content/using-web-runner.html (1323 => 1324)
--- trunk/web/distribution/src/main/site/content/using-web-runner.html 2009-10-11 14:22:05 UTC (rev 1323) +++ trunk/web/distribution/src/main/site/content/using-web-runner.html 2009-10-11 14:48:26 UTC (rev 1324) @@ -28,13 +28,13 @@ to a page where you can enter your textual scenario.</li> <li>Input textual scenario in textarea (e.g you can cut & paste the one found in the <a - href="" - web example</a>) and click on <b>Run Scenario</b> link.</li> + href="" + scenario</a>) and click on <b>Run Scenario</b> link.</li> <li>Upon execution, the output of the scenario is shown below. - By default the same output is shown as the one you would see when running - JBehave via a command-line interface. This includes any details of failed - and pending steps. If any failures occur, the user has be option to - expand the stack trace.</li> + By default the same output is shown as the one you would see when + running JBehave via a command-line interface. This includes any + details of failed and pending steps. If any failures occur, the user + has be option to expand the stack trace.</li> </ul> </body>
Modified: trunk/web/examples/trader-web/src/main/java/org/jbehave/web/examples/trader/scenarios/Stock.java (1323 => 1324)
--- trunk/web/examples/trader-web/src/main/java/org/jbehave/web/examples/trader/scenarios/Stock.java 2009-10-11 14:22:05 UTC (rev 1323) +++ trunk/web/examples/trader-web/src/main/java/org/jbehave/web/examples/trader/scenarios/Stock.java 2009-10-11 14:48:26 UTC (rev 1324) @@ -1,5 +1,6 @@ package org.jbehave.web.examples.trader.scenarios; +import java.util.ArrayList; import java.util.List; public class Stock { @@ -8,22 +9,21 @@ ON, OFF }; - private List<Double> prices; - private double alertPrice; + private double threshold; + private List<Double> prices = new ArrayList<Double>(); private AlertStatus status = AlertStatus.OFF; - public Stock(List<Double> prices, double alertPrice) { - this.prices = prices; - this.alertPrice = alertPrice; - } + public Stock(double threshold) { + this.threshold = threshold; + } - public List<Double> getPrices() { + public List<Double> getPrices() { return prices; } public void tradeAt(double price) { this.prices.add(price); - if (price > alertPrice) { + if (price > threshold) { status = AlertStatus.ON; } }
Modified: trunk/web/examples/trader-web/src/main/java/org/jbehave/web/examples/trader/scenarios/TraderSteps.java (1323 => 1324)
--- trunk/web/examples/trader-web/src/main/java/org/jbehave/web/examples/trader/scenarios/TraderSteps.java 2009-10-11 14:22:05 UTC (rev 1323) +++ trunk/web/examples/trader-web/src/main/java/org/jbehave/web/examples/trader/scenarios/TraderSteps.java 2009-10-11 14:48:26 UTC (rev 1324) @@ -3,8 +3,6 @@ import static org.hamcrest.CoreMatchers.equalTo; import static org.jbehave.Ensure.ensureThat; -import java.util.List; - import org.jbehave.scenario.annotations.Given; import org.jbehave.scenario.annotations.Then; import org.jbehave.scenario.annotations.When; @@ -15,9 +13,9 @@ private Stock stock; private Trader trader; - @Given("a stock of prices $prices and a threshold of $threshold") - public void aStockOfPrice(List<Double> prices, double threshold) { - stock = new Stock(prices, threshold); + @Given("a threshold of $threshold") + public void aThreshold(double threshold) { + stock = new Stock(threshold); } @When("the stock is traded at $price")
Deleted: trunk/web/examples/trader-web/src/main/resources/status_alert_can_be_activated.scenario (1323 => 1324)
--- trunk/web/examples/trader-web/src/main/resources/status_alert_can_be_activated.scenario 2009-10-11 14:22:05 UTC (rev 1323) +++ trunk/web/examples/trader-web/src/main/resources/status_alert_can_be_activated.scenario 2009-10-11 14:48:26 UTC (rev 1324) @@ -1,15 +0,0 @@ -Scenario: - -Given a stock exchange EXCH1 -When the stock exchange is opened -Then the stock exchanges opened are as contained in data/STOCK-EXCHANGES.txt -Given a resource root directory classpath:org/jbehave/web/examples/trader/scenarios/data -Then the stock exchanges opened are as contained in STOCK-EXCHANGES.txt - -Scenario: - -Given a stock of prices 0.5,1.0 and a threshold of 10.0 -When the stock is traded at 5.0 -Then the alert status should be OFF -When the stock is traded at 11.0 -Then the alert status should be ON
Copied: trunk/web/examples/trader-web/src/main/resources/trader.scenario (from rev 1276, trunk/web/examples/trader-web/src/main/resources/status_alert_can_be_activated.scenario) (0 => 1324)
--- trunk/web/examples/trader-web/src/main/resources/trader.scenario (rev 0) +++ trunk/web/examples/trader-web/src/main/resources/trader.scenario 2009-10-11 14:48:26 UTC (rev 1324) @@ -0,0 +1,14 @@ +Scenario: + +Given a stock exchange EXCH1 +Given a resource root directory classpath:org/jbehave/web/examples/trader/scenarios/data +When the stock exchange is opened +Then the stock exchanges opened are as contained in STOCK-EXCHANGES.txt + +Scenario: + +Given a threshold of 10.0 +When the stock is traded at 5.0 +Then the alert status should be OFF +When the stock is traded at 11.0 +Then the alert status should be ON
To unsubscribe from this list please visit:
