Skip to content

Commit

Permalink
Merge pull request quarkusio#20330 from loicmathieu/liquibase-mongodb-it
Browse files Browse the repository at this point in the history
Native support for Liquibase MongoDB
  • Loading branch information
loicmathieu authored Sep 23, 2021
2 parents abbb767 + cf9762c commit f87e933
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 f87e933

Please sign in to comment.