Skip to content

Commit

Permalink
FIX: inputFile path resolution
Browse files Browse the repository at this point in the history
add maven integration tests
  • Loading branch information
uniqueck committed Jan 15, 2020
1 parent e4f21c6 commit f3bd699
Show file tree
Hide file tree
Showing 34 changed files with 1,324 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fi
- run:
name: Build and Test
command: mvn -B package
command: mvn -B verify
- run:
name: Save test results
command: |
Expand Down
32 changes: 32 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,38 @@
</executions>
</plugin>

<!-- test example project -->
<plugin>
<artifactId>maven-invoker-plugin</artifactId>
<groupId>org.apache.maven.plugins</groupId>
<version>3.0.1</version>
<configuration>
<projectsDirectory>${basedir}/src/it</projectsDirectory>
<cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
<pomIncludes>
<pomInclude>*/pom.xml</pomInclude>
</pomIncludes>
<showErrors>true</showErrors>
<debug>false</debug>
<addTestClassPath>true</addTestClassPath>
<goals>
<goal>clean</goal>
<goal>generate-resources</goal>
</goals>
<postBuildHookScript>validate</postBuildHookScript>
</configuration>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>install</goal>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>


</plugins>
</build>

Expand Down
3 changes: 3 additions & 0 deletions src/it/example-with-copy-resources/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
invoker.goals=clean process-resources
invoker.description = Generate AsciiDoc with Liquibase Extension
invoker.name = Liquibase-Extension
93 changes: 93 additions & 0 deletions src/it/example-with-copy-resources/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>org.example</groupId>
<artifactId>asciidoctor-liquibase-extension-example</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>


<build>
<defaultGoal>clean process-resources</defaultGoal>
<plugins>
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>2.0.0-RC.1</version>
<configuration>
<backend>html</backend>
<sourceDirectory>${basedir}/src/docs</sourceDirectory>
<sourceDocumentName>index.adoc</sourceDocumentName>
<attributes>
<liquibase-dir>${project.build.directory}/generated-docs/liquibase</liquibase-dir>
</attributes>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<targetPath>liquibase</targetPath>
</resource>
</resources>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<goals><goal>process-asciidoc</goal></goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.uniqueck</groupId>
<artifactId>asciidoctorj-liquibase-extension</artifactId>
<version>@project.version@</version>
</dependency>
</dependencies>
</plugin>
</plugins>

</build>


<repositories>
<repository>
<snapshots>
<enabled>
false
</enabled>
</snapshots>
<id>
bintray-uniqueck-asciidoctorj
</id>
<name>
bintray
</name>
<url>
https://dl.bintray.com/uniqueck/asciidoctorj
</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<snapshots>
<enabled>
false
</enabled>
</snapshots>
<id>
bintray-uniqueck-asciidoctorj
</id>
<name>
bintray-plugins
</name>
<url>
https://dl.bintray.com/uniqueck/asciidoctorj
</url>
</pluginRepository>
</pluginRepositories>

</project>
5 changes: 5 additions & 0 deletions src/it/example-with-copy-resources/src/docs/index.adoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
= AsciiDoc Liquibase Extension Example

ifndef::liquibase-dir[:liquibase-dir: ../main/resources]

liquibase::{liquibase-dir}/db.changelog-master.xml[]
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">

<!-- Deployment_Job Seq - Start -->
<changeSet author="author@x.de" id="create_Deployment_Job_SEQ">
<preConditions onFail="MARK_RAN">
<not>
<sequenceExists sequenceName="DEPLOYMENTJOB_SEQ"/>
</not>
</preConditions>
<createSequence incrementBy="1" sequenceName="DEPLOYMENTJOB_SEQ" startValue="1"/>
</changeSet>
<!-- Deployment_Job Seq - Ende -->

<!-- Deployment_Job Table - Start -->
<changeSet author="author@x.de" id="create_Deployment_Job_TAB">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="DEPLOYMENT_JOB"/>
</not>
</preConditions>
<createTable tableName="DEPLOYMENT_JOB">
<column name="ID" type="number">
<constraints nullable="false" />
</column>

<column name="NAME" type="varchar(100)" />
<column name="PROJEKTNAME" type="varchar(100)" />
<column name="DEPLOYMENTART" type="varchar(20)" />

<column name="STATUS" type="varchar(10)" defaultValue="AKTIV">
<constraints nullable="false" />
</column>
</createTable>

<addUniqueConstraint tableName="DEPLOYMENT_JOB" columnNames="PROJEKTNAME" constraintName="DEPLOYMENT_JOB_UK1" />

<sql>ALTER TABLE DEPLOYMENT_JOB ADD CONSTRAINT DEPLOYMENT_JOB_CHK2 CHECK (STATUS IN ('AKTIV', 'INAKTIV'))</sql>
<sql>ALTER TABLE DEPLOYMENT_JOB ADD CONSTRAINT DEPLOYMENT_JOB_CHK1 CHECK (DEPLOYMENTART IN ('SERVER', 'CLIENT'))</sql>

</changeSet>
<!-- Deployment_Job Table - Ende -->

