15
15
*/
16
16
package jetbrains.exodus.entitystore.youtrackdb
17
17
18
+ import YTDBDatabaseProviderFactory
19
+ import YouTrackDBConfigFactory
20
+ import YouTrackDBFactory
18
21
import com.jetbrains.youtrack.db.api.DatabaseType
19
22
import com.jetbrains.youtrack.db.api.YouTrackDB
20
23
import com.jetbrains.youtrack.db.api.exception.RecordNotFoundException
@@ -27,7 +30,6 @@ import org.junit.Assert
27
30
import org.junit.Test
28
31
import org.junit.runner.RunWith
29
32
import org.junit.runners.Parameterized
30
- import java.lang.AssertionError
31
33
import java.nio.file.Files
32
34
import java.util.*
33
35
import kotlin.io.path.absolutePathString
@@ -42,7 +44,7 @@ class EncryptedDBTest(val number: Int) {
42
44
}
43
45
}
44
46
45
- lateinit var provider: YTDBDatabaseProviderImpl
47
+ lateinit var provider: YTDBDatabaseProvider
46
48
lateinit var db: YouTrackDB
47
49
48
50
private fun createConfig (key : ByteArray? ): YTDBDatabaseConfig {
@@ -74,8 +76,9 @@ class EncryptedDBTest(val number: Int) {
74
76
val config = createConfig(cipherKey)
75
77
val noEncryptionConfig = createConfig(null )
76
78
logger.info(" Connect to db and create test vertex class" )
77
- db = initYouTrackDb(config.connectionConfig)
78
- provider = YTDBDatabaseProviderImpl (config, db)
79
+ val dbConfig = YouTrackDBConfigFactory .createDefaultDBConfig(config)
80
+ db = YouTrackDBFactory .initYouTrackDb(config, dbConfig)
81
+ provider = YTDBDatabaseProviderFactory .createProvider(config, db, dbConfig)
79
82
provider.withSession { session ->
80
83
session.createVertexClass(" TEST" )
81
84
}
@@ -91,8 +94,8 @@ class EncryptedDBTest(val number: Int) {
91
94
logger.info(" Close the DB" )
92
95
Thread .sleep(1000 )
93
96
logger.info(" Connect to db one more time and read" )
94
- db = initYouTrackDb(config.connectionConfig )
95
- provider = YTDBDatabaseProviderImpl (config, db)
97
+ db = YouTrackDBFactory . initYouTrackDb(config, dbConfig )
98
+ provider = YTDBDatabaseProviderFactory .createProvider (config, db, dbConfig )
96
99
provider.withSession { session ->
97
100
session.executeInTx {
98
101
val vertex = session.query(" SELECT FROM TEST" ).vertexStream().toList()
@@ -103,9 +106,9 @@ class EncryptedDBTest(val number: Int) {
103
106
db.close()
104
107
Thread .sleep(1000 )
105
108
logger.info(" Connect to db one more time without encryption" )
106
- db = initYouTrackDb(config.connectionConfig )
109
+ db = YouTrackDBFactory . initYouTrackDb(config, dbConfig )
107
110
try {
108
- YTDBDatabaseProviderImpl (noEncryptionConfig, db).apply {
111
+ YTDBDatabaseProviderFactory .createProvider (noEncryptionConfig, db, dbConfig ).apply {
109
112
withSession { session ->
110
113
session.executeInTx {
111
114
val vertex = session.query(" SELECT FROM TEST" ).vertexStream().toList()
0 commit comments