fixes in exposed
This commit is contained in:
parent
17f6df0179
commit
9b48cc9214
@ -13,14 +13,14 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id "org.jetbrains.kotlin.multiplatform" version "$kotlin_version"
|
|
||||||
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version"
|
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version"
|
||||||
}
|
}
|
||||||
|
|
||||||
project.version = "$core_version"
|
project.version = "$core_version"
|
||||||
project.group = "com.insanusmokrassar"
|
project.group = "com.insanusmokrassar"
|
||||||
|
|
||||||
apply from: "publish.gradle"
|
apply plugin: "java-library"
|
||||||
|
apply plugin: 'kotlin'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenLocal()
|
mavenLocal()
|
||||||
@ -29,47 +29,18 @@ repositories {
|
|||||||
maven { url "https://kotlin.bintray.com/kotlinx" }
|
maven { url "https://kotlin.bintray.com/kotlinx" }
|
||||||
}
|
}
|
||||||
|
|
||||||
kotlin {
|
dependencies {
|
||||||
jvm()
|
api "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
||||||
js()
|
api "org.jetbrains.exposed:exposed-core:$exposed_version"
|
||||||
|
api "org.jetbrains.exposed:exposed-jdbc:$exposed_version"
|
||||||
|
|
||||||
sourceSets {
|
if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") {
|
||||||
commonMain {
|
api "com.insanusmokrassar:postssystem.core:$core_version"
|
||||||
dependencies {
|
} else {
|
||||||
implementation kotlin('stdlib')
|
implementation project(":postssystem.core")
|
||||||
api "org.jetbrains.exposed:exposed-core:$exposed_version"
|
|
||||||
|
|
||||||
if ((project.hasProperty('RELEASE_MODE') && project.property('RELEASE_MODE') == "true") || System.getenv('RELEASE_MODE') == "true") {
|
|
||||||
api "com.insanusmokrassar:postssystem.core:$core_version"
|
|
||||||
} else {
|
|
||||||
implementation project(":postssystem.core")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
commonTest {
|
|
||||||
dependencies {
|
|
||||||
implementation kotlin('test-common')
|
|
||||||
implementation kotlin('test-annotations-common')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
jvmMain {
|
|
||||||
dependencies {
|
|
||||||
implementation kotlin('stdlib-jdk8')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
jvmTest {
|
|
||||||
dependencies {
|
|
||||||
implementation kotlin('test-junit')
|
|
||||||
implementation "org.xerial:sqlite-jdbc:$test_sqlite_version"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
jsMain {
|
|
||||||
dependencies {
|
|
||||||
implementation kotlin('stdlib-js')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testImplementation "org.xerial:sqlite-jdbc:$test_sqlite_version"
|
||||||
|
testImplementation "org.jetbrains.kotlin:kotlin-test"
|
||||||
|
testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
|
||||||
}
|
}
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
exposed_version=0.23.1
|
exposed_version=0.23.1
|
||||||
test_sqlite_version=3.30.1
|
test_sqlite_version=3.28.0
|
||||||
|
@ -1 +1 @@
|
|||||||
{"bintrayConfig":{"repo":"InsanusMokrassar","packageName":"${project.name}","packageVcs":"https://github.com/PostsSystem/PostsSystemCore"},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://git.insanusmokrassar.com/PostsSystem/Core/src/master/LICENSE"}],"mavenConfig":{"name":"PostsSystem Core Exposed realization","description":"Exposed realisation for PostsSystem Core","url":"https://git.insanusmokrassar.com/PostsSystem/Core/","vcsUrl":"https://git.insanusmokrassar.com/PostsSystem/Core/.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]}}
|
{"bintrayConfig":{"repo":"InsanusMokrassar","packageName":"${project.name}","packageVcs":"https://github.com/PostsSystem/PostsSystemCore"},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://git.insanusmokrassar.com/PostsSystem/Core/src/master/LICENSE"}],"mavenConfig":{"name":"PostsSystem Core Exposed realization","description":"Exposed realisation for PostsSystem Core","url":"https://git.insanusmokrassar.com/PostsSystem/Core/","vcsUrl":"https://git.insanusmokrassar.com/PostsSystem/Core/.git","developers":[{"id":"InsanusMokrassar","name":"Ovsiannikov Aleksei","eMail":"ovsyannikov.alexey95@gmail.com"}]},"type":"JVM"}
|
@ -4,9 +4,9 @@ import com.insanusmokrassar.postssystem.core.content.SimpleTextContent
|
|||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.jetbrains.exposed.sql.Database
|
import org.jetbrains.exposed.sql.Database
|
||||||
import org.jetbrains.exposed.sql.transactions.transactionManager
|
import org.jetbrains.exposed.sql.transactions.transactionManager
|
||||||
import org.junit.jupiter.api.Test
|
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.sql.Connection
|
import java.sql.Connection
|
||||||
|
import kotlin.test.Test
|
||||||
|
|
||||||
class ExposedContentAPICommonTests {
|
class ExposedContentAPICommonTests {
|
||||||
private val tempFolder = System.getProperty("java.io.tmpdir")!!
|
private val tempFolder = System.getProperty("java.io.tmpdir")!!
|
||||||
@ -53,4 +53,4 @@ class ExposedContentAPICommonTests {
|
|||||||
File(it).delete()
|
File(it).delete()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -4,11 +4,11 @@ import com.insanusmokrassar.postssystem.core.post.SimplePost
|
|||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import org.jetbrains.exposed.sql.Database
|
import org.jetbrains.exposed.sql.Database
|
||||||
import org.jetbrains.exposed.sql.transactions.transactionManager
|
import org.jetbrains.exposed.sql.transactions.transactionManager
|
||||||
import org.junit.jupiter.api.*
|
import org.sqlite.JDBC
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.sql.Connection
|
import java.sql.Connection
|
||||||
|
import kotlin.test.*
|
||||||
|
|
||||||
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
|
|
||||||
class ExposedPostsAPICommonTests {
|
class ExposedPostsAPICommonTests {
|
||||||
private val tempFolder = System.getProperty("java.io.tmpdir")!!
|
private val tempFolder = System.getProperty("java.io.tmpdir")!!
|
||||||
|
|
||||||
@ -16,16 +16,17 @@ class ExposedPostsAPICommonTests {
|
|||||||
private lateinit var databaseFiles: List<File>
|
private lateinit var databaseFiles: List<File>
|
||||||
private lateinit var apis: List<ExposedPostsAPI>
|
private lateinit var apis: List<ExposedPostsAPI>
|
||||||
|
|
||||||
@BeforeAll
|
@BeforeTest
|
||||||
fun prepare() {
|
fun prepare() {
|
||||||
databaseFiles = (0 until numberOfDatabases).map {
|
databaseFiles = (0 until numberOfDatabases).map {
|
||||||
File("$tempFolder/ExposedPostsAPICommonTestsDB$it.db")
|
File("$tempFolder/ExposedPostsAPICommonTestsDB$it.db")
|
||||||
}
|
}
|
||||||
apis = databaseFiles.map {
|
apis = databaseFiles.map {
|
||||||
|
val database = Database.connect("jdbc:sqlite:${it.absolutePath}").also {
|
||||||
|
it.transactionManager.defaultIsolationLevel = Connection.TRANSACTION_SERIALIZABLE
|
||||||
|
}
|
||||||
ExposedPostsAPI(
|
ExposedPostsAPI(
|
||||||
Database.Companion.connect("jdbc:sqlite:${it.absolutePath}", driver = "org.sqlite.JDBC").also {
|
database
|
||||||
it.transactionManager.defaultIsolationLevel = Connection.TRANSACTION_SERIALIZABLE
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,7 +56,7 @@ class ExposedPostsAPICommonTests {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterAll
|
@AfterTest
|
||||||
fun `Close and delete databases`() {
|
fun `Close and delete databases`() {
|
||||||
databaseFiles.forEach {
|
databaseFiles.forEach {
|
||||||
it.delete()
|
it.delete()
|
Loading…
x
Reference in New Issue
Block a user