Skip to content

Commit c67a312

Browse files
committed
#1702 revert
1 parent cdcc107 commit c67a312

File tree

2 files changed

+104
-107
lines changed

2 files changed

+104
-107
lines changed

vuu/src/test/scala/org/finos/vuu/core/table/join/JoinTableTest.scala

Lines changed: 44 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,15 @@ class JoinTableTest extends AnyFeatureSpec with Matchers with ViewPortSetup {
2626
implicit val timeProvider: Clock = new DefaultClock
2727
implicit val metrics: MetricsProvider = new MetricsProviderImpl
2828

29-
case class NamedKeyObserver(name: String) extends KeyObserver[RowKeyUpdate] {
29+
case class NamedKeyObserver(name: String) extends KeyObserver[RowKeyUpdate]{
3030
override def onUpdate(update: RowKeyUpdate): Unit = {}
31-
3231
override def hashCode(): Int = name.hashCode
33-
3432
override def equals(obj: scala.Any): Boolean = {
3533
obj.isInstanceOf[NamedKeyObserver] && obj.asInstanceOf[NamedKeyObserver].name == this.name
3634
}
3735
}
3836

39-
Feature("check we can create join tables and tick data through") {
37+
Feature("check we can create join tables and tick data through"){
4038

4139
def setupViewPort(tableContainer: TableContainer, providerContainer: ProviderContainer) = {
4240

@@ -48,7 +46,7 @@ class JoinTableTest extends AnyFeatureSpec with Matchers with ViewPortSetup {
4846
viewPortContainer
4947
}
5048

51-
Scenario("check a tick all the way through from source to join table") {
49+
Scenario("check a tick all the way through from source to join table"){
5250

5351
implicit val lifecycle: LifecycleContainer = new LifecycleContainer
5452

@@ -58,26 +56,26 @@ class JoinTableTest extends AnyFeatureSpec with Matchers with ViewPortSetup {
5856
name = "orders",
5957
keyField = "orderId",
6058
columns = Columns.fromNames("orderId:String", "trader:String", "ric:String", "tradeTime:Long", "quantity:Double"),
61-
joinFields = "ric", "orderId")
59+
joinFields = "ric", "orderId")
6260

6361
val pricesDef = TableDef("prices", "ric", Columns.fromNames("ric:String", "bid:Double", "ask:Double", "last:Double", "open:Double", "close:Double"), "ric")
6462

6563
val joinDef = JoinTableDef(
66-
name = "orderPrices",
67-
baseTable = ordersDef,
68-
joinColumns = Columns.allFrom(ordersDef) ++ Columns.allFromExcept(pricesDef, "ric"),
69-
joins =
64+
name = "orderPrices",
65+
baseTable = ordersDef,
66+
joinColumns = Columns.allFrom(ordersDef) ++ Columns.allFromExcept(pricesDef, "ric"),
67+
joins =
7068
JoinTo(
7169
table = pricesDef,
72-
joinSpec = JoinSpec(left = "ric", right = "ric", LeftOuterJoin)
70+
joinSpec = JoinSpec( left = "ric", right = "ric", LeftOuterJoin)
7371
),
7472
links = VisualLinks(),
7573
joinFields = Seq()
7674
)
7775

7876
//val joinDef = JoinTableDef("ordersPrices", ordersDef, pricesDef, JoinSpec("ric", "ric"), Columns.allFrom(ordersDef) ++ Columns.allFromExcept(pricesDef, "ric") )
7977

80-
val joinProvider = JoinTableProviderImpl()
78+
val joinProvider = JoinTableProviderImpl()
8179

8280
val tableContainer = new TableContainer(joinProvider)
8381

@@ -114,22 +112,21 @@ class JoinTableTest extends AnyFeatureSpec with Matchers with ViewPortSetup {
114112

115113
val combinedUpdates = combineQs(viewPort)
116114

117-
combinedUpdates.length should be(3)
115+
combinedUpdates.length should be (3)
118116

119117
val updates = combinedUpdates.take(2)
120118

121119
val printToConsoleProcessor = new RowProcessor {
122120
override def processColumn(column: Column, value: Any): Unit = println(s"Column: ${column.name} = $value")
123-
124121
override def missingRow(): Unit = println("missing row")
125122

126123
override def missingRowData(rowKey: String, column: Column): Unit = {}
127124
}
128125

129-
updates.filter(vp => vp.vpUpdate == RowUpdateType).foreach(update => update.table.readRow(update.key.key, List("orderId", "trader", "tradeTime", "ric", "bid", "ask"), printToConsoleProcessor))
126+
updates.filter( vp => vp.vpUpdate == RowUpdateType).foreach(update => update.table.readRow(update.key.key, List("orderId", "trader", "tradeTime", "ric", "bid", "ask"), printToConsoleProcessor ))
130127
}
131128

132-
Scenario("check that registering and deregistering listeners on join table propagates to source tables") {
129+
Scenario("check that registering and deregistering listeners on join table propagates to source tables"){
133130

134131
implicit val lifecycle: LifecycleContainer = new LifecycleContainer
135132

@@ -152,34 +149,34 @@ class JoinTableTest extends AnyFeatureSpec with Matchers with ViewPortSetup {
152149
val ko2 = NamedKeyObserver("ko-2")
153150

154151
//first check we don't barf when regsitering a subscriber for a key that doesn't exist
155-
orderPrices.addKeyObserver("NYC-001", ko1) should be(true)
152+
orderPrices.addKeyObserver("NYC-001", ko1) should be (true)
156153

157-
orderPrices.addKeyObserver("NYC-0001", ko1) should be(true)
158-
orderPrices.addKeyObserver("NYC-0001", ko2) should be(false)
154+
orderPrices.addKeyObserver("NYC-0001", ko1) should be (true)
155+
orderPrices.addKeyObserver("NYC-0001", ko2) should be (false)
159156

160-
orders.isKeyObservedBy("NYC-0001", ko1) should be(true)
161-
orders.isKeyObservedBy("NYC-0001", ko2) should be(true)
157+
orders.isKeyObservedBy("NYC-0001", ko1) should be (true)
158+
orders.isKeyObservedBy("NYC-0001", ko2) should be (true)
162159

163-
orders.isKeyObservedBy("NYC-0002", ko2) should be(false)
160+
orders.isKeyObservedBy("NYC-0002", ko2) should be (false)
164161

165-
prices.isKeyObservedBy("VOD.L", ko1) should be(true)
166-
prices.isKeyObservedBy("VOD.L", ko2) should be(true)
162+
prices.isKeyObservedBy("VOD.L", ko1) should be (true)
163+
prices.isKeyObservedBy("VOD.L", ko2) should be (true)
167164

168165
orderPrices.removeKeyObserver("NYC-0001", ko1)
169-
orders.isKeyObservedBy("NYC-0001", ko1) should be(false)
170-
prices.isKeyObservedBy("VOD.L", ko1) should be(false)
166+
orders.isKeyObservedBy("NYC-0001", ko1) should be (false)
167+
prices.isKeyObservedBy("VOD.L", ko1) should be (false)
171168

172169
orderPrices.addKeyObserver("NYC-0002", ko2)
173170

174171
ordersProvider.tick("NYC-0002", Map("orderId" -> "NYC-0002", "trader" -> "chris", "tradeTime" -> dateTime, "quantity" -> 100, "ric" -> "VOD.L"))
175172

176173
joinProvider.runOnce()
177174

178-
prices.isKeyObservedBy("BT.L", ko2) should be(false)
179-
prices.isKeyObservedBy("VOD.L", ko2) should be(true)
175+
prices.isKeyObservedBy("BT.L", ko2) should be (false)
176+
prices.isKeyObservedBy("VOD.L", ko2) should be (true)
180177
}
181178

182-
Scenario("Check deleting keys from join table and see if it propogates correctly") {
179+
Scenario("Check deleting keys from join table and see if it propogates correctly"){
183180

184181
implicit val lifecycle: LifecycleContainer = new LifecycleContainer
185182

@@ -195,17 +192,17 @@ class JoinTableTest extends AnyFeatureSpec with Matchers with ViewPortSetup {
195192

196193
runContainersOnce(vpContainer, joinProvider)
197194

198-
assertVpEq(filterByVpId(combineQs(orderPricesViewport), orderPricesViewport)) {
195+
assertVpEq(filterByVpId(combineQs(orderPricesViewport), orderPricesViewport)){
199196
Table(
200-
("orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close"),
201-
("NYC-0001", "chris", "VOD.L", 1311544800000L, 100, 220.0, 222.0, null, null, null),
202-
("NYC-0002", "chris", "VOD.L", 1311544800000L, 200, 220.0, 222.0, null, null, null),
203-
("NYC-0003", "chris", "VOD.L", 1311544800000L, 300, 220.0, 222.0, null, null, null),
204-
("NYC-0004", "chris", "VOD.L", 1311544800000L, 400, 220.0, 222.0, null, null, null),
205-
("NYC-0005", "chris", "VOD.L", 1311544800000L, 500, 220.0, 222.0, null, null, null),
206-
("NYC-0006", "steve", "VOD.L", 1311544800000L, 600, 220.0, 222.0, null, null, null),
207-
("NYC-0007", "steve", "BT.L", 1311544800000L, 1000, 500.0, 501.0, null, null, null),
208-
("NYC-0008", "steve", "BT.L", 1311544800000L, 500, 500.0, 501.0, null, null, null)
197+
("orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ),
198+
("NYC-0001","chris" ,"VOD.L" ,1311544800000L,100 ,220.0 ,222.0 ,null ,null ,null ),
199+
("NYC-0002","chris" ,"VOD.L" ,1311544800000L,200 ,220.0 ,222.0 ,null ,null ,null ),
200+
("NYC-0003","chris" ,"VOD.L" ,1311544800000L,300 ,220.0 ,222.0 ,null ,null ,null ),
201+
("NYC-0004","chris" ,"VOD.L" ,1311544800000L,400 ,220.0 ,222.0 ,null ,null ,null ),
202+
("NYC-0005","chris" ,"VOD.L" ,1311544800000L,500 ,220.0 ,222.0 ,null ,null ,null ),
203+
("NYC-0006","steve" ,"VOD.L" ,1311544800000L,600 ,220.0 ,222.0 ,null ,null ,null ),
204+
("NYC-0007","steve" ,"BT.L" ,1311544800000L,1000 ,500.0 ,501.0 ,null ,null ,null ),
205+
("NYC-0008","steve" ,"BT.L" ,1311544800000L,500 ,500.0 ,501.0 ,null ,null ,null )
209206
)
210207
}
211208

@@ -231,15 +228,15 @@ class JoinTableTest extends AnyFeatureSpec with Matchers with ViewPortSetup {
231228

232229
val array = orderPrices.pullRowAsArray("NYC-0001", ViewPortColumnCreator.create(orderPrices, orderPrices.getTableDef.columns.map(_.name).toList))
233230

234-
assertVpEq(filterByVpId(combineQs(orderPricesViewport), orderPricesViewport)) {
231+
assertVpEq(filterByVpId(combineQs(orderPricesViewport), orderPricesViewport)){
235232
Table(
236-
("orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close"),
237-
("NYC-0003", "chris", "VOD.L", 1311544800000L, 300, 230, 222.0, null, null, null),
238-
("NYC-0004", "chris", "VOD.L", 1311544800000L, 400, 230, 222.0, null, null, null),
239-
("NYC-0005", "chris", "VOD.L", 1311544800000L, 500, 230, 222.0, null, null, null),
240-
("NYC-0006", "steve", "VOD.L", 1311544800000L, 600, 230, 222.0, null, null, null),
241-
("NYC-0007", "steve", "BT.L", 1311544800000L, 1000, 500.0, 501.0, null, null, null),
242-
("NYC-0008", "steve", "BT.L", 1311544800000L, 500, 500.0, 501.0, null, null, null)
233+
("orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ),
234+
("NYC-0003","chris" ,"VOD.L" ,1311544800000L,300 ,230 ,222.0 ,null ,null ,null ),
235+
("NYC-0004","chris" ,"VOD.L" ,1311544800000L,400 ,230 ,222.0 ,null ,null ,null ),
236+
("NYC-0005","chris" ,"VOD.L" ,1311544800000L,500 ,230 ,222.0 ,null ,null ,null ),
237+
("NYC-0006","steve" ,"VOD.L" ,1311544800000L,600 ,230 ,222.0 ,null ,null ,null ),
238+
("NYC-0007","steve" ,"BT.L" ,1311544800000L,1000 ,500.0 ,501.0 ,null ,null ,null ),
239+
("NYC-0008","steve" ,"BT.L" ,1311544800000L,500 ,500.0 ,501.0 ,null ,null ,null )
243240
)
244241
}
245242

0 commit comments

Comments
 (0)