HHH-12754 - Fix broken envers tests on other database platforms.

This commit is contained in:
Chris Cranford 2018-07-02 10:08:33 -04:00
parent 387bbc51c1
commit c33000d7ad
6 changed files with 78 additions and 72 deletions

View File

@ -29,6 +29,7 @@ import org.hibernate.testing.TestForIssue;
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
/**
@ -74,27 +75,27 @@ public class ListEqualsHashCodeTest extends BaseEnversJPAFunctionalTestCase {
public void testAuditRowsForValidityAuditStrategy() {
if ( ValidityAuditStrategy.class.getName().equals( getAuditStrategy() ) ) {
doInJPA( this::entityManagerFactory, entityManager -> {
List<Tuple> results = entityManager
.createNativeQuery(
Long results = entityManager
.createQuery(
"SELECT COUNT(1) FROM TestEntity_embs1_AUD WHERE REVEND IS NULL",
Tuple.class
Long.class
)
.getResultList();
.getSingleResult();
assertEquals( 1, results.size() );
assertEquals( BigInteger.valueOf( 4 ), results.get( 0 ).get( 0 ) );
assertNotNull( results );
assertEquals( Long.valueOf( 4 ), results );
} );
doInJPA( this::entityManagerFactory, entityManager -> {
List<Tuple> results = entityManager
.createNativeQuery(
Long results = entityManager
.createQuery(
"SELECT COUNT(1) FROM TestEntity_embs1_AUD",
Tuple.class
Long.class
)
.getResultList();
.getSingleResult();
assertEquals( 1, results.size() );
assertEquals( BigInteger.valueOf( 6 ), results.get( 0 ).get( 0 ) );
assertNotNull( results );
assertEquals( Long.valueOf( 6 ), results );
} );
}
}

View File

@ -28,6 +28,7 @@ import org.hibernate.testing.TestForIssue;
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
/**
@ -73,27 +74,27 @@ public class ListNoEqualsHashCodeTest extends BaseEnversJPAFunctionalTestCase {
public void testAuditRowsForValidityAuditStrategy() {
if ( ValidityAuditStrategy.class.getName().equals( getAuditStrategy() ) ) {
doInJPA( this::entityManagerFactory, entityManager -> {
List<Tuple> results = entityManager
.createNativeQuery(
Long results = entityManager
.createQuery(
"SELECT COUNT(1) FROM TestEntity_embs1_AUD WHERE REVEND IS NULL",
Tuple.class
Long.class
)
.getResultList();
.getSingleResult();
assertEquals( 1, results.size() );
assertEquals( BigInteger.valueOf( 4 ), results.get( 0 ).get( 0 ) );
assertNotNull( results );
assertEquals( Long.valueOf( 4 ), results );
} );
doInJPA( this::entityManagerFactory, entityManager -> {
List<Tuple> results = entityManager
.createNativeQuery(
Long results = entityManager
.createQuery(
"SELECT COUNT(1) FROM TestEntity_embs1_AUD",
Tuple.class
Long.class
)
.getResultList();
.getSingleResult();
assertEquals( 1, results.size() );
assertEquals( BigInteger.valueOf( 6 ), results.get( 0 ).get( 0 ) );
assertNotNull( results );
assertEquals( Long.valueOf( 6 ), results );
} );
}
}

View File

@ -29,6 +29,7 @@ import org.hibernate.testing.TestForIssue;
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
/**
* This test verifies that when a map-based {@link ElementCollection} of {@link Embeddable} objects
@ -89,27 +90,27 @@ public class MapEqualsHashCodeTest extends BaseEnversJPAFunctionalTestCase {
public void testAuditRowsForValidityAuditStrategy() {
if ( ValidityAuditStrategy.class.getName().equals( getAuditStrategy() ) ) {
doInJPA( this::entityManagerFactory, entityManager -> {
List<Tuple> results = entityManager
.createNativeQuery(
Long results = entityManager
.createQuery(
"SELECT COUNT(1) FROM TestEntity_embs1_AUD WHERE REVEND IS NULL",
Tuple.class
Long.class
)
.getResultList();
.getSingleResult();
assertEquals( 1, results.size() );
assertEquals( BigInteger.valueOf( 3 ), results.get( 0 ).get( 0 ) );
assertNotNull( results );
assertEquals( Long.valueOf( 3 ), results );
} );
doInJPA( this::entityManagerFactory, entityManager -> {
List<Tuple> results = entityManager
.createNativeQuery(
Long results = entityManager
.createQuery(
"SELECT COUNT(1) FROM TestEntity_embs1_AUD",
Tuple.class
Long.class
)
.getResultList();
.getSingleResult();
assertEquals( 1, results.size() );
assertEquals( BigInteger.valueOf( 4 ), results.get( 0 ).get( 0 ) );
assertNotNull( results );
assertEquals( Long.valueOf( 4 ), results );
} );
}
}

View File

@ -28,6 +28,7 @@ import org.hibernate.testing.TestForIssue;
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
/**
* This test verifies that when a map-based {@link ElementCollection} of {@link Embeddable} objects
@ -86,27 +87,27 @@ public class MapNoEqualsHashCodeTest extends BaseEnversJPAFunctionalTestCase {
public void testAuditRowsForValidityAuditStrategy() {
if ( ValidityAuditStrategy.class.getName().equals( getAuditStrategy() ) ) {
doInJPA( this::entityManagerFactory, entityManager -> {
List<Tuple> results = entityManager
.createNativeQuery(
Long results = entityManager
.createQuery(
"SELECT COUNT(1) FROM TestEntity_embs1_AUD WHERE REVEND IS NULL",
Tuple.class
Long.class
)
.getResultList();
.getSingleResult();
assertEquals( 1, results.size() );
assertEquals( BigInteger.valueOf( 3 ), results.get( 0 ).get( 0 ) );
assertNotNull( results );
assertEquals( Long.valueOf( 3 ), results );
} );
doInJPA( this::entityManagerFactory, entityManager -> {
List<Tuple> results = entityManager
.createNativeQuery(
Long results = entityManager
.createQuery(
"SELECT COUNT(1) FROM TestEntity_embs1_AUD",
Tuple.class
Long.class
)
.getResultList();
.getSingleResult();
assertEquals( 1, results.size() );
assertEquals( BigInteger.valueOf( 4 ), results.get( 0 ).get( 0 ) );
assertNotNull( results );
assertEquals( Long.valueOf( 4 ), results );
} );
}
}

View File

@ -30,6 +30,7 @@ import org.hibernate.testing.TestForIssue;
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
/**
* This test verifies that when a set-based {@link ElementCollection} of {@link Embeddable} objects
@ -93,27 +94,27 @@ public class SetEqualsHashCodeTest extends BaseEnversJPAFunctionalTestCase {
public void testAuditRowsForValidityAuditStrategy() {
if ( ValidityAuditStrategy.class.getName().equals( getAuditStrategy() ) ) {
doInJPA( this::entityManagerFactory, entityManager -> {
List<Tuple> results = entityManager
.createNativeQuery(
Long results = entityManager
.createQuery(
"SELECT COUNT(1) FROM TestEntity_embs1_AUD WHERE REVEND IS NULL",
Tuple.class
Long.class
)
.getResultList();
.getSingleResult();
assertEquals( 1, results.size() );
assertEquals( BigInteger.valueOf( 3 ), results.get( 0 ).get( 0 ) );
assertNotNull( results );
assertEquals( Long.valueOf( 3 ), results );
} );
doInJPA( this::entityManagerFactory, entityManager -> {
List<Tuple> results = entityManager
.createNativeQuery(
Long results = entityManager
.createQuery(
"SELECT COUNT(1) FROM TestEntity_embs1_AUD",
Tuple.class
Long.class
)
.getResultList();
.getSingleResult();
assertEquals( 1, results.size() );
assertEquals( BigInteger.valueOf( 4 ), results.get( 0 ).get( 0 ) );
assertNotNull( results );
assertEquals( Long.valueOf( 4 ), results );
} );
}
}

View File

@ -30,6 +30,7 @@ import org.hibernate.testing.TestForIssue;
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.fail;
/**
@ -97,27 +98,27 @@ public class SetNoEqualsHashCodeTest extends BaseEnversJPAFunctionalTestCase {
public void testAuditRowsForValidityAuditStrategy() {
if ( ValidityAuditStrategy.class.getName().equals( getAuditStrategy() ) ) {
doInJPA( this::entityManagerFactory, entityManager -> {
List<Tuple> results = entityManager
.createNativeQuery(
Long results = entityManager
.createQuery(
"SELECT COUNT(1) FROM TestEntity_embs1_AUD WHERE REVEND IS NULL",
Tuple.class
Long.class
)
.getResultList();
.getSingleResult();
assertEquals( 1, results.size() );
assertEquals( BigInteger.valueOf( 3 ), results.get( 0 ).get( 0 ) );
assertNotNull( results );
assertEquals( Long.valueOf( 3 ), results );
} );
doInJPA( this::entityManagerFactory, entityManager -> {
List<Tuple> results = entityManager
.createNativeQuery(
Long results = entityManager
.createQuery(
"SELECT COUNT(1) FROM TestEntity_embs1_AUD",
Tuple.class
Long.class
)
.getResultList();
.getSingleResult();
assertEquals( 1, results.size() );
assertEquals( BigInteger.valueOf( 4 ), results.get( 0 ).get( 0 ) );
assertNotNull( results );
assertEquals( Long.valueOf( 4 ), results );
} );
}
}