Skip to content

Commit 5d3e9f4

Browse files
committed
example now uses liquibase too
1 parent 844ad16 commit 5d3e9f4

File tree

10 files changed

+78
-44
lines changed

10 files changed

+78
-44
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- Running triggers can be failed now
77
- https://github.com/sterlp/spring-persistent-tasks/wiki/Cancel-a-task-trigger
88
- Triggers have now correlationId to collect them
9+
- Added Re-Queue / Re-Run trigger to history page
910
- Correlation Id is shown in the UI
1011
- ID search includes also Correlation Id
1112

core/pom.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@
3333
<groupId>org.apache.commons</groupId>
3434
<artifactId>commons-lang3</artifactId>
3535
</dependency>
36+
<dependency>
37+
<groupId>org.liquibase</groupId>
38+
<artifactId>liquibase-core</artifactId>
39+
</dependency>
3640

3741
<dependency>
3842
<groupId>org.springframework.boot</groupId>
@@ -73,11 +77,6 @@
7377
<artifactId>spring-boot-starter-test</artifactId>
7478
<scope>test</scope>
7579
</dependency>
76-
<dependency>
77-
<groupId>uk.co.jemos.podam</groupId>
78-
<artifactId>podam</artifactId>
79-
<scope>test</scope>
80-
</dependency>
8180

8281
<dependency>
8382
<groupId>com.microsoft.sqlserver</groupId>

core/src/test/java/org/sterl/spring/persistent_tasks/AbstractSpringTest.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636

3737
import jakarta.persistence.EntityManager;
3838
import lombok.RequiredArgsConstructor;
39-
import uk.co.jemos.podam.api.PodamFactory;
40-
import uk.co.jemos.podam.api.PodamFactoryImpl;
4139

