Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
mgramin committed Aug 23, 2019
1 parent fe4d2e1 commit a865987
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ open class SimpleEndpoint(
dataSource!!
} else {
val dataSourceNew = DataSource()
if (properties().containsKey("jdbc.url")) {
dataSourceNew.url = properties()["jdbc.url"].toString()
if (properties().containsKey("jdbc_url")) {
dataSourceNew.url = properties()["jdbc_url"].toString()
} else {
val jdbcProtocol = properties()["jdbc.protocol"]
val dbName = properties()["db.name"]
val dbPort = properties()["db.port"]
val jdbcProtocol = properties()["jdbc_protocol"]
val dbName = properties()["db_name"]
val dbPort = properties()["db_port"]
dataSourceNew.url = "$jdbcProtocol://$host:$dbPort/$dbName"
}
dataSourceNew.driverClassName = properties()["jdbc.driver.class.name"].toString()
dataSourceNew.username = properties()["db.user"].toString()
dataSourceNew.password = properties()["db.password"].toString()
dataSourceNew.driverClassName = properties()["jdbc_driver_class_name"].toString()
dataSourceNew.username = properties()["db_user"].toString()
dataSourceNew.password = properties()["db_password"].toString()
dataSourceNew.minIdle = 1
dataSourceNew.maxActive = 3
dataSourceNew.maxIdle = 3
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class FsResourceType(
fun resourceTypes() = resourceTypes

private val resourceTypes: List<ResourceType> =
walk(FileSystemResource(endpoints.first().properties()["fs.base.folder"].toString()).file.path)
walk(FileSystemResource(endpoints.first().properties()["fs_base_folder"].toString()).file.path)

private fun walk(path: String) =
File(path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class SqlResourceType(
endpoints
.map { connection ->
return@map createQuery(uri, connection, specificDialect
?: connection.properties()["sql.dialect"].toString()).execute(hashMapOf("uri" to uri))
?: connection.properties()["sql_dialect"].toString()).execute(hashMapOf("uri" to uri))
.map<Map<String, Any>?> {
val toMutableMap = it.toMutableMap()
toMutableMap["endpoint"] = connection.name()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ class FsResourceTypeTest {
dbMd.host = "127.0.0.1"
dbMd.properties = """
{
"fs.base.folder": "conf/h2/md/database",
"sql.dialect": "h2",
"jdbc.url": "jdbc:h2:mem:;INIT=RUNSCRIPT FROM 'classpath:schema.sql';",
"jdbc.driver.class.name": "org.h2.Driver"
"fs_base_folder": "conf/h2/md/database",
"sql_dialect": "h2",
"jdbc_url": "jdbc:h2:mem:;INIT=RUNSCRIPT FROM 'classpath:schema.sql';",
"jdbc_driver_class_name": "org.h2.Driver"
}
""".trimIndent()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ class SqlResourceTypeTest {
db.host = "127.0.0.1"
db.properties = """
{
"sql.dialect": "h2",
"jdbc.url": "jdbc:h2:mem:;INIT=RUNSCRIPT FROM 'classpath:schema.sql';",
"jdbc.driver.class.name": "org.h2.Driver"
"sql_dialect": "h2",
"jdbc_url": "jdbc:h2:mem:;INIT=RUNSCRIPT FROM 'classpath:schema.sql';",
"jdbc_driver_class_name": "org.h2.Driver"
}
""".trimIndent()
}
Expand Down
8 changes: 4 additions & 4 deletions src/test/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ conf:
host: 127.0.0.1
properties: >
{
"sql.dialect": "h2",
"fs.base.folder": "conf/h2/md/database",
"jdbc.url": "jdbc:h2:mem:;INIT=RUNSCRIPT FROM 'classpath:schema.sql';",
"jdbc.driver.class.name": "org.h2.Driver",
"sql_dialect": "h2",
"fs_base_folder": "conf/h2/md/database",
"jdbc_url": "jdbc:h2:mem:;INIT=RUNSCRIPT FROM 'classpath:schema.sql';",
"jdbc_driver_class_name": "org.h2.Driver",
"jdbc.user": "",
"jdbc.password": "",
"os.query.rest.port": "8082",
Expand Down

0 comments on commit a865987

Please sign in to comment.