-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#1167 move
buildQueryEntity
to ignite-plugin for better reuse
- invloves related refactoring and clean-ups in apache-ignite example.
- Loading branch information
1 parent
5c5d868
commit 6497216
Showing
11 changed files
with
60 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 0 additions & 20 deletions
20
...he-ignite/src/main/scala/org/finos/vuu/example/ignite/schema/ChildOrderEntityObject.scala
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
...e/apache-ignite/src/main/scala/org/finos/vuu/example/ignite/schema/ChildOrderSchema.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package org.finos.vuu.example.ignite.schema | ||
|
||
import org.apache.ignite.cache.QueryEntity | ||
import org.finos.vuu.core.module.simul.model.ChildOrder | ||
import org.finos.vuu.feature.ignite.utils.buildQueryEntity | ||
import org.finos.vuu.util.schema.{ExternalEntitySchema, ExternalEntitySchemaBuilder} | ||
|
||
object ChildOrderSchema { | ||
val schema: ExternalEntitySchema = ExternalEntitySchemaBuilder() | ||
.withCaseClass[ChildOrder] | ||
.withIndex("PARENTID_IDX", List("parentId")) | ||
.withIndex("CHILDID_IDX", List("id")) | ||
.build() | ||
|
||
val queryEntity: QueryEntity = buildQueryEntity(schema, classOf[Int], classOf[ChildOrder]) | ||
} |
8 changes: 8 additions & 0 deletions
8
...e-ignite/src/main/scala/org/finos/vuu/example/ignite/utils/getListToObjectConverter.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package org.finos.vuu.example.ignite.utils | ||
|
||
object getListToObjectConverter { | ||
def apply[ReturnType](obj: Object): List[_] => ReturnType = { | ||
val converter = obj.getClass.getMethods.find(x => x.getName == "apply" && x.isBridge).get | ||
values => converter.invoke(obj, values.map(_.asInstanceOf[AnyRef]): _*).asInstanceOf[ReturnType] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
...ite/src/test/scala/org/finos/vuu/example/ignite/schema/getListToObjectConverterTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package org.finos.vuu.example.ignite.schema | ||
|
||
import org.finos.vuu.example.ignite.utils.getListToObjectConverter | ||
import org.scalatest.featurespec.AnyFeatureSpec | ||
import org.scalatest.matchers.should.Matchers | ||
|
||
class getListToObjectConverterTest extends AnyFeatureSpec with Matchers { | ||
|
||
Feature("getListToObjectConverterTest") { | ||
Scenario("Can build Dto from a list of values") { | ||
val dto = getListToObjectConverter[TestDto](TestDto)(List("TestObject", 25.5)) | ||
|
||
dto shouldEqual TestDto(name = "TestObject", value = 25.5) | ||
} | ||
} | ||
|
||
private case class TestDto(name: String, value: Double) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters