-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added hibernate-orm property: quarkus.hibernate-orm.validation.mode t…
…hat controls how the hibernate validator behaves Co-Authored-By: George Gastaldi <[email protected]>
- Loading branch information
Showing
4 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...ment/src/test/java/io/quarkus/hibernate/orm/validation/JPAValidationDisabledTestCase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package io.quarkus.hibernate.orm.validation; | ||
|
||
import static org.hamcrest.Matchers.is; | ||
|
||
import javax.inject.Inject; | ||
import javax.persistence.EntityManager; | ||
import javax.transaction.Transactional; | ||
|
||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.hibernate.orm.MyEntity; | ||
import io.quarkus.test.QuarkusUnitTest; | ||
import io.restassured.RestAssured; | ||
|
||
public class JPAValidationDisabledTestCase { | ||
|
||
@Inject | ||
EntityManager em; | ||
|
||
@RegisterExtension | ||
static QuarkusUnitTest runner = new QuarkusUnitTest() | ||
.withApplicationRoot((jar) -> jar | ||
.addClasses(MyEntity.class, JPATestValidationResource.class) | ||
.addAsResource("application-validation-disabled.properties", "application.properties")); | ||
|
||
//define an empty import.sql file | ||
|
||
@Test | ||
@Transactional | ||
public void testValidEntity() { | ||
String entityName = MyEntity.ENTITY_NAME_TOO_LONG; | ||
RestAssured.given().body(entityName).when().post("/validation").then() | ||
.body(is("OK")); | ||
} | ||
|
||
} |
6 changes: 6 additions & 0 deletions
6
...ns/hibernate-orm/deployment/src/test/resources/application-validation-disabled.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
quarkus.datasource.db-kind=h2 | ||
quarkus.datasource.jdbc.url=jdbc:h2:mem:test | ||
|
||
#quarkus.hibernate-orm.log.sql=true | ||
quarkus.hibernate-orm.validation.enabled=false | ||
quarkus.hibernate-orm.database.generation=drop-and-create |