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
21
21
import kotlin.test.BeforeTest
22
22
import kotlin.test.Test
23
23
import kotlin.test.assertEquals
24
+ import kotlin.test.assertTrue
24
25
25
26
class IgnitePostgresTest {
26
27
lateinit var store: IgniteStoreClient
@@ -35,6 +36,18 @@ class IgnitePostgresTest {
35
36
store.dispose()
36
37
}
37
38
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
+
38
51
@Test
39
52
fun `store immutable object in repository` () {
40
53
val value = " immutable value " + System .nanoTime()
Original file line number Diff line number Diff line change 16
16
17
17
package org.modelix.model.server.store
18
18
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
+ */
19
27
data class ObjectInRepository (private val repositoryId : String , val key : String ) : Comparable<ObjectInRepository> {
20
28
fun isGlobal () = repositoryId == " "
21
29
fun getRepositoryId () = repositoryId.takeIf { it != " " }
Original file line number Diff line number Diff line change 77
77
<property name =" keyType" value =" org.modelix.model.server.store.ObjectInRepository" />
78
78
<property name =" valueType" value =" java.lang.String" />
79
79
<property name =" keyFields" >
80
+ <!-- Order of fields must be consistent with ObjectInRepository -->
80
81
<list >
81
82
<bean class =" org.apache.ignite.cache.store.jdbc.JdbcTypeField" >
82
83
<property name =" databaseFieldType" >
83
84
<util : constant static-field =" java.sql.Types.VARCHAR" />
84
85
</property >
85
- <property name =" databaseFieldName" value =" key " />
86
+ <property name =" databaseFieldName" value =" repository " />
86
87
<property name =" javaFieldType" value =" java.lang.String" />
87
- <property name =" javaFieldName" value =" key " />
88
+ <property name =" javaFieldName" value =" repositoryId " />
88
89
</bean >
89
90
<bean class =" org.apache.ignite.cache.store.jdbc.JdbcTypeField" >
90
91
<property name =" databaseFieldType" >
91
92
<util : constant static-field =" java.sql.Types.VARCHAR" />
92
93
</property >
93
- <property name =" databaseFieldName" value =" repository " />
94
+ <property name =" databaseFieldName" value =" key " />
94
95
<property name =" javaFieldType" value =" java.lang.String" />
95
- <property name =" javaFieldName" value =" repositoryId " />
96
+ <property name =" javaFieldName" value =" key " />
96
97
</bean >
97
98
</list >
98
99
</property >
You can’t perform that action at this time.
0 commit comments