-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#981 Added first test of send basket to market
- Loading branch information
1 parent
1013a05
commit b970f52
Showing
10 changed files
with
146 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
76 changes: 76 additions & 0 deletions
76
example/basket/src/test/scala/org/finos/vuu/core/module/basket/BasketSendToMarketTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package org.finos.vuu.core.module.basket | ||
|
||
import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} | ||
import org.finos.toolbox.lifecycle.LifecycleContainer | ||
import org.finos.toolbox.time.{Clock, TestFriendlyClock} | ||
import org.finos.vuu.api.ViewPortDef | ||
import org.finos.vuu.core.module.TableDefContainer | ||
import org.finos.vuu.core.module.basket.BasketTestCaseHelper.{tickBasketDef, tickConstituentsDef, tickPrices} | ||
import org.finos.vuu.core.module.basket.service.{BasketServiceIF, BasketTradingServiceIF} | ||
import org.finos.vuu.core.module.price.PriceModule | ||
import org.finos.vuu.order.oms.OmsApi | ||
import org.finos.vuu.test.VuuServerTestCase | ||
import org.finos.vuu.util.table.TableAsserts.assertVpEq | ||
import org.scalatest.prop.Tables.Table | ||
|
||
class BasketSendToMarketTest extends VuuServerTestCase { | ||
|
||
Feature("Basket Service Test Case") { | ||
|
||
Scenario("Check the creation of the baskets and constituents") { | ||
|
||
implicit val clock: Clock = new TestFriendlyClock(10001L) | ||
implicit val lifecycle: LifecycleContainer = new LifecycleContainer() | ||
implicit val tableDefContainer: TableDefContainer = new TableDefContainer(Map()) | ||
implicit val metricsProvider: MetricsProvider = new MetricsProviderImpl | ||
|
||
val omsApi = OmsApi() | ||
|
||
import BasketModule._ | ||
|
||
withVuuServer(PriceModule(), BasketModule(omsApi)) { | ||
vuuServer => | ||
|
||
vuuServer.login("testUser", "testToken") | ||
|
||
vuuServer.overrideViewPortDef("prices", (table, _, _, _) => ViewPortDef(table.getTableDef.columns, null)) | ||
|
||
val pricesProvider = vuuServer.getProvider(PriceModule.NAME, "prices") | ||
val basketProvider = vuuServer.getProvider(BasketModule.NAME, BasketTable) | ||
val constituentProvider = vuuServer.getProvider(BasketModule.NAME, BasketConstituentTable) | ||
|
||
tickPrices(pricesProvider) | ||
tickBasketDef(basketProvider) | ||
tickConstituentsDef(constituentProvider) | ||
|
||
val vpBasket = vuuServer.createViewPort(BasketModule.NAME, BasketTable) | ||
|
||
vuuServer.runOnce() | ||
|
||
Then("Get the Basket RPC Service and call create basket") | ||
val basketService = vuuServer.getViewPortRpcServiceProxy[BasketServiceIF](vpBasket) | ||
|
||
basketService.createBasket(".FTSE", "chris-001")(vuuServer.requestContext) | ||
|
||
val vpBasketTrading = vuuServer.createViewPort(BasketModule.NAME, BasketTradingTable) | ||
|
||
vuuServer.runOnce() | ||
|
||
val tradingService = vuuServer.getViewPortRpcServiceProxy[BasketTradingServiceIF](vpBasketTrading) | ||
|
||
And("send the basket to market") | ||
tradingService.sendToMarket("chris-001")(vuuServer.requestContext) | ||
|
||
vuuServer.runOnce() | ||
|
||
Then("verify basket is on market") | ||
assertVpEq(combineQsForVp(vpBasketTrading)) { | ||
Table( | ||
("instanceId", "basketId", "basketName", "status", "units", "filledPct", "fxRateToUsd", "totalNotional", "totalNotionalUsd", "side"), | ||
("chris-001", ".FTSE", "chris-001", "ON_MARKET", 1, null, null, null, null, "Buy") | ||
) | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters