Skip to content

Commit

Permalink
fix for issue davidkiss#4 - configured liquibase config file to be re…
Browse files Browse the repository at this point in the history
…ad from classpath
  • Loading branch information
davidkiss committed Mar 8, 2016
1 parent 01b00ad commit 1807e5a
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 3 deletions.
10 changes: 10 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@
</properties>

<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
Expand Down Expand Up @@ -53,6 +57,12 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.1.1</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public SchedulerFactoryBean schedulerFactoryBean(DataSource dataSource, JobFacto
factory.setJobFactory(jobFactory);

factory.setQuartzProperties(quartzProperties());
factory.setTriggers(sampleJobTrigger);
// factory.setTriggers(sampleJobTrigger);

return factory;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
spring.datasource.url=jdbc:h2:~/test
spring.datasource.url=jdbc:h2:mem:test
spring.datasource.username=sa
spring.datasource.password=
spring.datasource.driver-class-name=org.h2.Driver

liquibase.change-log=db/changelog/db.changelog-master.xml
liquibase.change-log=classpath:db/changelog/db.changelog-master.xml

quartz.enabled=true

Expand Down
31 changes: 31 additions & 0 deletions src/test/java/com/kaviddiss/bootquartz/ApplicationTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package com.kaviddiss.bootquartz;

import com.kaviddiss.bootquartz.job.SampleJob;
import org.quartz.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.test.context.testng.AbstractTransactionalTestNGSpringContextTests;
import org.testng.annotations.Test;

@SpringApplicationConfiguration(classes = Application.class)
public class ApplicationTest extends AbstractTransactionalTestNGSpringContextTests {
@Autowired
private Scheduler scheduler;

@Test
public void test() throws Exception {

JobDetail jobDetail = JobBuilder.newJob(SampleJob.class)
.storeDurably(true)
.build();

Trigger trigger = TriggerBuilder.newTrigger()
.forJob(jobDetail)
.startNow()
.build();

scheduler.scheduleJob(jobDetail, trigger);

Thread.sleep(5000);
}
}

0 comments on commit 1807e5a

Please sign in to comment.