Skip to content

Commit

Permalink
HHH-11896 Fix test to be deterministic
Browse files Browse the repository at this point in the history
  • Loading branch information
Naros committed Dec 17, 2021
1 parent 3e3d227 commit 2e8d16e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.hibernate.envers.AuditJoinTable;
import org.hibernate.envers.Audited;
import org.hibernate.envers.query.AuditEntity;
import org.hibernate.envers.query.order.NullPrecedence;
import org.hibernate.orm.test.envers.BaseEnversJPAFunctionalTestCase;
import org.hibernate.orm.test.envers.Priority;
import org.hibernate.testing.TestForIssue;
Expand Down Expand Up @@ -182,7 +183,7 @@ public void testManyToOne() {
List list = getAuditReader().createQuery()
.forEntitiesAtRevision( EntityA.class, 1 )
.traverseRelation( "bManyToOne", JoinType.LEFT, "b", AuditEntity.property( "b", "type" ).eq( "T1" ) )
.addOrder( AuditEntity.property( "b", "number" ).asc() )
.addOrder( AuditEntity.property( "b", "number" ).asc().nulls( NullPrecedence.FIRST ) )
.up()
.addProjection( AuditEntity.id() )
.addProjection( AuditEntity.property( "b", "number" ) )
Expand All @@ -194,7 +195,7 @@ public void testManyToOne() {
public void testOneToMany() {
List list = getAuditReader().createQuery().forEntitiesAtRevision( EntityA.class, 1 )
.traverseRelation( "bOneToMany", JoinType.LEFT, "b", AuditEntity.property( "b", "type" ).eq( "T1" ) )
.addOrder( AuditEntity.property( "b", "number" ).asc() )
.addOrder( AuditEntity.property( "b", "number" ).asc().nulls( NullPrecedence.FIRST ) )
.up()
.addOrder( AuditEntity.id().asc() )
.addProjection( AuditEntity.id() )
Expand All @@ -208,9 +209,10 @@ public void testManyToMany() {
List list = getAuditReader().createQuery()
.forEntitiesAtRevision( EntityA.class, 1 )
.traverseRelation( "bManyToMany", JoinType.LEFT, "b", AuditEntity.property( "b", "type" ).eq( "T1" ) )
.addOrder( AuditEntity.property( "b", "number" ).asc() )
.addOrder( AuditEntity.property( "b", "number" ).asc().nulls( NullPrecedence.FIRST ) )
.up()
.addOrder( AuditEntity.id().asc() ).addProjection( AuditEntity.id() )
.addOrder( AuditEntity.id().asc().nulls( NullPrecedence.FIRST ) )
.addProjection(AuditEntity.id() )
.addProjection( AuditEntity.property( "b", "number" ) )
.getResultList();
assertArrayListEquals( list, tuple( a1.getId(), null ), tuple( a1.getId(), 1 ), tuple( a2.getId(), 3 ), tuple( a3.getId(), 3 ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ public void testOnClauseOnSingleSymbol() {
.forEntitiesAtRevision( Asset.class, 1 )
.addProjection( AuditEntity.id() )
.traverseRelation( "singleSymbol", JoinType.LEFT, "s", AuditEntity.property( "s", "type" ).eq( type1 ) )
.addOrder( AuditEntity.property( "s", "identifier" ).asc() )
.addOrder( AuditEntity.property( "s", "identifier" ).asc().nulls( NullPrecedence.FIRST ) )
.up()
.addOrder( AuditEntity.id().asc() )
.getResultList();
Expand All @@ -357,7 +357,7 @@ public void testOnClauseOnMultiSymbol() {
.forEntitiesAtRevision( Asset.class, 1 )
.addProjection( AuditEntity.id() )
.traverseRelation( "multiSymbols", JoinType.LEFT, "s", AuditEntity.property( "s", "type" ).eq( type1 ) )
.addOrder( AuditEntity.property( "s", "identifier" ).asc() )
.addOrder( AuditEntity.property( "s", "identifier" ).asc().nulls( NullPrecedence.FIRST ) )
.up()
.addOrder( AuditEntity.id().asc() )
.getResultList();
Expand Down

0 comments on commit 2e8d16e

Please sign in to comment.