From 06c702ba03e3f319f069c4b1cee0b163d8ee3d2f Mon Sep 17 00:00:00 2001 From: chris Date: Fri, 29 Dec 2023 09:57:05 +0000 Subject: [PATCH] #989 fixed some of the merge issues --- .../basket/TestHelper/TestDataFactory.scala | 2 +- example/main-java/pom.xml | 9 +++ .../org/finos/vuu/module/MyExampleModule.java | 2 +- .../java/org/finos/vuu/JavaTestExample.java | 60 +++++++++++++++++++ 4 files changed, 71 insertions(+), 2 deletions(-) create mode 100644 example/main-java/src/test/java/org/finos/vuu/JavaTestExample.java diff --git a/example/basket/src/test/scala/org/finos/vuu/core/module/basket/TestHelper/TestDataFactory.scala b/example/basket/src/test/scala/org/finos/vuu/core/module/basket/TestHelper/TestDataFactory.scala index a7ce889b1..526a13f93 100644 --- a/example/basket/src/test/scala/org/finos/vuu/core/module/basket/TestHelper/TestDataFactory.scala +++ b/example/basket/src/test/scala/org/finos/vuu/core/module/basket/TestHelper/TestDataFactory.scala @@ -1,7 +1,7 @@ package org.finos.vuu.core.module.basket.TestHelper +import org.finos.vuu.core.module.basket.BasketModule.{BasketTradingColumnNames => BT, BasketTradingConstituentColumnNames => BTC} import org.finos.vuu.core.table.RowWithData -import org.finos.vuu.core.module.basket.BasketModule.{Sides, BasketColumnNames => B, BasketConstituentColumnNames => BC, BasketTradingColumnNames => BT, BasketTradingConstituentColumnNames => BTC} object TestDataFactory { def uuid = java.util.UUID.randomUUID.toString diff --git a/example/main-java/pom.xml b/example/main-java/pom.xml index 6f9014449..7e1e2f1b3 100644 --- a/example/main-java/pom.xml +++ b/example/main-java/pom.xml @@ -19,6 +19,15 @@ 0.9.36-SNAPSHOT + + org.finos.vuu + vuu + 0.9.36-SNAPSHOT + tests + test-jar + test + + org.finos.vuu basket diff --git a/example/main-java/src/main/java/org/finos/vuu/module/MyExampleModule.java b/example/main-java/src/main/java/org/finos/vuu/module/MyExampleModule.java index 188ac9ffa..2d3d441ff 100644 --- a/example/main-java/src/main/java/org/finos/vuu/module/MyExampleModule.java +++ b/example/main-java/src/main/java/org/finos/vuu/module/MyExampleModule.java @@ -14,7 +14,7 @@ public class MyExampleModule extends DefaultModule { - private final String NAME = "MY_MOD"; + public static final String NAME = "MY_MOD"; public ViewServerModule create(final TableDefContainer tableDefContainer){ return ModuleFactory.withNamespace(NAME, tableDefContainer) diff --git a/example/main-java/src/test/java/org/finos/vuu/JavaTestExample.java b/example/main-java/src/test/java/org/finos/vuu/JavaTestExample.java new file mode 100644 index 000000000..617a5e29d --- /dev/null +++ b/example/main-java/src/test/java/org/finos/vuu/JavaTestExample.java @@ -0,0 +1,60 @@ +package org.finos.vuu; + +import org.finos.toolbox.jmx.MetricsProvider; +import org.finos.toolbox.jmx.MetricsProviderImpl; +import org.finos.toolbox.lifecycle.LifecycleContainer; +import org.finos.toolbox.time.Clock; +import org.finos.toolbox.time.TestFriendlyClock; +import org.finos.vuu.core.module.TableDefContainer; +import org.finos.vuu.core.module.ViewServerModule; +import org.finos.vuu.module.MyExampleModule; +import org.finos.vuu.provider.MockProvider; +import org.finos.vuu.test.VuuServerTestCase; +import org.finos.vuu.viewport.ViewPort; +import org.scalatest.Ignore; +import scala.collection.immutable.Seq; + +import java.util.Arrays; +import java.util.stream.Collectors; + +import static scala.jdk.javaapi.CollectionConverters.asScala; + +public class JavaTestExample extends VuuServerTestCase { + + public static Seq toScalaSeq(ViewServerModule... modules){ + return new scala.collection.mutable.ListBuffer().addAll(asScala(Arrays.stream(modules).collect(Collectors.toList()))).toSeq(); + } + + + @Ignore + public void testVuuServerFunctionality() throws Exception{ + + final MetricsProvider metrics = new MetricsProviderImpl(); + final Clock clock = new TestFriendlyClock(1000000000000L); + final LifecycleContainer lifecycle = new LifecycleContainer(clock); + final TableDefContainer tableDefContainer = new TableDefContainer(); + + final ViewServerModule module = new MyExampleModule().create(tableDefContainer); + + withVuuServer(toScalaSeq(module), (vuuServer) -> { + + vuuServer.login("test", "test"); + + ViewPort viewport = vuuServer.createViewPort(MyExampleModule.NAME, "myTable"); + + MockProvider provider = vuuServer.getProvider(MyExampleModule.NAME, "myTable"); + +// provider.tick("123", Map.of("id", "123", "foo", "bar", "myInt", 123)); +// +// Seq updates = combineQs(viewport); +// +// assertVpEq(updates, () -> asList( +// asList("id", "foo", "myInt"), +// asList("123", "bar", 123) +// )); + + return null; + }, clock, lifecycle, metrics); + } + +}