From 6d7a896ee5638c5e95a84cee571aec080a3e6989 Mon Sep 17 00:00:00 2001 From: Peter Ling Date: Mon, 18 Sep 2023 14:48:09 +0100 Subject: [PATCH] Sync with Finos main --- .../toolbox/CoalescingPriorityQueueImpl.scala | 76 ++++++++ .../toolbox/CoalescingQueueNaiveImpl.scala | 8 +- .../toolbox/CoalescingPriorityQueueTest.scala | 66 +++++++ .../vuu-layout/src/drag-drop/Draggable.ts | 3 - .../vuu-layout/src/drag-drop/DropTarget.ts | 2 +- .../vuu-layout/src/flexbox/Flexbox.tsx | 10 +- .../vuu-layout/src/flexbox/FlexboxLayout.tsx | 25 ++- .../vuu-layout/src/flexbox/flexboxTypes.ts | 2 +- .../src/flexbox/useSplitterResizing.ts | 6 +- .../src/layout-reducer/layoutUtils.ts | 5 +- .../vuu-layout/src/palette/Palette.tsx | 2 +- .../scala/org/finos/vuu/api/TableDef.scala | 4 +- .../finos/vuu/core/CoreServerApiHandler.scala | 6 +- .../org/finos/vuu/core/table/JoinTable.scala | 5 + .../vuu/net/ClientConnectionCreator.scala | 24 +-- .../org/finos/vuu/net/RequestProcessor.scala | 7 +- .../vuu/provider/VuuJoinTableProvider.scala | 8 +- .../org/finos/vuu/util/PublishQueue.scala | 18 +- .../org/finos/vuu/viewport/ViewPort.scala | 27 ++- .../vuu/viewport/ViewPortContainer.scala | 4 +- vuu/src/test/resources/logback-test.xml | 4 + .../org/finos/vuu/api/CoreServerApiTest.scala | 14 +- .../typeahead/TypeAheadModuleTest.scala | 13 +- .../finos/vuu/core/table/DataTableTest.scala | 9 +- .../finos/vuu/core/table/JoinTableTest.scala | 12 +- .../core/table/JoinsOfJoinsTableTest.scala | 14 +- .../finos/vuu/core/table/RowDeleteTest.scala | 43 +++-- .../finos/vuu/core/table/RpcTableTest.scala | 12 +- .../vuu/core/table/TableTestHelper.scala | 24 ++- .../scala/org/finos/vuu/net/rpc/RpcTest.scala | 2 +- .../viewport/AbstractViewPortTestCase.scala | 48 +++-- .../viewport/AmendViewPortToTreeTest.scala | 37 ++-- .../CalculatedColumnsViewPortTest.scala | 18 +- .../vuu/viewport/ChangeViewPortTest.scala | 9 +- .../vuu/viewport/DeleteViewPortTest.scala | 4 +- .../vuu/viewport/FilterAndSortTest.scala | 91 +++++----- .../OnlySendDiffRowsViewPortTest.scala | 6 +- .../vuu/viewport/TreeAndAggregate2Test.scala | 170 +++++++++--------- .../vuu/viewport/TreeAndAggregateTest.scala | 86 +++++---- .../finos/vuu/viewport/TreeOnOffTest.scala | 11 +- .../org/finos/vuu/viewport/TreeSortTest.scala | 75 ++++---- .../viewport/TreeUpdateChildCountsTest.scala | 31 ++-- .../UpdateSelectionViewPortTest.scala | 36 ++-- .../vuu/viewport/ViewPortListenerTest.scala | 30 ++-- .../finos/vuu/viewport/ViewPortSetup.scala | 12 +- .../VisualLinkedTreeViewPortTest.scala | 36 ++-- .../viewport/VisualLinkedViewPortTest.scala | 60 +++---- .../auths/PermissionFilteredViewport.scala | 3 +- .../disable/DisableViewPortTest.scala | 14 +- .../menurpc/CallMenuRpcFromViewPortTest.scala | 20 +-- .../CalculateTreeOptimizationTest.scala | 10 +- ...DontRecalculateUnchangedViewPortTest.scala | 30 ++-- .../AbstractSessionTestCase.scala | 19 +- .../sessiontable/EditSessionTableTest.scala | 11 +- .../SessionTableViewportTest.scala | 21 ++- .../validation/CreateValidViewportTest.scala | 7 +- 56 files changed, 721 insertions(+), 629 deletions(-) create mode 100644 toolbox/src/main/scala/org/finos/toolbox/CoalescingPriorityQueueImpl.scala create mode 100644 toolbox/src/test/scala/org/finos/toolbox/CoalescingPriorityQueueTest.scala diff --git a/toolbox/src/main/scala/org/finos/toolbox/CoalescingPriorityQueueImpl.scala b/toolbox/src/main/scala/org/finos/toolbox/CoalescingPriorityQueueImpl.scala new file mode 100644 index 0000000000..6770b792b1 --- /dev/null +++ b/toolbox/src/main/scala/org/finos/toolbox/CoalescingPriorityQueueImpl.scala @@ -0,0 +1,76 @@ +package org.finos.toolbox + +import java.util.PriorityQueue + +class CoalescingPriorityQueueImpl[VALUE <: AnyRef, KEY](fn: VALUE => KEY, merge: (VALUE, VALUE) => VALUE, compareEqFun: (KEY, KEY) => Int) extends CoalescingQueue[VALUE, KEY] { + + case class PrioritizedItem[KEY](KEY: KEY, highPriority: Boolean) + + private val keysInOrder = new PriorityQueue[PrioritizedItem[KEY]]((o1: PrioritizedItem[KEY], o2: PrioritizedItem[KEY]) => { + if (o1.highPriority && !o2.highPriority) { + -1 + } else if (!o1.highPriority && o2.highPriority) { + 1 + } else { + compareEqFun(o1.KEY, o2.KEY) + } + }) + + private val values = new java.util.HashMap[KEY, VALUE]() + private val lock = new Object + + def length: Int = keysInOrder.size + + def push(item: VALUE) = { + lock.synchronized { + enqueue(fn(item), item, false) + } + } + + override def pushHighPriority(item: VALUE): Unit = { + lock.synchronized { + enqueue(fn(item), item, true) + } + } + + private def enqueue(key: KEY, value: VALUE, highPriority: Boolean) = { + lock.synchronized { + values.get(key) match { + case null => + keysInOrder.add(PrioritizedItem(key, highPriority)) + values.put(key, value) + case old => + val merged = merge(old, value) + if (merged ne old) { + values.put(key, merged) + } + } + } + } + + def isEmpty() = lock.synchronized { + values.isEmpty + } + + private def dequeue: VALUE = { + lock.synchronized { + val key = keysInOrder.poll() + values.remove(key.KEY) + } + } + + + def popUpTo(i: Int): Seq[VALUE] = { + lock.synchronized { + val entries = for (i <- 0 until i if keysInOrder.size > 0) yield keysInOrder.poll() + entries.map(x => values.remove(x.KEY)) + } + } + + def pop(): VALUE = dequeue + + def popOption(): Option[VALUE] = { + val v = dequeue + Option(v) + } +} diff --git a/toolbox/src/main/scala/org/finos/toolbox/CoalescingQueueNaiveImpl.scala b/toolbox/src/main/scala/org/finos/toolbox/CoalescingQueueNaiveImpl.scala index deeb9d0b30..8643f3118c 100644 --- a/toolbox/src/main/scala/org/finos/toolbox/CoalescingQueueNaiveImpl.scala +++ b/toolbox/src/main/scala/org/finos/toolbox/CoalescingQueueNaiveImpl.scala @@ -3,7 +3,8 @@ package org.finos.toolbox import scala.collection.mutable trait CoalescingQueue[VALUE <: AnyRef, KEY]{ - def push(item: VALUE) + def push(item: VALUE): Unit + def pushHighPriority(item: VALUE): Unit def isEmpty(): Boolean def popUpTo(i: Int): Seq[VALUE] def pop(): VALUE @@ -25,6 +26,8 @@ class CoalescingQueueNaiveImpl[VALUE <: AnyRef, KEY](fn: VALUE => KEY, merge: (V } } + override def pushHighPriority(item: VALUE): Unit = push(item) + protected def enqueue(key: KEY, value: VALUE) = { lock.synchronized{ values.get(key) match { @@ -68,8 +71,7 @@ class CoalescingQueueNaiveImpl[VALUE <: AnyRef, KEY](fn: VALUE => KEY, merge: (V def popOption(): Option[VALUE] = { val v = dequeue - if(v == null) None - else Some(v) + Option(v) } } diff --git a/toolbox/src/test/scala/org/finos/toolbox/CoalescingPriorityQueueTest.scala b/toolbox/src/test/scala/org/finos/toolbox/CoalescingPriorityQueueTest.scala new file mode 100644 index 0000000000..1b60e2d12b --- /dev/null +++ b/toolbox/src/test/scala/org/finos/toolbox/CoalescingPriorityQueueTest.scala @@ -0,0 +1,66 @@ +package org.finos.toolbox + +import org.scalatest.GivenWhenThen +import org.scalatest.featurespec.AnyFeatureSpec +import org.scalatest.matchers.should.Matchers + +class CoalescingPriorityQueueTest extends AnyFeatureSpec with Matchers with GivenWhenThen{ + + Feature("check prioritized queue") { + + Scenario("check queue") { + + case class QueueEntry(int: Integer, text: String) + + val queue = new CoalescingPriorityQueueImpl[QueueEntry, Integer](e => e.int, (x, y) => y, (key1, key2) => { + key1.compareTo(key2) + }) + + queue.push(QueueEntry(0, "foo")) + queue.push(QueueEntry(1, "bar")) + queue.pushHighPriority(QueueEntry(2, "ping")) + queue.pushHighPriority(QueueEntry(3, "pong")) + + queue.pop().int should equal(2) + queue.pop().int should equal(3) + queue.pop().int should equal(0) + queue.pop().int should equal(1) + + queue.push(QueueEntry(4, "foo")) + queue.push(QueueEntry(5, "bar")) + queue.pushHighPriority(QueueEntry(6, "ping")) + + val dequeued = queue.popUpTo(10) + + dequeued.size should be(3) + dequeued(0).int should equal(6) + dequeued(1).int should equal(4) + dequeued(2).int should equal(5) + + queue.pushHighPriority(QueueEntry(7, "ping")) + queue.pushHighPriority(QueueEntry(8, "ping")) + queue.pushHighPriority(QueueEntry(9, "ping")) + queue.pushHighPriority(QueueEntry(10, "ping")) + + val dequeued2 = queue.popUpTo(10) + + dequeued2.size should be(4) + dequeued2(0).int should equal(7) + dequeued2(1).int should equal(8) + dequeued2(2).int should equal(9) + dequeued2(3).int should equal(10) + + queue.push(QueueEntry(11, "foo")) + queue.push(QueueEntry(12, "bar")) + queue.push(QueueEntry(13, "bar")) + + val dequeued3 = queue.popUpTo(10) + + dequeued3.size should be(3) + dequeued3(0).int should equal(11) + dequeued3(1).int should equal(12) + dequeued3(2).int should equal(13) + } + } + +} diff --git a/vuu-ui/packages/vuu-layout/src/drag-drop/Draggable.ts b/vuu-ui/packages/vuu-layout/src/drag-drop/Draggable.ts index 03073d5dd1..a771fefc59 100644 --- a/vuu-ui/packages/vuu-layout/src/drag-drop/Draggable.ts +++ b/vuu-ui/packages/vuu-layout/src/drag-drop/Draggable.ts @@ -256,9 +256,6 @@ function dragMouseupHandler() { } function onDragEnd() { - if (!_dragContainer) { - return - } if (_dropTarget) { const dropTarget = _dropTargetRenderer.hoverDropTarget || diff --git a/vuu-ui/packages/vuu-layout/src/drag-drop/DropTarget.ts b/vuu-ui/packages/vuu-layout/src/drag-drop/DropTarget.ts index 220d5390ef..e0734ce9ec 100644 --- a/vuu-ui/packages/vuu-layout/src/drag-drop/DropTarget.ts +++ b/vuu-ui/packages/vuu-layout/src/drag-drop/DropTarget.ts @@ -7,7 +7,7 @@ import { Measurements, Position, positionValues, - RelativeDropPosition + RelativeDropPosition, } from "./BoxModel"; import { DragDropRect, DropPos, DropPosTab } from "./dragDropTypes"; import { DragState } from "./DragState"; diff --git a/vuu-ui/packages/vuu-layout/src/flexbox/Flexbox.tsx b/vuu-ui/packages/vuu-layout/src/flexbox/Flexbox.tsx index 5598f4e883..09c2cec87b 100644 --- a/vuu-ui/packages/vuu-layout/src/flexbox/Flexbox.tsx +++ b/vuu-ui/packages/vuu-layout/src/flexbox/Flexbox.tsx @@ -1,5 +1,6 @@ +import { useForkRef } from "@salt-ds/core"; import cx from "classnames"; -import { CSSProperties, forwardRef } from "react"; +import { CSSProperties, ForwardedRef, forwardRef } from "react"; import { FlexboxProps } from "./flexboxTypes"; import { useSplitterResizing } from "./useSplitterResizing"; @@ -9,10 +10,12 @@ const classBase = "hwFlexbox"; const Flexbox = forwardRef(function Flexbox( props: FlexboxProps, + ref: ForwardedRef ) { const { breakPoints, children, + // cols: colsProp, column, className: classNameProp, flexFill, @@ -28,8 +31,9 @@ const Flexbox = forwardRef(function Flexbox( ...rest } = props; - const { content } = useSplitterResizing({ + const { content, rootRef } = useSplitterResizing({ children, + // cols: colsProp, onSplitterMoved, style, }); @@ -45,8 +49,10 @@ const Flexbox = forwardRef(function Flexbox(
{ dispatch({ - type: "splitter-resize", + type: Action.SPLITTER_RESIZE, path, - sizes - }); + sizes, + } as SplitterResizeAction); }, [dispatch, path] ); return ; }; -FlexboxLayout.displayName = 'Flexbox'; +FlexboxLayout.displayName = "Flexbox"; -registerComponent('Flexbox', FlexboxLayout, 'container'); +registerComponent("Flexbox", FlexboxLayout, "container"); diff --git a/vuu-ui/packages/vuu-layout/src/flexbox/flexboxTypes.ts b/vuu-ui/packages/vuu-layout/src/flexbox/flexboxTypes.ts index fc5cbb9380..e976f2373b 100644 --- a/vuu-ui/packages/vuu-layout/src/flexbox/flexboxTypes.ts +++ b/vuu-ui/packages/vuu-layout/src/flexbox/flexboxTypes.ts @@ -3,7 +3,7 @@ import { HTMLAttributes, MutableRefObject, ReactElement, - ReactNode + ReactNode, } from "react"; import { SplitterProps } from "./Splitter"; diff --git a/vuu-ui/packages/vuu-layout/src/flexbox/useSplitterResizing.ts b/vuu-ui/packages/vuu-layout/src/flexbox/useSplitterResizing.ts index 9ddf05f798..4f4624eabf 100644 --- a/vuu-ui/packages/vuu-layout/src/flexbox/useSplitterResizing.ts +++ b/vuu-ui/packages/vuu-layout/src/flexbox/useSplitterResizing.ts @@ -4,7 +4,7 @@ import React, { useCallback, useMemo, useRef, - useState + useState, } from "react"; import { Placeholder } from "../placeholder"; import { Splitter } from "./Splitter"; @@ -14,14 +14,14 @@ import { gatherChildMeta, identifyResizeParties, PLACEHOLDER, - SPLITTER + SPLITTER, } from "./flexbox-utils"; import { ContentMeta, FlexSize, SplitterFactory, SplitterHookProps, - SplitterHookResult + SplitterHookResult, } from "./flexboxTypes"; const originalContentOnly = (meta: ContentMeta) => diff --git a/vuu-ui/packages/vuu-layout/src/layout-reducer/layoutUtils.ts b/vuu-ui/packages/vuu-layout/src/layout-reducer/layoutUtils.ts index 9ad6717518..16edd1ea0e 100644 --- a/vuu-ui/packages/vuu-layout/src/layout-reducer/layoutUtils.ts +++ b/vuu-ui/packages/vuu-layout/src/layout-reducer/layoutUtils.ts @@ -6,12 +6,12 @@ import { ComponentWithId, ComponentRegistry, isContainer, - isLayoutComponent + isLayoutComponent, } from "../registry/ComponentRegistry"; import { getPersistentState, hasPersistentState, - setPersistentState + setPersistentState, } from "../use-persistent-state"; import { expandFlex, getProps, typeOf } from "../utils"; import { LayoutJSON, LayoutModel, layoutType } from "./layoutTypes"; @@ -234,6 +234,7 @@ export function layoutFromJson( id, ...props, key: id, + path, }, children ? children.map((child, i) => layoutFromJson(child, `${path}.${i}`)) diff --git a/vuu-ui/packages/vuu-layout/src/palette/Palette.tsx b/vuu-ui/packages/vuu-layout/src/palette/Palette.tsx index 1fd7a3470a..ec0cb236e9 100644 --- a/vuu-ui/packages/vuu-layout/src/palette/Palette.tsx +++ b/vuu-ui/packages/vuu-layout/src/palette/Palette.tsx @@ -6,7 +6,7 @@ import { HTMLAttributes, memo, MouseEvent, - ReactElement + ReactElement, } from "react"; import { useLayoutProviderDispatch } from "../layout-provider"; import { View, ViewProps } from "../layout-view"; diff --git a/vuu/src/main/scala/org/finos/vuu/api/TableDef.scala b/vuu/src/main/scala/org/finos/vuu/api/TableDef.scala index 76ee7c7994..c8499db906 100644 --- a/vuu/src/main/scala/org/finos/vuu/api/TableDef.scala +++ b/vuu/src/main/scala/org/finos/vuu/api/TableDef.scala @@ -172,7 +172,9 @@ class LuceneTableDef(name: String, keyField: String, columns: Array[Column], joi trait JoinType -object LeftOuterJoin extends JoinType +object LeftOuterJoin extends JoinType{ + override def toString: String = "LeftOuterJoin" +} object InnerJoin extends JoinType diff --git a/vuu/src/main/scala/org/finos/vuu/core/CoreServerApiHandler.scala b/vuu/src/main/scala/org/finos/vuu/core/CoreServerApiHandler.scala index e172b9fd54..0062ed2423 100644 --- a/vuu/src/main/scala/org/finos/vuu/core/CoreServerApiHandler.scala +++ b/vuu/src/main/scala/org/finos/vuu/core/CoreServerApiHandler.scala @@ -1,12 +1,12 @@ package org.finos.vuu.core import com.typesafe.scalalogging.StrictLogging +import org.finos.toolbox.time.Clock import org.finos.vuu.api.AvailableViewPortVisualLink import org.finos.vuu.core.table.{DataType, TableContainer, ViewPortColumnCreator} import org.finos.vuu.net._ import org.finos.vuu.provider.{ProviderContainer, RpcProvider} import org.finos.vuu.viewport._ -import org.finos.toolbox.time.Clock import scala.util.{Failure, Success, Try} @@ -306,7 +306,7 @@ class CoreServerApiHandler(val viewPortContainer: ViewPortContainer, val filter = msg.filterSpec val viewPort = if (msg.groupBy.isEmpty) - viewPortContainer.create(ctx.requestId, ctx.session, ctx.queue, ctx.highPriorityQueue, table, msg.range, vpColumns, sort, filter, NoGroupBy) + viewPortContainer.create(ctx.requestId, ctx.session, ctx.queue, table, msg.range, vpColumns, sort, filter, NoGroupBy) else { val groupByColumns = msg.groupBy.filter(vpColumns.getColumnForName(_).get != null).flatMap(vpColumns.getColumnForName).toList @@ -315,7 +315,7 @@ class CoreServerApiHandler(val viewPortContainer: ViewPortContainer, val groupBy = new GroupBy(groupByColumns, aggs) - viewPortContainer.create(ctx.requestId, ctx.session, ctx.queue, ctx.highPriorityQueue, table, msg.range, vpColumns, sort, filter, groupBy) + viewPortContainer.create(ctx.requestId, ctx.session, ctx.queue, table, msg.range, vpColumns, sort, filter, groupBy) } vsMsg(CreateViewPortSuccess(viewPort.id, viewPort.table.name, msg.range, msg.columns, msg.sort, msg.groupBy, msg.filterSpec, msg.aggregations))(ctx) diff --git a/vuu/src/main/scala/org/finos/vuu/core/table/JoinTable.scala b/vuu/src/main/scala/org/finos/vuu/core/table/JoinTable.scala index 167d7b3683..c58637ebd1 100644 --- a/vuu/src/main/scala/org/finos/vuu/core/table/JoinTable.scala +++ b/vuu/src/main/scala/org/finos/vuu/core/table/JoinTable.scala @@ -333,6 +333,11 @@ class JoinTable(val tableDef: JoinTableDef, val sourceTables: Map[String, DataTa }) } + + override def toString: String = { + "JoinTable(base=" + this.tableDef.baseTable.name + ",joins=" + this.tableDef.joins.map(join => join.table.name + "[" + join.joinSpec.toString + "]").mkString(",") + ")" + } + @volatile private var updateCounterInternal: Long = 0 override def updateCounter: Long = updateCounterInternal diff --git a/vuu/src/main/scala/org/finos/vuu/net/ClientConnectionCreator.scala b/vuu/src/main/scala/org/finos/vuu/net/ClientConnectionCreator.scala index 76be0d6185..81cd8ef630 100644 --- a/vuu/src/main/scala/org/finos/vuu/net/ClientConnectionCreator.scala +++ b/vuu/src/main/scala/org/finos/vuu/net/ClientConnectionCreator.scala @@ -3,13 +3,13 @@ package org.finos.vuu.net import com.typesafe.scalalogging.StrictLogging import io.netty.channel.{Channel, ChannelFuture, ChannelFutureListener} import io.netty.handler.codec.http.websocketx.TextWebSocketFrame +import org.finos.toolbox.time.Clock import org.finos.vuu.client.messages.RequestId import org.finos.vuu.core.module.ModuleContainer import org.finos.vuu.net.flowcontrol.{BatchSize, Disconnect, FlowController, SendHeartbeat} import org.finos.vuu.net.json.Serializer import org.finos.vuu.util.PublishQueue import org.finos.vuu.viewport.{RowUpdateType, SizeUpdateType, ViewPortUpdate} -import org.finos.toolbox.time.Clock import java.util.concurrent.ConcurrentHashMap import scala.jdk.CollectionConverters._ @@ -31,7 +31,6 @@ trait MessageHandler extends InboundMessageHandler with OutboundMessageHandler { class DefaultMessageHandler(val channel: Channel, val outboundQueue: PublishQueue[ViewPortUpdate], - val highPriorityQueue: PublishQueue[ViewPortUpdate], val session: ClientSessionId, serverApi: ServerApi, serializer: Serializer[String, MessageBody], @@ -48,11 +47,6 @@ class DefaultMessageHandler(val channel: Channel, } }) - - private def hasHighPriorityUpdates: Boolean = { - highPriorityQueue.length > 0 - } - private def sendUpdatesInternal(updates: Seq[ViewPortUpdate], highPriority: Boolean = false) = { if (!updates.isEmpty) { @@ -81,19 +75,9 @@ class DefaultMessageHandler(val channel: Channel, disconnect() case BatchSize(size) => - if (hasHighPriorityUpdates) { - val updates = highPriorityQueue.popUpTo(size) - sendUpdatesInternal(updates, highPriority = true) - val remaining = size - updates.size - if (remaining > 0) { - val lpUpdates = outboundQueue.popUpTo(remaining) - sendUpdatesInternal(lpUpdates, highPriority = true) - } + val updates = outboundQueue.popUpTo(size) + sendUpdatesInternal(updates) - } else { - val updates = outboundQueue.popUpTo(size) - sendUpdatesInternal(updates) - } } } @@ -142,7 +126,7 @@ class DefaultMessageHandler(val channel: Channel, } override def handle(msg: ViewServerMessage): Option[ViewServerMessage] = { - val ctx = RequestContext(msg.requestId, session, outboundQueue, highPriorityQueue, msg.token) + val ctx = RequestContext(msg.requestId, session, outboundQueue, msg.token) flowController.process(msg) diff --git a/vuu/src/main/scala/org/finos/vuu/net/RequestProcessor.scala b/vuu/src/main/scala/org/finos/vuu/net/RequestProcessor.scala index 874e561ce2..765612317e 100644 --- a/vuu/src/main/scala/org/finos/vuu/net/RequestProcessor.scala +++ b/vuu/src/main/scala/org/finos/vuu/net/RequestProcessor.scala @@ -3,16 +3,16 @@ package org.finos.vuu.net import com.typesafe.scalalogging.StrictLogging import io.netty.channel.Channel import io.netty.handler.codec.http.websocketx.TextWebSocketFrame +import org.finos.toolbox.time.Clock import org.finos.vuu.client.messages.SessionId import org.finos.vuu.core.module.ModuleContainer import org.finos.vuu.net.flowcontrol.DefaultFlowController import org.finos.vuu.net.json.Serializer import org.finos.vuu.util.{OutboundRowPublishQueue, PublishQueue} import org.finos.vuu.viewport.ViewPortUpdate -import org.finos.toolbox.time.Clock case class RequestContext(requestId: String, session: ClientSessionId, - queue: PublishQueue[ViewPortUpdate], highPriorityQueue: PublishQueue[ViewPortUpdate], + queue: PublishQueue[ViewPortUpdate], token: String) @@ -63,9 +63,8 @@ class RequestProcessor(authenticator: Authenticator, protected def createMessageHandler(channel: Channel, sessionId: ClientSessionId): MessageHandler = { val queue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val flowController = new DefaultFlowController - new DefaultMessageHandler(channel, queue, highPriorityQueue, sessionId, serverApi, serializer, flowController, clientSessionContainer, moduleContainer) + new DefaultMessageHandler(channel, queue, sessionId, serverApi, serializer, flowController, clientSessionContainer, moduleContainer) } protected def handleViewServerMessage(msg: ViewServerMessage, channel: Channel): Option[ViewServerMessage] = { diff --git a/vuu/src/main/scala/org/finos/vuu/provider/VuuJoinTableProvider.scala b/vuu/src/main/scala/org/finos/vuu/provider/VuuJoinTableProvider.scala index 44c063c56c..5cc1e7eff6 100644 --- a/vuu/src/main/scala/org/finos/vuu/provider/VuuJoinTableProvider.scala +++ b/vuu/src/main/scala/org/finos/vuu/provider/VuuJoinTableProvider.scala @@ -65,7 +65,7 @@ class VuuJoinTableProvider(implicit timeProvider: Clock, lifecycle: LifecycleCon } } - def publishUpdateForLeftTableAndKey(joinTableDef: JoinTableDef, JoinTable: JoinTable, leftTableName: String, leftKey: String, ev: util.HashMap[String, Any]): Unit = { + private def publishUpdateForLeftTableAndKey(joinTableDef: JoinTableDef, JoinTable: JoinTable, leftTableName: String, leftKey: String, ev: util.HashMap[String, Any]): Unit = { //get cached data (actually do we need to do this..) //val cachedEventData = joinSink.getEventDataSink(leftTableName).getEventState(leftKey) @@ -186,9 +186,10 @@ class VuuJoinTableProvider(implicit timeProvider: Clock, lifecycle: LifecycleCon //if join contains table... if (joinTableDef.containsTable(tableName)) { + logger.debug("Starting Event Cycle...") logger.debug("processing event:" + ev + " for table:" + tableName + " in join:" + joinTableDef.name) - //does it participate as a left table? + //does it participate as a left table? i.e. the base table of the join if (joinTableDef.isLeftTable(tableName)) { joinRelations.addRowJoins(joinTableDef, ev) @@ -198,7 +199,7 @@ class VuuJoinTableProvider(implicit timeProvider: Clock, lifecycle: LifecycleCon //if so, publish a left table event for the right inbound event publishUpdateForLeftTableAndKey(joinTableDef, joinTable.asInstanceOf[JoinTable], tableName, eventToLeftKey(joinTableDef, ev), ev) - //otherwise must be a right table + //otherwise must be a right table, i.e. any one of the joinTo tables } else { val keyName = joinTableDef.keyFieldForTable(tableName) @@ -214,6 +215,7 @@ class VuuJoinTableProvider(implicit timeProvider: Clock, lifecycle: LifecycleCon publishUpdateForLeftTableAndKey(joinTableDef, joinTable.asInstanceOf[JoinTable], joinTableDef.baseTable.name, key, joinSink.getEventDataSink(joinTableDef.baseTable.name).getEventState(key)) }) } + logger.debug("Ended Event Cycle...\n") } else { //do nothing... we're not part of this join } diff --git a/vuu/src/main/scala/org/finos/vuu/util/PublishQueue.scala b/vuu/src/main/scala/org/finos/vuu/util/PublishQueue.scala index f98c4523b4..c3ef7e6b82 100644 --- a/vuu/src/main/scala/org/finos/vuu/util/PublishQueue.scala +++ b/vuu/src/main/scala/org/finos/vuu/util/PublishQueue.scala @@ -1,11 +1,13 @@ package org.finos.vuu.util +import org.finos.toolbox.CoalescingPriorityQueueImpl import org.finos.vuu.viewport.{ViewPortUpdate, ViewPortUpdateType} -import org.finos.toolbox.CoalescingQueueNaiveImpl trait PublishQueue[T] { - def push(entry: T) + def push(entry: T): Unit + + def pushHighPriority(entry: T): Unit def pop: T @@ -22,14 +24,22 @@ class OutboundRowPublishQueue extends PublishQueue[ViewPortUpdate] { private def mergeFn(vpOld: ViewPortUpdate, vpNew: ViewPortUpdate) = vpNew - private def toKeyFunc(vpu: ViewPortUpdate) = new CollKey(vpu.vp.id, vpu.vpUpdate, vpu.key.key) + private def toKeyFunc(vpu: ViewPortUpdate) = CollKey(vpu.vp.id, vpu.vpUpdate, vpu.key.key) + + private def compareEq(k1: CollKey, k2: CollKey): Int = { + k1.rowKey.compareTo(k2.rowKey) + } - private val coallescingQ = new CoalescingQueueNaiveImpl[ViewPortUpdate, CollKey](toKeyFunc, mergeFn) + private val coallescingQ = new CoalescingPriorityQueueImpl[ViewPortUpdate, CollKey](toKeyFunc, mergeFn, compareEq) override def push(entry: ViewPortUpdate): Unit = { coallescingQ.push(entry) } + override def pushHighPriority(entry: ViewPortUpdate): Unit = { + coallescingQ.pushHighPriority(entry) + } + override def popUpTo(i: Int): Seq[ViewPortUpdate] = coallescingQ.popUpTo(i) override def isEmpty: Boolean = coallescingQ.isEmpty diff --git a/vuu/src/main/scala/org/finos/vuu/viewport/ViewPort.scala b/vuu/src/main/scala/org/finos/vuu/viewport/ViewPort.scala index 8c57946319..ee4c747233 100644 --- a/vuu/src/main/scala/org/finos/vuu/viewport/ViewPort.scala +++ b/vuu/src/main/scala/org/finos/vuu/viewport/ViewPort.scala @@ -1,15 +1,15 @@ package org.finos.vuu.viewport import com.typesafe.scalalogging.LazyLogging -import org.finos.vuu.api.ViewPortDef -import org.finos.vuu.core.sort.{FilterAndSort, Sort, TwoStepCompoundFilter, UserDefinedFilterAndSort, VisualLinkedFilter} -import org.finos.vuu.core.table.{Column, KeyObserver, RowKeyUpdate} -import org.finos.vuu.net.{ClientSessionId, FilterSpec} -import org.finos.vuu.util.PublishQueue import org.finos.toolbox.collection.array.ImmutableArray import org.finos.toolbox.time.Clock +import org.finos.vuu.api.ViewPortDef import org.finos.vuu.core.auths.RowPermissionChecker +import org.finos.vuu.core.sort._ +import org.finos.vuu.core.table.{Column, KeyObserver, RowKeyUpdate} import org.finos.vuu.core.tree.TreeSessionTableImpl +import org.finos.vuu.net.{ClientSessionId, FilterSpec} +import org.finos.vuu.util.PublishQueue import org.finos.vuu.viewport.tree.TreeNodeState import java.util @@ -56,7 +56,9 @@ case class ViewPortRange(from: Int, to: Int) { } -case class ViewPortUpdate(vpRequestId: String, vp: ViewPort, table: RowSource, key: RowKeyUpdate, index: Int, vpUpdate: ViewPortUpdateType, size: Int, ts: Long) +case class ViewPortUpdate(vpRequestId: String, vp: ViewPort, table: RowSource, key: RowKeyUpdate, index: Int, vpUpdate: ViewPortUpdateType, size: Int, ts: Long) { + override def toString: String = s"VPU(type=$vpUpdate,key=${key.key},vp=${vp.id}(${vp.table.name})" +} trait ViewPort { @@ -104,8 +106,6 @@ trait ViewPort { def outboundQ: PublishQueue[ViewPortUpdate] - def highPriorityQ: PublishQueue[ViewPortUpdate] - def getColumns: ViewPortColumns def getSelection: Map[String, Int] @@ -116,7 +116,7 @@ trait ViewPort { def getSort: Sort - def combinedQueueLength: Int = highPriorityQ.length + outboundQ.length + def combinedQueueLength: Int = outboundQ.length def filterSpec: FilterSpec @@ -165,7 +165,6 @@ class ViewPortImpl(val id: String, //table: RowSource, val session: ClientSessionId, val outboundQ: PublishQueue[ViewPortUpdate], - @deprecated val highPriorityQ: PublishQueue[ViewPortUpdate], val structuralFields: AtomicReference[ViewPortStructuralFields], val range: AtomicReference[ViewPortRange] )(implicit timeProvider: Clock) extends ViewPort with KeyObserver[RowKeyUpdate] with LazyLogging { @@ -177,7 +176,7 @@ class ViewPortImpl(val id: String, @volatile private var requestId: String = "" override def updateSpecificKeys(keys: ImmutableArray[String]): Unit = { - keys.filter(rowKeyToIndex.containsKey(_)).foreach(key => outboundQ.push(ViewPortUpdate(this.requestId, this, this.table, RowKeyUpdate(key, this.table), rowKeyToIndex.get(key), RowUpdateType, this.keys.length, timeProvider.now()))) + keys.filter(rowKeyToIndex.containsKey(_)).foreach(key => outboundQ.pushHighPriority(ViewPortUpdate(this.requestId, this, this.table, RowKeyUpdate(key, this.table), rowKeyToIndex.get(key), RowUpdateType, this.keys.length, timeProvider.now()))) } override def setPermissionChecker(checker: Option[RowPermissionChecker]): Unit = { @@ -359,7 +358,7 @@ class ViewPortImpl(val id: String, def setKeysPost(sendSizeUpdate: Boolean, newKeys: ImmutableArray[String]): Unit = { if (sendSizeUpdate) { - outboundQ.push(ViewPortUpdate(this.requestId, this, null, RowKeyUpdate("SIZE", null), -1, SizeUpdateType, newKeys.length, timeProvider.now())) + outboundQ.pushHighPriority(ViewPortUpdate(this.requestId, this, null, RowKeyUpdate("SIZE", null), -1, SizeUpdateType, newKeys.length, timeProvider.now())) } subscribeToNewKeys(newKeys) } @@ -474,10 +473,10 @@ class ViewPortImpl(val id: String, addObserver(key) } - def publishHighPriorityUpdate(key: String, index: Int): Unit = { + private def publishHighPriorityUpdate(key: String, index: Int): Unit = { logger.debug(s"publishing update @[$index] = $key ") if (this.enabled) { - outboundQ.push(ViewPortUpdate(this.requestId, this, table, RowKeyUpdate(key, table), index, RowUpdateType, this.keys.length, timeProvider.now())) + outboundQ.pushHighPriority(ViewPortUpdate(this.requestId, this, table, RowKeyUpdate(key, table), index, RowUpdateType, this.keys.length, timeProvider.now())) } } diff --git a/vuu/src/main/scala/org/finos/vuu/viewport/ViewPortContainer.scala b/vuu/src/main/scala/org/finos/vuu/viewport/ViewPortContainer.scala index 9f98932ed0..4ecdc407cf 100644 --- a/vuu/src/main/scala/org/finos/vuu/viewport/ViewPortContainer.scala +++ b/vuu/src/main/scala/org/finos/vuu/viewport/ViewPortContainer.scala @@ -521,7 +521,7 @@ class ViewPortContainer(val tableContainer: TableContainer, val providerContaine viewPort } - def create(requestId: String, clientSession: ClientSessionId, outboundQ: PublishQueue[ViewPortUpdate], highPriorityQ: PublishQueue[ViewPortUpdate], table: RowSource, + def create(requestId: String, clientSession: ClientSessionId, outboundQ: PublishQueue[ViewPortUpdate], table: RowSource, range: ViewPortRange, columns: ViewPortColumns, sort: SortSpec = SortSpec(List()), filterSpec: FilterSpec = FilterSpec(""), groupBy: GroupBy = NoGroupBy): ViewPort = { val id = createId(clientSession.user) @@ -540,7 +540,7 @@ class ViewPortContainer(val tableContainer: TableContainer, val providerContaine val structural = viewport.ViewPortStructuralFields(aTable, columns, viewPortDef, filtAndSort, filterSpec, groupBy, ClosedTreeNodeState, None) - val viewPort = new ViewPortImpl(id, clientSession, outboundQ, highPriorityQ, new AtomicReference[ViewPortStructuralFields](structural), new AtomicReference[ViewPortRange](range)) + val viewPort = new ViewPortImpl(id, clientSession, outboundQ, new AtomicReference[ViewPortStructuralFields](structural), new AtomicReference[ViewPortRange](range)) val permission = table.asTable.getTableDef.permissionChecker(viewPort, tableContainer) diff --git a/vuu/src/test/resources/logback-test.xml b/vuu/src/test/resources/logback-test.xml index aea0412262..0173427a83 100644 --- a/vuu/src/test/resources/logback-test.xml +++ b/vuu/src/test/resources/logback-test.xml @@ -8,6 +8,10 @@ + + + + diff --git a/vuu/src/test/scala/org/finos/vuu/api/CoreServerApiTest.scala b/vuu/src/test/scala/org/finos/vuu/api/CoreServerApiTest.scala index 31084689ff..e26816dce1 100644 --- a/vuu/src/test/scala/org/finos/vuu/api/CoreServerApiTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/api/CoreServerApiTest.scala @@ -1,6 +1,6 @@ package org.finos.vuu.api -import org.finos.toolbox.jmx.MetricsProviderImpl +import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} import org.finos.toolbox.lifecycle.LifecycleContainer import org.finos.toolbox.time.TestFriendlyClock import org.finos.vuu.core.CoreServerApiHandler @@ -9,15 +9,15 @@ import org.finos.vuu.net.{ClientSessionId, HeartBeatResponse, RequestContext} import org.finos.vuu.provider.{JoinTableProviderImpl, ProviderContainer} import org.finos.vuu.util.OutboundRowPublishQueue import org.finos.vuu.viewport.ViewPortContainer -import org.scalatest.{BeforeAndAfterEach, GivenWhenThen} import org.scalatest.featurespec.AnyFeatureSpec +import org.scalatest.{BeforeAndAfterEach, GivenWhenThen} class CoreServerApiTest extends AnyFeatureSpec with BeforeAndAfterEach with GivenWhenThen { var coreServerApi: CoreServerApiHandler = _ - override def beforeEach() { - implicit val clock = new TestFriendlyClock(1311544800l) - implicit val lifecycle = new LifecycleContainer - implicit val metrics = new MetricsProviderImpl + override def beforeEach(): Unit = { + implicit val clock: TestFriendlyClock = new TestFriendlyClock(1311544800l) + implicit val lifecycle: LifecycleContainer = new LifecycleContainer + implicit val metrics: MetricsProvider = new MetricsProviderImpl val joinTableProvider = JoinTableProviderImpl() val tableContainer = new TableContainer(joinTableProvider) val providerContainer = new ProviderContainer(joinTableProvider) @@ -30,7 +30,7 @@ class CoreServerApiTest extends AnyFeatureSpec with BeforeAndAfterEach with Give Given("a heart beat response") val heartBeatResponse = HeartBeatResponse(100000) val requestContext = RequestContext("reqId", - ClientSessionId("sessionId", "user"), new OutboundRowPublishQueue(), new OutboundRowPublishQueue(), "token") + ClientSessionId("sessionId", "user"), new OutboundRowPublishQueue(), "token") val maybeMessage = coreServerApi.process(heartBeatResponse)(requestContext) Then("core server api should process successfully") diff --git a/vuu/src/test/scala/org/finos/vuu/core/module/typeahead/TypeAheadModuleTest.scala b/vuu/src/test/scala/org/finos/vuu/core/module/typeahead/TypeAheadModuleTest.scala index 6df0f68934..9cc12c9ae1 100644 --- a/vuu/src/test/scala/org/finos/vuu/core/module/typeahead/TypeAheadModuleTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/core/module/typeahead/TypeAheadModuleTest.scala @@ -1,14 +1,13 @@ package org.finos.vuu.core.module.typeahead +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.TableDef import org.finos.vuu.core.table.{Columns, RowWithData, TableContainer} -import org.finos.vuu.net.{ClientSessionId, JsonViewServerMessage, RequestContext, RpcCall, RpcResponse, ViewServerMessage} +import org.finos.vuu.net._ import org.finos.vuu.provider.VuuJoinTableProvider import org.finos.vuu.viewport.TestTimeStamp.EPOCH_DEFAULT -import org.finos.vuu.viewport.ViewPortTable -import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} -import org.finos.toolbox.lifecycle.LifecycleContainer -import org.finos.toolbox.time.{Clock, TestFriendlyClock} import org.scalatest.GivenWhenThen import org.scalatest.featurespec.AnyFeatureSpec import org.scalatest.matchers.should.Matchers @@ -23,7 +22,7 @@ class TypeAheadModuleTest extends AnyFeatureSpec with Matchers with GivenWhenThe val typeAheadRpc = new TypeAheadRpcHandlerImpl(tables) - val ctx = RequestContext("", ClientSessionId("",""), null, null, "") + val ctx = RequestContext("", ClientSessionId("", ""), null, "") val vsMsg = toVsMsg(RpcCall("TypeAheadRpcHandler", "getUniqueFieldValues", Array(Map("table" -> "orders", "module" -> "TEST"), column), Map())) @@ -36,7 +35,7 @@ class TypeAheadModuleTest extends AnyFeatureSpec with Matchers with GivenWhenThe val typeAheadRpc = new TypeAheadRpcHandlerImpl(tables) - val ctx = new RequestContext("", ClientSessionId("",""), null, null, "") + val ctx = new RequestContext("", ClientSessionId("", ""), null, "") val vsMsg = toVsMsg(RpcCall("TypeAheadRpcHandler", "getUniqueFieldValuesStartingWith", Array(Map("table" -> "orders", "module" -> "TEST"), column, starts), Map())) diff --git a/vuu/src/test/scala/org/finos/vuu/core/table/DataTableTest.scala b/vuu/src/test/scala/org/finos/vuu/core/table/DataTableTest.scala index 57dc560f5f..512bb07bbd 100644 --- a/vuu/src/test/scala/org/finos/vuu/core/table/DataTableTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/core/table/DataTableTest.scala @@ -1,5 +1,8 @@ package org.finos.vuu.core.table +import org.finos.toolbox.jmx.MetricsProviderImpl +import org.finos.toolbox.lifecycle.LifecycleContainer +import org.finos.toolbox.time.{Clock, DefaultClock} import org.finos.vuu.api.TableDef import org.finos.vuu.client.messages.RequestId import org.finos.vuu.core.table.TableTestHelper._ @@ -7,9 +10,6 @@ import org.finos.vuu.net.ClientSessionId import org.finos.vuu.provider.{JoinTableProviderImpl, MockProvider, ProviderContainer} import org.finos.vuu.util.OutboundRowPublishQueue import org.finos.vuu.viewport.{DefaultRange, ViewPortContainer} -import org.finos.toolbox.jmx.MetricsProviderImpl -import org.finos.toolbox.lifecycle.LifecycleContainer -import org.finos.toolbox.time.{Clock, DefaultClock} import org.scalatest.featurespec.AnyFeatureSpec import org.scalatest.matchers.should.Matchers @@ -29,7 +29,6 @@ class DataTableTest extends AnyFeatureSpec with Matchers { val tableContainer = new TableContainer(joinProvider) val outQueue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val providerContainer = new ProviderContainer(joinProvider) @@ -45,7 +44,7 @@ class DataTableTest extends AnyFeatureSpec with Matchers { val vpcolumns = List("ric", "bid", "ask") - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, table, DefaultRange, ViewPortColumnCreator.create(table, vpcolumns)) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, table, DefaultRange, ViewPortColumnCreator.create(table, vpcolumns)) provider.tick("VOD.L", Map("ric" -> "VOD.L", "bid" -> 220, "ask" -> 223)) diff --git a/vuu/src/test/scala/org/finos/vuu/core/table/JoinTableTest.scala b/vuu/src/test/scala/org/finos/vuu/core/table/JoinTableTest.scala index 9d5c07f154..46aacc2721 100644 --- a/vuu/src/test/scala/org/finos/vuu/core/table/JoinTableTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/core/table/JoinTableTest.scala @@ -1,5 +1,8 @@ package org.finos.vuu.core.table +import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} +import org.finos.toolbox.lifecycle.LifecycleContainer +import org.finos.toolbox.time.{Clock, DefaultClock} import org.finos.vuu.api._ import org.finos.vuu.client.messages.RequestId import org.finos.vuu.net.ClientSessionId @@ -7,9 +10,6 @@ import org.finos.vuu.provider.{JoinTableProviderImpl, MockProvider, ProviderCont import org.finos.vuu.util.OutboundRowPublishQueue import org.finos.vuu.util.table.TableAsserts.assertVpEq import org.finos.vuu.viewport._ -import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} -import org.finos.toolbox.lifecycle.LifecycleContainer -import org.finos.toolbox.time.{Clock, DefaultClock} import org.joda.time.LocalDateTime import org.scalatest.featurespec.AnyFeatureSpec import org.scalatest.matchers.should.Matchers @@ -94,11 +94,10 @@ class JoinTableTest extends AnyFeatureSpec with Matchers with ViewPortSetup { val session = ClientSessionId("sess-01", "chris") val outQueue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val vpcolumns = ViewPortColumnCreator.create(orderPrices, List("orderId", "trader", "tradeTime", "quantity", "ric")) - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, orderPrices, DefaultRange, vpcolumns) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, orderPrices, DefaultRange, vpcolumns) viewPortContainer.runOnce() @@ -175,13 +174,12 @@ class JoinTableTest extends AnyFeatureSpec with Matchers with ViewPortSetup { val (joinProvider, orders, prices, orderPrices, ordersProvider, pricesProvider, vpContainer) = setup() val queue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() joinProvider.start() tickInData(ordersProvider, pricesProvider) - val orderPricesViewport = vpContainer.create(RequestId.oneNew(), ClientSessionId("A", "B"), queue, highPriorityQueue, orderPrices, ViewPortRange(0, 20), ViewPortColumnCreator.create(orderPrices, orderPrices.getTableDef.columns.map(_.name).toList)) + val orderPricesViewport = vpContainer.create(RequestId.oneNew(), ClientSessionId("A", "B"), queue, orderPrices, ViewPortRange(0, 20), ViewPortColumnCreator.create(orderPrices, orderPrices.getTableDef.columns.map(_.name).toList)) runContainersOnce(vpContainer, joinProvider) diff --git a/vuu/src/test/scala/org/finos/vuu/core/table/JoinsOfJoinsTableTest.scala b/vuu/src/test/scala/org/finos/vuu/core/table/JoinsOfJoinsTableTest.scala index 286281c4cc..a1eb1806c9 100644 --- a/vuu/src/test/scala/org/finos/vuu/core/table/JoinsOfJoinsTableTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/core/table/JoinsOfJoinsTableTest.scala @@ -1,16 +1,15 @@ package org.finos.vuu.core.table +import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} +import org.finos.toolbox.lifecycle.LifecycleContainer +import org.finos.toolbox.time.{Clock, DefaultClock} import org.finos.vuu.api._ import org.finos.vuu.client.messages.RequestId import org.finos.vuu.net.ClientSessionId import org.finos.vuu.provider.{JoinTableProviderImpl, MockProvider, ProviderContainer} import org.finos.vuu.util.OutboundRowPublishQueue import org.finos.vuu.util.table.TableAsserts.assertVpEq -import org.finos.vuu.viewport.{DefaultRange, RowProcessor, RowUpdateType, ViewPortContainer, ViewPortSetup} -import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} -import org.finos.toolbox.lifecycle.LifecycleContainer -import org.finos.toolbox.time.{Clock, DefaultClock} -import org.joda.time.LocalDateTime +import org.finos.vuu.viewport.{DefaultRange, ViewPortContainer, ViewPortSetup} import org.scalatest.featurespec.AnyFeatureSpec import org.scalatest.matchers.should.Matchers import org.scalatest.prop.Tables.Table @@ -28,8 +27,6 @@ class JoinsOfJoinsTableTest extends AnyFeatureSpec with Matchers with ViewPortSe implicit val lifecycle: LifecycleContainer = new LifecycleContainer implicit val metrics: MetricsProvider = new MetricsProviderImpl - import TableTestHelper._ - def setupViewPort(tableContainer: TableContainer, providerContainer: ProviderContainer): ViewPortContainer = { val viewPortContainer = new ViewPortContainer(tableContainer, providerContainer) @@ -113,11 +110,10 @@ class JoinsOfJoinsTableTest extends AnyFeatureSpec with Matchers with ViewPortSe val session = ClientSessionId("sess-01", "chris") val outQueue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val vpcolumns = ViewPortColumnCreator.create(orderPricesFx, List("orderId", "trader", "tradeTime", "quantity", "ric", "fxbid", "fxask")) - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, orderPricesFx, DefaultRange, vpcolumns) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, orderPricesFx, DefaultRange, vpcolumns) viewPortContainer.runOnce() diff --git a/vuu/src/test/scala/org/finos/vuu/core/table/RowDeleteTest.scala b/vuu/src/test/scala/org/finos/vuu/core/table/RowDeleteTest.scala index 856d7bbbb1..108e549179 100644 --- a/vuu/src/test/scala/org/finos/vuu/core/table/RowDeleteTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/core/table/RowDeleteTest.scala @@ -1,5 +1,8 @@ package org.finos.vuu.core.table +import org.finos.toolbox.jmx.MetricsProviderImpl +import org.finos.toolbox.lifecycle.LifecycleContainer +import org.finos.toolbox.time.{Clock, DefaultClock, TestFriendlyClock} import org.finos.vuu.api.TableDef import org.finos.vuu.client.messages.RequestId import org.finos.vuu.core.table.TableTestHelper._ @@ -8,9 +11,6 @@ import org.finos.vuu.provider.{JoinTableProviderImpl, MockProvider, ProviderCont import org.finos.vuu.util.OutboundRowPublishQueue import org.finos.vuu.util.table.TableAsserts._ import org.finos.vuu.viewport.{DefaultRange, GroupBy, ViewPortContainer} -import org.finos.toolbox.jmx.MetricsProviderImpl -import org.finos.toolbox.lifecycle.LifecycleContainer -import org.finos.toolbox.time.{Clock, DefaultClock, TestFriendlyClock} import org.scalatest.featurespec.AnyFeatureSpec import org.scalatest.matchers.should.Matchers import org.scalatest.prop.Tables.Table @@ -32,7 +32,6 @@ class RowDeleteTest extends AnyFeatureSpec with Matchers with OneInstancePerTest val tableContainer = new TableContainer(joinProvider) val outQueue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val providerContainer = new ProviderContainer(joinProvider) @@ -48,7 +47,7 @@ class RowDeleteTest extends AnyFeatureSpec with Matchers with OneInstancePerTest val vpcolumns = ViewPortColumnCreator.create(table, List("ric", "bid", "ask")) - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, table, DefaultRange, vpcolumns) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, table, DefaultRange, vpcolumns) provider.tick("VOD.L", Map("ric" -> "VOD.L", "bid" -> 220, "ask" -> 223)) provider.tick("BT.L", Map("ric" -> "BT.L", "bid" -> 220, "ask" -> 223)) @@ -63,10 +62,10 @@ class RowDeleteTest extends AnyFeatureSpec with Matchers with OneInstancePerTest assertVpEq(updates) { Table( - ("ric" ,"bid" ,"ask" ), - ("VOD.L" ,220 ,223 ), - ("BT.L" ,220 ,223 ), - ("TW.L" ,220 ,223 ) + ("ric", "bid", "ask"), + ("BT.L", 220, 223), + ("TW.L", 220, 223), + ("VOD.L", 220, 223) ) } @@ -100,7 +99,6 @@ class RowDeleteTest extends AnyFeatureSpec with Matchers with OneInstancePerTest val tableContainer = new TableContainer(joinProvider) val outQueue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val providerContainer = new ProviderContainer(joinProvider) @@ -112,7 +110,7 @@ class RowDeleteTest extends AnyFeatureSpec with Matchers with OneInstancePerTest val vpcolumns = ViewPortColumnCreator.create(orderPrices, orderPrices.getTableDef.columns.map(_.name).toList) - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, orderPrices, DefaultRange, vpcolumns) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, orderPrices, DefaultRange, vpcolumns) ordersProvider.tick("NYC-0001", Map("orderId" -> "NYC-0001", "trader" -> "chris", "tradeTime" -> dateTime, "quantity" -> 100, "ric" -> "VOD.L")) ordersProvider.tick("NYC-0002", Map("orderId" -> "NYC-0002", "trader" -> "chris", "tradeTime" -> dateTime, "quantity" -> 100, "ric" -> "VOD.L")) @@ -176,7 +174,6 @@ class RowDeleteTest extends AnyFeatureSpec with Matchers with OneInstancePerTest val tableContainer = new TableContainer(joinProvider) val outQueue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val providerContainer = new ProviderContainer(joinProvider) @@ -188,11 +185,11 @@ class RowDeleteTest extends AnyFeatureSpec with Matchers with OneInstancePerTest val vpcolumns = ViewPortColumnCreator.create(orderPrices, orderPrices.getTableDef.columns.map(_.name).toList) - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, orderPrices, DefaultRange, vpcolumns, - groupBy = GroupBy(orderPrices, vpcolumns.getColumnForName( "trader").get) - .withSum("quantity") - .withCount("trader") - .asClause() + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, orderPrices, DefaultRange, vpcolumns, + groupBy = GroupBy(orderPrices, vpcolumns.getColumnForName("trader").get) + .withSum("quantity") + .withCount("trader") + .asClause() ) ordersProvider.tick("NYC-0001", Map("orderId" -> "NYC-0001", "trader" -> "chris", "tradeTime" -> dateTime, "quantity" -> 100, "ric" -> "VOD.L")) @@ -271,12 +268,12 @@ class RowDeleteTest extends AnyFeatureSpec with Matchers with OneInstancePerTest assertVpEq(combineQs(viewPort)) { Table( - ("_childCount","_depth" ,"_caption","_isOpen" ,"_treeKey","_isLeaf" ,"ric" ,"bid" ,"ask" ,"orderId" ,"trader" ,"ric" ,"quantity","last" ,"open" ,"close" ,"tradeTime"), - (0 ,2 ,"NYC-0005",false ,"$root|chris|NYC-0005",true ,"VOD.L" ,219.0 ,223.0 ,"NYC-0005","chris" ,"VOD.L" ,100 ,null ,null ,null ,1437732000000L), - (0 ,2 ,"NYC-0006",false ,"$root|chris|NYC-0006",true ,"VOD.L" ,219.0 ,223.0 ,"NYC-0006","chris" ,"VOD.L" ,100 ,null ,null ,null ,1437732000000L), - (0 ,2 ,"NYC-0007",false ,"$root|chris|NYC-0007",true ,"VOD.L" ,219.0 ,223.0 ,"NYC-0007","chris" ,"VOD.L" ,100 ,null ,null ,null ,1437732000000L), - (0 ,2 ,"NYC-0008",false ,"$root|chris|NYC-0008",true ,"VOD.L" ,219.0 ,223.0 ,"NYC-0008","chris" ,"VOD.L" ,100 ,null ,null ,null ,1437732000000L), - (4 ,1 ,"chris" ,true ,"$root|chris",false ,"" ,"" ,"" ,"" ,1 ,"" ,400.0 ,"" ,"" ,"" ,"" ) + ("_childCount", "_depth", "_caption", "_isOpen", "_treeKey", "_isLeaf", "ric", "bid", "ask", "orderId", "trader", "ric", "quantity", "last", "open", "close", "tradeTime"), + (4, 1, "chris", true, "$root|chris", false, "", "", "", "", 1, "", 400.0, "", "", "", ""), + (0, 2, "NYC-0005", false, "$root|chris|NYC-0005", true, "VOD.L", 219.0, 223.0, "NYC-0005", "chris", "VOD.L", 100, null, null, null, 1437732000000L), + (0, 2, "NYC-0006", false, "$root|chris|NYC-0006", true, "VOD.L", 219.0, 223.0, "NYC-0006", "chris", "VOD.L", 100, null, null, null, 1437732000000L), + (0, 2, "NYC-0007", false, "$root|chris|NYC-0007", true, "VOD.L", 219.0, 223.0, "NYC-0007", "chris", "VOD.L", 100, null, null, null, 1437732000000L), + (0, 2, "NYC-0008", false, "$root|chris|NYC-0008", true, "VOD.L", 219.0, 223.0, "NYC-0008", "chris", "VOD.L", 100, null, null, null, 1437732000000L) ) } diff --git a/vuu/src/test/scala/org/finos/vuu/core/table/RpcTableTest.scala b/vuu/src/test/scala/org/finos/vuu/core/table/RpcTableTest.scala index c655a6c5e0..51e25ab2e8 100644 --- a/vuu/src/test/scala/org/finos/vuu/core/table/RpcTableTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/core/table/RpcTableTest.scala @@ -1,14 +1,14 @@ package org.finos.vuu.core.table +import org.finos.toolbox.jmx.MetricsProviderImpl +import org.finos.toolbox.lifecycle.LifecycleContainer +import org.finos.toolbox.time.DefaultClock import org.finos.vuu.api.TableDef import org.finos.vuu.client.messages.RequestId import org.finos.vuu.core.table.TableTestHelper._ import org.finos.vuu.net.ClientSessionId import org.finos.vuu.provider.{JoinTableProviderImpl, ProviderContainer, RpcProvider} import org.finos.vuu.viewport.{DefaultRange, ViewPortContainer} -import org.finos.toolbox.jmx.MetricsProviderImpl -import org.finos.toolbox.lifecycle.LifecycleContainer -import org.finos.toolbox.time.DefaultClock import org.scalatest.OneInstancePerTest import org.scalatest.featurespec.AnyFeatureSpec import org.scalatest.matchers.should.Matchers @@ -31,7 +31,7 @@ class RpcTableTest extends AnyFeatureSpec with Matchers with OneInstancePerTest val tableContainer = new TableContainer(joinProvider) - val (outQueue, highPriorityQueue) = getQueues + val (outQueue) = getQueues //val highPriorityQueue = new OutboundRowPublishQueue() val providerContainer = new ProviderContainer(joinProvider) @@ -52,7 +52,7 @@ class RpcTableTest extends AnyFeatureSpec with Matchers with OneInstancePerTest val vpcolumns = ViewPortColumnCreator.create(orderEntry, List("clOrderId", "ric", "quantity", "orderType", "price", "priceLevel")) - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, orderEntry, DefaultRange, vpcolumns) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, orderEntry, DefaultRange, vpcolumns) provider.tick("CLORDID-1", Map("clOrderId" -> "CLORDID-1", "ric" -> "VOD.L", "quantity" -> 200)) @@ -62,7 +62,7 @@ class RpcTableTest extends AnyFeatureSpec with Matchers with OneInstancePerTest val viewPortUpdate = combineQs(viewPort) - viewPortUpdate(1).key.key should equal("CLORDID-1") + viewPortUpdate(0).key.key should equal("CLORDID-1") } } diff --git a/vuu/src/test/scala/org/finos/vuu/core/table/TableTestHelper.scala b/vuu/src/test/scala/org/finos/vuu/core/table/TableTestHelper.scala index e3eedadcd3..0658c02efa 100644 --- a/vuu/src/test/scala/org/finos/vuu/core/table/TableTestHelper.scala +++ b/vuu/src/test/scala/org/finos/vuu/core/table/TableTestHelper.scala @@ -1,32 +1,30 @@ package org.finos.vuu.core.table +import org.finos.toolbox.jmx.MetricsProviderImpl +import org.finos.toolbox.lifecycle.LifecycleContainer +import org.finos.toolbox.time.TestFriendlyClock import org.finos.vuu.api._ import org.finos.vuu.provider.{JoinTableProviderImpl, MockProvider} import org.finos.vuu.util.{OutboundRowPublishQueue, PublishQueue} import org.finos.vuu.viewport.{ViewPort, ViewPortUpdate} -import org.finos.toolbox.jmx.MetricsProviderImpl -import org.finos.toolbox.lifecycle.LifecycleContainer -import org.finos.toolbox.time.TestFriendlyClock object TableTestHelper { - def emptyQueues(viewPort: ViewPort) = { - viewPort.highPriorityQ.popUpTo(1000) + def emptyQueues(viewPort: ViewPort): Seq[ViewPortUpdate] = { viewPort.outboundQ.popUpTo(1000) } - def combineQs(queue: PublishQueue[ViewPortUpdate], highPriorityQueue: PublishQueue[ViewPortUpdate]) = { - highPriorityQueue.popUpTo(20) ++ queue.popUpTo(20) + def combineQs(queue: PublishQueue[ViewPortUpdate]): Seq[ViewPortUpdate] = { + queue.popUpTo(20) } - def combineQs(viewPort: ViewPort) = { - (viewPort.highPriorityQ.popUpTo(20) ++ viewPort.outboundQ.popUpTo(20)) + def combineQs(viewPort: ViewPort): Seq[ViewPortUpdate] = { + viewPort.outboundQ.popUpTo(20) } - def getQueues = { - val outQueue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() - (outQueue, highPriorityQueue) + def getQueues: OutboundRowPublishQueue = { + val outQueue = new OutboundRowPublishQueue() + (outQueue) } def createOrderPricesScenario() = { diff --git a/vuu/src/test/scala/org/finos/vuu/net/rpc/RpcTest.scala b/vuu/src/test/scala/org/finos/vuu/net/rpc/RpcTest.scala index 7d861685a8..19916afc72 100644 --- a/vuu/src/test/scala/org/finos/vuu/net/rpc/RpcTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/net/rpc/RpcTest.scala @@ -46,7 +46,7 @@ class RpcTest extends AnyFeatureSpec with Matchers { val myRpcHandler = new MyCustomRpcHandler - val ctx = new RequestContext("", ClientSessionId("",""), null, null, "") + val ctx = new RequestContext("", ClientSessionId("", ""), null, "") val vsMsg = toVsMsg(RpcCall("RpcHandler", "doSomething", Array("test", 1234.34), Map())) diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/AbstractViewPortTestCase.scala b/vuu/src/test/scala/org/finos/vuu/viewport/AbstractViewPortTestCase.scala index e31ad6f65c..9898dc3f0e 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/AbstractViewPortTestCase.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/AbstractViewPortTestCase.scala @@ -1,17 +1,17 @@ package org.finos.vuu.viewport +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._ -import org.finos.vuu.core.table.{Columns, TableContainer} +import org.finos.vuu.core.table.{Columns, DataTable, TableContainer} import org.finos.vuu.net.ClientSessionId import org.finos.vuu.provider.{JoinTableProviderImpl, MockProvider, ProviderContainer} import org.finos.vuu.util.OutboundRowPublishQueue -import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} -import org.finos.toolbox.lifecycle.LifecycleContainer -import org.finos.toolbox.time.{Clock, TestFriendlyClock} import org.scalatest.featurespec.AnyFeatureSpec object TestTimeStamp{ - def EPOCH_DEFAULT = 1311544800000l + def EPOCH_DEFAULT = 1311544800000L } class AbstractViewPortTestCase extends AnyFeatureSpec { @@ -23,17 +23,17 @@ class AbstractViewPortTestCase extends AnyFeatureSpec { vpUps.filter( vpu => vpu.vp.id == vp.id ) } - def setupViewPort(tableContainer: TableContainer, providerContainer: ProviderContainer) = { + def setupViewPort(tableContainer: TableContainer, providerContainer: ProviderContainer): ViewPortContainer = { val viewPortContainer = new ViewPortContainer(tableContainer, providerContainer) viewPortContainer } - def createDefaultViewPortInfra() = { - implicit val lifecycle = new LifecycleContainer + def createDefaultViewPortInfra(): (ViewPortContainer, DataTable, MockProvider, ClientSessionId, OutboundRowPublishQueue) = { + implicit val lifecycle: LifecycleContainer = new LifecycleContainer - val dateTime = 1437728400000l//new LocalDateTime(2015, 7, 24, 11, 0).toDateTime.toInstant.getMillis + val dateTime = 1437728400000L//new LocalDateTime(2015, 7, 24, 11, 0).toDateTime.toInstant.getMillis val ordersDef = TableDef( name = "orders", @@ -74,20 +74,19 @@ class AbstractViewPortTestCase extends AnyFeatureSpec { joinProvider.runOnce() - val session = new ClientSessionId("sess-01", "chris") + val session = ClientSessionId("sess-01", "chris") val outQueue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() - (viewPortContainer, orders, ordersProvider, session, outQueue, highPriorityQueue) + (viewPortContainer, orders, ordersProvider, session, outQueue) } - def createDefaultOrderPricesViewPortInfra() = { + def createDefaultOrderPricesViewPortInfra(): (ViewPortContainer, DataTable, MockProvider, DataTable, MockProvider, ClientSessionId, OutboundRowPublishQueue) = { implicit val lifecycle = new LifecycleContainer - val dateTime = 1437728400000l//new LocalDateTime(2015, 7, 24, 11, 0).toDateTime.toInstant.getMillis + val dateTime = 1437728400000L//new LocalDateTime(2015, 7, 24, 11, 0).toDateTime.toInstant.getMillis val ordersDef = TableDef( name = "orders", @@ -135,23 +134,22 @@ class AbstractViewPortTestCase extends AnyFeatureSpec { joinProvider.runOnce() - val session = new ClientSessionId("sess-01", "chris") + val session = ClientSessionId("sess-01", "chris") val outQueue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() - (viewPortContainer, orders, ordersProvider, prices, pricesProvider, session, outQueue, highPriorityQueue) + (viewPortContainer, orders, ordersProvider, prices, pricesProvider, session, outQueue) } - def createPricesRow(pricesProvider: MockProvider, ric: String, bid: Double, ask: Double, last: Double, close: Double) = { + def createPricesRow(pricesProvider: MockProvider, ric: String, bid: Double, ask: Double, last: Double, close: Double): Unit = { pricesProvider.tick(ric, Map("ric" -> ric, "bid" -> bid, "ask" -> ask, "last" -> last, "close" -> close)) } - def createPricesRow(pricesProvider: MockProvider, ric: String, bid: Double, ask: Double, last: Double, close: Double, exchange: String) = { + def createPricesRow(pricesProvider: MockProvider, ric: String, bid: Double, ask: Double, last: Double, close: Double, exchange: String): Unit = { pricesProvider.tick(ric, Map("ric" -> ric, "bid" -> bid, "ask" -> ask, "last" -> last, "close" -> close, "exchange" -> exchange)) } - def createNOrderRows(ordersProvider: MockProvider, n: Int, ric: String = "VOD.L", idOffset: Int = 0)(implicit clock: Clock) = { - (0 to n - 1).foreach( i=>{ + def createNOrderRows(ordersProvider: MockProvider, n: Int, ric: String = "VOD.L", idOffset: Int = 0)(implicit clock: Clock): Unit = { + (0 until n).foreach(i=>{ val iAsString = (idOffset + i).toString val orderId = "NYC-" + "0".padTo(4 - iAsString.length, "0").mkString + iAsString val quantity = 100 + i @@ -160,8 +158,8 @@ class AbstractViewPortTestCase extends AnyFeatureSpec { }) } - def createNOrderRows(ordersProvider: MockProvider, n: Int)(implicit clock: Clock) = { - (0 to n - 1).foreach( i=>{ + def createNOrderRows(ordersProvider: MockProvider, n: Int)(implicit clock: Clock): Unit = { + (0 until n).foreach(i=>{ val iAsString = i.toString val orderId = "NYC-" + "0".padTo(4 - iAsString.length, "0").mkString + iAsString val quantity = 100 + i @@ -170,8 +168,8 @@ class AbstractViewPortTestCase extends AnyFeatureSpec { }) } - def createNOrderRowsNoSleep(ordersProvider: MockProvider, n: Int)(implicit clock: Clock) = { - (0 to n - 1).foreach(i => { + def createNOrderRowsNoSleep(ordersProvider: MockProvider, n: Int)(implicit clock: Clock): Unit = { + (0 until n).foreach(i => { val iAsString = i.toString val orderId = "NYC-" + "0".padTo(4 - iAsString.length, "0").mkString + iAsString val quantity = 100 + i diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/AmendViewPortToTreeTest.scala b/vuu/src/test/scala/org/finos/vuu/viewport/AmendViewPortToTreeTest.scala index 5e1ec8e7ae..235c4efb93 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/AmendViewPortToTreeTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/AmendViewPortToTreeTest.scala @@ -1,5 +1,8 @@ package org.finos.vuu.viewport +import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} +import org.finos.toolbox.lifecycle.LifecycleContainer +import org.finos.toolbox.time.{Clock, DefaultClock} import org.finos.vuu.api._ import org.finos.vuu.client.messages.RequestId import org.finos.vuu.core.table.{Columns, TableContainer, ViewPortColumnCreator} @@ -7,9 +10,6 @@ import org.finos.vuu.net.{ClientSessionId, FilterSpec, SortSpec} import org.finos.vuu.provider.{JoinTableProviderImpl, MockProvider, ProviderContainer} import org.finos.vuu.util.OutboundRowPublishQueue import org.finos.vuu.util.table.TableAsserts._ -import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} -import org.finos.toolbox.lifecycle.LifecycleContainer -import org.finos.toolbox.time.{Clock, DefaultClock} import org.scalatest.featurespec.AnyFeatureSpec import org.scalatest.prop.Tables.Table @@ -73,11 +73,10 @@ class AmendViewPortToTreeTest extends AnyFeatureSpec with ViewPortSetup { val session = ClientSessionId("sess-01", "chris") val outQueue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val vpcolumns = ViewPortColumnCreator.create(orderPrices, List("orderId", "trader", "tradeTime", "quantity", "ric", "bid", "ask")) - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, orderPrices, DefaultRange, vpcolumns) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, orderPrices, DefaultRange, vpcolumns) runContainersOnce(viewPortContainer, joinProvider) @@ -124,9 +123,8 @@ class AmendViewPortToTreeTest extends AnyFeatureSpec with ViewPortSetup { assertVpEq(combinedUpdates3) { Table( ("_depth", "_isOpen", "_treeKey", "_isLeaf", "_isOpen", "_caption", "_childCount", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open"), - //(0, true, "$root", false, true, "", 2, "", "", "", "", "", "", "", "", ""), - (1, false, "$root|VOD.L", false, false, "VOD.L", 0, "", "", "VOD.L", "", "", "", "", "", ""), - (1, false, "$root|BT.L", false, false, "BT.L", 0, "", "", "BT.L", "", "", "", "", "", "") + (1, false, "$root|BT.L", false, false, "BT.L", 0, "", "", "BT.L", "", "", "", "", "", ""), + (1, false, "$root|VOD.L", false, false, "VOD.L", 0, "", "", "VOD.L", "", "", "", "", "", "") ) } @@ -193,11 +191,10 @@ class AmendViewPortToTreeTest extends AnyFeatureSpec with ViewPortSetup { val session = ClientSessionId("sess-01", "chris") val outQueue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val vpcolumns = ViewPortColumnCreator.create(orderPrices, List("orderId", "trader", "tradeTime", "quantity", "ric", "bid", "ask"))//.map(orderPrices.getTableDef.columnForName(_)) - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, orderPrices, DefaultRange, vpcolumns) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, orderPrices, DefaultRange, vpcolumns) runContainersOnce(viewPortContainer, joinProvider) @@ -248,9 +245,9 @@ class AmendViewPortToTreeTest extends AnyFeatureSpec with ViewPortSetup { assertVpEq(combinedUpdates3) { Table( - ("_depth" ,"_isOpen" ,"_treeKey","_isLeaf" ,"_isOpen" ,"_caption","_childCount","orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ), - (1 ,false ,"$root|VOD.L",false ,false ,"VOD.L" ,1 ,"" ,"" ,"VOD.L" ,"" ,"" ,"" ,"" ,"" ,"" ), - (1 ,false ,"$root|BT.L",false ,false ,"BT.L" ,2 ,"" ,"" ,"BT.L" ,"" ,"" ,"" ,"" ,"" ,"" ) + ("_depth", "_isOpen", "_treeKey", "_isLeaf", "_isOpen", "_caption", "_childCount", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open"), + (1, false, "$root|BT.L", false, false, "BT.L", 2, "", "", "BT.L", "", "", "", "", "", ""), + (1, false, "$root|VOD.L", false, false, "VOD.L", 1, "", "", "VOD.L", "", "", "", "", "", "") ) } @@ -273,13 +270,13 @@ class AmendViewPortToTreeTest extends AnyFeatureSpec with ViewPortSetup { assertVpEq(combineQs(viewPort3)) { Table( - ("_depth" ,"_isOpen" ,"_treeKey","_isLeaf" ,"_isOpen" ,"_caption","_childCount","orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ), - (2 ,true ,"$root|BT.L|chris",false ,true ,"chris" ,2 ,"" ,"chris" ,"BT.L" ,"" ,"" ,"" ,"" ,"" ,"" ), - (2 ,false ,"$root|BT.L|steve",false ,false ,"steve" ,2 ,"" ,"steve" ,"BT.L" ,"" ,"" ,"" ,"" ,"" ,"" ), - (1 ,true ,"$root|BT.L",false ,true ,"BT.L" ,2 ,"" ,"" ,"BT.L" ,"" ,"" ,"" ,"" ,"" ,"" ), - (1 ,false ,"$root|VOD.L",false ,false ,"VOD.L" ,1 ,"" ,"" ,"VOD.L" ,"" ,"" ,"" ,"" ,"" ,"" ), - (3 ,false ,"$root|BT.L|chris|NYC-0002",true ,false ,"NYC-0002",0 ,"NYC-0002","chris" ,"BT.L" ,1437728400000L,100 ,499.0 ,501.0 ,40 ,null ), - (3 ,false ,"$root|BT.L|chris|NYC-0003",true ,false ,"NYC-0003",0 ,"NYC-0003","chris" ,"BT.L" ,1437728400000L,100 ,499.0 ,501.0 ,40 ,null ) + ("_depth", "_isOpen", "_treeKey", "_isLeaf", "_isOpen", "_caption", "_childCount", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open"), + (1, true, "$root|BT.L", false, true, "BT.L", 2, "", "", "BT.L", "", "", "", "", "", ""), + (2, true, "$root|BT.L|chris", false, true, "chris", 2, "", "chris", "BT.L", "", "", "", "", "", ""), + (3, false, "$root|BT.L|chris|NYC-0002", true, false, "NYC-0002", 0, "NYC-0002", "chris", "BT.L", 1437728400000L, 100, 499.0, 501.0, 40, null), + (3, false, "$root|BT.L|chris|NYC-0003", true, false, "NYC-0003", 0, "NYC-0003", "chris", "BT.L", 1437728400000L, 100, 499.0, 501.0, 40, null), + (2, false, "$root|BT.L|steve", false, false, "steve", 2, "", "steve", "BT.L", "", "", "", "", "", ""), + (1, false, "$root|VOD.L", false, false, "VOD.L", 1, "", "", "VOD.L", "", "", "", "", "", "") ) } diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/CalculatedColumnsViewPortTest.scala b/vuu/src/test/scala/org/finos/vuu/viewport/CalculatedColumnsViewPortTest.scala index 0cbc48875f..7c6bbfd644 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/CalculatedColumnsViewPortTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/CalculatedColumnsViewPortTest.scala @@ -1,10 +1,10 @@ package org.finos.vuu.viewport import org.finos.vuu.client.messages.RequestId -import org.finos.vuu.core.table.ViewPortColumnCreator import org.finos.vuu.core.table.TableTestHelper.combineQs -import org.finos.vuu.util.table.TableAsserts.{assertVpEq, assertVpEqWithMeta} -import org.scalatest.{GivenWhenThen, Ignore} +import org.finos.vuu.core.table.ViewPortColumnCreator +import org.finos.vuu.util.table.TableAsserts.assertVpEq +import org.scalatest.GivenWhenThen import org.scalatest.matchers.should.Matchers import org.scalatest.prop.Tables.Table @@ -13,13 +13,13 @@ class CalculatedColumnsViewPortTest extends AbstractViewPortTestCase with Matche Feature("Create a Viewport with calc on a non-existant column") { Given("we've created a viewport with orders in and a calc'd column 2") - val (viewPortContainer, orders, ordersProvider, session, outQueue, highPriorityQueue) = createDefaultViewPortInfra() + val (viewPortContainer, orders, ordersProvider, session, outQueue) = createDefaultViewPortInfra() val viewPortColumns = ViewPortColumnCreator.create(orders, List("orderId", "trader", "tradeTime", "quantity", "ric", "logicTest:String:=if(fooBar = 109, \"Yay\", \"Boo\")")) createNOrderRowsNoSleep(ordersProvider, 10)(timeProvider) - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, orders, ViewPortRange(0, 10), viewPortColumns) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, orders, ViewPortRange(0, 10), viewPortColumns) viewPortContainer.runOnce() @@ -47,13 +47,13 @@ class CalculatedColumnsViewPortTest extends AbstractViewPortTestCase with Matche Feature("Create a Viewport with logical calculated columns in") { Given("we've created a viewport with orders in and a calc'd column") - val (viewPortContainer, orders, ordersProvider, session, outQueue, highPriorityQueue) = createDefaultViewPortInfra() + val (viewPortContainer, orders, ordersProvider, session, outQueue) = createDefaultViewPortInfra() val viewPortColumns = ViewPortColumnCreator.create(orders, List("orderId", "trader", "tradeTime", "quantity", "ric", "logicTest:String:=if(quantity = 109, \"Yay\", \"Boo\")")) createNOrderRowsNoSleep(ordersProvider, 10)(timeProvider) - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, orders, ViewPortRange(0, 10), viewPortColumns) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, orders, ViewPortRange(0, 10), viewPortColumns) viewPortContainer.runOnce() @@ -79,13 +79,13 @@ class CalculatedColumnsViewPortTest extends AbstractViewPortTestCase with Matche Feature("Create a Viewport with calculated columns in"){ Given("we've created a viewport with orders in and a calc'd column") - val (viewPortContainer, orders, ordersProvider, session, outQueue, highPriorityQueue) = createDefaultViewPortInfra() + val (viewPortContainer, orders, ordersProvider, session, outQueue) = createDefaultViewPortInfra() val viewPortColumns = ViewPortColumnCreator.create(orders, List("orderId", "trader", "tradeTime", "quantity", "ric", "quantityTimes100:Long:=quantity*100")) createNOrderRowsNoSleep(ordersProvider, 10)(timeProvider) - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, orders, ViewPortRange(0, 10), viewPortColumns) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, orders, ViewPortRange(0, 10), viewPortColumns) viewPortContainer.runOnce() diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/ChangeViewPortTest.scala b/vuu/src/test/scala/org/finos/vuu/viewport/ChangeViewPortTest.scala index 36e5a7ef2f..4b146a7248 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/ChangeViewPortTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/ChangeViewPortTest.scala @@ -1,5 +1,8 @@ package org.finos.vuu.viewport +import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} +import org.finos.toolbox.lifecycle.LifecycleContainer +import org.finos.toolbox.time.{Clock, DefaultClock} import org.finos.vuu.api._ import org.finos.vuu.client.messages.RequestId import org.finos.vuu.core.table.TableTestHelper._ @@ -8,9 +11,6 @@ import org.finos.vuu.net.{ClientSessionId, FilterSpec} import org.finos.vuu.provider.{JoinTableProviderImpl, MockProvider, ProviderContainer} import org.finos.vuu.util.OutboundRowPublishQueue import org.finos.vuu.util.table.TableAsserts._ -import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} -import org.finos.toolbox.lifecycle.LifecycleContainer -import org.finos.toolbox.time.{Clock, DefaultClock} import org.scalatest.featurespec.AnyFeatureSpec import org.scalatest.prop.Tables.Table @@ -82,11 +82,10 @@ class ChangeViewPortTest extends AnyFeatureSpec{ val session = ClientSessionId("sess-01", "chris") val outQueue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val vpcolumns = ViewPortColumnCreator.create(orderPrices, List("orderId", "trader", "tradeTime", "quantity", "ric", "bid", "ask"))//.map(orderPrices.getTableDef.columnForName(_)).toList - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, orderPrices, DefaultRange, vpcolumns) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, orderPrices, DefaultRange, vpcolumns) viewPortContainer.runOnce() diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/DeleteViewPortTest.scala b/vuu/src/test/scala/org/finos/vuu/viewport/DeleteViewPortTest.scala index 6625da871a..86a6b69656 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/DeleteViewPortTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/DeleteViewPortTest.scala @@ -14,13 +14,13 @@ class DeleteViewPortTest extends AbstractViewPortTestCase with Matchers with Giv Scenario("Create viewport delete it, check no further ticks") { - val (viewPortContainer, orders, ordersProvider, session, outQueue, highPriorityQueue) = createDefaultViewPortInfra() + val (viewPortContainer, orders, ordersProvider, session, outQueue) = createDefaultViewPortInfra() val vpcolumns = ViewPortColumnCreator.create(orders, List("orderId", "trader", "tradeTime", "quantity", "ric"))//.map(orders.getTableDef.columnForName(_)).toList createNOrderRows(ordersProvider, 10)(timeProvider) - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, orders, ViewPortRange(0, 4), vpcolumns) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, orders, ViewPortRange(0, 4), vpcolumns) viewPortContainer.runOnce() diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/FilterAndSortTest.scala b/vuu/src/test/scala/org/finos/vuu/viewport/FilterAndSortTest.scala index d922c347c8..26d2c9467a 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/FilterAndSortTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/FilterAndSortTest.scala @@ -1,16 +1,16 @@ package org.finos.vuu.viewport +import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} +import org.finos.toolbox.lifecycle.LifecycleContainer +import org.finos.toolbox.time.{Clock, DefaultClock} import org.finos.vuu.client.messages.RequestId import org.finos.vuu.core.filter.{EqualsClause, LessThanClause, NoFilter} import org.finos.vuu.core.sort.{AlphaSort, AntlrBasedFilter, SortDirection, UserDefinedFilterAndSort} +import org.finos.vuu.core.table.ViewPortColumnCreator import org.finos.vuu.net.ClientSessionId import org.finos.vuu.provider.MockProvider import org.finos.vuu.util.OutboundRowPublishQueue import org.finos.vuu.util.table.TableAsserts -import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} -import org.finos.toolbox.lifecycle.LifecycleContainer -import org.finos.toolbox.time.{Clock, DefaultClock} -import org.finos.vuu.core.table.ViewPortColumnCreator import org.joda.time.{DateTime, DateTimeZone} import org.scalatest.featurespec.AnyFeatureSpec import org.scalatest.matchers.should.Matchers @@ -48,11 +48,10 @@ class FilterAndSortTest extends AnyFeatureSpec with Matchers with ViewPortSetup (0 until 50).foreach( i => addRicSortableOrder(ordersProvider, i, dateTime)) val queue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val columns = ViewPortColumnCreator.create(orders, orders.getTableDef.columns.map(_.name).toList) - val viewport = viewPortContainer.create(RequestId.oneNew(), ClientSessionId("A", "B"), queue, highPriorityQueue, orders, ViewPortRange(0, 5), columns) + val viewport = viewPortContainer.create(RequestId.oneNew(), ClientSessionId("A", "B"), queue, orders, ViewPortRange(0, 5), columns) viewPortContainer.runOnce() @@ -93,12 +92,12 @@ class FilterAndSortTest extends AnyFeatureSpec with Matchers with ViewPortSetup assertVpEq(combineQs(viewport)){ Table( - ("orderId" ,"trader" ,"ric" ,"tradeTime","quantity"), - ("NYC-00090","chris" ,"90VOD.L" ,1437732000000l,100 ), - ("NYC-00080","chris" ,"80VOD.L" ,1437732000000l,100 ), - ("NYC-00070","chris" ,"70VOD.L" ,1437732000000l,100 ), - ("NYC-00060","chris" ,"60VOD.L" ,1437732000000l,100 ), - ("NYC-00050","chris" ,"50VOD.L" ,1437732000000l,100 ) + ("orderId", "trader", "ric", "tradeTime", "quantity"), + ("NYC-00050", "chris", "50VOD.L", 1437732000000L, 100), + ("NYC-00060", "chris", "60VOD.L", 1437732000000L, 100), + ("NYC-00070", "chris", "70VOD.L", 1437732000000L, 100), + ("NYC-00080", "chris", "80VOD.L", 1437732000000L, 100), + ("NYC-00090", "chris", "90VOD.L", 1437732000000L, 100) ) } @@ -175,13 +174,12 @@ class FilterAndSortTest extends AnyFeatureSpec with Matchers with ViewPortSetup // val viewPortContainer = new ViewPortContainer(groupByContainer, tableContainer) val queue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val columns = ViewPortColumnCreator.create(orderPrices, orderPrices.getTableDef.columns.map(_.name).toList) //val columns = orderPrices.getTableDef.columns - val viewport = viewPortContainer.create(RequestId.oneNew(), ClientSessionId("A", "B"), queue, highPriorityQueue, orderPrices, ViewPortRange(0, 20), columns) + val viewport = viewPortContainer.create(RequestId.oneNew(), ClientSessionId("A", "B"), queue, orderPrices, ViewPortRange(0, 20), columns) viewPortContainer.runOnce() @@ -189,15 +187,15 @@ class FilterAndSortTest extends AnyFeatureSpec with Matchers with ViewPortSetup assertVpEq(updates){ Table( - ("orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ), - ("NYC-0001","chris" ,"VOD.L" ,1437732000000l,100 ,220.0 ,222.0 ,null ,null ,null ), - ("NYC-0002","chris" ,"VOD.L" ,1437732000000l,200 ,220.0 ,222.0 ,null ,null ,null ), - ("NYC-0003","chris" ,"VOD.L" ,1437732000000l,300 ,220.0 ,222.0 ,null ,null ,null ), - ("NYC-0004","chris" ,"VOD.L" ,1437732000000l,400 ,220.0 ,222.0 ,null ,null ,null ), - ("NYC-0005","chris" ,"VOD.L" ,1437732000000l,500 ,220.0 ,222.0 ,null ,null ,null ), - ("NYC-0006","chris" ,"VOD.L" ,1437732000000l,600 ,220.0 ,222.0 ,null ,null ,null ), - ("NYC-0007","chris" ,"BT.L" ,1437732000000l,1000 ,500.0 ,501.0 ,null ,null ,null ), - ("NYC-0008","chris" ,"BT.L" ,1437732000000l,500 ,500.0 ,501.0 ,null ,null ,null ) + ("orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close"), + ("NYC-0001", "chris", "VOD.L", 1437732000000L, 100, 220.0, 222.0, null, null, null), + ("NYC-0002", "chris", "VOD.L", 1437732000000L, 200, 220.0, 222.0, null, null, null), + ("NYC-0003", "chris", "VOD.L", 1437732000000L, 300, 220.0, 222.0, null, null, null), + ("NYC-0004", "chris", "VOD.L", 1437732000000L, 400, 220.0, 222.0, null, null, null), + ("NYC-0005", "chris", "VOD.L", 1437732000000L, 500, 220.0, 222.0, null, null, null), + ("NYC-0006", "chris", "VOD.L", 1437732000000L, 600, 220.0, 222.0, null, null, null), + ("NYC-0007", "chris", "BT.L", 1437732000000L, 1000, 500.0, 501.0, null, null, null), + ("NYC-0008", "chris", "BT.L", 1437732000000L, 500, 500.0, 501.0, null, null, null) ) } @@ -210,13 +208,13 @@ class FilterAndSortTest extends AnyFeatureSpec with Matchers with ViewPortSetup assertVpEq(updates2){ Table( - ("orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ), - ("NYC-0001","chris" ,"VOD.L" ,1437732000000l,100 ,221.0 ,224.0 ,null ,226.0 ,null ), - ("NYC-0002","chris" ,"VOD.L" ,1437732000000l,200 ,221.0 ,224.0 ,null ,226.0 ,null ), - ("NYC-0003","chris" ,"VOD.L" ,1437732000000l,300 ,221.0 ,224.0 ,null ,226.0 ,null ), - ("NYC-0004","chris" ,"VOD.L" ,1437732000000l,400 ,221.0 ,224.0 ,null ,226.0 ,null ), - ("NYC-0005","chris" ,"VOD.L" ,1437732000000l,500 ,221.0 ,224.0 ,null ,226.0 ,null ), - ("NYC-0006","chris" ,"VOD.L" ,1437732000000l,600 ,221.0 ,224.0 ,null ,226.0 ,null ) + ("orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close"), + ("NYC-0001", "chris", "VOD.L", 1437732000000L, 100, 221.0, 224.0, null, 226.0, null), + ("NYC-0002", "chris", "VOD.L", 1437732000000L, 200, 221.0, 224.0, null, 226.0, null), + ("NYC-0003", "chris", "VOD.L", 1437732000000L, 300, 221.0, 224.0, null, 226.0, null), + ("NYC-0004", "chris", "VOD.L", 1437732000000L, 400, 221.0, 224.0, null, 226.0, null), + ("NYC-0005", "chris", "VOD.L", 1437732000000L, 500, 221.0, 224.0, null, 226.0, null), + ("NYC-0006", "chris", "VOD.L", 1437732000000L, 600, 221.0, 224.0, null, 226.0, null) ) } @@ -294,13 +292,13 @@ class FilterAndSortTest extends AnyFeatureSpec with Matchers with ViewPortSetup assertVpEq(updates5){ Table( - ("orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ), - ("NYC-0008","chris" ,"BT.L" ,1437732000000l,500 ,500.0 ,501.0 ,null ,null ,null ), - ("NYC-0006","chris" ,"VOD.L" ,1437732000000l,600 ,221.0 ,226.0 ,null ,226.0 ,null ), - ("NYC-0005","chris" ,"VOD.L" ,1437732000000l,500 ,221.0 ,226.0 ,null ,226.0 ,null ), - ("NYC-0003","chris" ,"VOD.L" ,1437732000000l,300 ,221.0 ,226.0 ,null ,226.0 ,null ), - ("NYC-0002","chris" ,"VOD.L" ,1437732000000l,200 ,221.0 ,226.0 ,null ,226.0 ,null ), - ("NYC-0001","chris" ,"VOD.L" ,1437732000000l,100 ,221.0 ,226.0 ,null ,226.0 ,null ) + ("orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close"), + ("NYC-0001", "chris", "VOD.L", 1437732000000L, 100, 221.0, 226.0, null, 226.0, null), + ("NYC-0002", "chris", "VOD.L", 1437732000000L, 200, 221.0, 226.0, null, 226.0, null), + ("NYC-0003", "chris", "VOD.L", 1437732000000L, 300, 221.0, 226.0, null, 226.0, null), + ("NYC-0005", "chris", "VOD.L", 1437732000000L, 500, 221.0, 226.0, null, 226.0, null), + ("NYC-0006", "chris", "VOD.L", 1437732000000L, 600, 221.0, 226.0, null, 226.0, null), + ("NYC-0008", "chris", "BT.L", 1437732000000L, 500, 500.0, 501.0, null, null, null) ) } @@ -338,13 +336,12 @@ class FilterAndSortTest extends AnyFeatureSpec with Matchers with ViewPortSetup // val viewPortContainer = new ViewPortContainer(groupByContainer, tableContainer) val queue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val columns = ViewPortColumnCreator.create(orderPrices, orderPrices.getTableDef.columns.map(_.name).toList ++ List("orderIdTrader:String:=concatenate(orderId, trader)")) //val columns = orderPrices.getTableDef.columns - val viewport = viewPortContainer.create(RequestId.oneNew(), ClientSessionId("A", "B"), queue, highPriorityQueue, orderPrices, ViewPortRange(0, 20), columns) + val viewport = viewPortContainer.create(RequestId.oneNew(), ClientSessionId("A", "B"), queue, orderPrices, ViewPortRange(0, 20), columns) viewPortContainer.runOnce() @@ -433,14 +430,14 @@ class FilterAndSortTest extends AnyFeatureSpec with Matchers with ViewPortSetup assertVpEq(updates4) { Table( - ("orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ,"orderIdTrader"), - ("NYC-0008","chris" ,"BT.L" ,1437732000000L,500 ,500.0 ,501.0 ,null ,null ,null ,"NYC-0008chris"), - ("NYC-0006","chris" ,"VOD.L" ,1437732000000L,600 ,221.0 ,226.0 ,null ,226.0 ,null ,"NYC-0006chris"), - ("NYC-0005","chris" ,"VOD.L" ,1437732000000L,500 ,221.0 ,226.0 ,null ,226.0 ,null ,"NYC-0005chris"), - ("NYC-0004","chris" ,"VOD.L" ,1437732000000L,400 ,221.0 ,226.0 ,null ,226.0 ,null ,"NYC-0004chris"), - ("NYC-0003","chris" ,"VOD.L" ,1437732000000L,300 ,221.0 ,226.0 ,null ,226.0 ,null ,"NYC-0003chris"), - ("NYC-0002","chris" ,"VOD.L" ,1437732000000L,200 ,221.0 ,226.0 ,null ,226.0 ,null ,"NYC-0002chris"), - ("NYC-0001","chris" ,"VOD.L" ,1437732000000L,100 ,221.0 ,226.0 ,null ,226.0 ,null ,"NYC-0001chris") + ("orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close", "orderIdTrader"), + ("NYC-0001", "chris", "VOD.L", 1437732000000L, 100, 221.0, 226.0, null, 226.0, null, "NYC-0001chris"), + ("NYC-0002", "chris", "VOD.L", 1437732000000L, 200, 221.0, 226.0, null, 226.0, null, "NYC-0002chris"), + ("NYC-0003", "chris", "VOD.L", 1437732000000L, 300, 221.0, 226.0, null, 226.0, null, "NYC-0003chris"), + ("NYC-0004", "chris", "VOD.L", 1437732000000L, 400, 221.0, 226.0, null, 226.0, null, "NYC-0004chris"), + ("NYC-0005", "chris", "VOD.L", 1437732000000L, 500, 221.0, 226.0, null, 226.0, null, "NYC-0005chris"), + ("NYC-0006", "chris", "VOD.L", 1437732000000L, 600, 221.0, 226.0, null, 226.0, null, "NYC-0006chris"), + ("NYC-0008", "chris", "BT.L", 1437732000000L, 500, 500.0, 501.0, null, null, null, "NYC-0008chris") ) } diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/OnlySendDiffRowsViewPortTest.scala b/vuu/src/test/scala/org/finos/vuu/viewport/OnlySendDiffRowsViewPortTest.scala index 2e63f7ceda..76c8cf2c48 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/OnlySendDiffRowsViewPortTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/OnlySendDiffRowsViewPortTest.scala @@ -18,13 +18,13 @@ class OnlySendDiffRowsViewPortTest extends AbstractViewPortTestCase with Matcher Scenario("Change viewport from 0-20 to 10-30 and check we only get 10 rows"){ - val (viewPortContainer, orders, ordersProvider, session, outQueue, highPriorityQueue) = createDefaultViewPortInfra() + val (viewPortContainer, orders, ordersProvider, session, outQueue) = createDefaultViewPortInfra() val vpcolumns = ViewPortColumnCreator.create(orders, List("orderId", "trader", "tradeTime", "quantity", "ric"))//.map(orders.getTableDef.columnForName(_)).toList createNOrderRows(ordersProvider, 10)(timeProvider) - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, orders, ViewPortRange(0, 4), vpcolumns) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, orders, ViewPortRange(0, 4), vpcolumns) viewPortContainer.runOnce() @@ -42,7 +42,7 @@ class OnlySendDiffRowsViewPortTest extends AbstractViewPortTestCase with Matcher ) } - val viewPortv2 = viewPortContainer.changeRange(session, highPriorityQueue, viewPort.id, ViewPortRange(2, 6)) + val viewPortv2 = viewPortContainer.changeRange(session, outQueue, viewPort.id, ViewPortRange(2, 6)) viewPortContainer.runOnce() diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/TreeAndAggregate2Test.scala b/vuu/src/test/scala/org/finos/vuu/viewport/TreeAndAggregate2Test.scala index 34b25e2249..b7d5542fb2 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/TreeAndAggregate2Test.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/TreeAndAggregate2Test.scala @@ -36,13 +36,12 @@ class TreeAndAggregate2Test extends AnyFeatureSpec with Matchers with GivenWhenT joinProvider.runOnce() val queue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val columns = ViewPortColumnCreator.create(orderPrices, orderPrices.getTableDef.columns.map(_.name).toList) val viewport = viewPortContainer.create(RequestId.oneNew(), ClientSessionId("A", "B"), - queue, highPriorityQueue, orderPrices, ViewPortRange(0, 20), columns, + queue, orderPrices, ViewPortRange(0, 20), columns, SortSpec(List()), FilterSpec(""), GroupBy(orderPrices, columns.getColumnForName("trader").get, columns.getColumnForName("ric").get) @@ -86,17 +85,17 @@ class TreeAndAggregate2Test extends AnyFeatureSpec with Matchers with GivenWhenT assertVpEq(filterByVpId(combineQs(viewport), viewport)) { Table( - ("_isOpen" ,"_depth" ,"_treeKey","_isLeaf" ,"_childCount","_caption","orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ), - (true ,2 ,"$root|chris|VOD.L",false ,5 ,"VOD.L" ,"" ,1 ,"VOD.L" ,"" ,1500.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,3 ,"$root|chris|VOD.L|NYC-0001",true ,0 ,"NYC-0001","NYC-0001","chris" ,"VOD.L" ,1311544800000L,100 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|chris|VOD.L|NYC-0002",true ,0 ,"NYC-0002","NYC-0002","chris" ,"VOD.L" ,1311544800000L,200 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|chris|VOD.L|NYC-0003",true ,0 ,"NYC-0003","NYC-0003","chris" ,"VOD.L" ,1311544800000L,300 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|chris|VOD.L|NYC-0004",true ,0 ,"NYC-0004","NYC-0004","chris" ,"VOD.L" ,1311544800000L,400 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|chris|VOD.L|NYC-0005",true ,0 ,"NYC-0005","NYC-0005","chris" ,"VOD.L" ,1311544800000L,500 ,220.0 ,222.0 ,null ,null ,null ), - (true ,1 ,"$root|steve",false ,2 ,"steve" ,"" ,1 ,"" ,"" ,2100.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,2 ,"$root|steve|VOD.L",false ,1 ,"VOD.L" ,"" ,1 ,"VOD.L" ,"" ,600.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,2 ,"$root|steve|BT.L",false ,2 ,"BT.L" ,"" ,1 ,"BT.L" ,"" ,1500.0 ,"" ,"" ,"" ,"" ,"" ), - (true ,1 ,"$root|chris",false ,1 ,"chris" ,"" ,1 ,"" ,"" ,1500.0 ,"" ,"" ,"" ,"" ,"" ) + ("_isOpen", "_depth", "_treeKey", "_isLeaf", "_childCount", "_caption", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close"), + (true, 1, "$root|chris", false, 1, "chris", "", 1, "", "", 1500.0, "", "", "", "", ""), + (true, 2, "$root|chris|VOD.L", false, 5, "VOD.L", "", 1, "VOD.L", "", 1500.0, "", "", "", "", ""), + (false, 3, "$root|chris|VOD.L|NYC-0001", true, 0, "NYC-0001", "NYC-0001", "chris", "VOD.L", 1311544800000L, 100, 220.0, 222.0, null, null, null), + (false, 3, "$root|chris|VOD.L|NYC-0002", true, 0, "NYC-0002", "NYC-0002", "chris", "VOD.L", 1311544800000L, 200, 220.0, 222.0, null, null, null), + (false, 3, "$root|chris|VOD.L|NYC-0003", true, 0, "NYC-0003", "NYC-0003", "chris", "VOD.L", 1311544800000L, 300, 220.0, 222.0, null, null, null), + (false, 3, "$root|chris|VOD.L|NYC-0004", true, 0, "NYC-0004", "NYC-0004", "chris", "VOD.L", 1311544800000L, 400, 220.0, 222.0, null, null, null), + (false, 3, "$root|chris|VOD.L|NYC-0005", true, 0, "NYC-0005", "NYC-0005", "chris", "VOD.L", 1311544800000L, 500, 220.0, 222.0, null, null, null), + (true, 1, "$root|steve", false, 2, "steve", "", 1, "", "", 2100.0, "", "", "", "", ""), + (false, 2, "$root|steve|BT.L", false, 2, "BT.L", "", 1, "BT.L", "", 1500.0, "", "", "", "", ""), + (false, 2, "$root|steve|VOD.L", false, 1, "VOD.L", "", 1, "VOD.L", "", 600.0, "", "", "", "", "") ) } @@ -112,12 +111,12 @@ class TreeAndAggregate2Test extends AnyFeatureSpec with Matchers with GivenWhenT assertVpEq(updates) { Table( - ("_isOpen" ,"_depth" ,"_treeKey","_isLeaf" ,"_childCount","_caption","orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ), - (false ,2 ,"$root|chris|BT.L",false ,1 ,"BT.L" ,"" ,1 ,"BT.L" ,"" ,700.0 ,"" ,"" ,"" ,"" ,"" ), - (true ,1 ,"$root|steve",false ,2 ,"steve" ,"" ,1 ,"" ,"" ,1600.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,2 ,"$root|steve|VOD.L",false ,1 ,"VOD.L" ,"" ,1 ,"VOD.L" ,"" ,600.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,2 ,"$root|steve|BT.L",false ,1 ,"BT.L" ,"" ,1 ,"BT.L" ,"" ,1000.0 ,"" ,"" ,"" ,"" ,"" ), - (true ,1 ,"$root|chris",false ,2 ,"chris" ,"" ,1 ,"" ,"" ,2200.0 ,"" ,"" ,"" ,"" ,"" ) + ("_isOpen", "_depth", "_treeKey", "_isLeaf", "_childCount", "_caption", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close"), + (true, 1, "$root|chris", false, 2, "chris", "", 1, "", "", 2200.0, "", "", "", "", ""), + (false, 2, "$root|chris|BT.L", false, 1, "BT.L", "", 1, "BT.L", "", 700.0, "", "", "", "", ""), + (true, 1, "$root|steve", false, 2, "steve", "", 1, "", "", 1600.0, "", "", "", "", ""), + (false, 2, "$root|steve|BT.L", false, 1, "BT.L", "", 1, "BT.L", "", 1000.0, "", "", "", "", ""), + (false, 2, "$root|steve|VOD.L", false, 1, "VOD.L", "", 1, "VOD.L", "", 600.0, "", "", "", "", "") ) } @@ -141,19 +140,19 @@ class TreeAndAggregate2Test extends AnyFeatureSpec with Matchers with GivenWhenT assertVpEq(updates2) { Table( - ("_isOpen" ,"_depth" ,"_treeKey","_isLeaf" ,"_childCount","_caption","orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ), - (true ,1 ,"$root|steve",false ,2 ,"steve" ,"" ,1 ,"" ,"" ,2600.0 ,"" ,"" ,"" ,"" ,"" ), - (true ,2 ,"$root|steve|VOD.L",false ,5 ,"VOD.L" ,"" ,1 ,"VOD.L" ,"" ,1600.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,3 ,"$root|steve|VOD.L|NYC-0001",true ,0 ,"NYC-0001","NYC-0001","steve" ,"VOD.L" ,1311544800000L,100 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|steve|VOD.L|NYC-0002",true ,0 ,"NYC-0002","NYC-0002","steve" ,"VOD.L" ,1311544800000L,200 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|steve|VOD.L|NYC-0003",true ,0 ,"NYC-0003","NYC-0003","steve" ,"VOD.L" ,1311544800000L,300 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|steve|VOD.L|NYC-0004",true ,0 ,"NYC-0004","NYC-0004","steve" ,"VOD.L" ,1311544800000L,400 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|steve|VOD.L|NYC-0006",true ,0 ,"NYC-0006","NYC-0006","steve" ,"VOD.L" ,1311544800000L,600 ,220.0 ,222.0 ,null ,null ,null ), - (false ,2 ,"$root|steve|BT.L",false ,1 ,"BT.L" ,"" ,1 ,"BT.L" ,"" ,1000.0 ,"" ,"" ,"" ,"" ,"" ), - (true ,1 ,"$root|chris",false ,2 ,"chris" ,"" ,1 ,"" ,"" ,1200.0 ,"" ,"" ,"" ,"" ,"" ), - (true ,2 ,"$root|chris|VOD.L",false ,1 ,"VOD.L" ,"" ,1 ,"VOD.L" ,"" ,500.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,3 ,"$root|chris|VOD.L|NYC-0005",true ,0 ,"NYC-0005","NYC-0005","chris" ,"VOD.L" ,1311544800000L,500 ,220.0 ,222.0 ,null ,null ,null ), - (false ,2 ,"$root|chris|BT.L",false ,1 ,"BT.L" ,"" ,1 ,"BT.L" ,"" ,700.0 ,"" ,"" ,"" ,"" ,"" ) + ("_isOpen", "_depth", "_treeKey", "_isLeaf", "_childCount", "_caption", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close"), + (true, 1, "$root|chris", false, 2, "chris", "", 1, "", "", 1200.0, "", "", "", "", ""), + (false, 2, "$root|chris|BT.L", false, 1, "BT.L", "", 1, "BT.L", "", 700.0, "", "", "", "", ""), + (true, 2, "$root|chris|VOD.L", false, 1, "VOD.L", "", 1, "VOD.L", "", 500.0, "", "", "", "", ""), + (false, 3, "$root|chris|VOD.L|NYC-0005", true, 0, "NYC-0005", "NYC-0005", "chris", "VOD.L", 1311544800000L, 500, 220.0, 222.0, null, null, null), + (true, 1, "$root|steve", false, 2, "steve", "", 1, "", "", 2600.0, "", "", "", "", ""), + (false, 2, "$root|steve|BT.L", false, 1, "BT.L", "", 1, "BT.L", "", 1000.0, "", "", "", "", ""), + (true, 2, "$root|steve|VOD.L", false, 5, "VOD.L", "", 1, "VOD.L", "", 1600.0, "", "", "", "", ""), + (false, 3, "$root|steve|VOD.L|NYC-0001", true, 0, "NYC-0001", "NYC-0001", "steve", "VOD.L", 1311544800000L, 100, 220.0, 222.0, null, null, null), + (false, 3, "$root|steve|VOD.L|NYC-0002", true, 0, "NYC-0002", "NYC-0002", "steve", "VOD.L", 1311544800000L, 200, 220.0, 222.0, null, null, null), + (false, 3, "$root|steve|VOD.L|NYC-0003", true, 0, "NYC-0003", "NYC-0003", "steve", "VOD.L", 1311544800000L, 300, 220.0, 222.0, null, null, null), + (false, 3, "$root|steve|VOD.L|NYC-0004", true, 0, "NYC-0004", "NYC-0004", "steve", "VOD.L", 1311544800000L, 400, 220.0, 222.0, null, null, null), + (false, 3, "$root|steve|VOD.L|NYC-0006", true, 0, "NYC-0006", "NYC-0006", "steve", "VOD.L", 1311544800000L, 600, 220.0, 222.0, null, null, null) ) } @@ -174,13 +173,12 @@ class TreeAndAggregate2Test extends AnyFeatureSpec with Matchers with GivenWhenT joinProvider.runOnce() val queue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val columns = ViewPortColumnCreator.create(orderPrices, orderPrices.getTableDef.columns.map(_.name).toList) val viewport = viewPortContainer.create(RequestId.oneNew(), ClientSessionId("A", "B"), - queue, highPriorityQueue, orderPrices, ViewPortRange(0, 20), columns, + queue, orderPrices, ViewPortRange(0, 20), columns, SortSpec(List()), FilterSpec(""), GroupBy(orderPrices, columns.getColumnForName("trader").get, columns.getColumnForName("ric").get) @@ -210,16 +208,16 @@ class TreeAndAggregate2Test extends AnyFeatureSpec with Matchers with GivenWhenT assertVpEq(updates) { Table( - ("_isOpen" ,"_depth" ,"_treeKey","_isLeaf" ,"_childCount","_caption","orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ), - (true ,1 ,"$root|chris",false ,2 ,"chris" ,"" ,1 ,"" ,"" ,2200.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,1 ,"$root|steve",false ,2 ,"steve" ,"" ,1 ,"" ,"" ,1600.0 ,"" ,"" ,"" ,"" ,"" ), - (true ,2 ,"$root|chris|VOD.L",false ,5 ,"VOD.L" ,"" ,1 ,"VOD.L" ,"" ,1500.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,3 ,"$root|chris|VOD.L|NYC-0001",true ,0 ,"NYC-0001","NYC-0001","chris" ,"VOD.L" ,1311544800000L,100 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|chris|VOD.L|NYC-0002",true ,0 ,"NYC-0002","NYC-0002","chris" ,"VOD.L" ,1311544800000L,200 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|chris|VOD.L|NYC-0003",true ,0 ,"NYC-0003","NYC-0003","chris" ,"VOD.L" ,1311544800000L,300 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|chris|VOD.L|NYC-0004",true ,0 ,"NYC-0004","NYC-0004","chris" ,"VOD.L" ,1311544800000L,400 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|chris|VOD.L|NYC-0005",true ,0 ,"NYC-0005","NYC-0005","chris" ,"VOD.L" ,1311544800000L,500 ,220.0 ,222.0 ,null ,null ,null ), - (false ,2 ,"$root|chris|BT.L",false ,1 ,"BT.L" ,"" ,1 ,"BT.L" ,"" ,700.0 ,"" ,"" ,"" ,"" ,"" ) + ("_isOpen", "_depth", "_treeKey", "_isLeaf", "_childCount", "_caption", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close"), + (true, 1, "$root|chris", false, 2, "chris", "", 1, "", "", 2200.0, "", "", "", "", ""), + (false, 2, "$root|chris|BT.L", false, 1, "BT.L", "", 1, "BT.L", "", 700.0, "", "", "", "", ""), + (true, 2, "$root|chris|VOD.L", false, 5, "VOD.L", "", 1, "VOD.L", "", 1500.0, "", "", "", "", ""), + (false, 3, "$root|chris|VOD.L|NYC-0001", true, 0, "NYC-0001", "NYC-0001", "chris", "VOD.L", 1311544800000L, 100, 220.0, 222.0, null, null, null), + (false, 3, "$root|chris|VOD.L|NYC-0002", true, 0, "NYC-0002", "NYC-0002", "chris", "VOD.L", 1311544800000L, 200, 220.0, 222.0, null, null, null), + (false, 3, "$root|chris|VOD.L|NYC-0003", true, 0, "NYC-0003", "NYC-0003", "chris", "VOD.L", 1311544800000L, 300, 220.0, 222.0, null, null, null), + (false, 3, "$root|chris|VOD.L|NYC-0004", true, 0, "NYC-0004", "NYC-0004", "chris", "VOD.L", 1311544800000L, 400, 220.0, 222.0, null, null, null), + (false, 3, "$root|chris|VOD.L|NYC-0005", true, 0, "NYC-0005", "NYC-0005", "chris", "VOD.L", 1311544800000L, 500, 220.0, 222.0, null, null, null), + (false, 1, "$root|steve", false, 2, "steve", "", 1, "", "", 1600.0, "", "", "", "", "") ) } @@ -241,13 +239,12 @@ class TreeAndAggregate2Test extends AnyFeatureSpec with Matchers with GivenWhenT joinProvider.runOnce() val queue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val columns = ViewPortColumnCreator.create(orderPrices, orderPrices.getTableDef.columns.map(_.name).toList ++ List("traderRic:String:=concatenate(trader, ric)")) val viewport = viewPortContainer.create(RequestId.oneNew(), ClientSessionId("A", "B"), - queue, highPriorityQueue, orderPrices, ViewPortRange(0, 20), columns, + queue, orderPrices, ViewPortRange(0, 20), columns, SortSpec(List()), FilterSpec(""), GroupBy(orderPrices, columns.getColumnForName("trader").get, columns.getColumnForName("ric").get) @@ -274,17 +271,17 @@ class TreeAndAggregate2Test extends AnyFeatureSpec with Matchers with GivenWhenT assertVpEq(updates) { Table( - ("_isOpen" ,"_depth" ,"_treeKey","_isLeaf" ,"_childCount","_caption","orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ,"traderRic"), - (true ,1 ,"$root|chris",false ,2 ,"chris" ,"" ,1 ,"" ,"" ,2200.0 ,"" ,"" ,"" ,"" ,"" ,"" ), - (false ,1 ,"$root|steve",false ,2 ,"steve" ,"" ,1 ,"" ,"" ,1600.0 ,"" ,"" ,"" ,"" ,"" ,"" ), - (true ,2 ,"$root|chris|VOD.L",false ,5 ,"VOD.L" ,"" ,1 ,"VOD.L" ,"" ,1500.0 ,"" ,"" ,"" ,"" ,"" ,"" ), - (false ,3 ,"$root|chris|VOD.L|NYC-0001",true ,0 ,"NYC-0001","NYC-0001","chris" ,"VOD.L" ,1311544800000L,100 ,220.0 ,222.0 ,null ,null ,null ,"chrisVOD.L"), - (false ,3 ,"$root|chris|VOD.L|NYC-0002",true ,0 ,"NYC-0002","NYC-0002","chris" ,"VOD.L" ,1311544800000L,200 ,220.0 ,222.0 ,null ,null ,null ,"chrisVOD.L"), - (false ,3 ,"$root|chris|VOD.L|NYC-0003",true ,0 ,"NYC-0003","NYC-0003","chris" ,"VOD.L" ,1311544800000L,300 ,220.0 ,222.0 ,null ,null ,null ,"chrisVOD.L"), - (false ,3 ,"$root|chris|VOD.L|NYC-0004",true ,0 ,"NYC-0004","NYC-0004","chris" ,"VOD.L" ,1311544800000L,400 ,220.0 ,222.0 ,null ,null ,null ,"chrisVOD.L"), - (false ,3 ,"$root|chris|VOD.L|NYC-0005",true ,0 ,"NYC-0005","NYC-0005","chris" ,"VOD.L" ,1311544800000L,500 ,220.0 ,222.0 ,null ,null ,null ,"chrisVOD.L"), - (true ,2 ,"$root|chris|BT.L",false ,1 ,"BT.L" ,"" ,1 ,"BT.L" ,"" ,700.0 ,"" ,"" ,"" ,"" ,"" ,"" ), - (false ,3 ,"$root|chris|BT.L|NYC-0008",true ,0 ,"NYC-0008","NYC-0008","chris" ,"BT.L" ,1437732000000L,700 ,500.0 ,501.0 ,null ,null ,null ,"chrisBT.L") + ("_isOpen", "_depth", "_treeKey", "_isLeaf", "_childCount", "_caption", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close", "traderRic"), + (true, 1, "$root|chris", false, 2, "chris", "", 1, "", "", 2200.0, "", "", "", "", "", ""), + (true, 2, "$root|chris|BT.L", false, 1, "BT.L", "", 1, "BT.L", "", 700.0, "", "", "", "", "", ""), + (false, 3, "$root|chris|BT.L|NYC-0008", true, 0, "NYC-0008", "NYC-0008", "chris", "BT.L", 1437732000000L, 700, 500.0, 501.0, null, null, null, "chrisBT.L"), + (true, 2, "$root|chris|VOD.L", false, 5, "VOD.L", "", 1, "VOD.L", "", 1500.0, "", "", "", "", "", ""), + (false, 3, "$root|chris|VOD.L|NYC-0001", true, 0, "NYC-0001", "NYC-0001", "chris", "VOD.L", 1311544800000L, 100, 220.0, 222.0, null, null, null, "chrisVOD.L"), + (false, 3, "$root|chris|VOD.L|NYC-0002", true, 0, "NYC-0002", "NYC-0002", "chris", "VOD.L", 1311544800000L, 200, 220.0, 222.0, null, null, null, "chrisVOD.L"), + (false, 3, "$root|chris|VOD.L|NYC-0003", true, 0, "NYC-0003", "NYC-0003", "chris", "VOD.L", 1311544800000L, 300, 220.0, 222.0, null, null, null, "chrisVOD.L"), + (false, 3, "$root|chris|VOD.L|NYC-0004", true, 0, "NYC-0004", "NYC-0004", "chris", "VOD.L", 1311544800000L, 400, 220.0, 222.0, null, null, null, "chrisVOD.L"), + (false, 3, "$root|chris|VOD.L|NYC-0005", true, 0, "NYC-0005", "NYC-0005", "chris", "VOD.L", 1311544800000L, 500, 220.0, 222.0, null, null, null, "chrisVOD.L"), + (false, 1, "$root|steve", false, 2, "steve", "", 1, "", "", 1600.0, "", "", "", "", "", "") ) } } @@ -304,13 +301,12 @@ class TreeAndAggregate2Test extends AnyFeatureSpec with Matchers with GivenWhenT joinProvider.runOnce() val queue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val columns = ViewPortColumnCreator.create(orderPrices, orderPrices.getTableDef.columns.map(_.name).toList ++ List("traderRic:String:=concatenate(trader, ric)")) val viewport = viewPortContainer.create(RequestId.oneNew(), ClientSessionId("A", "B"), - queue, highPriorityQueue, orderPrices, ViewPortRange(0, 20), columns, + queue, orderPrices, ViewPortRange(0, 20), columns, SortSpec(List()), FilterSpec(""), GroupBy(orderPrices, columns.getColumnForName("traderRic").get) @@ -335,16 +331,16 @@ class TreeAndAggregate2Test extends AnyFeatureSpec with Matchers with GivenWhenT assertVpEq(updates) { Table( ("_isOpen", "_depth", "_treeKey", "_isLeaf", "_childCount", "_caption", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close", "traderRic"), + (false, 1, "$root|chrisBT.L", false, 1, "chrisBT.L", "", 1, "", "", 700.0, "", "", "", "", "", "chrisBT.L"), (true, 1, "$root|chrisVOD.L", false, 5, "chrisVOD.L", "", 1, "", "", 1500.0, "", "", "", "", "", "chrisVOD.L"), - (false, 1, "$root|steveVOD.L", false, 1, "steveVOD.L", "", 1, "", "", 600.0, "", "", "", "", "", "steveVOD.L"), - (true, 1, "$root|steveBT.L", false, 1, "steveBT.L", "", 1, "", "", 1000.0, "", "", "", "", "", "steveBT.L"), (false, 2, "$root|chrisVOD.L|NYC-0001", true, 0, "NYC-0001", "NYC-0001", "chris", "VOD.L", 1311544800000L, 100, 220.0, 222.0, null, null, null, "chrisVOD.L"), (false, 2, "$root|chrisVOD.L|NYC-0002", true, 0, "NYC-0002", "NYC-0002", "chris", "VOD.L", 1311544800000L, 200, 220.0, 222.0, null, null, null, "chrisVOD.L"), (false, 2, "$root|chrisVOD.L|NYC-0003", true, 0, "NYC-0003", "NYC-0003", "chris", "VOD.L", 1311544800000L, 300, 220.0, 222.0, null, null, null, "chrisVOD.L"), (false, 2, "$root|chrisVOD.L|NYC-0004", true, 0, "NYC-0004", "NYC-0004", "chris", "VOD.L", 1311544800000L, 400, 220.0, 222.0, null, null, null, "chrisVOD.L"), (false, 2, "$root|chrisVOD.L|NYC-0005", true, 0, "NYC-0005", "NYC-0005", "chris", "VOD.L", 1311544800000L, 500, 220.0, 222.0, null, null, null, "chrisVOD.L"), + (true, 1, "$root|steveBT.L", false, 1, "steveBT.L", "", 1, "", "", 1000.0, "", "", "", "", "", "steveBT.L"), (false, 2, "$root|steveBT.L|NYC-0007", true, 0, "NYC-0007", "NYC-0007", "steve", "BT.L", 1311544800000L, 1000, 500.0, 501.0, null, null, null, "steveBT.L"), - (false, 1, "$root|chrisBT.L", false, 1, "chrisBT.L", "", 1, "", "", 700.0, "", "", "", "", "", "chrisBT.L") + (false, 1, "$root|steveVOD.L", false, 1, "steveVOD.L", "", 1, "", "", 600.0, "", "", "", "", "", "steveVOD.L") ) } } @@ -364,13 +360,12 @@ class TreeAndAggregate2Test extends AnyFeatureSpec with Matchers with GivenWhenT joinProvider.runOnce() val queue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val columns = ViewPortColumnCreator.create(orderPrices, orderPrices.getTableDef.columns.map(_.name).toList ++ List("traderRic:String:=concatenate(trader, ric)")) val viewport = viewPortContainer.create(RequestId.oneNew(), ClientSessionId("A", "B"), - queue, highPriorityQueue, orderPrices, ViewPortRange(0, 20), columns, + queue, orderPrices, ViewPortRange(0, 20), columns, SortSpec(List()), FilterSpec(""), GroupBy(orderPrices, columns.getColumnForName("traderRic").get) @@ -393,17 +388,17 @@ class TreeAndAggregate2Test extends AnyFeatureSpec with Matchers with GivenWhenT assertVpEq(updates) { Table( - ("_isOpen" ,"_depth" ,"_treeKey","_isLeaf" ,"_childCount","_caption","orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ,"traderRic"), - (true ,1 ,"$root|chrisVOD.L",false ,5 ,"chrisVOD.L","" ,"chris" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"chrisVOD.L"), - (false ,1 ,"$root|steveVOD.L",false ,1 ,"steveVOD.L","" ,"steve" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"steveVOD.L"), - (true ,1 ,"$root|steveBT.L",false ,1 ,"steveBT.L","" ,"steve" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"steveBT.L"), - (false ,2 ,"$root|chrisVOD.L|NYC-0001",true ,0 ,"NYC-0001","NYC-0001","chris" ,"VOD.L" ,1311544800000L,100 ,220.0 ,222.0 ,null ,null ,null ,"chrisVOD.L"), - (false ,2 ,"$root|chrisVOD.L|NYC-0002",true ,0 ,"NYC-0002","NYC-0002","chris" ,"VOD.L" ,1311544800000L,200 ,220.0 ,222.0 ,null ,null ,null ,"chrisVOD.L"), - (false ,2 ,"$root|chrisVOD.L|NYC-0003",true ,0 ,"NYC-0003","NYC-0003","chris" ,"VOD.L" ,1311544800000L,300 ,220.0 ,222.0 ,null ,null ,null ,"chrisVOD.L"), - (false ,2 ,"$root|chrisVOD.L|NYC-0004",true ,0 ,"NYC-0004","NYC-0004","chris" ,"VOD.L" ,1311544800000L,400 ,220.0 ,222.0 ,null ,null ,null ,"chrisVOD.L"), - (false ,2 ,"$root|chrisVOD.L|NYC-0005",true ,0 ,"NYC-0005","NYC-0005","chris" ,"VOD.L" ,1311544800000L,500 ,220.0 ,222.0 ,null ,null ,null ,"chrisVOD.L"), - (false ,2 ,"$root|steveBT.L|NYC-0007",true ,0 ,"NYC-0007","NYC-0007","steve" ,"BT.L" ,1311544800000L,1000 ,500.0 ,501.0 ,null ,null ,null ,"steveBT.L"), - (false ,1 ,"$root|chrisBT.L",false ,1 ,"chrisBT.L","" ,"chris" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"chrisBT.L") + ("_isOpen", "_depth", "_treeKey", "_isLeaf", "_childCount", "_caption", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close", "traderRic"), + (false, 1, "$root|chrisBT.L", false, 1, "chrisBT.L", "", "chris", "", "", "", "", "", "", "", "", "chrisBT.L"), + (true, 1, "$root|chrisVOD.L", false, 5, "chrisVOD.L", "", "chris", "", "", "", "", "", "", "", "", "chrisVOD.L"), + (false, 2, "$root|chrisVOD.L|NYC-0001", true, 0, "NYC-0001", "NYC-0001", "chris", "VOD.L", 1311544800000L, 100, 220.0, 222.0, null, null, null, "chrisVOD.L"), + (false, 2, "$root|chrisVOD.L|NYC-0002", true, 0, "NYC-0002", "NYC-0002", "chris", "VOD.L", 1311544800000L, 200, 220.0, 222.0, null, null, null, "chrisVOD.L"), + (false, 2, "$root|chrisVOD.L|NYC-0003", true, 0, "NYC-0003", "NYC-0003", "chris", "VOD.L", 1311544800000L, 300, 220.0, 222.0, null, null, null, "chrisVOD.L"), + (false, 2, "$root|chrisVOD.L|NYC-0004", true, 0, "NYC-0004", "NYC-0004", "chris", "VOD.L", 1311544800000L, 400, 220.0, 222.0, null, null, null, "chrisVOD.L"), + (false, 2, "$root|chrisVOD.L|NYC-0005", true, 0, "NYC-0005", "NYC-0005", "chris", "VOD.L", 1311544800000L, 500, 220.0, 222.0, null, null, null, "chrisVOD.L"), + (true, 1, "$root|steveBT.L", false, 1, "steveBT.L", "", "steve", "", "", "", "", "", "", "", "", "steveBT.L"), + (false, 2, "$root|steveBT.L|NYC-0007", true, 0, "NYC-0007", "NYC-0007", "steve", "BT.L", 1311544800000L, 1000, 500.0, 501.0, null, null, null, "steveBT.L"), + (false, 1, "$root|steveVOD.L", false, 1, "steveVOD.L", "", "steve", "", "", "", "", "", "", "", "", "steveVOD.L") ) } } @@ -423,13 +418,12 @@ class TreeAndAggregate2Test extends AnyFeatureSpec with Matchers with GivenWhenT joinProvider.runOnce() val queue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val columns = ViewPortColumnCreator.create(orderPrices, orderPrices.getTableDef.columns.map(_.name).toList ++ List("traderRic:String:=concatenate(trader, ric)")) val viewport = viewPortContainer.create(RequestId.oneNew(), ClientSessionId("A", "B"), - queue, highPriorityQueue, orderPrices, ViewPortRange(0, 20), columns, + queue, orderPrices, ViewPortRange(0, 20), columns, SortSpec(List()), FilterSpec(""), GroupBy(orderPrices, columns.getColumnForName("traderRic").get) @@ -452,17 +446,17 @@ class TreeAndAggregate2Test extends AnyFeatureSpec with Matchers with GivenWhenT assertVpEq(updates) { Table( - ("_isOpen" ,"_depth" ,"_treeKey","_isLeaf" ,"_childCount","_caption","orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ,"traderRic"), - (true ,1 ,"$root|chrisVOD.L",false ,5 ,"chrisVOD.L","NYC-0005,NYC-0004,NYC-0003,NYC-0002,NYC-0001","" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"chrisVOD.L"), - (false ,1 ,"$root|steveVOD.L",false ,1 ,"steveVOD.L","NYC-0006","" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"steveVOD.L"), - (true ,1 ,"$root|steveBT.L",false ,1 ,"steveBT.L","NYC-0007","" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"steveBT.L"), - (false ,2 ,"$root|chrisVOD.L|NYC-0001",true ,0 ,"NYC-0001","NYC-0001","chris" ,"VOD.L" ,1311544800000L,100 ,220.0 ,222.0 ,null ,null ,null ,"chrisVOD.L"), - (false ,2 ,"$root|chrisVOD.L|NYC-0002",true ,0 ,"NYC-0002","NYC-0002","chris" ,"VOD.L" ,1311544800000L,200 ,220.0 ,222.0 ,null ,null ,null ,"chrisVOD.L"), - (false ,2 ,"$root|chrisVOD.L|NYC-0003",true ,0 ,"NYC-0003","NYC-0003","chris" ,"VOD.L" ,1311544800000L,300 ,220.0 ,222.0 ,null ,null ,null ,"chrisVOD.L"), - (false ,2 ,"$root|chrisVOD.L|NYC-0004",true ,0 ,"NYC-0004","NYC-0004","chris" ,"VOD.L" ,1311544800000L,400 ,220.0 ,222.0 ,null ,null ,null ,"chrisVOD.L"), - (false ,2 ,"$root|chrisVOD.L|NYC-0005",true ,0 ,"NYC-0005","NYC-0005","chris" ,"VOD.L" ,1311544800000L,500 ,220.0 ,222.0 ,null ,null ,null ,"chrisVOD.L"), - (false ,2 ,"$root|steveBT.L|NYC-0007",true ,0 ,"NYC-0007","NYC-0007","steve" ,"BT.L" ,1311544800000L,1000 ,500.0 ,501.0 ,null ,null ,null ,"steveBT.L"), - (false ,1 ,"$root|chrisBT.L",false ,1 ,"chrisBT.L","NYC-0008","" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"" ,"chrisBT.L") + ("_isOpen", "_depth", "_treeKey", "_isLeaf", "_childCount", "_caption", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close", "traderRic"), + (false, 1, "$root|chrisBT.L", false, 1, "chrisBT.L", "NYC-0008", "", "", "", "", "", "", "", "", "", "chrisBT.L"), + (true, 1, "$root|chrisVOD.L", false, 5, "chrisVOD.L", "NYC-0005,NYC-0004,NYC-0003,NYC-0002,NYC-0001", "", "", "", "", "", "", "", "", "", "chrisVOD.L"), + (false, 2, "$root|chrisVOD.L|NYC-0001", true, 0, "NYC-0001", "NYC-0001", "chris", "VOD.L", 1311544800000L, 100, 220.0, 222.0, null, null, null, "chrisVOD.L"), + (false, 2, "$root|chrisVOD.L|NYC-0002", true, 0, "NYC-0002", "NYC-0002", "chris", "VOD.L", 1311544800000L, 200, 220.0, 222.0, null, null, null, "chrisVOD.L"), + (false, 2, "$root|chrisVOD.L|NYC-0003", true, 0, "NYC-0003", "NYC-0003", "chris", "VOD.L", 1311544800000L, 300, 220.0, 222.0, null, null, null, "chrisVOD.L"), + (false, 2, "$root|chrisVOD.L|NYC-0004", true, 0, "NYC-0004", "NYC-0004", "chris", "VOD.L", 1311544800000L, 400, 220.0, 222.0, null, null, null, "chrisVOD.L"), + (false, 2, "$root|chrisVOD.L|NYC-0005", true, 0, "NYC-0005", "NYC-0005", "chris", "VOD.L", 1311544800000L, 500, 220.0, 222.0, null, null, null, "chrisVOD.L"), + (true, 1, "$root|steveBT.L", false, 1, "steveBT.L", "NYC-0007", "", "", "", "", "", "", "", "", "", "steveBT.L"), + (false, 2, "$root|steveBT.L|NYC-0007", true, 0, "NYC-0007", "NYC-0007", "steve", "BT.L", 1311544800000L, 1000, 500.0, 501.0, null, null, null, "steveBT.L"), + (false, 1, "$root|steveVOD.L", false, 1, "steveVOD.L", "NYC-0006", "", "", "", "", "", "", "", "", "", "steveVOD.L") ) } } diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/TreeAndAggregateTest.scala b/vuu/src/test/scala/org/finos/vuu/viewport/TreeAndAggregateTest.scala index 677aea333c..a47d66e563 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/TreeAndAggregateTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/TreeAndAggregateTest.scala @@ -1,13 +1,13 @@ package org.finos.vuu.viewport +import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} +import org.finos.toolbox.lifecycle.LifecycleContainer +import org.finos.toolbox.time.{Clock, DefaultClock} import org.finos.vuu.client.messages.RequestId import org.finos.vuu.core.table.{RowWithData, ViewPortColumnCreator} import org.finos.vuu.net.{ClientSessionId, FilterSpec, SortSpec} import org.finos.vuu.util.OutboundRowPublishQueue import org.finos.vuu.util.table.TableAsserts._ -import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} -import org.finos.toolbox.lifecycle.LifecycleContainer -import org.finos.toolbox.time.{Clock, DefaultClock} import org.joda.time.{DateTime, DateTimeZone} import org.scalatest.GivenWhenThen import org.scalatest.featurespec.AnyFeatureSpec @@ -33,13 +33,12 @@ class TreeAndAggregateTest extends AnyFeatureSpec with Matchers with GivenWhenTh joinProvider.runOnce() val queue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val columns = ViewPortColumnCreator.create(orderPrices, orderPrices.getTableDef.columns.map(_.name).toList) val viewport = viewPortContainer.create(RequestId.oneNew(), ClientSessionId("A", "B"), - queue, highPriorityQueue, orderPrices, ViewPortRange(0, 20), columns, + queue, orderPrices, ViewPortRange(0, 20), columns, SortSpec(List()), FilterSpec(""), GroupBy(orderPrices, columns.getColumnForName("trader").get, columns.getColumnForName("ric").get) @@ -71,19 +70,19 @@ class TreeAndAggregateTest extends AnyFeatureSpec with Matchers with GivenWhenTh assertVpEq(filterByVpId(combineQs(viewport), viewport)) { Table( - ("_isOpen" ,"_depth" ,"_treeKey","_isLeaf" ,"_childCount","_caption","orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ), - (true ,2 ,"$root|chris|VOD.L",false ,5 ,"VOD.L" ,"" ,1 ,"VOD.L" ,"" ,1500.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,3 ,"$root|chris|VOD.L|NYC-0001",true ,0 ,"NYC-0001","NYC-0001","chris" ,"VOD.L" ,1311544800000L,100 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|chris|VOD.L|NYC-0002",true ,0 ,"NYC-0002","NYC-0002","chris" ,"VOD.L" ,1311544800000L,200 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|chris|VOD.L|NYC-0003",true ,0 ,"NYC-0003","NYC-0003","chris" ,"VOD.L" ,1311544800000L,300 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|chris|VOD.L|NYC-0004",true ,0 ,"NYC-0004","NYC-0004","chris" ,"VOD.L" ,1311544800000L,400 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|chris|VOD.L|NYC-0005",true ,0 ,"NYC-0005","NYC-0005","chris" ,"VOD.L" ,1311544800000L,500 ,220.0 ,222.0 ,null ,null ,null ), - (true ,1 ,"$root|steve",false ,2 ,"steve" ,"" ,1 ,"" ,"" ,2100.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,2 ,"$root|steve|VOD.L",false ,1 ,"VOD.L" ,"" ,1 ,"VOD.L" ,"" ,600.0 ,"" ,"" ,"" ,"" ,"" ), - (true ,2 ,"$root|steve|BT.L",false ,2 ,"BT.L" ,"" ,1 ,"BT.L" ,"" ,1500.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,3 ,"$root|steve|BT.L|NYC-0007",true ,0 ,"NYC-0007","NYC-0007","steve" ,"BT.L" ,1311544800000L,1000 ,500.0 ,501.0 ,null ,null ,null ), - (false ,3 ,"$root|steve|BT.L|NYC-0008",true ,0 ,"NYC-0008","NYC-0008","steve" ,"BT.L" ,1311544800000L,500 ,500.0 ,501.0 ,null ,null ,null ), - (true ,1 ,"$root|chris",false ,1 ,"chris" ,"" ,1 ,"" ,"" ,1500.0 ,"" ,"" ,"" ,"" ,"" ) + ("_isOpen", "_depth", "_treeKey", "_isLeaf", "_childCount", "_caption", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close"), + (true, 1, "$root|chris", false, 1, "chris", "", 1, "", "", 1500.0, "", "", "", "", ""), + (true, 2, "$root|chris|VOD.L", false, 5, "VOD.L", "", 1, "VOD.L", "", 1500.0, "", "", "", "", ""), + (false, 3, "$root|chris|VOD.L|NYC-0001", true, 0, "NYC-0001", "NYC-0001", "chris", "VOD.L", 1311544800000L, 100, 220.0, 222.0, null, null, null), + (false, 3, "$root|chris|VOD.L|NYC-0002", true, 0, "NYC-0002", "NYC-0002", "chris", "VOD.L", 1311544800000L, 200, 220.0, 222.0, null, null, null), + (false, 3, "$root|chris|VOD.L|NYC-0003", true, 0, "NYC-0003", "NYC-0003", "chris", "VOD.L", 1311544800000L, 300, 220.0, 222.0, null, null, null), + (false, 3, "$root|chris|VOD.L|NYC-0004", true, 0, "NYC-0004", "NYC-0004", "chris", "VOD.L", 1311544800000L, 400, 220.0, 222.0, null, null, null), + (false, 3, "$root|chris|VOD.L|NYC-0005", true, 0, "NYC-0005", "NYC-0005", "chris", "VOD.L", 1311544800000L, 500, 220.0, 222.0, null, null, null), + (true, 1, "$root|steve", false, 2, "steve", "", 1, "", "", 2100.0, "", "", "", "", ""), + (true, 2, "$root|steve|BT.L", false, 2, "BT.L", "", 1, "BT.L", "", 1500.0, "", "", "", "", ""), + (false, 3, "$root|steve|BT.L|NYC-0007", true, 0, "NYC-0007", "NYC-0007", "steve", "BT.L", 1311544800000L, 1000, 500.0, 501.0, null, null, null), + (false, 3, "$root|steve|BT.L|NYC-0008", true, 0, "NYC-0008", "NYC-0008", "steve", "BT.L", 1311544800000L, 500, 500.0, 501.0, null, null, null), + (false, 2, "$root|steve|VOD.L", false, 1, "VOD.L", "", 1, "VOD.L", "", 600.0, "", "", "", "", "") ) } @@ -134,12 +133,12 @@ class TreeAndAggregateTest extends AnyFeatureSpec with Matchers with GivenWhenTh assertVpEq(updates3) { Table( - ("_isOpen" ,"_depth" ,"_treeKey","_isLeaf" ,"_childCount","_caption","orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ), - (false ,2 ,"$root|steve|VOD.L",false ,1 ,"VOD.L" ,"" ,1 ,"VOD.L" ,"" ,600.0 ,"" ,"" ,"" ,"" ,"" ), - (true ,2 ,"$root|steve|BT.L",false ,2 ,"BT.L" ,"" ,1 ,"BT.L" ,"" ,1500.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,3 ,"$root|steve|BT.L|NYC-0007",true ,0 ,"NYC-0007","NYC-0007","steve" ,"BT.L" ,1311544800000L,1000 ,500.0 ,501.0 ,null ,null ,null ), - (false ,3 ,"$root|steve|BT.L|NYC-0008",true ,0 ,"NYC-0008","NYC-0008","steve" ,"BT.L" ,1311544800000L,500 ,500.0 ,501.0 ,null ,null ,null ), - (true ,1 ,"$root|steve",false ,2 ,"steve" ,"" ,1 ,"" ,"" ,2100.0 ,"" ,"" ,"" ,"" ,"" ) + ("_isOpen", "_depth", "_treeKey", "_isLeaf", "_childCount", "_caption", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close"), + (true, 1, "$root|steve", false, 2, "steve", "", 1, "", "", 2100.0, "", "", "", "", ""), + (true, 2, "$root|steve|BT.L", false, 2, "BT.L", "", 1, "BT.L", "", 1500.0, "", "", "", "", ""), + (false, 3, "$root|steve|BT.L|NYC-0007", true, 0, "NYC-0007", "NYC-0007", "steve", "BT.L", 1311544800000L, 1000, 500.0, 501.0, null, null, null), + (false, 3, "$root|steve|BT.L|NYC-0008", true, 0, "NYC-0008", "NYC-0008", "steve", "BT.L", 1311544800000L, 500, 500.0, 501.0, null, null, null), + (false, 2, "$root|steve|VOD.L", false, 1, "VOD.L", "", 1, "VOD.L", "", 600.0, "", "", "", "", "") ) } @@ -151,11 +150,11 @@ class TreeAndAggregateTest extends AnyFeatureSpec with Matchers with GivenWhenTh assertVpEq(updates4) { Table( - ("_isOpen" ,"_depth" ,"_treeKey","_isLeaf" ,"_childCount","_caption","orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ), - (false ,3 ,"$root|steve|BT.L|NYC-0007",true ,0 ,"NYC-0007","NYC-0007","steve" ,"BT.L" ,1311544800000L,1000 ,510.0 ,511.0 ,null ,null ,null ), - (false ,3 ,"$root|steve|BT.L|NYC-0008",true ,0 ,"NYC-0008","NYC-0008","steve" ,"BT.L" ,1311544800000L,500 ,510.0 ,511.0 ,null ,null ,null ), - (true ,2 ,"$root|steve|BT.L",false ,2 ,"BT.L" ,"" ,1 ,"BT.L" ,"" ,1500.0 ,"" ,"" ,"" ,"" ,"" ), - (true ,1 ,"$root|steve",false ,2 ,"steve" ,"" ,1 ,"" ,"" ,2100.0 ,"" ,"" ,"" ,"" ,"" ) + ("_isOpen", "_depth", "_treeKey", "_isLeaf", "_childCount", "_caption", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close"), + (true, 1, "$root|steve", false, 2, "steve", "", 1, "", "", 2100.0, "", "", "", "", ""), + (true, 2, "$root|steve|BT.L", false, 2, "BT.L", "", 1, "BT.L", "", 1500.0, "", "", "", "", ""), + (false, 3, "$root|steve|BT.L|NYC-0007", true, 0, "NYC-0007", "NYC-0007", "steve", "BT.L", 1311544800000L, 1000, 510.0, 511.0, null, null, null), + (false, 3, "$root|steve|BT.L|NYC-0008", true, 0, "NYC-0008", "NYC-0008", "steve", "BT.L", 1311544800000L, 500, 510.0, 511.0, null, null, null) ) } @@ -177,13 +176,12 @@ class TreeAndAggregateTest extends AnyFeatureSpec with Matchers with GivenWhenTh joinProvider.runOnce() val queue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val columns = ViewPortColumnCreator.create(orderPrices, orderPrices.getTableDef.columns.map(_.name).toList) val viewport = viewPortContainer.create(RequestId.oneNew(), ClientSessionId("A", "B"), - queue, highPriorityQueue, orderPrices, ViewPortRange(0, 20), columns, + queue, orderPrices, ViewPortRange(0, 20), columns, SortSpec(List()), FilterSpec(""), GroupBy(orderPrices, columns.getColumnForName("trader").get, columns.getColumnForName("ric").get) @@ -222,19 +220,19 @@ class TreeAndAggregateTest extends AnyFeatureSpec with Matchers with GivenWhenTh assertVpEq(updates) { Table( - ("_isOpen" ,"_depth" ,"_treeKey","_isLeaf" ,"_childCount","_caption","orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ), - (true ,2 ,"$root|chris|VOD.L",false ,5 ,"VOD.L" ,"" ,1 ,"VOD.L" ,"" ,1500.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,3 ,"$root|chris|VOD.L|NYC-0001",true ,0 ,"NYC-0001","NYC-0001","chris" ,"VOD.L" ,1311544800000L,100 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|chris|VOD.L|NYC-0002",true ,0 ,"NYC-0002","NYC-0002","chris" ,"VOD.L" ,1311544800000L,200 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|chris|VOD.L|NYC-0003",true ,0 ,"NYC-0003","NYC-0003","chris" ,"VOD.L" ,1311544800000L,300 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|chris|VOD.L|NYC-0004",true ,0 ,"NYC-0004","NYC-0004","chris" ,"VOD.L" ,1311544800000L,400 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|chris|VOD.L|NYC-0005",true ,0 ,"NYC-0005","NYC-0005","chris" ,"VOD.L" ,1311544800000L,500 ,220.0 ,222.0 ,null ,null ,null ), - (true ,1 ,"$root|steve",false ,2 ,"steve" ,"" ,1 ,"" ,"" ,2100.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,2 ,"$root|steve|VOD.L",false ,1 ,"VOD.L" ,"" ,1 ,"VOD.L" ,"" ,600.0 ,"" ,"" ,"" ,"" ,"" ), - (true ,2 ,"$root|steve|BT.L",false ,2 ,"BT.L" ,"" ,1 ,"BT.L" ,"" ,1500.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,3 ,"$root|steve|BT.L|NYC-0007",true ,0 ,"NYC-0007","NYC-0007","steve" ,"BT.L" ,1311544800000L,1000 ,500.0 ,501.0 ,null ,null ,null ), - (false ,3 ,"$root|steve|BT.L|NYC-0008",true ,0 ,"NYC-0008","NYC-0008","steve" ,"BT.L" ,1311544800000L,500 ,500.0 ,501.0 ,null ,null ,null ), - (true ,1 ,"$root|chris",false ,1 ,"chris" ,"" ,1 ,"" ,"" ,1500.0 ,"" ,"" ,"" ,"" ,"" ) + ("_isOpen", "_depth", "_treeKey", "_isLeaf", "_childCount", "_caption", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close"), + (true, 1, "$root|chris", false, 1, "chris", "", 1, "", "", 1500.0, "", "", "", "", ""), + (true, 2, "$root|chris|VOD.L", false, 5, "VOD.L", "", 1, "VOD.L", "", 1500.0, "", "", "", "", ""), + (false, 3, "$root|chris|VOD.L|NYC-0001", true, 0, "NYC-0001", "NYC-0001", "chris", "VOD.L", 1311544800000L, 100, 220.0, 222.0, null, null, null), + (false, 3, "$root|chris|VOD.L|NYC-0002", true, 0, "NYC-0002", "NYC-0002", "chris", "VOD.L", 1311544800000L, 200, 220.0, 222.0, null, null, null), + (false, 3, "$root|chris|VOD.L|NYC-0003", true, 0, "NYC-0003", "NYC-0003", "chris", "VOD.L", 1311544800000L, 300, 220.0, 222.0, null, null, null), + (false, 3, "$root|chris|VOD.L|NYC-0004", true, 0, "NYC-0004", "NYC-0004", "chris", "VOD.L", 1311544800000L, 400, 220.0, 222.0, null, null, null), + (false, 3, "$root|chris|VOD.L|NYC-0005", true, 0, "NYC-0005", "NYC-0005", "chris", "VOD.L", 1311544800000L, 500, 220.0, 222.0, null, null, null), + (true, 1, "$root|steve", false, 2, "steve", "", 1, "", "", 2100.0, "", "", "", "", ""), + (true, 2, "$root|steve|BT.L", false, 2, "BT.L", "", 1, "BT.L", "", 1500.0, "", "", "", "", ""), + (false, 3, "$root|steve|BT.L|NYC-0007", true, 0, "NYC-0007", "NYC-0007", "steve", "BT.L", 1311544800000L, 1000, 500.0, 501.0, null, null, null), + (false, 3, "$root|steve|BT.L|NYC-0008", true, 0, "NYC-0008", "NYC-0008", "steve", "BT.L", 1311544800000L, 500, 500.0, 501.0, null, null, null), + (false, 2, "$root|steve|VOD.L", false, 1, "VOD.L", "", 1, "VOD.L", "", 600.0, "", "", "", "", "") ) } diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/TreeOnOffTest.scala b/vuu/src/test/scala/org/finos/vuu/viewport/TreeOnOffTest.scala index b145bf52e2..b92cea4f0b 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/TreeOnOffTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/TreeOnOffTest.scala @@ -1,13 +1,13 @@ package org.finos.vuu.viewport -import org.finos.vuu.client.messages.RequestId -import org.finos.vuu.net.ClientSessionId -import org.finos.vuu.util.OutboundRowPublishQueue -import org.finos.vuu.util.table.TableAsserts.assertVpEq import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} import org.finos.toolbox.lifecycle.LifecycleContainer import org.finos.toolbox.time.{Clock, TestFriendlyClock} +import org.finos.vuu.client.messages.RequestId import org.finos.vuu.core.table.ViewPortColumnCreator +import org.finos.vuu.net.ClientSessionId +import org.finos.vuu.util.OutboundRowPublishQueue +import org.finos.vuu.util.table.TableAsserts.assertVpEq import org.scalatest.featurespec.AnyFeatureSpec import org.scalatest.matchers.should.Matchers import org.scalatest.prop.Tables.Table @@ -44,11 +44,10 @@ class TreeOnOffTest extends AnyFeatureSpec with Matchers with ViewPortSetup { joinProvider.runOnce() val queue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val session = ClientSessionId("A", "B") val columns = ViewPortColumnCreator.create(orderPrices, orderPrices.getTableDef.columns.map(_.name).toList) val range = ViewPortRange(0, 20) - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, queue, highPriorityQueue, orderPrices, range, columns) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, queue, orderPrices, range, columns) runContainersOnce(viewPortContainer, joinProvider) diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/TreeSortTest.scala b/vuu/src/test/scala/org/finos/vuu/viewport/TreeSortTest.scala index 92701369b3..ae6eafa7ba 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/TreeSortTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/TreeSortTest.scala @@ -1,13 +1,13 @@ package org.finos.vuu.viewport -import org.finos.vuu.client.messages.RequestId -import org.finos.vuu.net.{ClientSessionId, FilterSpec, SortDef, SortSpec} -import org.finos.vuu.util.OutboundRowPublishQueue -import org.finos.vuu.util.table.TableAsserts.assertVpEq import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} import org.finos.toolbox.lifecycle.LifecycleContainer import org.finos.toolbox.time.{Clock, DefaultClock} +import org.finos.vuu.client.messages.RequestId import org.finos.vuu.core.table.ViewPortColumnCreator +import org.finos.vuu.net.{ClientSessionId, FilterSpec, SortDef, SortSpec} +import org.finos.vuu.util.OutboundRowPublishQueue +import org.finos.vuu.util.table.TableAsserts.assertVpEq import org.joda.time.{DateTime, DateTimeZone} import org.scalatest.GivenWhenThen import org.scalatest.featurespec.AnyFeatureSpec @@ -33,7 +33,6 @@ class TreeSortTest extends AnyFeatureSpec with Matchers with GivenWhenThen with joinProvider.runOnce() val queue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val columns = orderPrices.getTableDef.columns @@ -41,7 +40,7 @@ class TreeSortTest extends AnyFeatureSpec with Matchers with GivenWhenThen with val viewport = viewPortContainer.create(RequestId.oneNew(), ClientSessionId("A", "B"), - queue, highPriorityQueue, orderPrices, ViewPortRange(0, 20), vpColumns, + queue, orderPrices, ViewPortRange(0, 20), vpColumns, SortSpec(List( SortDef("trader", 'A'), SortDef("ric", 'A') @@ -57,9 +56,9 @@ class TreeSortTest extends AnyFeatureSpec with Matchers with GivenWhenThen with assertVpEq(filterByVpId(combineQs(viewport), viewport)) { Table( - ("_isOpen" ,"_depth" ,"_treeKey","_isLeaf" ,"_childCount","_caption","orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ), - (false ,1 ,"$root|steve",false ,2 ,"steve" ,"" ,1 ,"" ,"" ,2100.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,1 ,"$root|chris",false ,1 ,"chris" ,"" ,1 ,"" ,"" ,1500.0 ,"" ,"" ,"" ,"" ,"" ) + ("_isOpen", "_depth", "_treeKey", "_isLeaf", "_childCount", "_caption", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close"), + (false, 1, "$root|chris", false, 1, "chris", "", 1, "", "", 1500.0, "", "", "", "", ""), + (false, 1, "$root|steve", false, 2, "steve", "", 1, "", "", 2100.0, "", "", "", "", "") ) } @@ -72,17 +71,17 @@ class TreeSortTest extends AnyFeatureSpec with Matchers with GivenWhenThen with assertVpEq(filterByVpId(combineQs(viewport), viewport)) { Table( - ("_isOpen" ,"_depth" ,"_treeKey","_isLeaf" ,"_childCount","_caption","orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ), - (false ,2 ,"$root|steve|VOD.L",false ,1 ,"VOD.L" ,"" ,1 ,"VOD.L" ,"" ,600.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,2 ,"$root|steve|BT.L",false ,2 ,"BT.L" ,"" ,1 ,"BT.L" ,"" ,1500.0 ,"" ,"" ,"" ,"" ,"" ), - (true ,1 ,"$root|chris",false ,1 ,"chris" ,"" ,1 ,"" ,"" ,1500.0 ,"" ,"" ,"" ,"" ,"" ), - (true ,2 ,"$root|chris|VOD.L",false ,5 ,"VOD.L" ,"" ,1 ,"VOD.L" ,"" ,1500.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,3 ,"$root|chris|VOD.L|NYC-0001",true ,0 ,"NYC-0001","NYC-0001","chris" ,"VOD.L" ,1311544800000L,100 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|chris|VOD.L|NYC-0002",true ,0 ,"NYC-0002","NYC-0002","chris" ,"VOD.L" ,1311544800000L,200 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|chris|VOD.L|NYC-0003",true ,0 ,"NYC-0003","NYC-0003","chris" ,"VOD.L" ,1311544800000L,300 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|chris|VOD.L|NYC-0004",true ,0 ,"NYC-0004","NYC-0004","chris" ,"VOD.L" ,1311544800000L,400 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|chris|VOD.L|NYC-0005",true ,0 ,"NYC-0005","NYC-0005","chris" ,"VOD.L" ,1311544800000L,500 ,220.0 ,222.0 ,null ,null ,null ), - (true ,1 ,"$root|steve",false ,2 ,"steve" ,"" ,1 ,"" ,"" ,2100.0 ,"" ,"" ,"" ,"" ,"" ) + ("_isOpen", "_depth", "_treeKey", "_isLeaf", "_childCount", "_caption", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close"), + (true, 1, "$root|chris", false, 1, "chris", "", 1, "", "", 1500.0, "", "", "", "", ""), + (true, 2, "$root|chris|VOD.L", false, 5, "VOD.L", "", 1, "VOD.L", "", 1500.0, "", "", "", "", ""), + (false, 3, "$root|chris|VOD.L|NYC-0001", true, 0, "NYC-0001", "NYC-0001", "chris", "VOD.L", 1311544800000L, 100, 220.0, 222.0, null, null, null), + (false, 3, "$root|chris|VOD.L|NYC-0002", true, 0, "NYC-0002", "NYC-0002", "chris", "VOD.L", 1311544800000L, 200, 220.0, 222.0, null, null, null), + (false, 3, "$root|chris|VOD.L|NYC-0003", true, 0, "NYC-0003", "NYC-0003", "chris", "VOD.L", 1311544800000L, 300, 220.0, 222.0, null, null, null), + (false, 3, "$root|chris|VOD.L|NYC-0004", true, 0, "NYC-0004", "NYC-0004", "chris", "VOD.L", 1311544800000L, 400, 220.0, 222.0, null, null, null), + (false, 3, "$root|chris|VOD.L|NYC-0005", true, 0, "NYC-0005", "NYC-0005", "chris", "VOD.L", 1311544800000L, 500, 220.0, 222.0, null, null, null), + (true, 1, "$root|steve", false, 2, "steve", "", 1, "", "", 2100.0, "", "", "", "", ""), + (false, 2, "$root|steve|BT.L", false, 2, "BT.L", "", 1, "BT.L", "", 1500.0, "", "", "", "", ""), + (false, 2, "$root|steve|VOD.L", false, 1, "VOD.L", "", 1, "VOD.L", "", 600.0, "", "", "", "", "") ) } @@ -98,11 +97,11 @@ class TreeSortTest extends AnyFeatureSpec with Matchers with GivenWhenThen with assertVpEq(updates) { Table( - ("_isOpen" ,"_depth" ,"_treeKey","_isLeaf" ,"_childCount","_caption","orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ), - (false ,2 ,"$root|chris|BT.L",false ,1 ,"BT.L" ,"" ,1 ,"BT.L" ,"" ,700.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,2 ,"$root|steve|BT.L",false ,1 ,"BT.L" ,"" ,1 ,"BT.L" ,"" ,1000.0 ,"" ,"" ,"" ,"" ,"" ), - (true ,1 ,"$root|steve",false ,2 ,"steve" ,"" ,1 ,"" ,"" ,1600.0 ,"" ,"" ,"" ,"" ,"" ), - (true ,1 ,"$root|chris",false ,2 ,"chris" ,"" ,1 ,"" ,"" ,2200.0 ,"" ,"" ,"" ,"" ,"" ) + ("_isOpen", "_depth", "_treeKey", "_isLeaf", "_childCount", "_caption", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close"), + (true, 1, "$root|chris", false, 2, "chris", "", 1, "", "", 2200.0, "", "", "", "", ""), + (false, 2, "$root|chris|BT.L", false, 1, "BT.L", "", 1, "BT.L", "", 700.0, "", "", "", "", ""), + (true, 1, "$root|steve", false, 2, "steve", "", 1, "", "", 1600.0, "", "", "", "", ""), + (false, 2, "$root|steve|BT.L", false, 1, "BT.L", "", 1, "BT.L", "", 1000.0, "", "", "", "", "") ) } @@ -126,19 +125,19 @@ class TreeSortTest extends AnyFeatureSpec with Matchers with GivenWhenThen with assertVpEq(updates2) { Table( - ("_isOpen" ,"_depth" ,"_treeKey","_isLeaf" ,"_childCount","_caption","orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ), - (false ,3 ,"$root|steve|VOD.L|NYC-0001",true ,0 ,"NYC-0001","NYC-0001","steve" ,"VOD.L" ,1311544800000L,100 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|steve|VOD.L|NYC-0002",true ,0 ,"NYC-0002","NYC-0002","steve" ,"VOD.L" ,1311544800000L,200 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|steve|VOD.L|NYC-0003",true ,0 ,"NYC-0003","NYC-0003","steve" ,"VOD.L" ,1311544800000L,300 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|steve|VOD.L|NYC-0004",true ,0 ,"NYC-0004","NYC-0004","steve" ,"VOD.L" ,1311544800000L,400 ,220.0 ,222.0 ,null ,null ,null ), - (false ,3 ,"$root|steve|VOD.L|NYC-0006",true ,0 ,"NYC-0006","NYC-0006","steve" ,"VOD.L" ,1311544800000L,600 ,220.0 ,222.0 ,null ,null ,null ), - (false ,2 ,"$root|steve|BT.L",false ,1 ,"BT.L" ,"" ,1 ,"BT.L" ,"" ,1000.0 ,"" ,"" ,"" ,"" ,"" ), - (true ,1 ,"$root|chris",false ,2 ,"chris" ,"" ,1 ,"" ,"" ,1200.0 ,"" ,"" ,"" ,"" ,"" ), - (true ,2 ,"$root|chris|VOD.L",false ,1 ,"VOD.L" ,"" ,1 ,"VOD.L" ,"" ,500.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,3 ,"$root|chris|VOD.L|NYC-0005",true ,0 ,"NYC-0005","NYC-0005","chris" ,"VOD.L" ,1311544800000L,500 ,220.0 ,222.0 ,null ,null ,null ), - (false ,2 ,"$root|chris|BT.L",false ,1 ,"BT.L" ,"" ,1 ,"BT.L" ,"" ,700.0 ,"" ,"" ,"" ,"" ,"" ), - (true ,2 ,"$root|steve|VOD.L",false ,5 ,"VOD.L" ,"" ,1 ,"VOD.L" ,"" ,1600.0 ,"" ,"" ,"" ,"" ,"" ), - (true ,1 ,"$root|steve",false ,2 ,"steve" ,"" ,1 ,"" ,"" ,2600.0 ,"" ,"" ,"" ,"" ,"" ) + ("_isOpen", "_depth", "_treeKey", "_isLeaf", "_childCount", "_caption", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close"), + (true, 1, "$root|chris", false, 2, "chris", "", 1, "", "", 1200.0, "", "", "", "", ""), + (false, 2, "$root|chris|BT.L", false, 1, "BT.L", "", 1, "BT.L", "", 700.0, "", "", "", "", ""), + (true, 2, "$root|chris|VOD.L", false, 1, "VOD.L", "", 1, "VOD.L", "", 500.0, "", "", "", "", ""), + (false, 3, "$root|chris|VOD.L|NYC-0005", true, 0, "NYC-0005", "NYC-0005", "chris", "VOD.L", 1311544800000L, 500, 220.0, 222.0, null, null, null), + (true, 1, "$root|steve", false, 2, "steve", "", 1, "", "", 2600.0, "", "", "", "", ""), + (false, 2, "$root|steve|BT.L", false, 1, "BT.L", "", 1, "BT.L", "", 1000.0, "", "", "", "", ""), + (true, 2, "$root|steve|VOD.L", false, 5, "VOD.L", "", 1, "VOD.L", "", 1600.0, "", "", "", "", ""), + (false, 3, "$root|steve|VOD.L|NYC-0001", true, 0, "NYC-0001", "NYC-0001", "steve", "VOD.L", 1311544800000L, 100, 220.0, 222.0, null, null, null), + (false, 3, "$root|steve|VOD.L|NYC-0002", true, 0, "NYC-0002", "NYC-0002", "steve", "VOD.L", 1311544800000L, 200, 220.0, 222.0, null, null, null), + (false, 3, "$root|steve|VOD.L|NYC-0003", true, 0, "NYC-0003", "NYC-0003", "steve", "VOD.L", 1311544800000L, 300, 220.0, 222.0, null, null, null), + (false, 3, "$root|steve|VOD.L|NYC-0004", true, 0, "NYC-0004", "NYC-0004", "steve", "VOD.L", 1311544800000L, 400, 220.0, 222.0, null, null, null), + (false, 3, "$root|steve|VOD.L|NYC-0006", true, 0, "NYC-0006", "NYC-0006", "steve", "VOD.L", 1311544800000L, 600, 220.0, 222.0, null, null, null) ) } diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/TreeUpdateChildCountsTest.scala b/vuu/src/test/scala/org/finos/vuu/viewport/TreeUpdateChildCountsTest.scala index d580953f2f..8c052c6d40 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/TreeUpdateChildCountsTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/TreeUpdateChildCountsTest.scala @@ -1,14 +1,14 @@ package org.finos.vuu.viewport +import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} +import org.finos.toolbox.lifecycle.LifecycleContainer +import org.finos.toolbox.time.{Clock, DefaultClock} import org.finos.vuu.client.messages.RequestId +import org.finos.vuu.core.table.ViewPortColumnCreator import org.finos.vuu.net.{ClientSessionId, FilterSpec, SortSpec} import org.finos.vuu.util.OutboundRowPublishQueue import org.finos.vuu.util.table.TableAsserts.assertVpEq import org.finos.vuu.viewport.TestTimeStamp.EPOCH_DEFAULT -import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} -import org.finos.toolbox.lifecycle.LifecycleContainer -import org.finos.toolbox.time.{Clock, DefaultClock} -import org.finos.vuu.core.table.ViewPortColumnCreator import org.joda.time.{DateTime, DateTimeZone} import org.scalatest.GivenWhenThen import org.scalatest.featurespec.AnyFeatureSpec @@ -34,7 +34,6 @@ class TreeUpdateChildCountsTest extends AnyFeatureSpec with Matchers with GivenW joinProvider.runOnce() val queue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val columns = orderPrices.getTableDef.columns @@ -42,11 +41,10 @@ class TreeUpdateChildCountsTest extends AnyFeatureSpec with Matchers with GivenW val viewport = viewPortContainer.create(RequestId.oneNew(), ClientSessionId("A", "B"), - queue, highPriorityQueue, orderPrices, ViewPortRange(0, 20), vpColumns, + queue, orderPrices, ViewPortRange(0, 20), vpColumns, SortSpec(List()), FilterSpec(""), - - GroupBy(orderPrices, vpColumns.getColumnForName( "ric").get) + GroupBy(orderPrices, vpColumns.getColumnForName("ric").get) .withCount("ric") .asClause() ) @@ -55,9 +53,9 @@ class TreeUpdateChildCountsTest extends AnyFeatureSpec with Matchers with GivenW assertVpEq(filterByVpId(combineQs(viewport), viewport)) { Table( - ("_isOpen" ,"_depth" ,"_treeKey","_isLeaf" ,"_childCount","_caption","orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ), - (false ,1 ,"$root|VOD.L",false ,6 ,"VOD.L" ,"" ,"" ,1 ,"" ,"" ,"" ,"" ,"" ,"" ,"" ), - (false ,1 ,"$root|BT.L",false ,2 ,"BT.L" ,"" ,"" ,1 ,"" ,"" ,"" ,"" ,"" ,"" ,"" ) + ("_isOpen", "_depth", "_treeKey", "_isLeaf", "_childCount", "_caption", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close"), + (false, 1, "$root|BT.L", false, 2, "BT.L", "", "", 1, "", "", "", "", "", "", ""), + (false, 1, "$root|VOD.L", false, 6, "VOD.L", "", "", 1, "", "", "", "", "", "", "") ) } @@ -92,7 +90,6 @@ class TreeUpdateChildCountsTest extends AnyFeatureSpec with Matchers with GivenW joinProvider.runOnce() val queue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val columns = orderPrices.getTableDef.columns @@ -100,10 +97,10 @@ class TreeUpdateChildCountsTest extends AnyFeatureSpec with Matchers with GivenW val viewport = viewPortContainer.create(RequestId.oneNew(), ClientSessionId("A", "B"), - queue, highPriorityQueue, orderPrices, ViewPortRange(0, 20), vpColumns, + queue, orderPrices, ViewPortRange(0, 20), vpColumns, SortSpec(List()), FilterSpec(""), - GroupBy(orderPrices, vpColumns.getColumnForName( "ric").get) + GroupBy(orderPrices, vpColumns.getColumnForName("ric").get) .withCount("ric") .withSum("quantity") .asClause() @@ -113,9 +110,9 @@ class TreeUpdateChildCountsTest extends AnyFeatureSpec with Matchers with GivenW assertVpEq(filterByVpId(combineQs(viewport), viewport)) { Table( - ("_isOpen" ,"_depth" ,"_treeKey","_isLeaf" ,"_childCount","_caption","orderId" ,"trader" ,"ric" ,"tradeTime","quantity","bid" ,"ask" ,"last" ,"open" ,"close" ), - (false ,1 ,"$root|VOD.L",false ,6 ,"VOD.L" ,"" ,"" ,1 ,"" ,2100.0 ,"" ,"" ,"" ,"" ,"" ), - (false ,1 ,"$root|BT.L",false ,2 ,"BT.L" ,"" ,"" ,1 ,"" ,1500.0 ,"" ,"" ,"" ,"" ,"" ) + ("_isOpen", "_depth", "_treeKey", "_isLeaf", "_childCount", "_caption", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open", "close"), + (false, 1, "$root|BT.L", false, 2, "BT.L", "", "", 1, "", 1500.0, "", "", "", "", ""), + (false, 1, "$root|VOD.L", false, 6, "VOD.L", "", "", 1, "", 2100.0, "", "", "", "", "") ) } diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/UpdateSelectionViewPortTest.scala b/vuu/src/test/scala/org/finos/vuu/viewport/UpdateSelectionViewPortTest.scala index c3b66e7f3f..00e1340269 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/UpdateSelectionViewPortTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/UpdateSelectionViewPortTest.scala @@ -16,13 +16,13 @@ class UpdateSelectionViewPortTest extends AbstractViewPortTestCase with Matchers Scenario("create viewport, update selection, see selection come back") { Given("we've created a viewport with orders in") - val (viewPortContainer, orders, ordersProvider, session, outQueue, highPriorityQueue) = createDefaultViewPortInfra() + val (viewPortContainer, orders, ordersProvider, session, outQueue) = createDefaultViewPortInfra() val vpcolumns = ViewPortColumnCreator.create(orders, List("orderId", "trader", "tradeTime", "quantity", "ric")) createNOrderRows(ordersProvider, 10)(timeProvider) - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, orders, ViewPortRange(0, 10), vpcolumns) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, orders, ViewPortRange(0, 10), vpcolumns) viewPortContainer.runOnce() @@ -45,7 +45,7 @@ class UpdateSelectionViewPortTest extends AbstractViewPortTestCase with Matchers } And("we select some rows in the grid") - viewPortContainer.changeSelection(session, highPriorityQueue, viewPort.id, ViewPortSelectedIndices(Array(0, 2))) + viewPortContainer.changeSelection(session, outQueue, viewPort.id, ViewPortSelectedIndices(Array(0, 2))) Then("Check the selected rows is updated") assertVpEqWithMeta(combineQs(viewPort)) { @@ -56,13 +56,13 @@ class UpdateSelectionViewPortTest extends AbstractViewPortTestCase with Matchers ) } - viewPortContainer.changeSelection(session, highPriorityQueue, viewPort.id, ViewPortSelectedIndices(Array(2))) + viewPortContainer.changeSelection(session, outQueue, viewPort.id, ViewPortSelectedIndices(Array(2))) assertVpEqWithMeta(combineQs(viewPort)) { Table( - ("sel","orderId" ,"trader" ,"ric" ,"tradeTime","quantity"), - (1 ,"NYC-0002","chris" ,"VOD.L" ,1311544820L,102 ), - (0 ,"NYC-0000","chris" ,"VOD.L" ,1311544800L,100 ) + ("sel", "orderId", "trader", "ric", "tradeTime", "quantity"), + (0, "NYC-0000", "chris", "VOD.L", 1311544800L, 100), + (1, "NYC-0002", "chris", "VOD.L", 1311544820L, 102) ) } @@ -74,17 +74,17 @@ class UpdateSelectionViewPortTest extends AbstractViewPortTestCase with Matchers Then("Check we still maintain the selection") assertVpEqWithMeta(combineQs(viewPortChanged)) { Table( - ("sel","orderId" ,"trader" ,"ric" ,"tradeTime","quantity"), - (0 ,"NYC-0009","chris" ,"VOD.L" ,1311544890L,109 ), - (0 ,"NYC-0008","chris" ,"VOD.L" ,1311544880L,108 ), - (0 ,"NYC-0007","chris" ,"VOD.L" ,1311544870L,107 ), - (0 ,"NYC-0006","chris" ,"VOD.L" ,1311544860L,106 ), - (0 ,"NYC-0005","chris" ,"VOD.L" ,1311544850L,105 ), - (0 ,"NYC-0004","chris" ,"VOD.L" ,1311544840L,104 ), - (0 ,"NYC-0003","chris" ,"VOD.L" ,1311544830L,103 ), - (1 ,"NYC-0002","chris" ,"VOD.L" ,1311544820L,102 ), - (0 ,"NYC-0001","chris" ,"VOD.L" ,1311544810L,101 ), - (0 ,"NYC-0000","chris" ,"VOD.L" ,1311544800L,100 ) + ("sel", "orderId", "trader", "ric", "tradeTime", "quantity"), + (0, "NYC-0000", "chris", "VOD.L", 1311544800L, 100), + (0, "NYC-0001", "chris", "VOD.L", 1311544810L, 101), + (1, "NYC-0002", "chris", "VOD.L", 1311544820L, 102), + (0, "NYC-0003", "chris", "VOD.L", 1311544830L, 103), + (0, "NYC-0004", "chris", "VOD.L", 1311544840L, 104), + (0, "NYC-0005", "chris", "VOD.L", 1311544850L, 105), + (0, "NYC-0006", "chris", "VOD.L", 1311544860L, 106), + (0, "NYC-0007", "chris", "VOD.L", 1311544870L, 107), + (0, "NYC-0008", "chris", "VOD.L", 1311544880L, 108), + (0, "NYC-0009", "chris", "VOD.L", 1311544890L, 109) ) } } diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/ViewPortListenerTest.scala b/vuu/src/test/scala/org/finos/vuu/viewport/ViewPortListenerTest.scala index b66573410f..cf5023df56 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/ViewPortListenerTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/ViewPortListenerTest.scala @@ -14,7 +14,7 @@ class ViewPortListenerTest extends AbstractViewPortTestCase with Matchers with G Scenario("Check when we move vp down and back and tick, rows come through"){ - val (viewPortContainer, orders, ordersProvider, session, outQueue, highPriorityQueue) = createDefaultViewPortInfra() + val (viewPortContainer, orders, ordersProvider, session, outQueue) = createDefaultViewPortInfra() val vpcolumns = ViewPortColumnCreator.create(orders, List("orderId", "trader", "tradeTime", "quantity", "ric")) @@ -22,7 +22,7 @@ class ViewPortListenerTest extends AbstractViewPortTestCase with Matchers with G createNOrderRows(ordersProvider, 30)(timeProvider) - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, orders, ViewPortRange(0, 10), vpcolumns) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, orders, ViewPortRange(0, 10), vpcolumns) viewPortContainer.runOnce() @@ -44,7 +44,7 @@ class ViewPortListenerTest extends AbstractViewPortTestCase with Matchers with G ) } - val viewPortv2 = viewPortContainer.changeRange(session, highPriorityQueue, viewPort.id, ViewPortRange(15, 25)) + val viewPortv2 = viewPortContainer.changeRange(session, outQueue, viewPort.id, ViewPortRange(15, 25)) viewPortContainer.runOnce() @@ -66,7 +66,7 @@ class ViewPortListenerTest extends AbstractViewPortTestCase with Matchers with G ) } - val viewPortv3 = viewPortContainer.changeRange(session, highPriorityQueue, viewPort.id, ViewPortRange(5, 15)) + val viewPortv3 = viewPortContainer.changeRange(session, outQueue, viewPort.id, ViewPortRange(5, 15)) viewPortContainer.runOnce() @@ -99,17 +99,17 @@ class ViewPortListenerTest extends AbstractViewPortTestCase with Matchers with G assertVpEq(combinedUpdates4){ Table( - ("orderId" ,"trader" ,"ric" ,"tradeTime","quantity"), - ("NYC-0005","chris" ,"VOD.L" ,1311544850L,1005 ), - ("NYC-0006","chris" ,"VOD.L" ,1311544860L,1006 ), - ("NYC-0007","chris" ,"VOD.L" ,1311544870L,1007 ), - ("NYC-0008","chris" ,"VOD.L" ,1311544880L,1008 ), - ("NYC-0009","chris" ,"VOD.L" ,1311544890L,1009 ), - ("NYC-0010","chris" ,"VOD.L" ,1311544900L,1010 ), - ("NYC-0011","chris" ,"VOD.L" ,1311544910L,1011 ), - ("NYC-0012","chris" ,"VOD.L" ,1311544920L,1012 ), - ("NYC-0013","chris" ,"VOD.L" ,1311544930L,1013 ), - ("NYC-0014","chris" ,"VOD.L" ,1311544940L,1014 ) + ("orderId", "trader", "ric", "tradeTime", "quantity"), + ("NYC-0014", "chris", "VOD.L", 1311544940L, 1014), + ("NYC-0005", "chris", "VOD.L", 1311544850L, 1005), + ("NYC-0006", "chris", "VOD.L", 1311544860L, 1006), + ("NYC-0007", "chris", "VOD.L", 1311544870L, 1007), + ("NYC-0008", "chris", "VOD.L", 1311544880L, 1008), + ("NYC-0009", "chris", "VOD.L", 1311544890L, 1009), + ("NYC-0010", "chris", "VOD.L", 1311544900L, 1010), + ("NYC-0011", "chris", "VOD.L", 1311544910L, 1011), + ("NYC-0012", "chris", "VOD.L", 1311544920L, 1012), + ("NYC-0013", "chris", "VOD.L", 1311544930L, 1013) ) } diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/ViewPortSetup.scala b/vuu/src/test/scala/org/finos/vuu/viewport/ViewPortSetup.scala index 9c73e0b1fc..71d60ef5da 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/ViewPortSetup.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/ViewPortSetup.scala @@ -1,14 +1,13 @@ package org.finos.vuu.viewport -import org.finos.vuu.api._ -import org.finos.vuu.core.table.{Columns, DataTable, TableContainer} -import org.finos.vuu.provider.{JoinTableProvider, JoinTableProviderImpl, MockProvider, ProviderContainer} -import org.finos.vuu.util.{OutboundRowPublishQueue, PublishQueue} import org.finos.toolbox.jmx.MetricsProvider import org.finos.toolbox.lifecycle.LifecycleContainer import org.finos.toolbox.time.Clock -import org.finos.vuu.core.auths.RowPermissionChecker +import org.finos.vuu.api._ import org.finos.vuu.core.module.auths.PermissionSet +import org.finos.vuu.core.table.{Columns, DataTable, TableContainer} +import org.finos.vuu.provider.{JoinTableProvider, JoinTableProviderImpl, MockProvider, ProviderContainer} +import org.finos.vuu.util.{OutboundRowPublishQueue, PublishQueue} import org.finos.vuu.viewport.auths.TestFriendlyPermissionChecker import org.joda.time.LocalDateTime @@ -17,7 +16,6 @@ trait ViewPortSetup { import TestTimeStamp.EPOCH_DEFAULT def emptyQueues(viewPort: ViewPort): Seq[ViewPortUpdate] = { - viewPort.highPriorityQ.popUpTo(1000) viewPort.outboundQ.popUpTo(1000) } @@ -26,7 +24,7 @@ trait ViewPortSetup { } def combineQs(viewPort: ViewPort): Seq[ViewPortUpdate] = { - (viewPort.highPriorityQ.popUpTo(20) ++ viewPort.outboundQ.popUpTo(20)) + viewPort.outboundQ.popUpTo(20) } def getQueues: (OutboundRowPublishQueue, OutboundRowPublishQueue) = { diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/VisualLinkedTreeViewPortTest.scala b/vuu/src/test/scala/org/finos/vuu/viewport/VisualLinkedTreeViewPortTest.scala index bb454475c8..b6bf75e1fc 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/VisualLinkedTreeViewPortTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/VisualLinkedTreeViewPortTest.scala @@ -15,7 +15,7 @@ class VisualLinkedTreeViewPortTest extends AbstractViewPortTestCase with Matcher Scenario("create viewport, update selection, see selection come back") { Given("we've created a viewport with orders in") - val (viewPortContainer, orders, ordersProvider, prices, pricesProvider, session, outQueue, highPriorityQueue) = createDefaultOrderPricesViewPortInfra() + val (viewPortContainer, orders, ordersProvider, prices, pricesProvider, session, outQueue) = createDefaultOrderPricesViewPortInfra() val vpcolumnsOrders = ViewPortColumnCreator.create(orders, List("orderId", "trader", "tradeTime", "quantity", "ric")) val vpcolumnsPrices = ViewPortColumnCreator.create(prices, List("ric", "bid", "ask", "last", "open", "exchange")) @@ -28,8 +28,8 @@ class VisualLinkedTreeViewPortTest extends AbstractViewPortTestCase with Matcher createNOrderRows(ordersProvider, 4, ric = "BT.L", idOffset = 3)(timeProvider) createNOrderRows(ordersProvider, 5, ric = "BP.L", idOffset = 7)(timeProvider) - val viewPortOrders = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, orders, ViewPortRange(0, 10), vpcolumnsOrders) - val viewPortPricesGroupBy = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, prices, ViewPortRange(0, 10), vpcolumnsPrices, groupBy = GroupBy(List(vpcolumnsPrices.getColumnForName("exchange").get), List())) + val viewPortOrders = viewPortContainer.create(RequestId.oneNew(), session, outQueue, orders, ViewPortRange(0, 10), vpcolumnsOrders) + val viewPortPricesGroupBy = viewPortContainer.create(RequestId.oneNew(), session, outQueue, prices, ViewPortRange(0, 10), vpcolumnsPrices, groupBy = GroupBy(List(vpcolumnsPrices.getColumnForName("exchange").get), List())) viewPortContainer.runOnce() viewPortContainer.runGroupByOnce() @@ -57,10 +57,10 @@ class VisualLinkedTreeViewPortTest extends AbstractViewPortTestCase with Matcher assertVpEqWithMeta(priceUpdates) { Table( - ("sel" ,"_isOpen" ,"_depth" ,"_treeKey","_isLeaf" ,"_childCount","_caption","ric" ,"bid" ,"ask" ,"last" ,"open" ,"exchange"), - (0 ,false ,1 ,"$root|XLON",false ,0 ,"XLON" ,"" ,"" ,"" ,"" ,"" ,"XLON" ), - (0 ,false ,1 ,"$root|NYSE",false ,0 ,"NYSE" ,"" ,"" ,"" ,"" ,"" ,"NYSE" ), - (0 ,false ,1 ,"$root|XAMS",false ,0 ,"XAMS" ,"" ,"" ,"" ,"" ,"" ,"XAMS" ) + ("sel", "_isOpen", "_depth", "_treeKey", "_isLeaf", "_childCount", "_caption", "ric", "bid", "ask", "last", "open", "exchange"), + (0, false, 1, "$root|NYSE", false, 0, "NYSE", "", "", "", "", "", "NYSE"), + (0, false, 1, "$root|XAMS", false, 0, "XAMS", "", "", "", "", "", "XAMS"), + (0, false, 1, "$root|XLON", false, 0, "XLON", "", "", "", "", "", "XLON") ) } @@ -73,7 +73,7 @@ class VisualLinkedTreeViewPortTest extends AbstractViewPortTestCase with Matcher viewPortContainer.openNode(viewPortPricesGroupBy.id, "$root|XAMS") Then("we link the viewports, with nothing selected in the parent grid yet") - viewPortContainer.linkViewPorts(session, highPriorityQueue, childVpId = viewPortOrders.id, parentVpId = viewPortPricesGroupBy.id, "ric", "ric") + viewPortContainer.linkViewPorts(session, outQueue, childVpId = viewPortOrders.id, parentVpId = viewPortPricesGroupBy.id, "ric", "ric") And("we run the container once through") viewPortContainer.runOnce() @@ -82,7 +82,7 @@ class VisualLinkedTreeViewPortTest extends AbstractViewPortTestCase with Matcher viewPortOrders.getKeys.length shouldEqual 0 When("we select some rows in the grid") - viewPortContainer.changeSelection(session, highPriorityQueue, viewPortPricesGroupBy.id, ViewPortSelectedIndices(Array(5))) + viewPortContainer.changeSelection(session, outQueue, viewPortPricesGroupBy.id, ViewPortSelectedIndices(Array(5))) viewPortContainer.runGroupByOnce() viewPortContainer.runOnce() @@ -91,18 +91,18 @@ class VisualLinkedTreeViewPortTest extends AbstractViewPortTestCase with Matcher Then("Check the selected rows is updated in the vp") assertVpEqWithMeta(filterByVpId(combinedUpdates2, viewPortPricesGroupBy)) { Table( - ("sel" ,"_isOpen" ,"_depth" ,"_treeKey","_isLeaf" ,"_childCount","_caption","ric" ,"bid" ,"ask" ,"last" ,"open" ,"exchange"), - (0 ,false ,2 ,"$root|XLON|VOD.L",true ,0 ,"VOD.L" ,"VOD.L" ,100.0 ,101.0 ,100.5 ,null ,"XLON" ), - (0 ,true ,1 ,"$root|NYSE",false ,1 ,"NYSE" ,"" ,"" ,"" ,"" ,"" ,"NYSE" ), - (0 ,false ,2 ,"$root|NYSE|BT.L",true ,0 ,"BT.L" ,"BT.L" ,200.0 ,201.0 ,200.5 ,null ,"NYSE" ), - (0 ,true ,1 ,"$root|XAMS",false ,1 ,"XAMS" ,"" ,"" ,"" ,"" ,"" ,"XAMS" ), - (0 ,false ,2 ,"$root|XAMS|BP.L",true ,0 ,"BP.L" ,"BP.L" ,300.0 ,301.0 ,300.5 ,null ,"XAMS" ), - (0 ,true ,1 ,"$root|XLON",false ,1 ,"XLON" ,"" ,"" ,"" ,"" ,"" ,"XLON" ) + ("sel", "_isOpen", "_depth", "_treeKey", "_isLeaf", "_childCount", "_caption", "ric", "bid", "ask", "last", "open", "exchange"), + (0, true, 1, "$root|NYSE", false, 1, "NYSE", "", "", "", "", "", "NYSE"), + (0, false, 2, "$root|NYSE|BT.L", true, 0, "BT.L", "BT.L", 200.0, 201.0, 200.5, null, "NYSE"), + (0, true, 1, "$root|XAMS", false, 1, "XAMS", "", "", "", "", "", "XAMS"), + (0, false, 2, "$root|XAMS|BP.L", true, 0, "BP.L", "BP.L", 300.0, 301.0, 300.5, null, "XAMS"), + (0, true, 1, "$root|XLON", false, 1, "XLON", "", "", "", "", "", "XLON"), + (0, false, 2, "$root|XLON|VOD.L", true, 0, "VOD.L", "VOD.L", 100.0, 101.0, 100.5, null, "XLON") ) } And("if we expend the selection to include BP.L in the prices table") - viewPortContainer.changeSelection(session, highPriorityQueue, viewPortPricesGroupBy.id, ViewPortSelectedIndices(Array(3,5))) + viewPortContainer.changeSelection(session, outQueue, viewPortPricesGroupBy.id, ViewPortSelectedIndices(Array(3, 5))) viewPortContainer.runOnce() viewPortContainer.runGroupByOnce() @@ -138,7 +138,7 @@ class VisualLinkedTreeViewPortTest extends AbstractViewPortTestCase with Matcher viewPortOrders.getKeys.length shouldEqual 9 And("if we set selection to none") - viewPortContainer.changeSelection(session, highPriorityQueue, viewPortPricesGroupBy.id, ViewPortSelectedIndices(Array())) + viewPortContainer.changeSelection(session, outQueue, viewPortPricesGroupBy.id, ViewPortSelectedIndices(Array())) viewPortContainer.runOnce() Then("we should have nothing available in the viewport") diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/VisualLinkedViewPortTest.scala b/vuu/src/test/scala/org/finos/vuu/viewport/VisualLinkedViewPortTest.scala index 1df22bcffc..6772144300 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/VisualLinkedViewPortTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/VisualLinkedViewPortTest.scala @@ -16,13 +16,13 @@ class VisualLinkedViewPortTest extends AbstractViewPortTestCase with Matchers wi Scenario("create viewport, update selection, see selection come back") { Given("we've created a viewport with orders in") - val (viewPortContainer, orders, ordersProvider, prices, pricesProvider, session, outQueue, highPriorityQueue) = createDefaultOrderPricesViewPortInfra() + val (viewPortContainer, orders, ordersProvider, prices, pricesProvider, session, outQueue) = createDefaultOrderPricesViewPortInfra() val vpcolumnsOrders = ViewPortColumnCreator.create(orders, List("orderId", "trader", "tradeTime", "quantity", "ric")) val vpcolumnsPrices = ViewPortColumnCreator.create(prices, List("ric", "bid", "ask", "last", "open")) // val vpcolumnsOrders = List("orderId", "trader", "tradeTime", "quantity", "ric").map(orders.getTableDef.columnForName(_)) -// val vpcolumnsPrices = List("ric", "bid", "ask", "last", "open").map(prices.getTableDef.columnForName(_)) + // val vpcolumnsPrices = List("ric", "bid", "ask", "last", "open").map(prices.getTableDef.columnForName(_)) createPricesRow(pricesProvider, "VOD.L", 100, 101, 100.5, 99.5) createPricesRow(pricesProvider, "BT.L", 200, 201, 200.5, 199.5) @@ -32,8 +32,8 @@ class VisualLinkedViewPortTest extends AbstractViewPortTestCase with Matchers wi createNOrderRows(ordersProvider, 4, ric = "BT.L", idOffset = 3)(timeProvider) createNOrderRows(ordersProvider, 5, ric = "BP.L", idOffset = 7)(timeProvider) - val viewPortOrders = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, orders, ViewPortRange(0, 10), vpcolumnsOrders) - val viewPortPrices = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, prices, ViewPortRange(0, 10), vpcolumnsPrices) + val viewPortOrders = viewPortContainer.create(RequestId.oneNew(), session, outQueue, orders, ViewPortRange(0, 10), vpcolumnsOrders) + val viewPortPrices = viewPortContainer.create(RequestId.oneNew(), session, outQueue, prices, ViewPortRange(0, 10), vpcolumnsPrices) viewPortContainer.runOnce() @@ -60,10 +60,10 @@ class VisualLinkedViewPortTest extends AbstractViewPortTestCase with Matchers wi assertVpEqWithMeta(priceUpdates) { Table( - ("sel" ,"ric" ,"bid" ,"ask" ,"last" ,"open" ), - (0 ,"VOD.L" ,100.0 ,101.0 ,100.5 ,null ), - (0 ,"BT.L" ,200.0 ,201.0 ,200.5 ,null ), - (0 ,"BP.L" ,300.0 ,301.0 ,300.5 ,null ) + ("sel", "ric", "bid", "ask", "last", "open"), + (0, "BP.L", 300.0, 301.0, 300.5, null), + (0, "BT.L", 200.0, 201.0, 200.5, null), + (0, "VOD.L", 100.0, 101.0, 100.5, null) ) } @@ -72,7 +72,7 @@ class VisualLinkedViewPortTest extends AbstractViewPortTestCase with Matchers wi results.head._2.table.name shouldEqual "prices" Then("we link the viewports, with nothing selected in the parent grid yet") - viewPortContainer.linkViewPorts(session, highPriorityQueue, childVpId = viewPortOrders.id, parentVpId = viewPortPrices.id, "ric", "ric") + viewPortContainer.linkViewPorts(session, outQueue, childVpId = viewPortOrders.id, parentVpId = viewPortPrices.id, "ric", "ric") And("we run the container once through") viewPortContainer.runOnce() @@ -81,7 +81,7 @@ class VisualLinkedViewPortTest extends AbstractViewPortTestCase with Matchers wi viewPortOrders.getKeys.length shouldEqual 0 When("we select some rows in the grid") - viewPortContainer.changeSelection(session, highPriorityQueue, viewPortPrices.id, ViewPortSelectedIndices(Array(1))) + viewPortContainer.changeSelection(session, outQueue, viewPortPrices.id, ViewPortSelectedIndices(Array(1))) Then("Check the selected rows is updated in the vp") assertVpEqWithMeta(combineQs(viewPortPrices)) { @@ -105,7 +105,7 @@ class VisualLinkedViewPortTest extends AbstractViewPortTestCase with Matchers wi } And("if we expend the selection to include BP.L in the prices table") - viewPortContainer.changeSelection(session, highPriorityQueue, viewPortPrices.id, ViewPortSelectedIndices(Array(1, 2))) + viewPortContainer.changeSelection(session, outQueue, viewPortPrices.id, ViewPortSelectedIndices(Array(1, 2))) viewPortContainer.runOnce() @@ -125,7 +125,7 @@ class VisualLinkedViewPortTest extends AbstractViewPortTestCase with Matchers wi viewPortOrders.getKeys.length shouldEqual 9 And("if we set selection to none") - viewPortContainer.changeSelection(session, highPriorityQueue, viewPortPrices.id, ViewPortSelectedIndices(Array())) + viewPortContainer.changeSelection(session, outQueue, viewPortPrices.id, ViewPortSelectedIndices(Array())) viewPortContainer.runOnce() Then("we should have nothing available in the viewport") @@ -133,24 +133,24 @@ class VisualLinkedViewPortTest extends AbstractViewPortTestCase with Matchers wi Then("Change the viewport to sort by quantity") viewPortContainer.change(RequestId.oneNew(), session, viewPortOrders.id, ViewPortRange(0, 10), vpcolumnsOrders, SortSpec(List(SortDef("quantity", 'A')))) - viewPortContainer.changeSelection(session, highPriorityQueue, viewPortPrices.id, ViewPortSelectedIndices(Array(1))) + viewPortContainer.changeSelection(session, outQueue, viewPortPrices.id, ViewPortSelectedIndices(Array(1))) viewPortContainer.runOnce() Then("Check we still maintain the selection even with a new sort or filter") assertVpEqWithMeta(combineQs(viewPortOrders).filter(vpu => vpu.vp.id == viewPortOrders.id)) { Table( - ("sel" ,"orderId" ,"trader" ,"ric" ,"tradeTime","quantity"), - (0 ,"NYC-0006","chris" ,"BT.L" ,1311544860L,103 ), - (0 ,"NYC-0005","chris" ,"BT.L" ,1311544850L,102 ), - (0 ,"NYC-0004","chris" ,"BT.L" ,1311544840L,101 ), - (0 ,"NYC-0003","chris" ,"BT.L" ,1311544830L,100 ) + ("sel", "orderId", "trader", "ric", "tradeTime", "quantity"), + (0, "NYC-0003", "chris", "BT.L", 1311544830L, 100), + (0, "NYC-0004", "chris", "BT.L", 1311544840L, 101), + (0, "NYC-0005", "chris", "BT.L", 1311544850L, 102), + (0, "NYC-0006", "chris", "BT.L", 1311544860L, 103) ) } Then("Check we can remove the visual linking") - viewPortContainer.unlinkViewPorts(session, highPriorityQueue, viewPortOrders.id) + viewPortContainer.unlinkViewPorts(session, outQueue, viewPortOrders.id) viewPortContainer.runOnce() @@ -161,17 +161,17 @@ class VisualLinkedViewPortTest extends AbstractViewPortTestCase with Matchers wi assertVpEqWithMeta(orderUpdates2) { Table( - ("sel" ,"orderId" ,"trader" ,"ric" ,"tradeTime","quantity"), - (0 ,"NYC-0011","chris" ,"BP.L" ,1311544910L,104 ), - (0 ,"NYC-0006","chris" ,"BT.L" ,1311544860L,103 ), - (0 ,"NYC-0010","chris" ,"BP.L" ,1311544900L,103 ), - (0 ,"NYC-0002","chris" ,"VOD.L" ,1311544820L,102 ), - (0 ,"NYC-0005","chris" ,"BT.L" ,1311544850L,102 ), - (0 ,"NYC-0009","chris" ,"BP.L" ,1311544890L,102 ), - (0 ,"NYC-0001","chris" ,"VOD.L" ,1311544810L,101 ), - (0 ,"NYC-0004","chris" ,"BT.L" ,1311544840L,101 ), - (0 ,"NYC-0008","chris" ,"BP.L" ,1311544880L,101 ), - (0 ,"NYC-0000","chris" ,"VOD.L" ,1311544800L,100 ) + ("sel", "orderId", "trader", "ric", "tradeTime", "quantity"), + (0, "NYC-0000", "chris", "VOD.L", 1311544800L, 100), + (0, "NYC-0001", "chris", "VOD.L", 1311544810L, 101), + (0, "NYC-0002", "chris", "VOD.L", 1311544820L, 102), + (0, "NYC-0004", "chris", "BT.L", 1311544840L, 101), + (0, "NYC-0005", "chris", "BT.L", 1311544850L, 102), + (0, "NYC-0006", "chris", "BT.L", 1311544860L, 103), + (0, "NYC-0008", "chris", "BP.L", 1311544880L, 101), + (0, "NYC-0009", "chris", "BP.L", 1311544890L, 102), + (0, "NYC-0010", "chris", "BP.L", 1311544900L, 103), + (0, "NYC-0011", "chris", "BP.L", 1311544910L, 104) ) } diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/auths/PermissionFilteredViewport.scala b/vuu/src/test/scala/org/finos/vuu/viewport/auths/PermissionFilteredViewport.scala index 59adf70266..415e97b9ef 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/auths/PermissionFilteredViewport.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/auths/PermissionFilteredViewport.scala @@ -33,11 +33,10 @@ class PermissionFilteredViewport extends AnyFeatureSpec with Matchers with ViewP joinProvider.runOnce() val queue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val session = ClientSessionId("A", "B") val columns = ViewPortColumnCreator.create(orders, orders.getTableDef.columns.map(_.name).toList) val range = ViewPortRange(0, 20) - val viewport = viewPortContainer.create(RequestId.oneNew(), session, queue, highPriorityQueue, orders, range, columns) + val viewport = viewPortContainer.create(RequestId.oneNew(), session, queue, orders, range, columns) val permissionChecker = viewport.permissionChecker().get.asInstanceOf[TestFriendlyPermissionChecker] permissionChecker.addRole(PermissionSet.SalesTradingPermission) diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/disable/DisableViewPortTest.scala b/vuu/src/test/scala/org/finos/vuu/viewport/disable/DisableViewPortTest.scala index ca924bc30c..11d0369b6c 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/disable/DisableViewPortTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/disable/DisableViewPortTest.scala @@ -1,19 +1,11 @@ package org.finos.vuu.viewport.disable -import org.finos.vuu.api._ import org.finos.vuu.client.messages.RequestId import org.finos.vuu.core.table.TableTestHelper._ -import org.finos.vuu.core.table.{Columns, TableContainer, ViewPortColumnCreator} -import org.finos.vuu.net.{ClientSessionId, FilterSpec} -import org.finos.vuu.provider.{JoinTableProviderImpl, MockProvider, ProviderContainer} -import org.finos.vuu.util.OutboundRowPublishQueue +import org.finos.vuu.core.table.ViewPortColumnCreator import org.finos.vuu.util.table.TableAsserts._ -import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} -import org.finos.toolbox.lifecycle.LifecycleContainer -import org.finos.toolbox.time.{Clock, DefaultClock} import org.finos.vuu.viewport.{AbstractViewPortTestCase, ViewPortRange} import org.scalatest.GivenWhenThen -import org.scalatest.featurespec.AnyFeatureSpec import org.scalatest.matchers.should.Matchers import org.scalatest.prop.Tables.Table @@ -24,13 +16,13 @@ class DisableViewPortTest extends AbstractViewPortTestCase with Matchers with Gi Scenario("Check that a viewport is not emptied when disabled") { Given("we've created a viewport with orders in and a calc'd column 2") - val (viewPortContainer, orders, ordersProvider, session, outQueue, highPriorityQueue) = createDefaultViewPortInfra() + val (viewPortContainer, orders, ordersProvider, session, outQueue) = createDefaultViewPortInfra() val viewPortColumns = ViewPortColumnCreator.create(orders, List("orderId", "trader", "tradeTime", "quantity", "ric")) createNOrderRowsNoSleep(ordersProvider, 10)(timeProvider) - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, orders, ViewPortRange(0, 10), viewPortColumns) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, orders, ViewPortRange(0, 10), viewPortColumns) viewPortContainer.runOnce() diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/menurpc/CallMenuRpcFromViewPortTest.scala b/vuu/src/test/scala/org/finos/vuu/viewport/menurpc/CallMenuRpcFromViewPortTest.scala index aa55d8bd7f..bc16ae438f 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/menurpc/CallMenuRpcFromViewPortTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/menurpc/CallMenuRpcFromViewPortTest.scala @@ -1,5 +1,8 @@ package org.finos.vuu.viewport.menurpc +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.{TableDef, ViewPortDef, VisualLinks} import org.finos.vuu.client.messages.RequestId import org.finos.vuu.core.module.ModuleFactory.stringToString @@ -10,9 +13,6 @@ import org.finos.vuu.provider.{JoinTableProviderImpl, MockProvider, Provider, Pr import org.finos.vuu.util.OutboundRowPublishQueue import org.finos.vuu.util.table.TableAsserts.assertVpEq import org.finos.vuu.viewport._ -import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} -import org.finos.toolbox.lifecycle.LifecycleContainer -import org.finos.toolbox.time.{Clock, TestFriendlyClock} import org.scalatest.featurespec.AnyFeatureSpec import org.scalatest.matchers.should.Matchers import org.scalatest.prop.Tables.Table @@ -62,7 +62,7 @@ class CallMenuRpcFromViewPortTest extends AnyFeatureSpec with Matchers with View } } - def createInstrumentsRpc(): (ViewPortContainer, DataTable, MockProvider, ClientSessionId, OutboundRowPublishQueue, OutboundRowPublishQueue) = { + def createInstrumentsRpc(): (ViewPortContainer, DataTable, MockProvider, ClientSessionId, OutboundRowPublishQueue) = { implicit val lifecycle: LifecycleContainer = new LifecycleContainer @@ -91,7 +91,7 @@ class CallMenuRpcFromViewPortTest extends AnyFeatureSpec with Matchers with View val outQueue = new OutboundRowPublishQueue() val highPriorityQueue = new OutboundRowPublishQueue() - (viewPortContainer, instruments, instrumentsProvider, session, outQueue, highPriorityQueue) + (viewPortContainer, instruments, instrumentsProvider, session, outQueue) } def createViewPortDef(): (DataTable, Provider, ProviderContainer, TableContainer) => ViewPortDef = { @@ -103,13 +103,13 @@ class CallMenuRpcFromViewPortTest extends AnyFeatureSpec with Matchers with View Scenario("Invoke a viewport related rpc function") { - val (vpContainer, instruments, instrumentsProvider, session, outQueue, highPriorityQueue) = createInstrumentsRpc() + val (vpContainer, instruments, instrumentsProvider, session, outQueue) = createInstrumentsRpc() vpContainer.addViewPortDefinition(instruments.getTableDef.name, createViewPortDef()) val vpcolumnsOrders = ViewPortColumnCreator.create(instruments, instruments.getTableDef.columns.map(_.name).toList ) - val viewPort = vpContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, instruments, DefaultRange, vpcolumnsOrders) + val viewPort = vpContainer.create(RequestId.oneNew(), session, outQueue, instruments, DefaultRange, vpcolumnsOrders) instrumentsProvider.tick("VOD.L", Map("ric" -> "VOD.L", "description" -> "Vodafone", "bbg" -> "VOD LN", "currency" -> "GBp", "exchange" -> "XLON/SETS")) instrumentsProvider.tick("BT.L", Map("ric" -> "BT.L", "description" -> "British Telecom", "bbg" -> "BT LN", "currency" -> "GBp", "exchange" -> "XLON/SETS")) @@ -120,9 +120,9 @@ class CallMenuRpcFromViewPortTest extends AnyFeatureSpec with Matchers with View assertVpEq(combinedUpdates){ Table( - ("ric" ,"description","bbg" ,"currency","exchange", "lotSize", "isin"), - ("VOD.L" ,"Vodafone","VOD LN" ,"GBp" ,"XLON/SETS", null, null), - ("BT.L" ,"British Telecom","BT LN" ,"GBp" ,"XLON/SETS", null, null) + ("ric", "description", "bbg", "currency", "exchange", "lotSize", "isin"), + ("BT.L", "British Telecom", "BT LN", "GBp", "XLON/SETS", null, null), + ("VOD.L", "Vodafone", "VOD LN", "GBp", "XLON/SETS", null, null) ) } diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/performance/CalculateTreeOptimizationTest.scala b/vuu/src/test/scala/org/finos/vuu/viewport/performance/CalculateTreeOptimizationTest.scala index 87d4fdac2c..4bb8fe6a67 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/performance/CalculateTreeOptimizationTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/performance/CalculateTreeOptimizationTest.scala @@ -10,8 +10,8 @@ import org.finos.vuu.net.{ClientSessionId, FilterSpec, SortSpec} import org.finos.vuu.provider.{JoinTableProviderImpl, MockProvider, ProviderContainer} import org.finos.vuu.util.OutboundRowPublishQueue import org.finos.vuu.util.table.TableAsserts._ -import org.finos.vuu.viewport.{DefaultRange, GroupBy, ViewPortSetup} import org.finos.vuu.viewport.ViewPortTestFns.setupViewPort +import org.finos.vuu.viewport.{DefaultRange, GroupBy, ViewPortSetup} import org.scalatest.featurespec.AnyFeatureSpec import org.scalatest.prop.Tables.Table @@ -73,11 +73,10 @@ class CalculateTreeOptimizationTest extends AnyFeatureSpec with ViewPortSetup { val session = ClientSessionId("sess-01", "chris") val outQueue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() val vpcolumns = ViewPortColumnCreator.create(orderPrices, List("orderId", "trader", "tradeTime", "quantity", "ric", "bid", "ask")) - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, orderPrices, DefaultRange, vpcolumns) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, orderPrices, DefaultRange, vpcolumns) runContainersOnce(viewPortContainer, joinProvider) @@ -133,9 +132,8 @@ class CalculateTreeOptimizationTest extends AnyFeatureSpec with ViewPortSetup { assertVpEq(combinedUpdates3) { Table( ("_depth", "_isOpen", "_treeKey", "_isLeaf", "_isOpen", "_caption", "_childCount", "orderId", "trader", "ric", "tradeTime", "quantity", "bid", "ask", "last", "open"), - //(0, true, "$root", false, true, "", 2, "", "", "", "", "", "", "", "", ""), - (1, false, "$root|VOD.L", false, false, "VOD.L", 0, "", "", "VOD.L", "", "", "", "", "", ""), - (1, false, "$root|BT.L", false, false, "BT.L", 0, "", "", "BT.L", "", "", "", "", "", "") + (1, false, "$root|BT.L", false, false, "BT.L", 0, "", "", "BT.L", "", "", "", "", "", ""), + (1, false, "$root|VOD.L", false, false, "VOD.L", 0, "", "", "VOD.L", "", "", "", "", "", "") ) } diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/performance/DontRecalculateUnchangedViewPortTest.scala b/vuu/src/test/scala/org/finos/vuu/viewport/performance/DontRecalculateUnchangedViewPortTest.scala index 6ed0527ea9..a6ff14a453 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/performance/DontRecalculateUnchangedViewPortTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/performance/DontRecalculateUnchangedViewPortTest.scala @@ -16,13 +16,13 @@ class DontRecalculateUnchangedViewPortTest extends AbstractViewPortTestCase with Scenario("Create Viewport, run cycle count and check we recalc only when required") { Given("we've created a viewport with orders in") - val (viewPortContainer, orders, ordersProvider, session, outQueue, highPriorityQueue) = createDefaultViewPortInfra() + val (viewPortContainer, orders, ordersProvider, session, outQueue) = createDefaultViewPortInfra() val vpcolumns = ViewPortColumnCreator.create(orders, List("orderId", "trader", "tradeTime", "quantity", "ric")) createNOrderRows(ordersProvider, 10)(timeProvider) - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, orders, ViewPortRange(0, 20), vpcolumns) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, orders, ViewPortRange(0, 20), vpcolumns) val hashCode1 = viewPort.getStructuralHashCode() val updateCount1 = viewPort.getTableUpdateCount() @@ -116,19 +116,19 @@ class DontRecalculateUnchangedViewPortTest extends AbstractViewPortTestCase with assertVpEqWithMeta(combineQs(viewPort)) { Table( - ("sel" ,"orderId" ,"trader" ,"ric" ,"tradeTime"), - (0 ,"NYC-0000","chris" ,"VOD.L" ,1311544900L), - (0 ,"NYC-0001","chris" ,"VOD.L" ,1311544910L), - (0 ,"NYC-0002","chris" ,"VOD.L" ,1311544920L), - (0 ,"NYC-0003","chris" ,"VOD.L" ,1311544930L), - (0 ,"NYC-0004","chris" ,"VOD.L" ,1311544940L), - (0 ,"NYC-0005","chris" ,"VOD.L" ,1311544950L), - (0 ,"NYC-0006","chris" ,"VOD.L" ,1311544960L), - (0 ,"NYC-0007","chris" ,"VOD.L" ,1311544970L), - (0 ,"NYC-0008","chris" ,"VOD.L" ,1311544980L), - (0 ,"NYC-0009","chris" ,"VOD.L" ,1311544990L), - (0 ,"NYC-0010","chris" ,"VOD.L" ,1311545000L), - (0 ,"NYC-0011","chris" ,"VOD.L" ,1311545010L) + ("sel", "orderId", "trader", "ric", "tradeTime"), + (0, "NYC-0010", "chris", "VOD.L", 1311545000L), + (0, "NYC-0011", "chris", "VOD.L", 1311545010L), + (0, "NYC-0000", "chris", "VOD.L", 1311544900L), + (0, "NYC-0001", "chris", "VOD.L", 1311544910L), + (0, "NYC-0002", "chris", "VOD.L", 1311544920L), + (0, "NYC-0003", "chris", "VOD.L", 1311544930L), + (0, "NYC-0004", "chris", "VOD.L", 1311544940L), + (0, "NYC-0005", "chris", "VOD.L", 1311544950L), + (0, "NYC-0006", "chris", "VOD.L", 1311544960L), + (0, "NYC-0007", "chris", "VOD.L", 1311544970L), + (0, "NYC-0008", "chris", "VOD.L", 1311544980L), + (0, "NYC-0009", "chris", "VOD.L", 1311544990L) ) } diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/sessiontable/AbstractSessionTestCase.scala b/vuu/src/test/scala/org/finos/vuu/viewport/sessiontable/AbstractSessionTestCase.scala index 7844aabeee..f6fd6ca4be 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/sessiontable/AbstractSessionTestCase.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/sessiontable/AbstractSessionTestCase.scala @@ -1,26 +1,20 @@ package org.finos.vuu.viewport.sessiontable -import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} +import org.finos.toolbox.jmx.MetricsProvider import org.finos.toolbox.lifecycle.LifecycleContainer -import org.finos.toolbox.time.{Clock, TestFriendlyClock} +import org.finos.toolbox.time.Clock import org.finos.vuu.api._ -import org.finos.vuu.client.messages.{ClientOrderId, RequestId} import org.finos.vuu.core.VuuServer import org.finos.vuu.core.module.ModuleFactory.stringToString import org.finos.vuu.core.module.{StaticServedResource, ViewServerModule} -import org.finos.vuu.core.table.TableTestHelper.{combineQs, emptyQueues} -import org.finos.vuu.core.table.{Columns, DataTable, RowWithData, TableContainer, ViewPortColumnCreator} +import org.finos.vuu.core.table.{Columns, DataTable, TableContainer} import org.finos.vuu.net.ClientSessionId import org.finos.vuu.net.rest.RestService import org.finos.vuu.net.rpc.RpcHandler import org.finos.vuu.provider.{JoinTableProviderImpl, MockProvider, Provider, ProviderContainer} import org.finos.vuu.util.OutboundRowPublishQueue -import org.finos.vuu.util.table.TableAsserts.assertVpEq +import org.finos.vuu.viewport.ViewPortContainer import org.finos.vuu.viewport.ViewPortTestFns.setupViewPort -import org.finos.vuu.viewport.{AbstractViewPortTestCase, CellViewPortMenuItem, DefaultRange, NoAction, OpenDialogViewPortAction, RowViewPortMenuItem, SelectionViewPortMenuItem, TableViewPortMenuItem, ViewPortAction, ViewPortContainer, ViewPortMenu, ViewPortSelectedIndices, ViewPortSelection, ViewPortTable} -import org.scalatest.GivenWhenThen -import org.scalatest.matchers.should.Matchers -import org.scalatest.prop.Tables.Table trait AbstractSessionTestCase { @@ -40,7 +34,7 @@ trait AbstractSessionTestCase { final val TEST_TIME = 1450770869442L var counter: Int = 0 - def setupEditableSessionTableInfra()(implicit clock: Clock, metrics: MetricsProvider): (ViewPortContainer, DataTable, MockProvider, ClientSessionId, OutboundRowPublishQueue, OutboundRowPublishQueue, DataTable, TableContainer) = { + def setupEditableSessionTableInfra()(implicit clock: Clock, metrics: MetricsProvider): (ViewPortContainer, DataTable, MockProvider, ClientSessionId, OutboundRowPublishQueue, DataTable, TableContainer) = { implicit val lifecycle: LifecycleContainer = new LifecycleContainer val module = createViewServerModule("TEST") @@ -80,9 +74,8 @@ trait AbstractSessionTestCase { val session = ClientSessionId("sess-01", "chris") val outQueue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() - (viewPortContainer, process, processProvider, session, outQueue, highPriorityQueue, fixSequence, tableContainer) + (viewPortContainer, process, processProvider, session, outQueue, fixSequence, tableContainer) } diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/sessiontable/EditSessionTableTest.scala b/vuu/src/test/scala/org/finos/vuu/viewport/sessiontable/EditSessionTableTest.scala index f344586981..d216085b22 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/sessiontable/EditSessionTableTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/sessiontable/EditSessionTableTest.scala @@ -1,6 +1,5 @@ package org.finos.vuu.viewport.sessiontable -import org.finos.toolbox.jmx.{MetricsProvider, MetricsProviderImpl} import org.finos.toolbox.time.{Clock, TestFriendlyClock} import org.finos.vuu.client.messages.RequestId import org.finos.vuu.core.table.TableTestHelper.{combineQs, emptyQueues} @@ -8,13 +7,11 @@ import org.finos.vuu.core.table.{RowWithData, TableContainer, ViewPortColumnCrea import org.finos.vuu.net.ClientSessionId import org.finos.vuu.net.rpc.{EditRpcHandler, RpcHandler} import org.finos.vuu.util.table.TableAsserts.assertVpEq -import org.finos.vuu.viewport.{AbstractViewPortTestCase, CloseDialogViewPortAction, DefaultRange, NoAction, OpenDialogViewPortAction, RenderComponent, SelectionViewPortMenuItem, ViewPort, ViewPortAction, ViewPortAddRowAction, ViewPortDeleteCellAction, ViewPortDeleteRowAction, ViewPortEditAction, ViewPortEditCellAction, ViewPortEditFailure, ViewPortEditRowAction, ViewPortEditSuccess, ViewPortFormCloseAction, ViewPortFormSubmitAction, ViewPortMenu, ViewPortSelectedIndices, ViewPortSelection, ViewPortTable} +import org.finos.vuu.viewport._ import org.scalatest.GivenWhenThen import org.scalatest.matchers.should.Matchers import org.scalatest.prop.Tables.Table -import java.lang - class EditSessionTableTest extends AbstractViewPortTestCase with Matchers with GivenWhenThen with AbstractSessionTestCase { final implicit val clock: Clock = new TestFriendlyClock(TEST_TIME) @@ -96,7 +93,7 @@ class EditSessionTableTest extends AbstractViewPortTestCase with Matchers with G Scenario("Create a session table based on a user action and populate it with callbacks") { - val (viewPortContainer, process, processProvider, session, outQueue, highPriorityQueue, fixSequence, tableContainer) = setupEditableSessionTableInfra() + val (viewPortContainer, process, processProvider, session, outQueue, fixSequence, tableContainer) = setupEditableSessionTableInfra() Given("We create a viewport on the process table (view only)") val vpcolumns = ViewPortColumnCreator.create(process, process.getTableDef.columns.map(_.name).toList) @@ -111,7 +108,7 @@ class EditSessionTableTest extends AbstractViewPortTestCase with Matchers with G processProvider.tick("proc-2", Map("id" -> "proc-2", "name" -> "My Process 2", "uptime" -> 5000L, "status" -> "running")) Then("we create a viewport...") - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, process, DefaultRange, vpcolumns) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, process, DefaultRange, vpcolumns) viewPortContainer.runOnce() @@ -131,7 +128,7 @@ class EditSessionTableTest extends AbstractViewPortTestCase with Matchers with G val sessionTable = tableContainer.getTable(action.table.table) val sessionColumns = ViewPortColumnCreator.create(sessionTable, sessionTable.getTableDef.columns.map(_.name).toList) - val sessionViewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, sessionTable, DefaultRange, sessionColumns) + val sessionViewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, sessionTable, DefaultRange, sessionColumns) viewPortContainer.runOnce() diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/sessiontable/SessionTableViewportTest.scala b/vuu/src/test/scala/org/finos/vuu/viewport/sessiontable/SessionTableViewportTest.scala index e7a5054408..8e9930c1f4 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/sessiontable/SessionTableViewportTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/sessiontable/SessionTableViewportTest.scala @@ -3,19 +3,19 @@ package org.finos.vuu.viewport.sessiontable import org.finos.toolbox.lifecycle.LifecycleContainer import org.finos.toolbox.time.{Clock, TestFriendlyClock} import org.finos.vuu.api._ -import org.finos.vuu.client.messages.{ClientOrderId, RequestId} +import org.finos.vuu.client.messages.RequestId import org.finos.vuu.core.VuuServer import org.finos.vuu.core.module.ModuleFactory.stringToString import org.finos.vuu.core.module.{StaticServedResource, ViewServerModule} import org.finos.vuu.core.table.TableTestHelper.{combineQs, emptyQueues} -import org.finos.vuu.core.table.{Columns, DataTable, RowWithData, TableContainer, ViewPortColumnCreator} +import org.finos.vuu.core.table._ import org.finos.vuu.net.ClientSessionId import org.finos.vuu.net.rest.RestService import org.finos.vuu.net.rpc.RpcHandler import org.finos.vuu.provider.{JoinTableProviderImpl, MockProvider, Provider, ProviderContainer} import org.finos.vuu.util.OutboundRowPublishQueue import org.finos.vuu.util.table.TableAsserts.assertVpEq -import org.finos.vuu.viewport.{AbstractViewPortTestCase, CellViewPortMenuItem, DefaultRange, NoAction, OpenDialogViewPortAction, RowViewPortMenuItem, SelectionViewPortMenuItem, TableViewPortMenuItem, ViewPortAction, ViewPortContainer, ViewPortMenu, ViewPortSelectedIndices, ViewPortSelection, ViewPortTable} +import org.finos.vuu.viewport._ import org.scalatest.GivenWhenThen import org.scalatest.matchers.should.Matchers import org.scalatest.prop.Tables.Table @@ -88,7 +88,7 @@ class SessionTableViewportTest extends AbstractViewPortTestCase with Matchers wi } } - def createDefaultSessionTableInfra(): (ViewPortContainer, DataTable, MockProvider, DataTable, MockProvider, ClientSessionId, OutboundRowPublishQueue, OutboundRowPublishQueue, DataTable, TableContainer) = { + def createDefaultSessionTableInfra(): (ViewPortContainer, DataTable, MockProvider, DataTable, MockProvider, ClientSessionId, OutboundRowPublishQueue, DataTable, TableContainer) = { implicit val lifecycle = new LifecycleContainer val dateTime = 1437728400000L //new LocalDateTime(2015, 7, 24, 11, 0).toDateTime.toInstant.getMillis @@ -178,9 +178,8 @@ class SessionTableViewportTest extends AbstractViewPortTestCase with Matchers wi val session = ClientSessionId("sess-01", "chris") val outQueue = new OutboundRowPublishQueue() - val highPriorityQueue = new OutboundRowPublishQueue() - (viewPortContainer, instruments, instrumentsProvider, prices, pricesProvider, session, outQueue, highPriorityQueue, basketOrders, tableContainer) + (viewPortContainer, instruments, instrumentsProvider, prices, pricesProvider, session, outQueue, basketOrders, tableContainer) } def createViewPortDefFunc(tableContainer: TableContainer, clock: Clock): (DataTable, Provider, ProviderContainer, TableContainer) => ViewPortDef = { @@ -192,14 +191,14 @@ class SessionTableViewportTest extends AbstractViewPortTestCase with Matchers wi Scenario("Create a session table from an rpc call and edit it") { - val (viewPortContainer, instruments, instrumentsProvider, prices, pricesProvider, session, outQueue, highPriorityQueue, basketOrders, tableContainer) = createDefaultSessionTableInfra() + val (viewPortContainer, instruments, instrumentsProvider, prices, pricesProvider, session, outQueue, basketOrders, tableContainer) = createDefaultSessionTableInfra() val vpcolumns = ViewPortColumnCreator.create(instruments, instruments.getTableDef.columns.map(_.name).toList) Given("We have a viewport on instruments with an rpc service attached...") viewPortContainer.addViewPortDefinition(instruments.getTableDef.name, createViewPortDefFunc(tableContainer, clock)) - val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, instruments, DefaultRange, vpcolumns) + val viewPort = viewPortContainer.create(RequestId.oneNew(), session, outQueue, instruments, DefaultRange, vpcolumns) viewPortContainer.runOnce() @@ -215,8 +214,8 @@ class SessionTableViewportTest extends AbstractViewPortTestCase with Matchers wi assertVpEq(combinedUpdates) { Table( ("ric", "description", "bbg", "currency", "exchange", "lotSize", "isin"), - ("VOD.L", "Vodafone", "VOD LN", "GBp", "XLON/SETS", null, null), - ("BT.L", "British Telecom", "BT LN", "GBp", "XLON/SETS", null, null) + ("BT.L", "British Telecom", "BT LN", "GBp", "XLON/SETS", null, null), + ("VOD.L", "Vodafone", "VOD LN", "GBp", "XLON/SETS", null, null) ) } @@ -234,7 +233,7 @@ class SessionTableViewportTest extends AbstractViewPortTestCase with Matchers wi case x: OpenDialogViewPortAction => val basketTable = tableContainer.getTable(x.table.table) val vpColumns2 = ViewPortColumnCreator.create(basketTable, basketTable.getTableDef.columns.map(_.name).toList) - val viewPort2 = viewPortContainer.create(RequestId.oneNew(), session, outQueue, highPriorityQueue, basketTable, DefaultRange, vpColumns2) + val viewPort2 = viewPortContainer.create(RequestId.oneNew(), session, outQueue, basketTable, DefaultRange, vpColumns2) viewPortContainer.runOnce() diff --git a/vuu/src/test/scala/org/finos/vuu/viewport/validation/CreateValidViewportTest.scala b/vuu/src/test/scala/org/finos/vuu/viewport/validation/CreateValidViewportTest.scala index 23a49a4321..b9daedc70f 100644 --- a/vuu/src/test/scala/org/finos/vuu/viewport/validation/CreateValidViewportTest.scala +++ b/vuu/src/test/scala/org/finos/vuu/viewport/validation/CreateValidViewportTest.scala @@ -1,8 +1,7 @@ package org.finos.vuu.viewport.validation -import org.finos.vuu.client.messages.RequestId import org.finos.vuu.core.CoreServerApiHandler -import org.finos.vuu.net.{ClientSessionId, CreateViewPortRequest, RequestContext, ServerApi} +import org.finos.vuu.net.{ClientSessionId, CreateViewPortRequest, RequestContext} import org.finos.vuu.viewport.{AbstractViewPortTestCase, ViewPortRange, ViewPortTable} import org.scalatest.GivenWhenThen import org.scalatest.matchers.should.Matchers @@ -14,13 +13,13 @@ class CreateValidViewportTest extends AbstractViewPortTestCase with Matchers wit Scenario("create viewport, with incorrect columns, check for error") { Given("we've created a viewport with orders in") - val (viewPortContainer, _, _, prices, _, _, outQueue, highPriorityQueue) = createDefaultOrderPricesViewPortInfra() + val (viewPortContainer, _, _, prices, _, _, outQueue) = createDefaultOrderPricesViewPortInfra() val api = new CoreServerApiHandler(viewPortContainer, tableContainer = viewPortContainer.tableContainer, providers = viewPortContainer.providerContainer) val vpcolumnsOrders = List("orderId", "trader", "tradeTime", "quantity", "ric", "foo-bar") - val ctx = RequestContext("req-101", ClientSessionId("A", "A"), outQueue, highPriorityQueue, "token-0001") + val ctx = RequestContext("req-101", ClientSessionId("A", "A"), outQueue, "token-0001") val exception = intercept[Exception]{ api.process(CreateViewPortRequest(ViewPortTable("orders", "TEST"), ViewPortRange(0, 100), vpcolumnsOrders.toArray))(ctx)