<!-- Deployment_Job Primary Key - Start -->
<changeSet author="author@x.de" id="create_Deployment_Job_PK">
<preConditions onFail="MARK_RAN">
<not>
<primaryKeyExists tableName="DEPLOYMENT_JOB" primaryKeyName="DEPLOYMENTJOB_PK"/>
</not>
</preConditions>
<addPrimaryKey tableName="DEPLOYMENT_JOB" columnNames="ID" constraintName="DEPLOYMENTJOB_PK" />
</changeSet>
<!-- DeploymentLog Primary Key - Ende -->


<!-- Deployment_Job Trigger - Start -->
<changeSet author="author@x.de" id="create_Deployment_Job_TRG">
<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>
<createProcedure dbms="oracle">
create or replace TRIGGER DEPLOYMENT_JOB_TRIGGER
before insert on DEPLOYMENT_JOB
for each row
begin
if inserting then
if :NEW."ID" is null then
select DEPLOYMENTJOB_SEQ.nextval into :NEW."ID" from dual;
end if;
end if;
end;
</createProcedure>
</changeSet>
<!-- DeploymentLog Trigger - Ende -->





<changeSet author="author@x.de" id="tag-1.0">
<tagDatabase tag="1.0"/>
</changeSet>


</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<databaseChangeLog
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog
http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.1.xsd">

<!-- Deployment_Log Seq - Start -->
<changeSet author="author@x.de" id="create_Deployment_Log_SEQ">
<preConditions onFail="MARK_RAN">
<not>
<sequenceExists sequenceName="DEPLOYMENT_LOG_SEQ"/>
</not>
</preConditions>
<createSequence incrementBy="1" sequenceName="DEPLOYMENT_LOG_SEQ" startValue="1"/>
</changeSet>
<!-- Deployment_Log Seq - Ende -->

<!-- Deployment_Log Table - Start -->
<changeSet author="author@x.de" id="create_Deployment_Log_TAB">
<preConditions onFail="MARK_RAN">
<not>
<tableExists tableName="DEPLOYMENT_LOG"/>
</not>
</preConditions>
<createTable tableName="DEPLOYMENT_LOG">
<column name="ID" type="number">
<constraints nullable="false" />
</column>

<column name="DEPLOYMENTTRIGGER_ID" type="number">
<constraints nullable="false" />
</column>

<column name="ZEITPUNKT" type="datetime(6)">
<constraints nullable="false" />
</column>

<column name="DEPLOYMENTLOG_ID" type="number" />
</createTable>
</changeSet>
<!-- Deployment_Log Table - Ende -->

<!-- Deployment_Log Primary Key - Start -->
<changeSet author="author@x.de" id="create_Deployment_Log_PK">
<preConditions onFail="MARK_RAN">
<not>
<primaryKeyExists tableName="DEPLOYMENT_LOG" primaryKeyName="DEPLOYMENT_LOG_PK"/>
</not>
</preConditions>
<addPrimaryKey tableName="DEPLOYMENT_LOG" columnNames="ID" constraintName="DEPLOYMENT_LOG_PK" />
</changeSet>
<!-- Deployment_Log Primary Key - Ende -->

<!-- Deployment_Log Add Foreign Key - Start -->
<changeSet author="author@x.de" id="add_Deployment_Log_ForeignKey_Deployment_Trigger">
<preConditions onFail="MARK_RAN">
<not>
<foreignKeyConstraintExists foreignKeyName="DEPLOYMENT_LOG_DEPLOYMENT_FK1"></foreignKeyConstraintExists>
</not>
</preConditions>
<addForeignKeyConstraint baseTableName="DEPLOYMENT_LOG" baseColumnNames="DEPLOYMENTTRIGGER_ID" referencedTableName="DEPLOYMENT_TRIGGER" referencedColumnNames="ID" constraintName="DEPLOYMENT_LOG_DEPLOYMENT_FK1" />
</changeSet>

<changeSet author="author@x.de" id="add_Deployment_Log_ForeignKey_Deployment_Log">
<preConditions onFail="MARK_RAN">
<not>
<foreignKeyConstraintExists foreignKeyName="DEPLOYMENT_LOG_DEPLOYMENT_FK2" />
</not>
</preConditions>
<addForeignKeyConstraint baseTableName="DEPLOYMENT_LOG" baseColumnNames="DEPLOYMENTLOG_ID" referencedTableName="DEPLOYMENT_LOG" referencedColumnNames="ID" constraintName="DEPLOYMENT_LOG_DEPLOYMENT_FK2" />
</changeSet>
<!-- Deployment_Log Add Foreign Key - Ende -->


<!-- Deployment_Log Trigger - Start -->
<changeSet author="author@x.de" id="create_Deployment_Log_TRG">
<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>
<createProcedure dbms="oracle">
create or replace TRIGGER DEPLOYMENT_LOG_TRIGGER
before insert on DEPLOYMENT_LOG
for each row
begin
if inserting then
if :NEW."ID" is null then
select DEPLOYMENT_LOG_SEQ.nextval into :NEW."ID" from dual;
end if;
end if;
end;
</createProcedure>
</changeSet>
<!-- Deployment_Log Trigger - Ende -->

</databaseChangeLog>
Loading

0 comments on commit f3bd699

Please sign in to comment.