Sitelet https://github.com/jasync-sql/jasync-sql/pull/370/files
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion r2dbc-mysql/src/main/java/JasyncConnectionFactory.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import org.reactivestreams.Publisher
import reactor.core.publisher.Mono
import reactor.kotlin.core.publisher.toMono

class JasyncConnectionFactory(private val mySQLConnectionFactory: MySQLConnectionFactory) : ConnectionFactory {
class JasyncConnectionFactory(val mySQLConnectionFactory: MySQLConnectionFactory) : ConnectionFactory {

override fun create(): Publisher<out Connection> {
return Mono.defer { mySQLConnectionFactory.create().toMono().map { JasyncClientConnection(it, mySQLConnectionFactory) } }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,31 +1,24 @@
package com.github.jasync.r2dbc.mysql

import com.github.jasync.sql.db.SSLConfiguration
import io.mockk.every
import io.mockk.mockkObject
import io.mockk.verify
import io.r2dbc.spi.ConnectionFactoryOptions
import org.junit.Assert.assertEquals
import org.junit.Test

internal class MysqlConnectionFactoryProviderTest {
class MysqlConnectionFactoryProviderTest {

private val provider = MysqlConnectionFactoryProvider()

@Test
fun shouldCreateMysqlConnectionWithMysqlSSLConfigurationFactory() {
// given
mockkObject(MysqlSSLConfigurationFactory)
every { MysqlSSLConfigurationFactory.create(any()) } returns SSLConfiguration()

val options =
ConnectionFactoryOptions.parse("r2dbc:mysql://user@host:443/")

// when
provider.create(options)
val result = provider.create(options)

// then
verify {
MysqlSSLConfigurationFactory.create(options)
}
assertEquals(SSLConfiguration(), result.mySQLConnectionFactory.configuration.ssl)
}
}