Skip to content
This repository has been archived by the owner on Dec 14, 2021. It is now read-only.

Commit

Permalink
Merge pull request #7 from tomsoete/master
Browse files Browse the repository at this point in the history
fixed ShootCommand (groovy) test
  • Loading branch information
abuijze committed Jul 30, 2012
2 parents c9641d9 + 606491c commit 86e69ab
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import org.axonframework.samples.trader.orders.api.transaction.StartSellTransact
import org.axonframework.samples.trader.query.portfolio.PortfolioEntry
import org.axonframework.samples.trader.tradeengine.api.order.OrderBookId
import org.axonframework.samples.trader.tradeengine.api.order.PortfolioId
import org.axonframework.samples.trader.tradeengine.api.order.TransactionId;

/**
* Class used to create an order based on the provided Profile. If the profile has money we place buy orders, if
Expand All @@ -40,6 +41,7 @@ class CommandCreator {
def createCommand(PortfolioEntry portfolio) {
if (portfolio.amountOfMoney - portfolio.reservedAmountOfMoney > 10000) {
command = new StartBuyTransactionCommand(
new TransactionId(),
new OrderBookId(obtainRandomOrderBook()),
new PortfolioId(portfolio.identifier),
randomFactory.nextInt(50) + 1,
Expand All @@ -48,6 +50,7 @@ class CommandCreator {
def availableOrderBook = obtainAvailableOrderBook(portfolio)
if (availableOrderBook) {
command = new StartSellTransactionCommand(
new TransactionId(),
new OrderBookId(availableOrderBook[0]),
new PortfolioId(portfolio.identifier),
availableOrderBook[1],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import org.axonframework.samples.trader.query.portfolio.PortfolioEntry
* @author Jettro Coenradie
*/
class CommandSender {
def http = new HTTPBuilder('http://localhost:8080/trader/')
def http = new HTTPBuilder('http://localhost:8080/')
def requestContentType = ContentType.URLENC
XStream xStream = new XStream()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ for (int i = 0; i < 1000; i++) {
PortfolioEntry portfolio = commandSender.obtainPortfolio(portfolioIdentifier)
def command = commandCreator.createCommand(portfolio)

println "${portfolio.userName} # ${command.tradeCount} \$ ${command.itemPrice} ${companyNames[command.orderbookIdentifier.asString()]}"
println "${portfolio.userName} # ${command.tradeCount} \$ ${command.itemPrice} ${companyNames[command.orderbookIdentifier.toString()]}"

commandSender.sendCommand(command)

Expand Down

0 comments on commit 86e69ab

Please sign in to comment.