From 0af292fc209ed43b68e2e80ea222e5502e46b024 Mon Sep 17 00:00:00 2001 From: aegbert Date: Mon, 7 Oct 2024 11:17:51 -0600 Subject: [PATCH] Dont use SchedulerFactory reserved prefixes --- .../main/scala/com/lucidchart/piezo/ConnectionProvider.scala | 4 ++-- worker/src/test/resources/quartz_test_mysql.properties | 2 +- .../quartz_test_mysql_failover_every_connection.properties | 4 ++-- worker/src/test/scala/com/lucidchart/piezo/ModelTest.scala | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/worker/src/main/scala/com/lucidchart/piezo/ConnectionProvider.scala b/worker/src/main/scala/com/lucidchart/piezo/ConnectionProvider.scala index d381c56..6d9be51 100644 --- a/worker/src/main/scala/com/lucidchart/piezo/ConnectionProvider.scala +++ b/worker/src/main/scala/com/lucidchart/piezo/ConnectionProvider.scala @@ -21,7 +21,7 @@ class ConnectionProvider(props: Properties) { val logger = LoggerFactory.getLogger(this.getClass) private val dataSource = props.getProperty("org.quartz.jobStore.dataSource") private val jdbcURL = if (dataSource != null) props.getProperty("org.quartz.dataSource." + dataSource + ".URL") else null - private val detectIpAddressFailover = if (dataSource != null) props.getProperty("org.quartz.dataSource." + dataSource + ".ipFailover") == "true" else false + private val detectIpAddressFailover = props.getProperty("supportIPFailover") == "true" // Removes "jdbc:mysql://" prefix and ":{port}..." suffix private val dataSourceHostname = if (jdbcURL != null) jdbcURL.replace("jdbc:mysql://", "").split(":")(0) else null @@ -37,7 +37,7 @@ class ConnectionProvider(props: Properties) { private val pool: Pool = new Pool(getIP) // Intended to be used only for tests. This mocks an IP failover every time a connection is retreived - private val causeFailoverEveryConnection = if (dataSource != null) props.getProperty("org.quartz.dataSource." + dataSource + ".causeFailoverEveryConnection") == "true" else false + private val causeFailoverEveryConnection = props.getProperty("causeFailoverEveryConnection") == "true" def createNewConnectionProvider(): Option[HikariCpPoolingConnectionProvider] = { if(dataSource != null) { diff --git a/worker/src/test/resources/quartz_test_mysql.properties b/worker/src/test/resources/quartz_test_mysql.properties index 2c82d48..8b9d8c1 100644 --- a/worker/src/test/resources/quartz_test_mysql.properties +++ b/worker/src/test/resources/quartz_test_mysql.properties @@ -31,4 +31,4 @@ org.quartz.dataSource.test_jobs.user: root org.quartz.dataSource.test_jobs.password: root org.quartz.dataSource.test_jobs.maxConnections: 10 org.quartz.dataSource.test_jobs.validationQuery: select 0 -org.quartz.dataSource.test_jobs.ipFailover: true +supportIPFailover: true diff --git a/worker/src/test/resources/quartz_test_mysql_failover_every_connection.properties b/worker/src/test/resources/quartz_test_mysql_failover_every_connection.properties index 02cba1d..4a05c22 100644 --- a/worker/src/test/resources/quartz_test_mysql_failover_every_connection.properties +++ b/worker/src/test/resources/quartz_test_mysql_failover_every_connection.properties @@ -31,7 +31,7 @@ org.quartz.dataSource.test_jobs.user: root org.quartz.dataSource.test_jobs.password: root org.quartz.dataSource.test_jobs.maxConnections: 10 org.quartz.dataSource.test_jobs.validationQuery: select 0 -org.quartz.dataSource.test_jobs.ipFailover: true +supportIPFailover: true # Unique configuration to this file -org.quartz.dataSource.test_jobs.causeFailoverEveryConnection: true +causeFailoverEveryConnection: true diff --git a/worker/src/test/scala/com/lucidchart/piezo/ModelTest.scala b/worker/src/test/scala/com/lucidchart/piezo/ModelTest.scala index 90cb34c..e45fa11 100644 --- a/worker/src/test/scala/com/lucidchart/piezo/ModelTest.scala +++ b/worker/src/test/scala/com/lucidchart/piezo/ModelTest.scala @@ -69,7 +69,7 @@ class ModelTest extends Specification with BeforeAll with AfterAll { "JobHistoryModel" should { "work correctly" in { - properties.getProperty("org.quartz.dataSource.test_jobs.causeFailoverEveryConnection") must beNull + properties.getProperty("causeFailoverEveryConnection") must beNull val jobHistoryModel = new JobHistoryModel(properties) val jobKey = new JobKey("blah", "blah") val triggerKey = new TriggerKey("blahtn", "blahtg") @@ -81,7 +81,7 @@ class ModelTest extends Specification with BeforeAll with AfterAll { } "work correctly with a failover for every connection to the database" in { - propertiesWithFailoverEveryConnection.getProperty("org.quartz.dataSource.test_jobs.causeFailoverEveryConnection") mustEqual("true") + propertiesWithFailoverEveryConnection.getProperty("causeFailoverEveryConnection") mustEqual("true") val jobHistoryModel = new JobHistoryModel(propertiesWithFailoverEveryConnection) val jobKey = new JobKey("blahc", "blahc") val triggerKey = new TriggerKey("blahtnc", "blahtgc")