Skip to content

Commit

Permalink
Dont use SchedulerFactory reserved prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
aegbert5 committed Oct 7, 2024
1 parent c571102 commit 0af292f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion worker/src/test/resources/quartz_test_mysql.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions worker/src/test/scala/com/lucidchart/piezo/ModelTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -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")
Expand Down

0 comments on commit 0af292f

Please sign in to comment.