Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testcontainers integration #21

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
134 changes: 21 additions & 113 deletions core-schema/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,144 +11,52 @@

<artifactId>loader-core-schema</artifactId>

<properties>
<flyway.version>7.5.0</flyway.version>
<jooq.version>3.14.4</jooq.version>

<!--
JDBC connection settings for the temporary database
Any changes made here must be likewise updated in jooq.xml -->
<jdbc.mariadb-port>50000</jdbc.mariadb-port>
<jdbc.dbname>solardata</jdbc.dbname>
<jdbc.url>jdbc:mariadb://localhost:50000/solardata</jdbc.url>
</properties>

<build>
<plugins>
<!--
These 3 plugins handle the development lifecycle with respect to flyway and jooq.
First, mariadb4j-maven-plugin starts a temporary MariaDB instance.
Second, flyway applies migrations to this database.
Third, jooq reads the schema and generates table and column references based on it.
Finally, mariadb4-maven-plugin stops the MariaDB instance.

Points of interest:
* The flyway and jooq plugins are both run in the generate-sources phase. As a result,
the ordering of the plugin declarations is significant.
* There are no 'pre-generate-sources' or 'post-generate-sources' phases in Maven,
so 'initialize' and 'generate-resources' are instead used for starting and stopping
the temporary MariaDB instance.
-->
<!-- literally use tick + testcontainers lol !-->
<plugin>
<groupId>ch.vorburger.mariaDB4j</groupId>
<artifactId>mariaDB4j-maven-plugin</artifactId>
<version>${mariadb4j.version}</version>
<executions>
<execution>
<id>setup</id>
<!-- Pre generate-sources = initialize -->
<phase>initialize</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>teardown</id>
<!-- Post generate-sources = generate-resources -->
<phase>generate-resources</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<configuration>
<dataDir>${project.build.outputDirectory}/mariadb4j-temporary-database</dataDir>
<port>${jdbc.mariadb-port}</port>
<databaseName>${jdbc.dbname}</databaseName>
</configuration>
</plugin>
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<version>${flyway.version}</version>
<dependencies>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>${mariadb-connector.version}</version>
</dependency>
</dependencies>
<groupId>me.aurium</groupId>
<artifactId>tick-full</artifactId>
<version>1.0.0</version>

<executions>
<execution>
<id>create-stuff</id>
<phase>generate-sources</phase>
<goals>
<goal>migrate</goal>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<ignoreFutureMigrations>false</ignoreFutureMigrations>
<validateMigrationNaming>true</validateMigrationNaming>
<group>true</group>

<url>${jdbc.url}</url>
<user>root</user>
<!--
Maven does not allow setting an empty string as the password, so flyway-password.conf is used
-->
<configFiles>flyway-password.conf</configFiles>
<configuration>
<packageName>gg.solarmc.loader.schema</packageName>
<outputDirectory>filesystem:target/generated-sources/</outputDirectory>
<locations>
<location>filesystem:src/main/resources/sql-schema</location>
<location>filesystem:flyway-libertybans</location>
</locations>
</configuration>
</plugin>
<plugin>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen-maven</artifactId>
<version>${jooq.version}</version>



<dependencies>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>${mariadb-connector.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>generate-sources</phase>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
<configuration>
<configurationFile>jooq.xml</configurationFile>
</configuration>
</plugin>
</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>${flyway.version}</version>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq</artifactId>
<version>${jooq.version}</version>
</dependency>
<!--<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-meta</artifactId>
<version>${jooq.version}</version>
</dependency>
<dependency>
<groupId>org.jooq</groupId>
<artifactId>jooq-codegen</artifactId>
<version>${jooq.version}</version>
</dependency>-->
</dependencies>

<repositories>
<repository>
<id>repsy</id>
<url>https://repo.repsy.io/mvn/elytraforce/default</url>
</repository>
</repositories>

</project>
1 change: 0 additions & 1 deletion core-schema/src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module gg.solarmc.loader.schema {

requires transitive org.jooq;
requires java.xml;

exports gg.solarmc.loader.schema;
Expand Down