Skip to content

Commit f3bd699

Browse files
committed
FIX: inputFile path resolution
add maven integration tests
1 parent e4f21c6 commit f3bd699

34 files changed

+1324
-2
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
fi
1616
- run:
1717
name: Build and Test
18-
command: mvn -B package
18+
command: mvn -B verify
1919
- run:
2020
name: Save test results
2121
command: |

pom.xml

+32
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,38 @@
158158
</executions>
159159
</plugin>
160160

161+
<!-- test example project -->
162+
<plugin>
163+
<artifactId>maven-invoker-plugin</artifactId>
164+
<groupId>org.apache.maven.plugins</groupId>
165+
<version>3.0.1</version>
166+
<configuration>
167+
<projectsDirectory>${basedir}/src/it</projectsDirectory>
168+
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
169+
<pomIncludes>
170+
<pomInclude>*/pom.xml</pomInclude>
171+
</pomIncludes>
172+
<showErrors>true</showErrors>
173+
<debug>false</debug>
174+
<addTestClassPath>true</addTestClassPath>
175+
<goals>
176+
<goal>clean</goal>
177+
<goal>generate-resources</goal>
178+
</goals>
179+
<postBuildHookScript>validate</postBuildHookScript>
180+
</configuration>
181+
<executions>
182+
<execution>
183+
<id>integration-test</id>
184+
<goals>
185+
<goal>install</goal>
186+
<goal>run</goal>
187+
</goals>
188+
</execution>
189+
</executions>
190+
</plugin>
191+
192+
161193
</plugins>
162194
</build>
163195

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
invoker.goals=clean process-resources
2+
invoker.description = Generate AsciiDoc with Liquibase Extension
3+
invoker.name = Liquibase-Extension
+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>org.example</groupId>
8+
<artifactId>asciidoctor-liquibase-extension-example</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
11+
<properties>
12+
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
13+
</properties>
14+
15+
16+
<build>
17+
<defaultGoal>clean process-resources</defaultGoal>
18+
<plugins>
19+
<plugin>
20+
<groupId>org.asciidoctor</groupId>
21+
<artifactId>asciidoctor-maven-plugin</artifactId>
22+
<version>2.0.0-RC.1</version>
23+
<configuration>
24+
<backend>html</backend>
25+
<sourceDirectory>${basedir}/src/docs</sourceDirectory>
26+
<sourceDocumentName>index.adoc</sourceDocumentName>
27+
<attributes>
28+
<liquibase-dir>${project.build.directory}/generated-docs/liquibase</liquibase-dir>
29+
</attributes>
30+
<resources>
31+
<resource>
32+
<directory>${basedir}/src/main/resources</directory>
33+
<targetPath>liquibase</targetPath>
34+
</resource>
35+
</resources>
36+
</configuration>
37+
<executions>
38+
<execution>
39+
<phase>process-resources</phase>
40+
<goals><goal>process-asciidoc</goal></goals>
41+
</execution>
42+
</executions>
43+
<dependencies>
44+
<dependency>
45+
<groupId>com.uniqueck</groupId>
46+
<artifactId>asciidoctorj-liquibase-extension</artifactId>
47+
<version>@project.version@</version>
48+
</dependency>
49+
</dependencies>
50+
</plugin>
51+
</plugins>
52+
53+
</build>
54+
55+
56+
<repositories>
57+
<repository>
58+
<snapshots>
59+
<enabled>
60+
false
61+
</enabled>
62+
</snapshots>
63+
<id>
64+
bintray-uniqueck-asciidoctorj
65+
</id>
66+
<name>
67+
bintray
68+
</name>
69+
<url>
70+
https://dl.bintray.com/uniqueck/asciidoctorj
71+
</url>
72+
</repository>
73+
</repositories>
74+
<pluginRepositories>
75+
<pluginRepository>
76+
<snapshots>
77+
<enabled>
78+
false
79+
</enabled>
80+
</snapshots>
81+
<id>
82+
bintray-uniqueck-asciidoctorj
83+
</id>
84+
<name>
85+
bintray-plugins
86+
</name>
87+
<url>
88+
https://dl.bintray.com/uniqueck/asciidoctorj
89+
</url>
90+
</pluginRepository>
91+
</pluginRepositories>
92+
93+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
= AsciiDoc Liquibase Extension Example
2+
3+
ifndef::liquibase-dir[:liquibase-dir: ../main/resources]
4+
5+
liquibase::{liquibase-dir}/db.changelog-master.xml[]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<databaseChangeLog
3+
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
6+
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
7+
8+
<!-- Deployment_Job Seq - Start -->
9+
<changeSet author="author@x.de" id="create_Deployment_Job_SEQ">
10+
<preConditions onFail="MARK_RAN">
11+
<not>
12+
<sequenceExists sequenceName="DEPLOYMENTJOB_SEQ"/>
13+
</not>
14+
</preConditions>
15+
<createSequence incrementBy="1" sequenceName="DEPLOYMENTJOB_SEQ" startValue="1"/>
16+
</changeSet>
17+
<!-- Deployment_Job Seq - Ende -->
18+
19+
<!-- Deployment_Job Table - Start -->
20+
<changeSet author="author@x.de" id="create_Deployment_Job_TAB">
21+
<preConditions onFail="MARK_RAN">
22+
<not>
23+
<tableExists tableName="DEPLOYMENT_JOB"/>
24+
</not>
25+
</preConditions>
26+
<createTable tableName="DEPLOYMENT_JOB">
27+
<column name="ID" type="number">
28+
<constraints nullable="false" />
29+
</column>
30+
31+
<column name="NAME" type="varchar(100)" />
32+
<column name="PROJEKTNAME" type="varchar(100)" />
33+
<column name="DEPLOYMENTART" type="varchar(20)" />
34+
35+
<column name="STATUS" type="varchar(10)" defaultValue="AKTIV">
36+
<constraints nullable="false" />
37+
</column>
38+
</createTable>
39+
40+
<addUniqueConstraint tableName="DEPLOYMENT_JOB" columnNames="PROJEKTNAME" constraintName="DEPLOYMENT_JOB_UK1" />
41+
42+
<sql>ALTER TABLE DEPLOYMENT_JOB ADD CONSTRAINT DEPLOYMENT_JOB_CHK2 CHECK (STATUS IN ('AKTIV', 'INAKTIV'))</sql>
43+
<sql>ALTER TABLE DEPLOYMENT_JOB ADD CONSTRAINT DEPLOYMENT_JOB_CHK1 CHECK (DEPLOYMENTART IN ('SERVER', 'CLIENT'))</sql>
44+
45+
</changeSet>
46+
<!-- Deployment_Job Table - Ende -->
47+
48+
<!-- Deployment_Job Primary Key - Start -->
49+
<changeSet author="author@x.de" id="create_Deployment_Job_PK">
50+
<preConditions onFail="MARK_RAN">
51+
<not>
52+
<primaryKeyExists tableName="DEPLOYMENT_JOB" primaryKeyName="DEPLOYMENTJOB_PK"/>
53+
</not>
54+
</preConditions>
55+
<addPrimaryKey tableName="DEPLOYMENT_JOB" columnNames="ID" constraintName="DEPLOYMENTJOB_PK" />
56+
</changeSet>
57+
<!-- DeploymentLog Primary Key - Ende -->
58+
59+
60+
<!-- Deployment_Job Trigger - Start -->
61+
<changeSet author="author@x.de" id="create_Deployment_Job_TRG">
62+
<sql dbms="hsqldb">CREATE TRIGGER DEPLOYMENT_JOB_TRIGGER BEFORE INSERT ON DEPLOYMENT_JOB REFERENCING NEW ROW AS newrow FOR EACH ROW SET newrow.ID = NEXT VALUE FOR DEPLOYMENTJOB_SEQ</sql>
63+
<createProcedure dbms="oracle">
64+
create or replace TRIGGER DEPLOYMENT_JOB_TRIGGER
65+
before insert on DEPLOYMENT_JOB
66+
for each row
67+
begin
68+
if inserting then
69+
if :NEW."ID" is null then
70+
select DEPLOYMENTJOB_SEQ.nextval into :NEW."ID" from dual;
71+
end if;
72+
end if;
73+
end;
74+
</createProcedure>
75+
</changeSet>
76+
<!-- DeploymentLog Trigger - Ende -->
77+
78+
79+
80+
81+
82+
<changeSet author="author@x.de" id="tag-1.0">
83+
<tagDatabase tag="1.0"/>
84+
</changeSet>
85+
86+
87+
</databaseChangeLog>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<databaseChangeLog
3+
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5+
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
6+
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">
7+
8+
<!-- Deployment_Log Seq - Start -->
9+
<changeSet author="author@x.de" id="create_Deployment_Log_SEQ">
10+
<preConditions onFail="MARK_RAN">
11+
<not>
12+
<sequenceExists sequenceName="DEPLOYMENT_LOG_SEQ"/>
13+
</not>
14+
</preConditions>
15+
<createSequence incrementBy="1" sequenceName="DEPLOYMENT_LOG_SEQ" startValue="1"/>
16+
</changeSet>
17+
<!-- Deployment_Log Seq - Ende -->
18+
19+
<!-- Deployment_Log Table - Start -->
20+
<changeSet author="author@x.de" id="create_Deployment_Log_TAB">
21+
<preConditions onFail="MARK_RAN">
22+
<not>
23+
<tableExists tableName="DEPLOYMENT_LOG"/>
24+
</not>
25+
</preConditions>
26+
<createTable tableName="DEPLOYMENT_LOG">
27+
<column name="ID" type="number">
28+
<constraints nullable="false" />
29+
</column>
30+
31+
<column name="DEPLOYMENTTRIGGER_ID" type="number">
32+
<constraints nullable="false" />
33+
</column>
34+
35+
<column name="ZEITPUNKT" type="datetime(6)">
36+
<constraints nullable="false" />
37+
</column>
38+
39+
<column name="DEPLOYMENTLOG_ID" type="number" />
40+
</createTable>
41+
</changeSet>
42+
<!-- Deployment_Log Table - Ende -->
43+
44+
<!-- Deployment_Log Primary Key - Start -->
45+
<changeSet author="author@x.de" id="create_Deployment_Log_PK">
46+
<preConditions onFail="MARK_RAN">
47+
<not>
48+
<primaryKeyExists tableName="DEPLOYMENT_LOG" primaryKeyName="DEPLOYMENT_LOG_PK"/>
49+
</not>
50+
</preConditions>
51+
<addPrimaryKey tableName="DEPLOYMENT_LOG" columnNames="ID" constraintName="DEPLOYMENT_LOG_PK" />
52+
</changeSet>
53+
<!-- Deployment_Log Primary Key - Ende -->
54+
55+
<!-- Deployment_Log Add Foreign Key - Start -->
56+
<changeSet author="author@x.de" id="add_Deployment_Log_ForeignKey_Deployment_Trigger">
57+
<preConditions onFail="MARK_RAN">
58+
<not>
59+
<foreignKeyConstraintExists foreignKeyName="DEPLOYMENT_LOG_DEPLOYMENT_FK1"></foreignKeyConstraintExists>
60+
</not>
61+
</preConditions>
62+
<addForeignKeyConstraint baseTableName="DEPLOYMENT_LOG" baseColumnNames="DEPLOYMENTTRIGGER_ID" referencedTableName="DEPLOYMENT_TRIGGER" referencedColumnNames="ID" constraintName="DEPLOYMENT_LOG_DEPLOYMENT_FK1" />
63+
</changeSet>
64+
65+
<changeSet author="author@x.de" id="add_Deployment_Log_ForeignKey_Deployment_Log">
66+
<preConditions onFail="MARK_RAN">
67+
<not>
68+
<foreignKeyConstraintExists foreignKeyName="DEPLOYMENT_LOG_DEPLOYMENT_FK2" />
69+
</not>
70+
</preConditions>
71+
<addForeignKeyConstraint baseTableName="DEPLOYMENT_LOG" baseColumnNames="DEPLOYMENTLOG_ID" referencedTableName="DEPLOYMENT_LOG" referencedColumnNames="ID" constraintName="DEPLOYMENT_LOG_DEPLOYMENT_FK2" />
72+
</changeSet>
73+
<!-- Deployment_Log Add Foreign Key - Ende -->
74+
75+
76+
<!-- Deployment_Log Trigger - Start -->
77+
<changeSet author="author@x.de" id="create_Deployment_Log_TRG">
78+
<sql dbms="hsqldb">CREATE TRIGGER DEPLOYMENT_LOG_TRIGGER BEFORE INSERT ON DEPLOYMENT_LOG REFERENCING NEW ROW AS newrow FOR EACH ROW SET newrow.ID = NEXT VALUE FOR DEPLOYMENT_LOG_SEQ</sql>
79+
<createProcedure dbms="oracle">
80+
create or replace TRIGGER DEPLOYMENT_LOG_TRIGGER
81+
before insert on DEPLOYMENT_LOG
82+
for each row
83+
begin
84+
if inserting then
85+
if :NEW."ID" is null then
86+
select DEPLOYMENT_LOG_SEQ.nextval into :NEW."ID" from dual;
87+
end if;
88+
end if;
89+
end;
90+
</createProcedure>
91+
</changeSet>
92+
<!-- Deployment_Log Trigger - Ende -->
93+
94+
</databaseChangeLog>

0 commit comments

Comments
 (0)