Skip to content

Commit

Permalink
finos#1296 SQL filtering tests
Browse files Browse the repository at this point in the history
  • Loading branch information
junaidzm13 committed Apr 26, 2024
1 parent 663fb46 commit eb38607
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import org.finos.toolbox.time.Clock
import org.finos.vuu.api.ViewPortDef
import org.finos.vuu.core.module.{DefaultModule, ModuleFactory, TableDefContainer, ViewServerModule}
import org.finos.vuu.core.table.{Column, Columns}
import org.finos.vuu.example.ignite.{IgniteColumnValueProvider, IgniteOrderStore}
import org.finos.vuu.example.ignite.IgniteOrderStore
import org.finos.vuu.example.ignite.provider.IgniteOrderDataProvider
import org.finos.vuu.net.rpc.RpcHandler
import org.finos.vuu.plugin.virtualized.api.VirtualizedSessionTableDef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import org.apache.ignite.{Ignite, IgniteCache, Ignition}
import org.apache.ignite.cluster.ClusterState
import org.apache.ignite.configuration.{CacheConfiguration, IgniteConfiguration}

import java.sql.Date
import java.math.BigDecimal
import java.util
import scala.collection.mutable
import scala.jdk.CollectionConverters._
Expand Down Expand Up @@ -62,6 +64,8 @@ object IgniteTestStore {
fields.put("price", classOf[Double].getName)
fields.put("quantity", classOf[Int].getName)
fields.put("rating", classOf[Char].getName)
fields.put("createdAt", classOf[Date].getName)
fields.put("totalFill", classOf[BigDecimal].getName)
fields
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
package org.finos.vuu.feature.ignite

import java.sql.Date
import java.math.BigDecimal

object TestInput {
def createTestOrderEntity(id: Int, ric: String, parentId: Int = 1, price: Double = 10.4, quantity: Int = 100, rating: Char = 'A'): TestOrderEntity =
TestOrderEntity(parentId = parentId, id = id, ric = ric, price = price, quantity = quantity, rating = rating)
}
def createTestOrderEntity(id: Int, ric: String, parentId: Int = 1, price: Double = 10.4, quantity: Int = 100,
rating: Char = 'A', createdAt: Date = Date.valueOf("2024-02-10"),
totalFill: BigDecimal = new BigDecimal(10_000.3333)): TestOrderEntity =
TestOrderEntity(
parentId = parentId,
id = id,
ric = ric,
price = price,
quantity = quantity,
rating = rating,
createdAt = createdAt,
totalFill = totalFill
)
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
package org.finos.vuu.feature.ignite

case class TestOrderEntity(
parentId: Int,
id: Int,
ric: String,
price: Double,
quantity: Int,
rating: Char){
import java.sql.Date
import java.math.BigDecimal

}
case class TestOrderEntity(parentId: Int,
id: Int,
ric: String,
price: Double,
quantity: Int,
rating: Char,
createdAt: Date,
totalFill: BigDecimal) {}

object TestOrderEntity{
def createFrom(cols: java.util.List[_]): TestOrderEntity = {
Expand All @@ -18,7 +20,9 @@ object TestOrderEntity{
ric = cols.get(2).asInstanceOf[String],
price = cols.get(3).asInstanceOf[Double],
quantity = cols.get(4).asInstanceOf[Int],
rating = cols.get(5).asInstanceOf[Char]
rating = cols.get(5).asInstanceOf[Char],
createdAt = cols.get(6).asInstanceOf[Date],
totalFill = cols.get(7).asInstanceOf[BigDecimal]
)
}
}
Expand All @@ -34,6 +38,8 @@ object ColumnMap {
"quantity" -> "quantity",
"parentOrderId" -> "parentId",
"rating" -> "rating",
"createdAt" -> "createdAt",
"totalFill" -> "totalFill",
)
def toIgniteColumn(tableColumn: String): Option[String] =
orderMap.get(tableColumn)
Expand Down

0 comments on commit eb38607

Please sign in to comment.