16
16
17
17
package org.jacodb.testing.storage.kv
18
18
19
+ import jetbrains.exodus.io.DataReaderWriterProvider
20
+ import org.jacodb.impl.JcXodusErsSettings
19
21
import org.jacodb.impl.storage.kv.xodus.XODUS_KEY_VALUE_STORAGE_SPI
22
+ import org.junit.jupiter.api.Assertions.assertEquals
23
+ import org.junit.jupiter.api.Assertions.assertNotNull
24
+ import org.junit.jupiter.api.Assertions.assertNull
25
+ import org.junit.jupiter.api.Assertions.assertTrue
26
+ import org.junit.jupiter.api.Test
27
+ import java.lang.Long.getLong
20
28
21
29
class XodusKeyValueStorageTest : PluggableKeyValueStorageTest () {
22
30
23
31
override val kvStorageId = XODUS_KEY_VALUE_STORAGE_SPI
32
+
33
+ @Test
34
+ fun `test shared usage of the same db` () {
35
+ val settings = JcXodusErsSettings {
36
+ logDataReaderWriterProvider = DataReaderWriterProvider .WATCHING_READER_WRITER_PROVIDER
37
+ }
38
+ val roStorage = kvStorageSpi.newStorage(location = location, settings = settings)
39
+ roStorage.transactional { txn ->
40
+ assertTrue(txn.isReadonly)
41
+ assertNull(txn.get(" a map" , " key" .asByteArray))
42
+ }
43
+ putGet()
44
+ Thread .sleep(getLong(" jetbrains.exodus.io.watching.forceCheckEach" , 3000L ) + 500 )
45
+ roStorage.transactional { txn ->
46
+ val got = txn.get(" a map" , " key" .asByteArray)
47
+ assertNotNull(got)
48
+ assertEquals(" value" , got?.asString)
49
+ }
50
+ }
24
51
}
0 commit comments