HHH-14585 Skip test for some dialects

This commit is contained in:
Fabio Massimo Ercoli 2021-05-11 09:05:28 +02:00
parent 51529f5f20
commit 15d9eb4112
1 changed files with 20 additions and 28 deletions

View File

@ -7,15 +7,12 @@
package org.hibernate.test.hql.size; package org.hibernate.test.hql.size;
import org.hibernate.annotations.ResultCheckStyle; import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
import org.hibernate.annotations.SQLDelete; import static org.junit.Assert.assertEquals;
import org.hibernate.annotations.Where;
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
import org.hibernate.testing.TestForIssue;
import org.junit.After;
import org.junit.Test;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.persistence.CascadeType; import javax.persistence.CascadeType;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.FetchType; import javax.persistence.FetchType;
@ -24,14 +21,21 @@ import javax.persistence.Id;
import javax.persistence.ManyToOne; import javax.persistence.ManyToOne;
import javax.persistence.OneToMany; import javax.persistence.OneToMany;
import javax.persistence.TypedQuery; import javax.persistence.TypedQuery;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA; import org.hibernate.annotations.ResultCheckStyle;
import static org.junit.Assert.assertEquals; import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.Where;
import org.hibernate.dialect.H2Dialect;
import org.hibernate.dialect.PostgreSQL82Dialect;
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.TestForIssue;
import org.junit.Test;
@TestForIssue(jiraKey = "HHH-14585") @TestForIssue(jiraKey = "HHH-14585")
@RequiresDialect(value = PostgreSQL82Dialect.class, comment = "Other databases may not support boolean data types")
@RequiresDialect(value = H2Dialect.class, comment = "Other databases may not support boolean data types")
public class WhereClauseOrderBySizeTest extends BaseEntityManagerFunctionalTestCase { public class WhereClauseOrderBySizeTest extends BaseEntityManagerFunctionalTestCase {
@Override @Override
@ -96,21 +100,6 @@ public class WhereClauseOrderBySizeTest extends BaseEntityManagerFunctionalTestC
); );
} }
@After
public void cleanupDatabase() {
doInJPA(
this::entityManagerFactory,
entityManager -> {
for ( Book book : entityManager.createQuery( "from Book", Book.class ).getResultList() ) {
entityManager.remove( book );
}
for ( Person person : entityManager.createQuery( "from Person", Person.class ).getResultList() ) {
entityManager.remove( person );
}
}
);
}
@Entity(name = "Person") @Entity(name = "Person")
public static class Person { public static class Person {
@Id @Id
@ -120,6 +109,9 @@ public class WhereClauseOrderBySizeTest extends BaseEntityManagerFunctionalTestC
@OneToMany(mappedBy = "owner", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE) @OneToMany(mappedBy = "owner", fetch = FetchType.LAZY, cascade = CascadeType.REMOVE)
private List<Book> books = new ArrayList<>(); private List<Book> books = new ArrayList<>();
public Person() {
}
public Person(String name) { public Person(String name) {
this.name = name; this.name = name;
} }