Skip to content

Commit

Permalink
Native suport for Liquibase MongoDB
Browse files Browse the repository at this point in the history
  • Loading branch information
loicmathieu committed Sep 23, 2021
1 parent 8181ed2 commit cf9762c
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 8 deletions.
4 changes: 1 addition & 3 deletions extensions/liquibase-mongodb/deployment/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,9 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-mongodb-client-deployment</artifactId>
</dependency>

<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5-internal</artifactId>
<scope>test</scope>
<artifactId>quarkus-jaxb-deployment</artifactId>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,9 @@
import liquibase.parser.ChangeLogParserFactory;
import liquibase.resource.ClassLoaderResourceAccessor;

class LiquibaseProcessor {
class LiquibaseMongodbProcessor {

private static final Logger LOGGER = Logger.getLogger(LiquibaseProcessor.class);

private static final String LIQUIBASE_BEAN_NAME_PREFIX = "liquibase_";
private static final Logger LOGGER = Logger.getLogger(LiquibaseMongodbProcessor.class);

private static final DotName DATABASE_CHANGE_PROPERTY = DotName.createSimple(DatabaseChangeProperty.class.getName());

Expand Down Expand Up @@ -114,7 +112,8 @@ void nativeImageConfiguration(
liquibase.sql.visitor.PrependSqlVisitor.class.getName(),
liquibase.sql.visitor.ReplaceSqlVisitor.class.getName(),
liquibase.sql.visitor.AppendSqlVisitor.class.getName(),
liquibase.sql.visitor.RegExpReplaceSqlVisitor.class.getName()));
liquibase.sql.visitor.RegExpReplaceSqlVisitor.class.getName(),
liquibase.ext.mongodb.database.MongoClientDriver.class.getName()));

reflective.produce(new ReflectiveClassBuildItem(false, false, true,
liquibase.change.ConstraintsConfig.class.getName()));
Expand Down
4 changes: 4 additions & 0 deletions extensions/liquibase-mongodb/runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@
<groupId>io.quarkus</groupId>
<artifactId>quarkus-mongodb-client</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jaxb</artifactId>
</dependency>
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package io.quarkus.it.liquibase.mongodb;

import static io.restassured.RestAssured.get;

import java.util.List;

import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.condition.DisabledOnOs;
import org.junit.jupiter.api.condition.OS;

import io.quarkus.test.common.QuarkusTestResource;
import io.quarkus.test.junit.NativeImageTest;
import io.quarkus.test.mongodb.MongoTestResource;
import io.restassured.common.mapper.TypeRef;

@NativeImageTest
@QuarkusTestResource(MongoTestResource.class)
@DisabledOnOs(OS.WINDOWS)
class NativeFruitResourceTestIT {
@Test
public void testTheEndpoint() {
// assert that a fruit exist as one has been created in the changelog
List<Fruit> list = get("/fruits").as(new TypeRef<List<Fruit>>() {
});
Assertions.assertEquals(1, list.size());
}
}

0 comments on commit cf9762c

Please sign in to comment.