File tree Expand file tree Collapse file tree 3 files changed +26
-4
lines changed
model-server-test/src/test/kotlin
kotlin/org/modelix/model/server/store
resources/org/modelix/model/server/store Expand file tree Collapse file tree 3 files changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -21,6 +21,7 @@ import kotlin.test.AfterTest
2121import kotlin.test.BeforeTest
2222import kotlin.test.Test
2323import kotlin.test.assertEquals
24+ import kotlin.test.assertTrue
2425
2526class IgnitePostgresTest {
2627 lateinit var store: IgniteStoreClient
@@ -35,6 +36,18 @@ class IgnitePostgresTest {
3536 store.dispose()
3637 }
3738
39+ @Test
40+ fun `can get values for multiple keys when Ignite has not cached the keys yet` () {
41+ // The actual keys are irrelevant for this test.
42+ // A fresh client will have no keys cached.
43+ val keys = listOf (" zK4Y2*xIEWlYlQGJL2Va4Z0ESgpWgnSQcOmnPeqt34PA" , " zxgZN*oLuudxsu42ppSEGnCib8LkrSvauQk2B6T7AW6o" )
44+ .map { ObjectInRepository .global(it) }
45+
46+ val values = store.getAll(keys)
47+
48+ assertTrue(values.filterNotNull().isNotEmpty())
49+ }
50+
3851 @Test
3952 fun `store immutable object in repository` () {
4053 val value = " immutable value " + System .nanoTime()
Original file line number Diff line number Diff line change 1616
1717package org.modelix.model.server.store
1818
19+ /* *
20+ * A composed key used in the key-value stores to persist model data.
21+ * The key is composed of a [key] and an optional [repositoryId].
22+ * The [repositoryId] is set when an entry is scoped to the repository.
23+ *
24+ * This class is directly used with the Ignite cache (see [IgniteStoreClient]).
25+ * Therefore, the order of fields must be consistent with the configuration of `JdbcType` in ignite.xml.
26+ */
1927data class ObjectInRepository (private val repositoryId : String , val key : String ) : Comparable<ObjectInRepository> {
2028 fun isGlobal () = repositoryId == " "
2129 fun getRepositoryId () = repositoryId.takeIf { it != " " }
Original file line number Diff line number Diff line change 7777 <property name =" keyType" value =" org.modelix.model.server.store.ObjectInRepository" />
7878 <property name =" valueType" value =" java.lang.String" />
7979 <property name =" keyFields" >
80+ <!-- Order of fields must be consistent with ObjectInRepository -->
8081 <list >
8182 <bean class =" org.apache.ignite.cache.store.jdbc.JdbcTypeField" >
8283 <property name =" databaseFieldType" >
8384 <util : constant static-field =" java.sql.Types.VARCHAR" />
8485 </property >
85- <property name =" databaseFieldName" value =" key " />
86+ <property name =" databaseFieldName" value =" repository " />
8687 <property name =" javaFieldType" value =" java.lang.String" />
87- <property name =" javaFieldName" value =" key " />
88+ <property name =" javaFieldName" value =" repositoryId " />
8889 </bean >
8990 <bean class =" org.apache.ignite.cache.store.jdbc.JdbcTypeField" >
9091 <property name =" databaseFieldType" >
9192 <util : constant static-field =" java.sql.Types.VARCHAR" />
9293 </property >
93- <property name =" databaseFieldName" value =" repository " />
94+ <property name =" databaseFieldName" value =" key " />
9495 <property name =" javaFieldType" value =" java.lang.String" />
95- <property name =" javaFieldName" value =" repositoryId " />
96+ <property name =" javaFieldName" value =" key " />
9697 </bean >
9798 </list >
9899 </property >
You can’t perform that action at this time.
0 commit comments