fixes in exposed

This commit is contained in:
InsanusMokrassar 2020-04-10 16:30:20 +06:00
parent 17f6df0179
commit 9b48cc9214
9 changed files with 25 additions and 53 deletions

View File

@ -13,14 +13,14 @@ buildscript {
}
plugins {
id "org.jetbrains.kotlin.multiplatform" version "$kotlin_version"
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version"
}
project.version = "$core_version"
project.group = "com.insanusmokrassar"
apply from: "publish.gradle"
apply plugin: "java-library"
apply plugin: 'kotlin'
repositories {
mavenLocal()
@ -29,47 +29,18 @@ repositories {
maven { url "https://kotlin.bintray.com/kotlinx" }
}
kotlin {
jvm()
js()
dependencies {
api "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
api "org.jetbrains.exposed:exposed-core:$exposed_version"
api "org.jetbrains.exposed:exposed-jdbc:$exposed_version"
sourceSets {
commonMain {
dependencies {
implementation kotlin('stdlib')
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')
}
}
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")
}
testImplementation "org.xerial:sqlite-jdbc:$test_sqlite_version"
testImplementation "org.jetbrains.kotlin:kotlin-test"
testImplementation "org.jetbrains.kotlin:kotlin-test-junit"
}

View File

@ -1,2 +1,2 @@
exposed_version=0.23.1
test_sqlite_version=3.30.1
test_sqlite_version=3.28.0

View File

@ -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"}

View File

@ -4,9 +4,9 @@ import com.insanusmokrassar.postssystem.core.content.SimpleTextContent
import kotlinx.coroutines.runBlocking
import org.jetbrains.exposed.sql.Database
import org.jetbrains.exposed.sql.transactions.transactionManager
import org.junit.jupiter.api.Test
import java.io.File
import java.sql.Connection
import kotlin.test.Test
class ExposedContentAPICommonTests {
private val tempFolder = System.getProperty("java.io.tmpdir")!!

View File

@ -4,11 +4,11 @@ import com.insanusmokrassar.postssystem.core.post.SimplePost
import kotlinx.coroutines.runBlocking
import org.jetbrains.exposed.sql.Database
import org.jetbrains.exposed.sql.transactions.transactionManager
import org.junit.jupiter.api.*
import org.sqlite.JDBC
import java.io.File
import java.sql.Connection
import kotlin.test.*
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
class ExposedPostsAPICommonTests {
private val tempFolder = System.getProperty("java.io.tmpdir")!!
@ -16,16 +16,17 @@ class ExposedPostsAPICommonTests {
private lateinit var databaseFiles: List<File>
private lateinit var apis: List<ExposedPostsAPI>
@BeforeAll
@BeforeTest
fun prepare() {
databaseFiles = (0 until numberOfDatabases).map {
File("$tempFolder/ExposedPostsAPICommonTestsDB$it.db")
}
apis = databaseFiles.map {
val database = Database.connect("jdbc:sqlite:${it.absolutePath}").also {
it.transactionManager.defaultIsolationLevel = Connection.TRANSACTION_SERIALIZABLE
}
ExposedPostsAPI(
Database.Companion.connect("jdbc:sqlite:${it.absolutePath}", driver = "org.sqlite.JDBC").also {
it.transactionManager.defaultIsolationLevel = Connection.TRANSACTION_SERIALIZABLE
}
database
)
}
}
@ -55,7 +56,7 @@ class ExposedPostsAPICommonTests {
}
}
@AfterAll
@AfterTest
fun `Close and delete databases`() {
databaseFiles.forEach {
it.delete()