Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Some renaming to conform a bit more with trading terminology

Still not perfect, but it is a bit more realistic now.
  • Loading branch information...
commit 8bd2dc737c998285bb74d90e4e49306ef4c99148 1 parent 1fc8566
@abuijze abuijze authored
Showing with 186 additions and 186 deletions.
  1. +5 −5 ...folio/{money/CancelMoneyReservationFromPortfolioCommand.java → cash/CancelCashReservationCommand.java}
  2. +3 −3 ...amples/trader/api/portfolio/{money/MoneyDepositedToPortfolioEvent.java → cash/CashDepositedEvent.java}
  3. +5 −5 ...lio/{money/MoneyReservationCancelledFromPortfolioEvent.java → cash/CashReservationCancelledEvent.java}
  4. +5 −5 ...lio/{money/MoneyReservationConfirmedFromPortfolioEvent.java → cash/CashReservationConfirmedEvent.java}
  5. +4 −4 .../{money/NotEnoughMoneyInPortfolioToMakeReservationEvent.java → cash/CashReservationRejectedEvent.java}
  6. +3 −3 ...amples/trader/api/portfolio/{money/MoneyReservedFromPortfolioEvent.java → cash/CashReservedEvent.java}
  7. +3 −3 ...ples/trader/api/portfolio/{money/MoneyWithdrawnFromPortfolioEvent.java → cash/CashWithdrawnEvent.java}
  8. +6 −6 ...io/{money/ConfirmMoneyReservationFromPortfolionCommand.java → cash/ConfirmCashReservationCommand.java}
  9. +4 −4 ...amples/trader/api/portfolio/{money/DepositMoneyToPortfolioCommand.java → cash/DepositCashCommand.java}
  10. +5 −5 ...ples/trader/api/portfolio/{money/ReserveMoneyFromPortfolioCommand.java → cash/ReserveCashCommand.java}
  11. +3 −3 ...es/trader/api/portfolio/{money/WithdrawMoneyFromPortfolioCommand.java → cash/WithdrawCashCommand.java}
  12. +1 −1  ...ain/java/org/axonframework/samples/trader/api/portfolio/{item → stock}/AddItemsToPortfolioCommand.java
  13. +1 −1  ...xonframework/samples/trader/api/portfolio/{item → stock}/CancelItemReservationForPortfolioCommand.java
  14. +1 −1  ...onframework/samples/trader/api/portfolio/{item → stock}/ConfirmItemReservationForPortfolioCommand.java
  15. +1 −1  ...onframework/samples/trader/api/portfolio/{item → stock}/ItemReservationCancelledForPortfolioEvent.java
  16. +1 −1  ...onframework/samples/trader/api/portfolio/{item → stock}/ItemReservationConfirmedForPortfolioEvent.java
  17. +1 −1  ...onframework/samples/trader/api/portfolio/{item → stock}/ItemToReserveNotAvailableInPortfolioEvent.java
  18. +1 −1  ...ain/java/org/axonframework/samples/trader/api/portfolio/{item → stock}/ItemsAddedToPortfolioEvent.java
  19. +1 −1  ...pi/src/main/java/org/axonframework/samples/trader/api/portfolio/{item → stock}/ItemsReservedEvent.java
  20. +1 −1  ...framework/samples/trader/api/portfolio/{item → stock}/NotEnoughItemsAvailableToReserveInPortfolio.java
  21. +1 −1  ...i/src/main/java/org/axonframework/samples/trader/api/portfolio/{item → stock}/ReserveItemsCommand.java
  22. +16 −16 orders/src/main/java/org/axonframework/samples/trader/orders/command/BuyTradeManagerSaga.java
  23. +14 −14 orders/src/main/java/org/axonframework/samples/trader/orders/command/Portfolio.java
  24. +10 −10 orders/src/main/java/org/axonframework/samples/trader/orders/command/PortfolioCommandHandler.java
  25. +9 −9 orders/src/main/java/org/axonframework/samples/trader/orders/command/SellTradeManagerSaga.java
  26. +9 −9 orders/src/test/java/org/axonframework/samples/trader/orders/command/BuyTradeManagerSagaTest.java
  27. +22 −22 orders/src/test/java/org/axonframework/samples/trader/orders/command/PortfolioCommandHandlerTest.java
  28. +2 −2 orders/src/test/java/org/axonframework/samples/trader/orders/command/SellTradeManagerSagaTest.java
  29. +1 −1  ...c/test/java/org/axonframework/samples/trader/orders/command/matchers/AddItemsToPortfolioCommandMatcher.java
  30. +1 −1  ...g/axonframework/samples/trader/orders/command/matchers/CancelItemReservationForPortfolioCommandMatcher.java
  31. +4 −4 ...axonframework/samples/trader/orders/command/matchers/CancelMoneyReservationFromPortfolioCommandMatcher.java
  32. +1 −1  .../axonframework/samples/trader/orders/command/matchers/ConfirmItemReservationForPortfolioCommandMatcher.java
  33. +4 −4 ...onframework/samples/trader/orders/command/matchers/ConfirmMoneyReservationFromPortfolionCommandMatcher.java
  34. +4 −4 ...st/java/org/axonframework/samples/trader/orders/command/matchers/DepositMoneyToPortfolioCommandMatcher.java
  35. +4 −4 .../java/org/axonframework/samples/trader/orders/command/matchers/ReserveMoneyFromPortfolioCommandMatcher.java
  36. +1 −1  orders/src/test/java/org/axonframework/samples/trader/orders/command/matchers/ReservedItemsCommandMatcher.java
  37. +4 −4 query/src/main/java/org/axonframework/samples/trader/query/portfolio/PortfolioItemEventListener.java
  38. +6 −6 query/src/main/java/org/axonframework/samples/trader/query/portfolio/PortfolioMoneyEventListener.java
  39. +4 −4 query/src/test/java/org/axonframework/samples/trader/query/portfolio/PortfolioItemEventListenerTest.java
  40. +5 −5 web-ui/src/main/java/org/axonframework/samples/trader/webui/admin/AdminController.java
  41. +1 −1  web-ui/src/main/java/org/axonframework/samples/trader/webui/companies/CompanyController.java
  42. +5 −5 web-ui/src/main/java/org/axonframework/samples/trader/webui/init/DBInit.java
  43. +1 −1  web-ui/src/main/java/org/axonframework/samples/trader/webui/init/MongoController.java
  44. +2 −2 web-ui/src/test/java/org/axonframework/samples/trader/test/CommandCreator.groovy
