Skip to content

Commit 51413b5

Browse files
committed
sql ops simplified for mssql
1 parent 4a5f3b1 commit 51413b5

File tree

4 files changed

+8
-7
lines changed
  • lib
    • stove-testing-e2e-mongodb/src/main/kotlin/com/trendyol/stove/testing/e2e/mongodb
    • stove-testing-e2e-rdbms-mssql/src
    • stove-testing-e2e-rdbms/src/main/kotlin/com/trendyol/stove/testing/e2e/rdbms

4 files changed

+8
-7
lines changed

lib/stove-testing-e2e-mongodb/src/main/kotlin/com/trendyol/stove/testing/e2e/mongodb/MongodbSystem.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import kotlin.collections.listOf
2323
import kotlin.collections.plus
2424
import kotlin.collections.set
2525

26-
@StoveDsl
26+
@MongoDsl
2727
class MongodbSystem internal constructor(
2828
override val testSystem: TestSystem,
2929
val context: MongodbContext

lib/stove-testing-e2e-rdbms-mssql/src/main/kotlin/com/trendyol/stove/testing/e2e/rdbms/mssql/MsSqlSystem.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@ class MsSqlSystem internal constructor(
6767
override fun configuration(): List<String> = context.configureExposedConfiguration(exposedConfiguration)
6868

6969
@MssqlDsl
70-
suspend fun ops(operations: suspend SqlOperations.() -> Unit) {
70+
suspend fun ops(operations: suspend Handle.() -> Unit) {
7171
sqlOperations.isOpen().let {
7272
if (it) {
73-
operations(sqlOperations)
73+
sqlOperations.transaction(operations)
7474
} else {
7575
throw IllegalStateException("The connection is not open. Please check the connection status.")
7676
}

lib/stove-testing-e2e-rdbms-mssql/src/test/kotlin/com/trendyol/stove/testing/e2e/rdbms/mssql/MssqlSystemTest.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,8 @@ class MssqlSystemTests : ShouldSpec({
6868
validate {
6969
mssql {
7070
ops {
71-
transaction {
72-
val result = select("SELECT 1")
73-
result.rowsUpdated.awaitFirstOrNull() shouldBe 1
74-
}
71+
val result = select("SELECT 1")
72+
result.rowsUpdated.awaitFirstOrNull() shouldBe 1
7573
}
7674
}
7775
}

lib/stove-testing-e2e-rdbms/src/main/kotlin/com/trendyol/stove/testing/e2e/rdbms/SqlOperations.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ class SqlOperations(private val connectionFactory: ConnectionFactory) {
1616
* Opens a connection from the factory.
1717
*/
1818
suspend fun open() {
19+
if (isOpen()) {
20+
return
21+
}
1922
connection = this.connectionFactory.create().awaitFirst()
2023
}
2124

0 commit comments

Comments
 (0)