8000 test ssl config by oshai · Pull Request #370 · jasync-sql/jasync-sql · GitHub
[go: up one dir, main page]

Skip to content

test ssl config #370

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2023
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)
}
}
0