View
10 ...y/CancelMoneyReservationFromPortfolioCommand.java → .../portfolio/cash/CancelCashReservationCommand.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.axonframework.samples.trader.api.portfolio.money;
+package org.axonframework.samples.trader.api.portfolio.cash;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
import org.axonframework.samples.trader.api.orders.trades.TransactionId;
@@ -22,15 +22,15 @@
/**
* @author Jettro Coenradie
*/
-public class CancelMoneyReservationFromPortfolioCommand {
+public class CancelCashReservationCommand {
private PortfolioId portfolioIdentifier;
private TransactionId transactionIdentifier;
private long amountOfMoneyToCancel;
- public CancelMoneyReservationFromPortfolioCommand(PortfolioId portfolioIdentifier,
- TransactionId transactionIdentifier,
- long amountOfMoneyToCancel) {
+ public CancelCashReservationCommand(PortfolioId portfolioIdentifier,
+ TransactionId transactionIdentifier,
+ long amountOfMoneyToCancel) {
this.portfolioIdentifier = portfolioIdentifier;
this.transactionIdentifier = transactionIdentifier;
this.amountOfMoneyToCancel = amountOfMoneyToCancel;
View
6 ...rtfolio/money/MoneyDepositedToPortfolioEvent.java → ...trader/api/portfolio/cash/CashDepositedEvent.java
@@ -14,18 +14,18 @@
* limitations under the License.
*/
-package org.axonframework.samples.trader.api.portfolio.money;
+package org.axonframework.samples.trader.api.portfolio.cash;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
/**
* @author Jettro Coenradie
*/
-public class MoneyDepositedToPortfolioEvent {
+public class CashDepositedEvent {
private PortfolioId portfolioId;
private long moneyAddedInCents;
- public MoneyDepositedToPortfolioEvent(PortfolioId portfolioId, long moneyAddedInCents) {
+ public CashDepositedEvent(PortfolioId portfolioId, long moneyAddedInCents) {
this.portfolioId = portfolioId;
this.moneyAddedInCents = moneyAddedInCents;
}
View
10 .../MoneyReservationCancelledFromPortfolioEvent.java → ...portfolio/cash/CashReservationCancelledEvent.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.axonframework.samples.trader.api.portfolio.money;
+package org.axonframework.samples.trader.api.portfolio.cash;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
import org.axonframework.samples.trader.api.orders.trades.TransactionId;
@@ -22,14 +22,14 @@
/**
* @author Jettro Coenradie
*/
-public class MoneyReservationCancelledFromPortfolioEvent {
+public class CashReservationCancelledEvent {
private PortfolioId portfolioIdentifier;
private TransactionId transactionIdentifier;
private long amountOfMoneyToCancel;
- public MoneyReservationCancelledFromPortfolioEvent(PortfolioId portfolioIdentifier,
- TransactionId transactionIdentifier,
- long amountOfMoneyToCancel) {
+ public CashReservationCancelledEvent(PortfolioId portfolioIdentifier,
+ TransactionId transactionIdentifier,
+ long amountOfMoneyToCancel) {
this.portfolioIdentifier = portfolioIdentifier;
this.transactionIdentifier = transactionIdentifier;
this.amountOfMoneyToCancel = amountOfMoneyToCancel;
View
10 .../MoneyReservationConfirmedFromPortfolioEvent.java → ...portfolio/cash/CashReservationConfirmedEvent.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.axonframework.samples.trader.api.portfolio.money;
+package org.axonframework.samples.trader.api.portfolio.cash;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
import org.axonframework.samples.trader.api.orders.trades.TransactionId;
@@ -22,14 +22,14 @@
/**
* @author Jettro Coenradie
*/
-public class MoneyReservationConfirmedFromPortfolioEvent {
+public class CashReservationConfirmedEvent {
private TransactionId transactionIdentifier;
private PortfolioId portfolioIdentifier;
private long amountOfMoneyConfirmedInCents;
- public MoneyReservationConfirmedFromPortfolioEvent(PortfolioId portfolioIdentifier,
- TransactionId transactionId,
- long amountOfMoneyConfirmedInCents) {
+ public CashReservationConfirmedEvent(PortfolioId portfolioIdentifier,
+ TransactionId transactionId,
+ long amountOfMoneyConfirmedInCents) {
this.portfolioIdentifier = portfolioIdentifier;
this.transactionIdentifier = transactionId;
this.amountOfMoneyConfirmedInCents = amountOfMoneyConfirmedInCents;
View
8 ...EnoughMoneyInPortfolioToMakeReservationEvent.java → .../portfolio/cash/CashReservationRejectedEvent.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.axonframework.samples.trader.api.portfolio.money;
+package org.axonframework.samples.trader.api.portfolio.cash;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
import org.axonframework.samples.trader.api.orders.trades.TransactionId;
@@ -22,13 +22,13 @@
/**
* @author Jettro Coenradie
*/
-public class NotEnoughMoneyInPortfolioToMakeReservationEvent {
+public class CashReservationRejectedEvent {
private PortfolioId portfolioIdentifier;
private TransactionId transactionIdentifier;
private long amountToPayInCents;
- public NotEnoughMoneyInPortfolioToMakeReservationEvent(PortfolioId portfolioIdentifier, TransactionId transactionIdentifier,
- long amountToPayInCents) {
+ public CashReservationRejectedEvent(PortfolioId portfolioIdentifier, TransactionId transactionIdentifier,
+ long amountToPayInCents) {
this.portfolioIdentifier = portfolioIdentifier;
this.transactionIdentifier = transactionIdentifier;
this.amountToPayInCents = amountToPayInCents;
View
6 ...tfolio/money/MoneyReservedFromPortfolioEvent.java → .../trader/api/portfolio/cash/CashReservedEvent.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.axonframework.samples.trader.api.portfolio.money;
+package org.axonframework.samples.trader.api.portfolio.cash;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
import org.axonframework.samples.trader.api.orders.trades.TransactionId;
@@ -22,12 +22,12 @@
/**
* @author Jettro Coenradie
*/
-public class MoneyReservedFromPortfolioEvent {
+public class CashReservedEvent {
private PortfolioId portfolioIdentifier;
private TransactionId transactionIdentifier;
private long amountToReserve;
- public MoneyReservedFromPortfolioEvent(PortfolioId portfolioIdentifier, TransactionId transactionIdentifier, long amountToReserve) {
+ public CashReservedEvent(PortfolioId portfolioIdentifier, TransactionId transactionIdentifier, long amountToReserve) {
this.portfolioIdentifier = portfolioIdentifier;
this.transactionIdentifier = transactionIdentifier;
this.amountToReserve = amountToReserve;
View
6 ...folio/money/MoneyWithdrawnFromPortfolioEvent.java → ...trader/api/portfolio/cash/CashWithdrawnEvent.java
@@ -14,18 +14,18 @@
* limitations under the License.
*/
-package org.axonframework.samples.trader.api.portfolio.money;
+package org.axonframework.samples.trader.api.portfolio.cash;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
/**
* @author Jettro Coenradie
*/
-public class MoneyWithdrawnFromPortfolioEvent {
+public class CashWithdrawnEvent {
private PortfolioId portfolioIdentifier;
private long amountPaidInCents;
- public MoneyWithdrawnFromPortfolioEvent(PortfolioId portfolioIdentifier, long amountPaidInCents) {
+ public CashWithdrawnEvent(PortfolioId portfolioIdentifier, long amountPaidInCents) {
this.portfolioIdentifier = portfolioIdentifier;
this.amountPaidInCents = amountPaidInCents;
}
View
12 ...ConfirmMoneyReservationFromPortfolionCommand.java → ...portfolio/cash/ConfirmCashReservationCommand.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.axonframework.samples.trader.api.portfolio.money;
+package org.axonframework.samples.trader.api.portfolio.cash;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
import org.axonframework.samples.trader.api.orders.trades.TransactionId;
@@ -22,16 +22,16 @@
/**
* @author Jettro Coenradie
*/
-public class ConfirmMoneyReservationFromPortfolionCommand {
+public class ConfirmCashReservationCommand {
private PortfolioId portfolioIdentifier;
private TransactionId transactionIdentifier;
private long amountOfMoneyToConfirmInCents;
- public ConfirmMoneyReservationFromPortfolionCommand(PortfolioId portfolioIdentifier,
- TransactionId transactionIdentifier,
- long amountOfMoneyToConfirmInCents) {
+ public ConfirmCashReservationCommand(PortfolioId portfolioIdentifier,
+ TransactionId transactionIdentifier,
+ long amountOfMoneyToConfirmInCents) {
this.portfolioIdentifier = portfolioIdentifier;
this.transactionIdentifier = transactionIdentifier;
this.amountOfMoneyToConfirmInCents = amountOfMoneyToConfirmInCents;
@@ -51,7 +51,7 @@ public TransactionId getTransactionIdentifier() {
@Override
public String toString() {
- return "ConfirmMoneyReservationFromPortfolionCommand{" +
+ return "ConfirmCashReservationCommand{" +
"amountOfMoneyToConfirmInCents=" + amountOfMoneyToConfirmInCents +
", portfolioIdentifier=" + portfolioIdentifier +
", transactionIdentifier=" + transactionIdentifier +
View
8 ...rtfolio/money/DepositMoneyToPortfolioCommand.java → ...trader/api/portfolio/cash/DepositCashCommand.java
@@ -14,21 +14,21 @@
* limitations under the License.
*/
-package org.axonframework.samples.trader.api.portfolio.money;
+package org.axonframework.samples.trader.api.portfolio.cash;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
/**
- * Adding money to your Portfolio through a deposit
+ * Adding cash to your Portfolio through a deposit
*
* @author Jettro Coenradie
*/
-public class DepositMoneyToPortfolioCommand {
+public class DepositCashCommand {
private PortfolioId portfolioIdentifier;
private long moneyToAddInCents;
- public DepositMoneyToPortfolioCommand(PortfolioId portfolioIdentifier, long moneyToAddInCents) {
+ public DepositCashCommand(PortfolioId portfolioIdentifier, long moneyToAddInCents) {
this.portfolioIdentifier = portfolioIdentifier;
this.moneyToAddInCents = moneyToAddInCents;
}
View
10 ...folio/money/ReserveMoneyFromPortfolioCommand.java → ...trader/api/portfolio/cash/ReserveCashCommand.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.axonframework.samples.trader.api.portfolio.money;
+package org.axonframework.samples.trader.api.portfolio.cash;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
import org.axonframework.samples.trader.api.orders.trades.TransactionId;
@@ -22,15 +22,15 @@
/**
* @author Jettro Coenradie
*/
-public class ReserveMoneyFromPortfolioCommand {
+public class ReserveCashCommand {
private PortfolioId portfolioIdentifier;
private TransactionId transactionIdentifier;
private long amountOfMoneyToReserve;
- public ReserveMoneyFromPortfolioCommand(PortfolioId portfolioIdentifier,
- TransactionId transactionIdentifier,
- long amountOfMoneyToReserve) {
+ public ReserveCashCommand(PortfolioId portfolioIdentifier,
+ TransactionId transactionIdentifier,
+ long amountOfMoneyToReserve) {
this.portfolioIdentifier = portfolioIdentifier;
this.transactionIdentifier = transactionIdentifier;
this.amountOfMoneyToReserve = amountOfMoneyToReserve;
View
6 ...olio/money/WithdrawMoneyFromPortfolioCommand.java → ...rader/api/portfolio/cash/WithdrawCashCommand.java
@@ -14,19 +14,19 @@
* limitations under the License.
*/
-package org.axonframework.samples.trader.api.portfolio.money;
+package org.axonframework.samples.trader.api.portfolio.cash;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
/**
* @author Jettro Coenradie
*/
-public class WithdrawMoneyFromPortfolioCommand {
+public class WithdrawCashCommand {
private PortfolioId portfolioIdentifier;
private long amountToPayInCents;
- public WithdrawMoneyFromPortfolioCommand(PortfolioId portfolioIdentifier, long amountToPayInCents) {
+ public WithdrawCashCommand(PortfolioId portfolioIdentifier, long amountToPayInCents) {
this.portfolioIdentifier = portfolioIdentifier;
this.amountToPayInCents = amountToPayInCents;
View
2  ...pi/portfolio/item/AddItemsToPortfolioCommand.java → ...i/portfolio/stock/AddItemsToPortfolioCommand.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.axonframework.samples.trader.api.portfolio.item;
+package org.axonframework.samples.trader.api.portfolio.stock;
import org.axonframework.samples.trader.api.orders.trades.OrderBookId;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
View
2  ...tem/CancelItemReservationForPortfolioCommand.java → ...ock/CancelItemReservationForPortfolioCommand.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.axonframework.samples.trader.api.portfolio.item;
+package org.axonframework.samples.trader.api.portfolio.stock;
import org.axonframework.samples.trader.api.orders.trades.OrderBookId;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
View
2  ...em/ConfirmItemReservationForPortfolioCommand.java → ...ck/ConfirmItemReservationForPortfolioCommand.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.axonframework.samples.trader.api.portfolio.item;
+package org.axonframework.samples.trader.api.portfolio.stock;
import org.axonframework.samples.trader.api.orders.trades.OrderBookId;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
View
2  ...em/ItemReservationCancelledForPortfolioEvent.java → ...ck/ItemReservationCancelledForPortfolioEvent.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.axonframework.samples.trader.api.portfolio.item;
+package org.axonframework.samples.trader.api.portfolio.stock;
import org.axonframework.samples.trader.api.orders.trades.OrderBookId;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
View
2  ...em/ItemReservationConfirmedForPortfolioEvent.java → ...ck/ItemReservationConfirmedForPortfolioEvent.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.axonframework.samples.trader.api.portfolio.item;
+package org.axonframework.samples.trader.api.portfolio.stock;
import org.axonframework.samples.trader.api.orders.trades.OrderBookId;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
View
2  ...em/ItemToReserveNotAvailableInPortfolioEvent.java → ...ck/ItemToReserveNotAvailableInPortfolioEvent.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.axonframework.samples.trader.api.portfolio.item;
+package org.axonframework.samples.trader.api.portfolio.stock;
import org.axonframework.samples.trader.api.orders.trades.OrderBookId;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
View
2  ...pi/portfolio/item/ItemsAddedToPortfolioEvent.java → ...i/portfolio/stock/ItemsAddedToPortfolioEvent.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.axonframework.samples.trader.api.portfolio.item;
+package org.axonframework.samples.trader.api.portfolio.stock;
import org.axonframework.samples.trader.api.orders.trades.OrderBookId;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
View
2  ...trader/api/portfolio/item/ItemsReservedEvent.java → ...rader/api/portfolio/stock/ItemsReservedEvent.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.axonframework.samples.trader.api.portfolio.item;
+package org.axonframework.samples.trader.api.portfolio.stock;
import org.axonframework.samples.trader.api.orders.trades.OrderBookId;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
View
2  .../NotEnoughItemsAvailableToReserveInPortfolio.java → .../NotEnoughItemsAvailableToReserveInPortfolio.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.axonframework.samples.trader.api.portfolio.item;
+package org.axonframework.samples.trader.api.portfolio.stock;
import org.axonframework.samples.trader.api.orders.trades.OrderBookId;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
View
2  ...rader/api/portfolio/item/ReserveItemsCommand.java → ...ader/api/portfolio/stock/ReserveItemsCommand.java
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package org.axonframework.samples.trader.api.portfolio.item;
+package org.axonframework.samples.trader.api.portfolio.stock;
import org.axonframework.samples.trader.api.orders.trades.OrderBookId;
View
32 orders/src/main/java/org/axonframework/samples/trader/orders/command/BuyTradeManagerSaga.java
@@ -21,8 +21,8 @@
import org.axonframework.saga.annotation.EndSaga;
import org.axonframework.saga.annotation.SagaEventHandler;
import org.axonframework.saga.annotation.StartSaga;
-import org.axonframework.samples.trader.api.portfolio.item.AddItemsToPortfolioCommand;
-import org.axonframework.samples.trader.api.portfolio.money.*;
+import org.axonframework.samples.trader.api.portfolio.stock.AddItemsToPortfolioCommand;
+import org.axonframework.samples.trader.api.portfolio.cash.*;
import org.axonframework.samples.trader.api.orders.transaction.*;
import org.axonframework.samples.trader.api.orders.trades.CreateBuyOrderCommand;
import org.axonframework.samples.trader.api.orders.trades.OrderId;
@@ -58,15 +58,15 @@ public void handle(BuyTransactionStartedEvent event) {
setPricePerItem(event.getPricePerItem());
setTotalItems(event.getTotalItems());
- ReserveMoneyFromPortfolioCommand command = new ReserveMoneyFromPortfolioCommand(getPortfolioIdentifier(),
+ ReserveCashCommand command = new ReserveCashCommand(getPortfolioIdentifier(),
getTransactionIdentifier(),
getTotalItems()
* getPricePerItem());
- getCommandBus().dispatch(new GenericCommandMessage<ReserveMoneyFromPortfolioCommand>(command));
+ getCommandBus().dispatch(new GenericCommandMessage<ReserveCashCommand>(command));
}
@SagaEventHandler(associationProperty = "transactionIdentifier")
- public void handle(MoneyReservedFromPortfolioEvent event) {
+ public void handle(CashReservedEvent event) {
logger.debug("Money for transaction with identifier {} is reserved", getTransactionIdentifier());
ConfirmTransactionCommand command = new ConfirmTransactionCommand(getTransactionIdentifier());
getCommandBus().dispatch(new GenericCommandMessage<ConfirmTransactionCommand>(command),
@@ -86,9 +86,9 @@ public void onFailure(Throwable cause) {
@SagaEventHandler(associationProperty = "transactionIdentifier")
@EndSaga
- public void handle(NotEnoughMoneyInPortfolioToMakeReservationEvent event) {
+ public void handle(CashReservationRejectedEvent event) {
logger.debug(
- "Not enough money was available to make reservation in transaction {} for portfolio {}. Required: {}",
+ "Not enough cash was available to make reservation in transaction {} for portfolio {}. Required: {}",
new Object[]{getTransactionIdentifier(),
event.getPortfolioIdentifier(),
event.getAmountToPayInCents()});
@@ -108,14 +108,14 @@ public void handle(BuyTransactionConfirmedEvent event) {
@SagaEventHandler(associationProperty = "transactionIdentifier")
public void handle(BuyTransactionCancelledEvent event) {
long amountToCancel = (event.getTotalAmountOfItems() - event.getAmountOfExecutedItems()) * getPricePerItem();
- logger.debug("Buy Transaction {} is cancelled, amount of money reserved to cancel is {}",
+ logger.debug("Buy Transaction {} is cancelled, amount of cash reserved to cancel is {}",
event.getTransactionIdentifier(),
amountToCancel);
- CancelMoneyReservationFromPortfolioCommand command = new CancelMoneyReservationFromPortfolioCommand(
+ CancelCashReservationCommand command = new CancelCashReservationCommand(
getPortfolioIdentifier(),
getTransactionIdentifier(),
amountToCancel);
- getCommandBus().dispatch(new GenericCommandMessage<CancelMoneyReservationFromPortfolioCommand>(command));
+ getCommandBus().dispatch(new GenericCommandMessage<CancelCashReservationCommand>(command));
}
@SagaEventHandler(associationProperty = "buyTransactionId", keyName = "transactionIdentifier")
@@ -133,11 +133,11 @@ public void handle(TradeExecutedEvent event) {
public void handle(BuyTransactionExecutedEvent event) {
logger.debug("Buy Transaction {} is executed, last amount of executed items is {} for a price of {}",
new Object[]{event.getTransactionIdentifier(), event.getAmountOfItems(), event.getItemPrice()});
- ConfirmMoneyReservationFromPortfolionCommand confirmCommand =
- new ConfirmMoneyReservationFromPortfolionCommand(getPortfolioIdentifier(),
+ ConfirmCashReservationCommand confirmCommand =
+ new ConfirmCashReservationCommand(getPortfolioIdentifier(),
getTransactionIdentifier(),
event.getAmountOfItems() * event.getItemPrice());
- getCommandBus().dispatch(new GenericCommandMessage<ConfirmMoneyReservationFromPortfolionCommand>(confirmCommand));
+ getCommandBus().dispatch(new GenericCommandMessage<ConfirmCashReservationCommand>(confirmCommand));
AddItemsToPortfolioCommand addItemsCommand =
new AddItemsToPortfolioCommand(getPortfolioIdentifier(),
getOrderbookIdentifier(),
@@ -151,12 +151,12 @@ public void handle(BuyTransactionPartiallyExecutedEvent event) {
new Object[]{event.getTransactionIdentifier(),
event.getAmountOfExecutedItems(),
event.getItemPrice()});
- ConfirmMoneyReservationFromPortfolionCommand confirmCommand =
- new ConfirmMoneyReservationFromPortfolionCommand(getPortfolioIdentifier(),
+ ConfirmCashReservationCommand confirmCommand =
+ new ConfirmCashReservationCommand(getPortfolioIdentifier(),
getTransactionIdentifier(),
event.getAmountOfExecutedItems() * event
.getItemPrice());
- getCommandBus().dispatch(new GenericCommandMessage<ConfirmMoneyReservationFromPortfolionCommand>(confirmCommand));
+ getCommandBus().dispatch(new GenericCommandMessage<ConfirmCashReservationCommand>(confirmCommand));
AddItemsToPortfolioCommand addItemsCommand =
new AddItemsToPortfolioCommand(getPortfolioIdentifier(),
getOrderbookIdentifier(),
View
28 orders/src/main/java/org/axonframework/samples/trader/orders/command/Portfolio.java
@@ -20,8 +20,8 @@
import org.axonframework.eventsourcing.annotation.AbstractAnnotatedAggregateRoot;
import org.axonframework.eventsourcing.annotation.AggregateIdentifier;
import org.axonframework.samples.trader.api.portfolio.PortfolioCreatedEvent;
-import org.axonframework.samples.trader.api.portfolio.item.*;
-import org.axonframework.samples.trader.api.portfolio.money.*;
+import org.axonframework.samples.trader.api.portfolio.stock.*;
+import org.axonframework.samples.trader.api.portfolio.cash.*;
import org.axonframework.samples.trader.api.orders.trades.OrderBookId;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
import org.axonframework.samples.trader.api.orders.trades.TransactionId;
@@ -34,7 +34,7 @@
* Not a lot of checks are available. We will check if you still have item before you reserve them. Other than that
* we will not do checks. It is possible to give more items than you reserve.
* <p/>
- * When buying items you need to reserve money. Reservations need to be confirmed or cancelled. It is up to the user
+ * When buying items you need to reserve cash. Reservations need to be confirmed or cancelled. It is up to the user
* to confirm and cancel the right amounts. The Portfolio does not keep track of it.
*
* @author Jettro Coenradie
@@ -93,27 +93,27 @@ public void cancelReservation(OrderBookId orderBookIdentifier, TransactionId tra
}
public void addMoney(long moneyToAddInCents) {
- apply(new MoneyDepositedToPortfolioEvent(portfolioId, moneyToAddInCents));
+ apply(new CashDepositedEvent(portfolioId, moneyToAddInCents));
}
public void makePayment(long amountToPayInCents) {
- apply(new MoneyWithdrawnFromPortfolioEvent(portfolioId, amountToPayInCents));
+ apply(new CashWithdrawnEvent(portfolioId, amountToPayInCents));
}
public void reserveMoney(TransactionId transactionIdentifier, long amountToReserve) {
if (amountOfMoney >= amountToReserve) {
- apply(new MoneyReservedFromPortfolioEvent(portfolioId, transactionIdentifier, amountToReserve));
+ apply(new CashReservedEvent(portfolioId, transactionIdentifier, amountToReserve));
} else {
- apply(new NotEnoughMoneyInPortfolioToMakeReservationEvent(portfolioId, transactionIdentifier, amountToReserve));
+ apply(new CashReservationRejectedEvent(portfolioId, transactionIdentifier, amountToReserve));
}
}
public void cancelMoneyReservation(TransactionId transactionIdentifier, long amountOfMoneyToCancel) {
- apply(new MoneyReservationCancelledFromPortfolioEvent(portfolioId, transactionIdentifier, amountOfMoneyToCancel));
+ apply(new CashReservationCancelledEvent(portfolioId, transactionIdentifier, amountOfMoneyToCancel));
}
public void confirmMoneyReservation(TransactionId transactionIdentifier, long amountOfMoneyToConfirm) {
- apply(new MoneyReservationConfirmedFromPortfolioEvent(portfolioId, transactionIdentifier, amountOfMoneyToConfirm));
+ apply(new CashReservationConfirmedEvent(portfolioId, transactionIdentifier, amountOfMoneyToConfirm));
}
/* EVENT HANDLING */
@@ -156,29 +156,29 @@ public void onReservationCancelled(ItemReservationCancelledForPortfolioEvent eve
}
@EventHandler
- public void onMoneyAddedToPortfolio(MoneyDepositedToPortfolioEvent event) {
+ public void onMoneyAddedToPortfolio(CashDepositedEvent event) {
amountOfMoney += event.getMoneyAddedInCents();
}
@EventHandler
- public void onPaymentMadeFromPortfolio(MoneyWithdrawnFromPortfolioEvent event) {
+ public void onPaymentMadeFromPortfolio(CashWithdrawnEvent event) {
amountOfMoney -= event.getAmountPaidInCents();
}
@EventHandler
- public void onMoneyReservedFromPortfolio(MoneyReservedFromPortfolioEvent event) {
+ public void onMoneyReservedFromPortfolio(CashReservedEvent event) {
amountOfMoney -= event.getAmountToReserve();
reservedAmountOfMoney += event.getAmountToReserve();
}
@EventHandler
- public void onMoneyReservationCancelled(MoneyReservationCancelledFromPortfolioEvent event) {
+ public void onMoneyReservationCancelled(CashReservationCancelledEvent event) {
amountOfMoney += event.getAmountOfMoneyToCancel();
reservedAmountOfMoney -= event.getAmountOfMoneyToCancel();
}
@EventHandler
- public void onMoneyReservationConfirmed(MoneyReservationConfirmedFromPortfolioEvent event) {
+ public void onMoneyReservationConfirmed(CashReservationConfirmedEvent event) {
reservedAmountOfMoney -= event.getAmountOfMoneyConfirmedInCents();
}
View
20 orders/src/main/java/org/axonframework/samples/trader/orders/command/PortfolioCommandHandler.java
@@ -20,11 +20,11 @@
import org.axonframework.eventsourcing.EventSourcingRepository;
import org.axonframework.repository.Repository;
import org.axonframework.samples.trader.api.portfolio.CreatePortfolioCommand;
-import org.axonframework.samples.trader.api.portfolio.item.AddItemsToPortfolioCommand;
-import org.axonframework.samples.trader.api.portfolio.item.CancelItemReservationForPortfolioCommand;
-import org.axonframework.samples.trader.api.portfolio.item.ConfirmItemReservationForPortfolioCommand;
-import org.axonframework.samples.trader.api.portfolio.item.ReserveItemsCommand;
-import org.axonframework.samples.trader.api.portfolio.money.*;
+import org.axonframework.samples.trader.api.portfolio.stock.AddItemsToPortfolioCommand;
+import org.axonframework.samples.trader.api.portfolio.stock.CancelItemReservationForPortfolioCommand;
+import org.axonframework.samples.trader.api.portfolio.stock.ConfirmItemReservationForPortfolioCommand;
+import org.axonframework.samples.trader.api.portfolio.stock.ReserveItemsCommand;
+import org.axonframework.samples.trader.api.portfolio.cash.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
@@ -74,32 +74,32 @@ public void handleCancelReservationCommand(CancelItemReservationForPortfolioComm
}
@CommandHandler
- public void handleAddMoneyToPortfolioCommand(DepositMoneyToPortfolioCommand command) {
+ public void handleAddMoneyToPortfolioCommand(DepositCashCommand command) {
Portfolio portfolio = portfolioRepository.load(command.getPortfolioIdentifier());
portfolio.addMoney(command.getMoneyToAddInCents());
}
@CommandHandler
- public void handleMakePaymentFromPortfolioCommand(WithdrawMoneyFromPortfolioCommand command) {
+ public void handleMakePaymentFromPortfolioCommand(WithdrawCashCommand command) {
Portfolio portfolio = portfolioRepository.load(command.getPortfolioIdentifier());
portfolio.makePayment(command.getAmountToPayInCents());
}
@CommandHandler
- public void handleReserveMoneyFromPortfolioCommand(ReserveMoneyFromPortfolioCommand command) {
+ public void handleReserveMoneyFromPortfolioCommand(ReserveCashCommand command) {
Portfolio portfolio = portfolioRepository.load(command.getPortfolioIdentifier());
portfolio.reserveMoney(command.getTransactionIdentifier(), command.getAmountOfMoneyToReserve());
}
@CommandHandler
- public void handleCancelMoneyReservationFromPortfolioCommand(CancelMoneyReservationFromPortfolioCommand command) {
+ public void handleCancelMoneyReservationFromPortfolioCommand(CancelCashReservationCommand command) {
Portfolio portfolio = portfolioRepository.load(command.getPortfolioIdentifier());
portfolio.cancelMoneyReservation(command.getTransactionIdentifier(), command.getAmountOfMoneyToCancel());
}
@CommandHandler
public void handleConfirmMoneyReservationFromPortfolioCommand(
- ConfirmMoneyReservationFromPortfolionCommand command) {
+ ConfirmCashReservationCommand command) {
Portfolio portfolio = portfolioRepository.load(command.getPortfolioIdentifier());
portfolio.confirmMoneyReservation(command.getTransactionIdentifier(),
command.getAmountOfMoneyToConfirmInCents());
View
18 orders/src/main/java/org/axonframework/samples/trader/orders/command/SellTradeManagerSaga.java
@@ -20,8 +20,8 @@
import org.axonframework.saga.annotation.EndSaga;
import org.axonframework.saga.annotation.SagaEventHandler;
import org.axonframework.saga.annotation.StartSaga;
-import org.axonframework.samples.trader.api.portfolio.item.*;
-import org.axonframework.samples.trader.api.portfolio.money.DepositMoneyToPortfolioCommand;
+import org.axonframework.samples.trader.api.portfolio.stock.*;
+import org.axonframework.samples.trader.api.portfolio.cash.DepositCashCommand;
import org.axonframework.samples.trader.api.orders.transaction.*;
import org.axonframework.samples.trader.api.orders.trades.CreateSellOrderCommand;
import org.axonframework.samples.trader.api.orders.trades.OrderId;
@@ -97,7 +97,7 @@ public void handle(SellTransactionConfirmedEvent event) {
@EndSaga
public void handle(SellTransactionCancelledEvent event) {
long amountOfCancelledItems = event.getTotalAmountOfItems() - event.getAmountOfExecutedItems();
- logger.debug("Sell Transaction {} is cancelled, amount of money reserved to cancel is {}",
+ logger.debug("Sell Transaction {} is cancelled, amount of cash reserved to cancel is {}",
event.getTransactionIdentifier(),
amountOfCancelledItems);
CancelItemReservationForPortfolioCommand command =
@@ -131,10 +131,10 @@ public void handle(SellTransactionExecutedEvent event) {
getTransactionIdentifier(),
event.getAmountOfItems());
getCommandBus().dispatch(new GenericCommandMessage<ConfirmItemReservationForPortfolioCommand>(confirmCommand));
- DepositMoneyToPortfolioCommand depositCommand =
- new DepositMoneyToPortfolioCommand(getPortfolioIdentifier(),
+ DepositCashCommand depositCommand =
+ new DepositCashCommand(getPortfolioIdentifier(),
event.getItemPrice() * event.getAmountOfItems());
- getCommandBus().dispatch(new GenericCommandMessage<DepositMoneyToPortfolioCommand>(depositCommand));
+ getCommandBus().dispatch(new GenericCommandMessage<DepositCashCommand>(depositCommand));
}
@SagaEventHandler(associationProperty = "transactionIdentifier")
@@ -150,9 +150,9 @@ public void handle(SellTransactionPartiallyExecutedEvent event) {
getTransactionIdentifier(),
event.getAmountOfExecutedItems());
getCommandBus().dispatch(new GenericCommandMessage<ConfirmItemReservationForPortfolioCommand>(confirmCommand));
- DepositMoneyToPortfolioCommand depositCommand =
- new DepositMoneyToPortfolioCommand(getPortfolioIdentifier(),
+ DepositCashCommand depositCommand =
+ new DepositCashCommand(getPortfolioIdentifier(),
event.getItemPrice() * event.getAmountOfExecutedItems());
- getCommandBus().dispatch(new GenericCommandMessage<DepositMoneyToPortfolioCommand>(depositCommand));
+ getCommandBus().dispatch(new GenericCommandMessage<DepositCashCommand>(depositCommand));
}
}
View
18 orders/src/test/java/org/axonframework/samples/trader/orders/command/BuyTradeManagerSagaTest.java
@@ -16,8 +16,8 @@
package org.axonframework.samples.trader.orders.command;
-import org.axonframework.samples.trader.api.portfolio.money.MoneyReservedFromPortfolioEvent;
-import org.axonframework.samples.trader.api.portfolio.money.NotEnoughMoneyInPortfolioToMakeReservationEvent;
+import org.axonframework.samples.trader.api.portfolio.cash.CashReservationRejectedEvent;
+import org.axonframework.samples.trader.api.portfolio.cash.CashReservedEvent;
import org.axonframework.samples.trader.api.orders.transaction.*;
import org.axonframework.samples.trader.api.orders.trades.OrderBookId;
import org.axonframework.samples.trader.api.orders.trades.OrderId;
@@ -76,7 +76,7 @@ public void testHandle_MoneyIsReserved() {
TOTAL_ITEMS,
PRICE_PER_ITEM))
.whenAggregate(portfolioIdentifier).publishes(
- new MoneyReservedFromPortfolioEvent(portfolioIdentifier, transactionIdentifier,
+ new CashReservedEvent(portfolioIdentifier, transactionIdentifier,
TOTAL_ITEMS
* PRICE_PER_ITEM))
.expectActiveSagas(1)
@@ -94,7 +94,7 @@ public void testHandle_NotEnoughMoneyToReserved() {
TOTAL_ITEMS,
PRICE_PER_ITEM))
.whenAggregate(portfolioIdentifier).publishes(
- new NotEnoughMoneyInPortfolioToMakeReservationEvent(
+ new CashReservationRejectedEvent(
portfolioIdentifier, transactionIdentifier, TOTAL_ITEMS * PRICE_PER_ITEM))
.expectActiveSagas(0);
}
@@ -108,7 +108,7 @@ public void testHandle_TransactionConfirmed() {
TOTAL_ITEMS,
PRICE_PER_ITEM))
.andThenAggregate(portfolioIdentifier).published(
- new MoneyReservedFromPortfolioEvent(
+ new CashReservedEvent(
portfolioIdentifier,
transactionIdentifier,
TOTAL_ITEMS * PRICE_PER_ITEM))
@@ -146,7 +146,7 @@ public void testHandle_TradeExecutedPlaced() {
portfolioIdentifier,
TOTAL_ITEMS,
PRICE_PER_ITEM))
- .andThenAggregate(portfolioIdentifier).published(new MoneyReservedFromPortfolioEvent(
+ .andThenAggregate(portfolioIdentifier).published(new CashReservedEvent(
portfolioIdentifier, transactionIdentifier,
TOTAL_ITEMS * PRICE_PER_ITEM))
.andThenAggregate(transactionIdentifier).published(new BuyTransactionConfirmedEvent(transactionIdentifier))
@@ -175,7 +175,7 @@ public void testHandle_BuyTransactionExecuted() {
portfolioIdentifier,
TOTAL_ITEMS,
PRICE_PER_ITEM))
- .andThenAggregate(portfolioIdentifier).published(new MoneyReservedFromPortfolioEvent(
+ .andThenAggregate(portfolioIdentifier).published(new CashReservedEvent(
portfolioIdentifier, transactionIdentifier,
TOTAL_ITEMS * PRICE_PER_ITEM))
.andThenAggregate(transactionIdentifier).published(new BuyTransactionConfirmedEvent(transactionIdentifier))
@@ -207,7 +207,7 @@ public void testHandle_BuyTransactionPartiallyExecuted() {
portfolioIdentifier,
TOTAL_ITEMS,
PRICE_PER_ITEM))
- .andThenAggregate(portfolioIdentifier).published(new MoneyReservedFromPortfolioEvent(
+ .andThenAggregate(portfolioIdentifier).published(new CashReservedEvent(
portfolioIdentifier, transactionIdentifier,
TOTAL_ITEMS * PRICE_PER_ITEM))
.andThenAggregate(transactionIdentifier).published(new BuyTransactionConfirmedEvent(transactionIdentifier))
@@ -237,7 +237,7 @@ public void testHandle_MultipleBuyTransactionPartiallyExecuted() {
portfolioIdentifier,
TOTAL_ITEMS,
PRICE_PER_ITEM))
- .andThenAggregate(portfolioIdentifier).published(new MoneyReservedFromPortfolioEvent(
+ .andThenAggregate(portfolioIdentifier).published(new CashReservedEvent(
portfolioIdentifier, transactionIdentifier,
TOTAL_ITEMS * PRICE_PER_ITEM))
.andThenAggregate(transactionIdentifier).published(new BuyTransactionConfirmedEvent(transactionIdentifier))
View
44 orders/src/test/java/org/axonframework/samples/trader/orders/command/PortfolioCommandHandlerTest.java
@@ -18,8 +18,8 @@
import org.axonframework.samples.trader.api.portfolio.CreatePortfolioCommand;
import org.axonframework.samples.trader.api.portfolio.PortfolioCreatedEvent;
-import org.axonframework.samples.trader.api.portfolio.item.*;
-import org.axonframework.samples.trader.api.portfolio.money.*;
+import org.axonframework.samples.trader.api.portfolio.stock.*;
+import org.axonframework.samples.trader.api.portfolio.cash.*;
import org.axonframework.samples.trader.api.orders.trades.OrderBookId;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
import org.axonframework.samples.trader.api.orders.trades.TransactionId;
@@ -148,67 +148,67 @@ public void testCancellationOfReservation() {
/* Money related test methods */
@Test
public void testDepositingMoneyToThePortfolio() {
- DepositMoneyToPortfolioCommand command = new DepositMoneyToPortfolioCommand(portfolioIdentifier, 2000l);
+ DepositCashCommand command = new DepositCashCommand(portfolioIdentifier, 2000l);
fixture.given(new PortfolioCreatedEvent(portfolioIdentifier, userIdentifier))
.when(command)
- .expectEvents(new MoneyDepositedToPortfolioEvent(portfolioIdentifier, 2000l));
+ .expectEvents(new CashDepositedEvent(portfolioIdentifier, 2000l));
}
@Test
public void testWithdrawingMoneyFromPortfolio() {
- WithdrawMoneyFromPortfolioCommand command = new WithdrawMoneyFromPortfolioCommand(portfolioIdentifier, 300l);
- fixture.given(new PortfolioCreatedEvent(portfolioIdentifier, userIdentifier), new MoneyDepositedToPortfolioEvent(portfolioIdentifier, 400))
+ WithdrawCashCommand command = new WithdrawCashCommand(portfolioIdentifier, 300l);
+ fixture.given(new PortfolioCreatedEvent(portfolioIdentifier, userIdentifier), new CashDepositedEvent(portfolioIdentifier, 400))
.when(command)
- .expectEvents(new MoneyWithdrawnFromPortfolioEvent(portfolioIdentifier, 300l));
+ .expectEvents(new CashWithdrawnEvent(portfolioIdentifier, 300l));
}
@Test
public void testWithdrawingMoneyFromPortfolio_withoutEnoughMoney() {
- WithdrawMoneyFromPortfolioCommand command = new WithdrawMoneyFromPortfolioCommand(portfolioIdentifier, 300l);
- fixture.given(new PortfolioCreatedEvent(portfolioIdentifier, userIdentifier), new MoneyDepositedToPortfolioEvent(portfolioIdentifier, 200))
+ WithdrawCashCommand command = new WithdrawCashCommand(portfolioIdentifier, 300l);
+ fixture.given(new PortfolioCreatedEvent(portfolioIdentifier, userIdentifier), new CashDepositedEvent(portfolioIdentifier, 200))
.when(command)
- .expectEvents(new MoneyWithdrawnFromPortfolioEvent(portfolioIdentifier, 300l));
+ .expectEvents(new CashWithdrawnEvent(portfolioIdentifier, 300l));
}
@Test
public void testMakingMoneyReservation() {
- ReserveMoneyFromPortfolioCommand command = new ReserveMoneyFromPortfolioCommand(portfolioIdentifier,
+ ReserveCashCommand command = new ReserveCashCommand(portfolioIdentifier,
transactionIdentifier,
300l);
- fixture.given(new PortfolioCreatedEvent(portfolioIdentifier, userIdentifier), new MoneyDepositedToPortfolioEvent(portfolioIdentifier, 400))
+ fixture.given(new PortfolioCreatedEvent(portfolioIdentifier, userIdentifier), new CashDepositedEvent(portfolioIdentifier, 400))
.when(command)
- .expectEvents(new MoneyReservedFromPortfolioEvent(portfolioIdentifier, transactionIdentifier, 300l));
+ .expectEvents(new CashReservedEvent(portfolioIdentifier, transactionIdentifier, 300l));
}
@Test
public void testMakingMoneyReservation_withoutEnoughMoney() {
- ReserveMoneyFromPortfolioCommand command = new ReserveMoneyFromPortfolioCommand(portfolioIdentifier,
+ ReserveCashCommand command = new ReserveCashCommand(portfolioIdentifier,
transactionIdentifier,
600l);
- fixture.given(new PortfolioCreatedEvent(portfolioIdentifier, userIdentifier), new MoneyDepositedToPortfolioEvent(portfolioIdentifier, 400))
+ fixture.given(new PortfolioCreatedEvent(portfolioIdentifier, userIdentifier), new CashDepositedEvent(portfolioIdentifier, 400))
.when(command)
- .expectEvents(new NotEnoughMoneyInPortfolioToMakeReservationEvent(portfolioIdentifier, transactionIdentifier, 600));
+ .expectEvents(new CashReservationRejectedEvent(portfolioIdentifier, transactionIdentifier, 600));
}
@Test
public void testCancelMoneyReservation() {
- CancelMoneyReservationFromPortfolioCommand command = new CancelMoneyReservationFromPortfolioCommand(
+ CancelCashReservationCommand command = new CancelCashReservationCommand(
portfolioIdentifier,
transactionIdentifier,
200l);
- fixture.given(new PortfolioCreatedEvent(portfolioIdentifier, userIdentifier), new MoneyDepositedToPortfolioEvent(portfolioIdentifier, 400))
+ fixture.given(new PortfolioCreatedEvent(portfolioIdentifier, userIdentifier), new CashDepositedEvent(portfolioIdentifier, 400))
.when(command)
- .expectEvents(new MoneyReservationCancelledFromPortfolioEvent(portfolioIdentifier, transactionIdentifier, 200l));
+ .expectEvents(new CashReservationCancelledEvent(portfolioIdentifier, transactionIdentifier, 200l));
}
@Test
public void testConfirmMoneyReservation() {
- ConfirmMoneyReservationFromPortfolionCommand command = new ConfirmMoneyReservationFromPortfolionCommand(
+ ConfirmCashReservationCommand command = new ConfirmCashReservationCommand(
portfolioIdentifier,
transactionIdentifier,
200l);
- fixture.given(new PortfolioCreatedEvent(portfolioIdentifier, userIdentifier), new MoneyDepositedToPortfolioEvent(portfolioIdentifier, 400))
+ fixture.given(new PortfolioCreatedEvent(portfolioIdentifier, userIdentifier), new CashDepositedEvent(portfolioIdentifier, 400))
.when(command)
- .expectEvents(new MoneyReservationConfirmedFromPortfolioEvent(portfolioIdentifier, transactionIdentifier, 200l));
+ .expectEvents(new CashReservationConfirmedEvent(portfolioIdentifier, transactionIdentifier, 200l));
}
}
View
4 orders/src/test/java/org/axonframework/samples/trader/orders/command/SellTradeManagerSagaTest.java
@@ -16,8 +16,8 @@
package org.axonframework.samples.trader.orders.command;
-import org.axonframework.samples.trader.api.portfolio.item.ItemsReservedEvent;
-import org.axonframework.samples.trader.api.portfolio.item.NotEnoughItemsAvailableToReserveInPortfolio;
+import org.axonframework.samples.trader.api.portfolio.stock.ItemsReservedEvent;
+import org.axonframework.samples.trader.api.portfolio.stock.NotEnoughItemsAvailableToReserveInPortfolio;
import org.axonframework.samples.trader.api.orders.transaction.*;
import org.axonframework.samples.trader.api.orders.trades.OrderBookId;
import org.axonframework.samples.trader.api.orders.trades.OrderId;
View
2  ...est/java/org/axonframework/samples/trader/orders/command/matchers/AddItemsToPortfolioCommandMatcher.java
@@ -16,7 +16,7 @@
package org.axonframework.samples.trader.orders.command.matchers;
-import org.axonframework.samples.trader.api.portfolio.item.AddItemsToPortfolioCommand;
+import org.axonframework.samples.trader.api.portfolio.stock.AddItemsToPortfolioCommand;
import org.axonframework.samples.trader.api.orders.trades.OrderBookId;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
import org.hamcrest.Description;
View
2  ...xonframework/samples/trader/orders/command/matchers/CancelItemReservationForPortfolioCommandMatcher.java
@@ -16,7 +16,7 @@
package org.axonframework.samples.trader.orders.command.matchers;
-import org.axonframework.samples.trader.api.portfolio.item.CancelItemReservationForPortfolioCommand;
+import org.axonframework.samples.trader.api.portfolio.stock.CancelItemReservationForPortfolioCommand;
import org.axonframework.samples.trader.api.orders.trades.OrderBookId;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
import org.hamcrest.Description;
View
8 ...nframework/samples/trader/orders/command/matchers/CancelMoneyReservationFromPortfolioCommandMatcher.java
@@ -16,7 +16,7 @@
package org.axonframework.samples.trader.orders.command.matchers;
-import org.axonframework.samples.trader.api.portfolio.money.CancelMoneyReservationFromPortfolioCommand;
+import org.axonframework.samples.trader.api.portfolio.cash.CancelCashReservationCommand;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
import org.hamcrest.Description;
@@ -24,7 +24,7 @@
* @author Jettro Coenradie
*/
public class CancelMoneyReservationFromPortfolioCommandMatcher
- extends BaseCommandMatcher<CancelMoneyReservationFromPortfolioCommand> {
+ extends BaseCommandMatcher<CancelCashReservationCommand> {
public CancelMoneyReservationFromPortfolioCommandMatcher(PortfolioId portfolioIdentifier,
long amountOfMoneyToCancel) {
@@ -36,14 +36,14 @@ public CancelMoneyReservationFromPortfolioCommandMatcher(PortfolioId portfolioId
private long amountOfMoneyToCancel;
@Override
- protected boolean doMatches(CancelMoneyReservationFromPortfolioCommand command) {
+ protected boolean doMatches(CancelCashReservationCommand command) {
return command.getPortfolioIdentifier().equals(portfolioIdentifier)
&& command.getAmountOfMoneyToCancel() == amountOfMoneyToCancel;
}
@Override
public void describeTo(Description description) {
- description.appendText("CancelMoneyReservationFromPortfolioCommand with amountOfMoneyToCancel [")
+ description.appendText("CancelCashReservationCommand with amountOfMoneyToCancel [")
.appendValue(amountOfMoneyToCancel)
.appendText("] for Portfolio with identifier [")
.appendValue(portfolioIdentifier)
View
2  ...onframework/samples/trader/orders/command/matchers/ConfirmItemReservationForPortfolioCommandMatcher.java
@@ -16,7 +16,7 @@
package org.axonframework.samples.trader.orders.command.matchers;
-import org.axonframework.samples.trader.api.portfolio.item.ConfirmItemReservationForPortfolioCommand;
+import org.axonframework.samples.trader.api.portfolio.stock.ConfirmItemReservationForPortfolioCommand;
import org.axonframework.samples.trader.api.orders.trades.OrderBookId;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
import org.hamcrest.Description;
View
8 ...ramework/samples/trader/orders/command/matchers/ConfirmMoneyReservationFromPortfolionCommandMatcher.java
@@ -16,7 +16,7 @@
package org.axonframework.samples.trader.orders.command.matchers;
-import org.axonframework.samples.trader.api.portfolio.money.ConfirmMoneyReservationFromPortfolionCommand;
+import org.axonframework.samples.trader.api.portfolio.cash.ConfirmCashReservationCommand;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
import org.hamcrest.Description;
@@ -24,7 +24,7 @@
* @author Jettro Coenradie
*/
public class ConfirmMoneyReservationFromPortfolionCommandMatcher
- extends BaseCommandMatcher<ConfirmMoneyReservationFromPortfolionCommand> {
+ extends BaseCommandMatcher<ConfirmCashReservationCommand> {
private PortfolioId portfolioIdentifier;
private long amountOfMoneyToconfirm;
@@ -36,14 +36,14 @@ public ConfirmMoneyReservationFromPortfolionCommandMatcher(PortfolioId portfolio
}
@Override
- protected boolean doMatches(ConfirmMoneyReservationFromPortfolionCommand command) {
+ protected boolean doMatches(ConfirmCashReservationCommand command) {
return command.getPortfolioIdentifier().equals(portfolioIdentifier)
&& command.getAmountOfMoneyToConfirmInCents() == amountOfMoneyToconfirm;
}
@Override
public void describeTo(Description description) {
- description.appendText("ConfirmMoneyReservationFromPortfolionCommand with amountOfMoneyToConfirm [")
+ description.appendText("ConfirmCashReservationCommand with amountOfMoneyToConfirm [")
.appendValue(amountOfMoneyToconfirm)
.appendText("] for Portfolio with identifier [")
.appendValue(portfolioIdentifier)
View
8 ...java/org/axonframework/samples/trader/orders/command/matchers/DepositMoneyToPortfolioCommandMatcher.java
@@ -16,14 +16,14 @@
package org.axonframework.samples.trader.orders.command.matchers;
-import org.axonframework.samples.trader.api.portfolio.money.DepositMoneyToPortfolioCommand;
+import org.axonframework.samples.trader.api.portfolio.cash.DepositCashCommand;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
import org.hamcrest.Description;
/**
* @author Jettro Coenradie
*/
-public class DepositMoneyToPortfolioCommandMatcher extends BaseCommandMatcher<DepositMoneyToPortfolioCommand> {
+public class DepositMoneyToPortfolioCommandMatcher extends BaseCommandMatcher<DepositCashCommand> {
private long moneyToAddInCents;
private PortfolioId portfolioIdentifier;
@@ -34,14 +34,14 @@ public DepositMoneyToPortfolioCommandMatcher(PortfolioId portfolioIdentifier, lo
}
@Override
- protected boolean doMatches(DepositMoneyToPortfolioCommand command) {
+ protected boolean doMatches(DepositCashCommand command) {
return moneyToAddInCents == command.getMoneyToAddInCents()
&& portfolioIdentifier.equals(command.getPortfolioIdentifier());
}
@Override
public void describeTo(Description description) {
- description.appendText("DepositMoneyToPortfolioCommand with moneyToAddInCents [")
+ description.appendText("DepositCashCommand with moneyToAddInCents [")
.appendValue(moneyToAddInCents)
.appendText("] for Portfolio with identifier [")
.appendValue(portfolioIdentifier)
View
8 ...va/org/axonframework/samples/trader/orders/command/matchers/ReserveMoneyFromPortfolioCommandMatcher.java
@@ -16,14 +16,14 @@
package org.axonframework.samples.trader.orders.command.matchers;
-import org.axonframework.samples.trader.api.portfolio.money.ReserveMoneyFromPortfolioCommand;
+import org.axonframework.samples.trader.api.portfolio.cash.ReserveCashCommand;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
import org.hamcrest.Description;
/**
* @author Jettro Coenradie
*/
-public class ReserveMoneyFromPortfolioCommandMatcher extends BaseCommandMatcher<ReserveMoneyFromPortfolioCommand> {
+public class ReserveMoneyFromPortfolioCommandMatcher extends BaseCommandMatcher<ReserveCashCommand> {
private PortfolioId portfolioIdentifier;
private long amountOfMoneyToReserve;
@@ -34,14 +34,14 @@ public ReserveMoneyFromPortfolioCommandMatcher(PortfolioId portfolioIdentifier,
}
@Override
- protected boolean doMatches(ReserveMoneyFromPortfolioCommand command) {
+ protected boolean doMatches(ReserveCashCommand command) {
return command.getPortfolioIdentifier().equals(portfolioIdentifier)
&& command.getAmountOfMoneyToReserve() == amountOfMoneyToReserve;
}
@Override
public void describeTo(Description description) {
- description.appendText("ReserveMoneyFromPortfolioCommand with amountOfMoneyToReserve [")
+ description.appendText("ReserveCashCommand with amountOfMoneyToReserve [")
.appendValue(amountOfMoneyToReserve)
.appendText("] for Portfolio with identifier [")
.appendValue(portfolioIdentifier)
View
2  .../src/test/java/org/axonframework/samples/trader/orders/command/matchers/ReservedItemsCommandMatcher.java
@@ -16,7 +16,7 @@
package org.axonframework.samples.trader.orders.command.matchers;
-import org.axonframework.samples.trader.api.portfolio.item.ReserveItemsCommand;
+import org.axonframework.samples.trader.api.portfolio.stock.ReserveItemsCommand;
import org.axonframework.samples.trader.api.orders.trades.OrderBookId;
import org.axonframework.samples.trader.api.orders.trades.PortfolioId;
import org.hamcrest.Description;
View
8 query/src/main/java/org/axonframework/samples/trader/query/portfolio/PortfolioItemEventListener.java
@@ -17,10 +17,10 @@
package org.axonframework.samples.trader.query.portfolio;
import org.axonframework.eventhandling.annotation.EventHandler;
-import org.axonframework.samples.trader.api.portfolio.item.ItemReservationCancelledForPortfolioEvent;
-import org.axonframework.samples.trader.api.portfolio.item.ItemReservationConfirmedForPortfolioEvent;
-import org.axonframework.samples.trader.api.portfolio.item.ItemsAddedToPortfolioEvent;
-import org.axonframework.samples.trader.api.portfolio.item.ItemsReservedEvent;
+import org.axonframework.samples.trader.api.portfolio.stock.ItemReservationCancelledForPortfolioEvent;
+import org.axonframework.samples.trader.api.portfolio.stock.ItemReservationConfirmedForPortfolioEvent;
+import org.axonframework.samples.trader.api.portfolio.stock.ItemsAddedToPortfolioEvent;
+import org.axonframework.samples.trader.api.portfolio.stock.ItemsReservedEvent;
import org.axonframework.samples.trader.query.orderbook.OrderBookEntry;
import org.axonframework.samples.trader.query.orderbook.repositories.OrderBookQueryRepository;
import org.axonframework.samples.trader.query.portfolio.repositories.PortfolioQueryRepository;
View
12 query/src/main/java/org/axonframework/samples/trader/query/portfolio/PortfolioMoneyEventListener.java
@@ -18,7 +18,7 @@
import org.axonframework.eventhandling.annotation.EventHandler;
import org.axonframework.samples.trader.api.portfolio.PortfolioCreatedEvent;
-import org.axonframework.samples.trader.api.portfolio.money.*;
+import org.axonframework.samples.trader.api.portfolio.cash.*;
import org.axonframework.samples.trader.query.portfolio.repositories.PortfolioQueryRepository;
import org.axonframework.samples.trader.query.users.repositories.UserQueryRepository;
import org.slf4j.Logger;
@@ -54,28 +54,28 @@ public void handleEvent(PortfolioCreatedEvent event) {
}
@EventHandler
- public void handleEvent(MoneyDepositedToPortfolioEvent event) {
+ public void handleEvent(CashDepositedEvent event) {
PortfolioEntry portfolioEntry = portfolioRepository.findOne(event.getPortfolioIdentifier().toString());
portfolioEntry.setAmountOfMoney(portfolioEntry.getAmountOfMoney() + event.getMoneyAddedInCents());
portfolioRepository.save(portfolioEntry);
}
@EventHandler
- public void handleEvent(MoneyWithdrawnFromPortfolioEvent event) {
+ public void handleEvent(CashWithdrawnEvent event) {
PortfolioEntry portfolioEntry = portfolioRepository.findOne(event.getPortfolioIdentifier().toString());
portfolioEntry.setAmountOfMoney(portfolioEntry.getAmountOfMoney() - event.getAmountPaidInCents());
portfolioRepository.save(portfolioEntry);
}
@EventHandler
- public void handleEvent(MoneyReservedFromPortfolioEvent event) {
+ public void handleEvent(CashReservedEvent event) {
PortfolioEntry portfolioEntry = portfolioRepository.findOne(event.getPortfolioIdentifier().toString());
portfolioEntry.setReservedAmountOfMoney(portfolioEntry.getReservedAmountOfMoney() + event.getAmountToReserve());
portfolioRepository.save(portfolioEntry);
}
@EventHandler
- public void handleEvent(MoneyReservationCancelledFromPortfolioEvent event) {
+ public void handleEvent(CashReservationCancelledEvent event) {
PortfolioEntry portfolioEntry = portfolioRepository.findOne(event.getPortfolioIdentifier().toString());
portfolioEntry.setReservedAmountOfMoney(
portfolioEntry.getReservedAmountOfMoney() - event.getAmountOfMoneyToCancel());
@@ -83,7 +83,7 @@ public void handleEvent(MoneyReservationCancelledFromPortfolioEvent event) {
}
@EventHandler
- public void handleEvent(MoneyReservationConfirmedFromPortfolioEvent event) {
+ public void handleEvent(CashReservationConfirmedEvent event) {
PortfolioEntry portfolioEntry = portfolioRepository.findOne(event.getPortfolioIdentifier().toString());
long reservedAmountOfMoney = portfolioEntry.getReservedAmountOfMoney();
long amountOfMoneyConfirmed = event.getAmountOfMoneyConfirmedInCents();
View
8 query/src/test/java/org/axonframework/samples/trader/query/portfolio/PortfolioItemEventListenerTest.java
@@ -17,10 +17,10 @@
package org.axonframework.samples.trader.query.portfolio;
import org.axonframework.samples.trader.api.company.CompanyId;
-import org.axonframework.samples.trader.api.portfolio.item.ItemReservationCancelledForPortfolioEvent;
-import org.axonframework.samples.trader.api.portfolio.item.ItemReservationConfirmedForPortfolioEvent;
-import org.axonframework.samples.trader.api.portfolio.item.ItemsAddedToPortfolioEvent;
-import org.axonframework.samples.trader.api.portfolio.item.ItemsReservedEvent;
+import org.axonframework.samples.trader.api.portfolio.stock.ItemReservationCancelledForPortfolioEvent;
+import org.axonframework.samples.trader.api.portfolio.stock.ItemReservationConfirmedForPortfolioEvent;
+import org.axonframework.samples.trader.api.portfolio.stock.ItemsAddedToPortfolioEvent;
+import org.axonframework.samples.trader.api.portfolio.stock.ItemsReservedEvent;
import org.axonframework.samples.trader.query.orderbook.OrderBookEntry;
import org.axonframework.samples.trader.query.orderbook.repositories.OrderBookQueryRepository;
import org.axonframework.samples.trader.query.portfolio.repositories.PortfolioQueryRepository;
View
10 web-ui/src/main/java/org/axonframework/samples/trader/webui/admin/AdminController.java
@@ -18,8 +18,8 @@
import org.axonframework.commandhandling.CommandBus;
import org.axonframework.commandhandling.GenericCommandMessage;
-import org.axonframework.samples.trader.api.portfolio.item.AddItemsToPortfolioCommand;
-import org.axonframework.samples.trader.api.portfolio.money.DepositMoneyToPortfolioCommand;
+import org.axonframework.samples.trader.api.portfolio.stock.AddItemsToPortfolioCommand;
+import org.axonframework.samples.trader.api.portfolio.cash.DepositCashCommand;
import org.axonframework.samples.trader.query.orderbook.OrderBookEntry;
import org.axonframework.samples.trader.query.orderbook.repositories.OrderBookQueryRepository;
import org.axonframework.samples.trader.query.portfolio.PortfolioEntry;
@@ -68,9 +68,9 @@ public String showPortfolio(@PathVariable("identifier") String portfolioIdentifi
public String addMoney(@PathVariable("identifier") String portfolioIdentifier,
@RequestParam("amount") long amountOfMoney
) {
- DepositMoneyToPortfolioCommand command =
- new DepositMoneyToPortfolioCommand(new PortfolioId(portfolioIdentifier), amountOfMoney);
- commandBus.dispatch(new GenericCommandMessage<DepositMoneyToPortfolioCommand>(command));
+ DepositCashCommand command =
+ new DepositCashCommand(new PortfolioId(portfolioIdentifier), amountOfMoney);
+ commandBus.dispatch(new GenericCommandMessage<DepositCashCommand>(command));
return "redirect:/admin/portfolio/{identifier}";
}
View
2  web-ui/src/main/java/org/axonframework/samples/trader/webui/companies/CompanyController.java
@@ -158,7 +158,7 @@ public String buy(@ModelAttribute("order") @Valid BuyOrder order, BindingResult
if (portfolioEntry.obtainMoneyToSpend() < order.getTradeCount() * order.getItemPrice()) {
bindingResult.rejectValue("tradeCount",
"error.order.buy.notenoughmoney",
- "Not enough money to spend to buy the items for the price you want");
+ "Not enough cash to spend to buy the items for the price you want");
addPortfolioMoneyInfoToModel(portfolioEntry, model);
return "company/buy";
}
View
10 web-ui/src/main/java/org/axonframework/samples/trader/webui/init/DBInit.java
@@ -22,8 +22,8 @@
import org.axonframework.saga.repository.mongo.MongoTemplate;
import org.axonframework.samples.trader.api.company.CompanyId;
import org.axonframework.samples.trader.api.company.CreateCompanyCommand;
-import org.axonframework.samples.trader.api.portfolio.item.AddItemsToPortfolioCommand;
-import org.axonframework.samples.trader.api.portfolio.money.DepositMoneyToPortfolioCommand;
+import org.axonframework.samples.trader.api.portfolio.stock.AddItemsToPortfolioCommand;
+import org.axonframework.samples.trader.api.portfolio.cash.DepositCashCommand;
import org.axonframework.samples.trader.query.company.CompanyEntry;
import org.axonframework.samples.trader.query.company.repositories.CompanyQueryRepository;
import org.axonframework.samples.trader.query.orderbook.OrderBookEntry;
@@ -142,9 +142,9 @@ private void addMoney(UserId buyer1, long amount) {
}
public void depositMoneyToPortfolio(String portfolioIdentifier, long amountOfMoney) {
- DepositMoneyToPortfolioCommand command =
- new DepositMoneyToPortfolioCommand(new PortfolioId(portfolioIdentifier), amountOfMoney);
- commandBus.dispatch(new GenericCommandMessage<DepositMoneyToPortfolioCommand>(command));
+ DepositCashCommand command =
+ new DepositCashCommand(new PortfolioId(portfolioIdentifier), amountOfMoney);
+ commandBus.dispatch(new GenericCommandMessage<DepositCashCommand>(command));
}
View
2  web-ui/src/main/java/org/axonframework/samples/trader/webui/init/MongoController.java
@@ -91,7 +91,7 @@ public String addMoneyToPortfolio(@PathVariable("identifier") String portfolioId
@PathVariable("amount") long amount,
Model model) {
dbInit.depositMoneyToPortfolio(portfolioIdentifier, amount);
- model.addAttribute("info", "Added money to the portfolio.");
+ model.addAttribute("info", "Added cash to the portfolio.");
return "data/info";
}
}
View
4 web-ui/src/test/java/org/axonframework/samples/trader/test/CommandCreator.groovy
@@ -24,8 +24,8 @@ import org.axonframework.samples.trader.api.orders.trades.PortfolioId
import org.axonframework.samples.trader.api.orders.trades.TransactionId;
/**
- * Class used to create an order based on the provided Profile. If the profile has money we place buy orders, if
- * the profile is almost out of money we start selling stuff.
+ * Class used to create an order based on the provided Profile. If the profile has cash we place buy orders, if
+ * the profile is almost out of cash we start selling stuff.
*
* @author Jettro Coenradie
*/
Please sign in to comment.
Something went wrong with that request. Please try again.