4240
// @ActiveProfiles("mssql") // postgres mssql mariadb mysql
4341
@SpringBootTest(classes = SampleApp.class, webEnvironment = WebEnvironment.RANDOM_PORT)
@@ -72,8 +70,6 @@ public class AbstractSpringTest {
7270
@Autowired
7371
protected HibernateAsserts hibernateAsserts;
7472

75-
protected final PodamFactory pm = new PodamFactoryImpl();
76-
7773
@Configuration
7874
public static class TaskConfig {
7975
@Bean

example/pom.xml

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
66
<parent>
7-
<groupId>org.sterl.spring</groupId>
8-
<artifactId>spring-persistent-tasks-root</artifactId>
9-
<version>1.6.0-SNAPSHOT</version>
10-
<relativePath>../pom.xml</relativePath>
7+
<groupId>org.springframework.boot</groupId>
8+
<artifactId>spring-boot-starter-parent</artifactId>
9+
<version>3.3.8</version>
10+
<relativePath /> <!-- lookup parent from repository -->
1111
</parent>
1212

1313
<artifactId>spring-persistent-tasks-example</artifactId>
@@ -17,12 +17,17 @@
1717
<dependency>
1818
<groupId>org.sterl.spring</groupId>
1919
<artifactId>spring-persistent-tasks-core</artifactId>
20-
<version>${project.version}</version>
20+
<version>1.5.6</version>
2121
</dependency>
2222
<dependency>
2323
<groupId>org.sterl.spring</groupId>
2424
<artifactId>spring-persistent-tasks-ui</artifactId>
25-
<version>${project.version}</version>
25+
<version>1.5.6</version>
26+
</dependency>
27+
<dependency>
28+
<groupId>org.sterl.spring</groupId>
29+
<artifactId>spring-persistent-tasks-db</artifactId>
30+
<version>1.5.6</version>
2631
</dependency>
2732
<dependency>
2833
<groupId>org.springframework.boot</groupId>
@@ -45,6 +50,7 @@
4550
<dependency>
4651
<groupId>uk.co.jemos.podam</groupId>
4752
<artifactId>podam</artifactId>
53+
<version>8.0.1.RELEASE</version>
4854
</dependency>
4955

5056
<dependency>
@@ -59,13 +65,6 @@
5965
<scope>runtime</scope>
6066
</dependency>
6167

62-
<dependency>
63-
<groupId>org.springframework.boot</groupId>
64-
<artifactId>spring-boot-devtools</artifactId>
65-
<scope>runtime</scope>
66-
<optional>true</optional>
67-
</dependency>
68-
6968
<dependency>
7069
<groupId>com.h2database</groupId>
7170
<artifactId>h2</artifactId>
@@ -87,15 +86,4 @@
8786
<scope>test</scope>
8887
</dependency>
8988
</dependencies>
90-
91-
<build>
92-
<plugins>
93-
<plugin>
94-
<groupId>org.springframework.boot</groupId>
95-
<artifactId>spring-boot-maven-plugin</artifactId>
96-
<version>${spring-boot.version}</version>
97-
</plugin>
98-
</plugins>
99-
</build>
100-
10189
</project>

example/src/main/java/org/sterl/spring/example_app/vehicle/task/BuildVehicleTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
import org.sterl.spring.example_app.vehicle.model.Vehicle;
88
import org.sterl.spring.example_app.vehicle.repository.VehicleRepository;
99
import org.sterl.spring.persistent_tasks.api.TaskId;
10-
import org.sterl.spring.persistent_tasks.api.task.TransactionalTask;
10+
import org.sterl.spring.persistent_tasks.api.TransactionalTask;
1111

1212
import lombok.RequiredArgsConstructor;
1313
import lombok.extern.slf4j.Slf4j;

example/src/main/java/org/sterl/spring/example_app/vehicle/task/FailingBuildVehicleTask.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import org.sterl.spring.example_app.vehicle.model.Vehicle;
77
import org.sterl.spring.example_app.vehicle.repository.VehicleRepository;
88
import org.sterl.spring.persistent_tasks.api.TaskId;
9-
import org.sterl.spring.persistent_tasks.api.task.TransactionalTask;
9+
import org.sterl.spring.persistent_tasks.api.TransactionalTask;
1010

1111
import lombok.RequiredArgsConstructor;
1212
import lombok.extern.slf4j.Slf4j;

example/src/main/resources/application-mssql.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ spring:
88
maximum-pool-size: 100
99
jpa:
1010
hibernate:
11-
ddl-auto: create-drop
11+
ddl-auto: none

example/src/main/resources/application.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@ spring:
33
name: example
44
jpa:
55
open-in-view: false
6+
hibernate:
7+
ddl-auto: none
68

79
persistent-tasks:
810
max-threads: 1
9-
11+
12+
liquibase:
13+
change-log: classpath:db/changelog/db.changelog-master.xml
14+
1015
springdoc:
1116
swagger-ui:
1217
use-root-path: true
13-
18+
1419
logging:
1520
level:
1621
org.sterl.spring.persistent_tasks: DEBUG
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?xml version="1.1" encoding="UTF-8" standalone="no"?>
2+
<databaseChangeLog xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
3+
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
4+
xmlns:pro="http://www.liquibase.org/xml/ns/pro"
5+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd
7+
http://www.liquibase.org/xml/ns/pro http://www.liquibase.org/xml/ns/pro/liquibase-pro-latest.xsd
8+
http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-latest.xsd">
9+
10+
<changeSet author="sterlp" id="2025-03-09-initial-test-db">
11+
12+
<createTable tableName="vehicle">
13+
<column computed="false" name="id" type="bigint">
14+
<constraints nullable="false" primaryKey="true"
15+
primaryKeyName="pk_vehicle_id" />
16+
</column>
17+
<column computed="false" name="type" type="varchar(50)" />
18+
<column computed="false" name="name" type="varchar(50)">
19+
<constraints nullable="false" />
20+
</column>
21+
<column computed="false" name="engine_id" type="bigint" />
22+
</createTable>
23+
24+
<createSequence cycle="false" incrementBy="50" sequenceName="vehicle_seq" startValue="1" />
25+
26+
</changeSet>
27+
28+
<include file="spring-persistent-tasks/db.changelog-master.xml" />
29+
30+
<changeSet author="sterlp" id="2025-03-09-add-engine">
31+
32+
<createTable tableName="engine">
33+
<column computed="false" name="id" type="bigint">
34+
<constraints nullable="false" primaryKey="true"
35+
primaryKeyName="pk_engine_id" />
36+
</column>
37+
<column computed="false" name="type" type="varchar(50)" />
38+
<column computed="false" name="power" type="bigint" />
39+
</createTable>
40+
41+
<createSequence cycle="false" incrementBy="50" sequenceName="engine_seq" startValue="1" />
42+
43+
</changeSet>
44+
45+
<changeSet author="sterlp" id="2025-03-09-add-engine-fk">
46+
<addForeignKeyConstraint constraintName="fk_" onDelete="CASCADE"
47+
baseTableName="vehicle" baseColumnNames="engine_id"
48+
referencedTableName="engine" referencedColumnNames="id" />
49+
</changeSet>
50+
51+
</databaseChangeLog>

pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@
6161
</properties>
6262

6363
<modules>
64-
<module>example</module>
6564
<module>db</module>
6665
<module>ui</module>
6766
<module>core</module>
@@ -76,11 +75,6 @@
7675
<type>pom</type>
7776
<scope>import</scope>
7877
</dependency>
79-
<dependency>
80-
<groupId>uk.co.jemos.podam</groupId>
81-
<artifactId>podam</artifactId>
82-
<version>8.0.1.RELEASE</version>
83-
</dependency>
8478
</dependencies>
8579
</dependencyManagement>
8680

0 commit comments

Comments
 (0)