HHH-12992 - Fix tests to run on various db platforms without naming conflicts.

This commit is contained in:
Chris Cranford 2018-10-31 15:52:14 -04:00
parent 3218f6cc7d
commit 1e2eea95cb
3 changed files with 47 additions and 47 deletions

View File

@ -54,8 +54,8 @@ public class OrderByOneAuditEntityTest extends BaseEnversJPAFunctionalTestCase {
private Integer id; private Integer id;
@OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER) @OneToMany(mappedBy = "parent", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
@OrderBy("index, index2 desc") @OrderBy("index1, index2 desc")
@AuditMappedBy(mappedBy = "parent", positionMappedBy = "index") @AuditMappedBy(mappedBy = "parent", positionMappedBy = "index1")
@Fetch(FetchMode.SELECT) @Fetch(FetchMode.SELECT)
@BatchSize(size = 100) @BatchSize(size = 100)
private List<Child> children = new ArrayList<>(); private List<Child> children = new ArrayList<>();
@ -83,7 +83,7 @@ public class OrderByOneAuditEntityTest extends BaseEnversJPAFunctionalTestCase {
@Id @Id
private Integer id; private Integer id;
private Integer index; private Integer index1;
private Integer index2; private Integer index2;
@ManyToOne @ManyToOne
@ -93,9 +93,9 @@ public class OrderByOneAuditEntityTest extends BaseEnversJPAFunctionalTestCase {
} }
public Child(Integer id, Integer index) { public Child(Integer id, Integer index1) {
this.id = id; this.id = id;
this.index = index; this.index1 = index1;
} }
public Integer getId() { public Integer getId() {
@ -106,12 +106,12 @@ public class OrderByOneAuditEntityTest extends BaseEnversJPAFunctionalTestCase {
this.id = id; this.id = id;
} }
public Integer getIndex() { public Integer getIndex1() {
return index; return index1;
} }
public void setIndex(Integer index) { public void setIndex1(Integer index1) {
this.index = index; this.index1 = index1;
} }
public Integer getIndex2() { public Integer getIndex2() {
@ -140,19 +140,19 @@ public class OrderByOneAuditEntityTest extends BaseEnversJPAFunctionalTestCase {
} }
Child child = (Child) o; Child child = (Child) o;
return Objects.equals( id, child.id ) && return Objects.equals( id, child.id ) &&
Objects.equals( index, child.index ); Objects.equals( index1, child.index1 );
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash( id, index ); return Objects.hash( id, index1 );
} }
@Override @Override
public String toString() { public String toString() {
return "Child{" + return "Child{" +
"id=" + id + "id=" + id +
", index=" + index + ", index1=" + index1 +
'}'; '}';
} }
} }
@ -172,14 +172,14 @@ public class OrderByOneAuditEntityTest extends BaseEnversJPAFunctionalTestCase {
final Child child1 = new Child(); final Child child1 = new Child();
child1.setId( 1 ); child1.setId( 1 );
child1.setIndex( 1 ); child1.setIndex1( 1 );
child1.setIndex2( 1 ); child1.setIndex2( 1 );
child1.setParent( parent ); child1.setParent( parent );
parent.getChildren().add( child1 ); parent.getChildren().add( child1 );
final Child child2 = new Child(); final Child child2 = new Child();
child2.setId( 2 ); child2.setId( 2 );
child2.setIndex( 2 ); child2.setIndex1( 2 );
child2.setIndex2( 2 ); child2.setIndex2( 2 );
child2.setParent( parent ); child2.setParent( parent );
parent.getChildren().add( child2 ); parent.getChildren().add( child2 );
@ -195,7 +195,7 @@ public class OrderByOneAuditEntityTest extends BaseEnversJPAFunctionalTestCase {
final Child child = new Child(); final Child child = new Child();
child.setId( 3 ); child.setId( 3 );
child.setIndex( 3 ); child.setIndex1( 3 );
child.setIndex2( 3 ); child.setIndex2( 3 );
child.setParent( parent ); child.setParent( parent );
parent.getChildren().add( child ); parent.getChildren().add( child );
@ -206,7 +206,7 @@ public class OrderByOneAuditEntityTest extends BaseEnversJPAFunctionalTestCase {
// Rev 3 // Rev 3
doInJPA( this::entityManagerFactory, entityManager -> { doInJPA( this::entityManagerFactory, entityManager -> {
final Parent parent = entityManager.find( Parent.class, parentId ); final Parent parent = entityManager.find( Parent.class, parentId );
parent.getChildren().removeIf( c -> c.getIndex() == 2 ); parent.getChildren().removeIf( c -> c.getIndex1() == 2 );
entityManager.merge( parent ); entityManager.merge( parent );
} ); } );

View File

@ -55,7 +55,7 @@ public class OrderByTwoEntityOneAuditedTest extends BaseEnversJPAFunctionalTestC
@Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED) @Audited(targetAuditMode = RelationTargetAuditMode.NOT_AUDITED)
@ManyToMany(mappedBy = "parents", cascade = CascadeType.ALL, fetch = FetchType.EAGER) @ManyToMany(mappedBy = "parents", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@OrderBy("index, index2 desc") @OrderBy("index1, index2 desc")
@Fetch(FetchMode.SELECT) @Fetch(FetchMode.SELECT)
@BatchSize(size = 100) @BatchSize(size = 100)
private List<Child> children = new ArrayList<>(); private List<Child> children = new ArrayList<>();
@ -83,7 +83,7 @@ public class OrderByTwoEntityOneAuditedTest extends BaseEnversJPAFunctionalTestC
@Id @Id
private Integer id; private Integer id;
private Integer index; private Integer index1;
private Integer index2; private Integer index2;
@ManyToMany @ManyToMany
@ -93,9 +93,9 @@ public class OrderByTwoEntityOneAuditedTest extends BaseEnversJPAFunctionalTestC
} }
public Child(Integer id, Integer index) { public Child(Integer id, Integer index1) {
this.id = id; this.id = id;
this.index = index; this.index1 = index1;
} }
public Integer getId() { public Integer getId() {
@ -106,12 +106,12 @@ public class OrderByTwoEntityOneAuditedTest extends BaseEnversJPAFunctionalTestC
this.id = id; this.id = id;
} }
public Integer getIndex() { public Integer getIndex1() {
return index; return index1;
} }
public void setIndex(Integer index) { public void setIndex1(Integer index1) {
this.index = index; this.index1 = index1;
} }
public Integer getIndex2() { public Integer getIndex2() {
@ -140,19 +140,19 @@ public class OrderByTwoEntityOneAuditedTest extends BaseEnversJPAFunctionalTestC
} }
Child child = (Child) o; Child child = (Child) o;
return Objects.equals( id, child.id ) && return Objects.equals( id, child.id ) &&
Objects.equals( index, child.index ); Objects.equals( index1, child.index1 );
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash( id, index ); return Objects.hash( id, index1 );
} }
@Override @Override
public String toString() { public String toString() {
return "Child{" + return "Child{" +
"id=" + id + "id=" + id +
", index=" + index + ", index1=" + index1 +
'}'; '}';
} }
} }
@ -172,14 +172,14 @@ public class OrderByTwoEntityOneAuditedTest extends BaseEnversJPAFunctionalTestC
final Child child1 = new Child(); final Child child1 = new Child();
child1.setId( 1 ); child1.setId( 1 );
child1.setIndex( 1 ); child1.setIndex1( 1 );
child1.setIndex2( 1 ); child1.setIndex2( 1 );
child1.getParents().add( parent ); child1.getParents().add( parent );
parent.getChildren().add( child1 ); parent.getChildren().add( child1 );
final Child child2 = new Child(); final Child child2 = new Child();
child2.setId( 2 ); child2.setId( 2 );
child2.setIndex( 2 ); child2.setIndex1( 2 );
child2.setIndex2( 2 ); child2.setIndex2( 2 );
child2.getParents().add( parent ); child2.getParents().add( parent );
parent.getChildren().add( child2 ); parent.getChildren().add( child2 );
@ -195,7 +195,7 @@ public class OrderByTwoEntityOneAuditedTest extends BaseEnversJPAFunctionalTestC
final Child child = new Child(); final Child child = new Child();
child.setId( 3 ); child.setId( 3 );
child.setIndex( 3 ); child.setIndex1( 3 );
child.setIndex2( 3 ); child.setIndex2( 3 );
child.getParents().add( parent ); child.getParents().add( parent );
parent.getChildren().add( child ); parent.getChildren().add( child );
@ -207,7 +207,7 @@ public class OrderByTwoEntityOneAuditedTest extends BaseEnversJPAFunctionalTestC
doInJPA( this::entityManagerFactory, entityManager -> { doInJPA( this::entityManagerFactory, entityManager -> {
final Parent parent = entityManager.find( Parent.class, parentId ); final Parent parent = entityManager.find( Parent.class, parentId );
parent.getChildren().removeIf( c -> { parent.getChildren().removeIf( c -> {
if ( c.getIndex() == 2 ) { if ( c.getIndex1() == 2 ) {
c.getParents().remove( parent ); c.getParents().remove( parent );
return true; return true;
} }

View File

@ -54,8 +54,8 @@ public class OrderByTwoEntityTest extends BaseEnversJPAFunctionalTestCase {
private Integer id; private Integer id;
@ManyToMany(mappedBy = "parents", cascade = CascadeType.ALL, fetch = FetchType.EAGER) @ManyToMany(mappedBy = "parents", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@OrderBy("index, index2 desc") @OrderBy("index1, index2 desc")
@AuditMappedBy(mappedBy = "parents", positionMappedBy = "index") @AuditMappedBy(mappedBy = "parents", positionMappedBy = "index1")
@Fetch(FetchMode.SELECT) @Fetch(FetchMode.SELECT)
@BatchSize(size = 100) @BatchSize(size = 100)
private List<Child> children = new ArrayList<>(); private List<Child> children = new ArrayList<>();
@ -83,7 +83,7 @@ public class OrderByTwoEntityTest extends BaseEnversJPAFunctionalTestCase {
@Id @Id
private Integer id; private Integer id;
private Integer index; private Integer index1;
private Integer index2; private Integer index2;
@ManyToMany @ManyToMany
@ -93,9 +93,9 @@ public class OrderByTwoEntityTest extends BaseEnversJPAFunctionalTestCase {
} }
public Child(Integer id, Integer index) { public Child(Integer id, Integer index1) {
this.id = id; this.id = id;
this.index = index; this.index1 = index1;
} }
public Integer getId() { public Integer getId() {
@ -106,12 +106,12 @@ public class OrderByTwoEntityTest extends BaseEnversJPAFunctionalTestCase {
this.id = id; this.id = id;
} }
public Integer getIndex() { public Integer getIndex1() {
return index; return index1;
} }
public void setIndex(Integer index) { public void setIndex1(Integer index1) {
this.index = index; this.index1 = index1;
} }
public Integer getIndex2() { public Integer getIndex2() {
@ -140,19 +140,19 @@ public class OrderByTwoEntityTest extends BaseEnversJPAFunctionalTestCase {
} }
Child child = (Child) o; Child child = (Child) o;
return Objects.equals( id, child.id ) && return Objects.equals( id, child.id ) &&
Objects.equals( index, child.index ); Objects.equals( index1, child.index1 );
} }
@Override @Override
public int hashCode() { public int hashCode() {
return Objects.hash( id, index ); return Objects.hash( id, index1 );
} }
@Override @Override
public String toString() { public String toString() {
return "Child{" + return "Child{" +
"id=" + id + "id=" + id +
", index=" + index + ", index1=" + index1 +
'}'; '}';
} }
} }
@ -172,14 +172,14 @@ public class OrderByTwoEntityTest extends BaseEnversJPAFunctionalTestCase {
final Child child1 = new Child(); final Child child1 = new Child();
child1.setId( 1 ); child1.setId( 1 );
child1.setIndex( 1 ); child1.setIndex1( 1 );
child1.setIndex2( 1 ); child1.setIndex2( 1 );
child1.getParents().add( parent ); child1.getParents().add( parent );
parent.getChildren().add( child1 ); parent.getChildren().add( child1 );
final Child child2 = new Child(); final Child child2 = new Child();
child2.setId( 2 ); child2.setId( 2 );
child2.setIndex( 2 ); child2.setIndex1( 2 );
child2.setIndex2( 2 ); child2.setIndex2( 2 );
child2.getParents().add( parent ); child2.getParents().add( parent );
parent.getChildren().add( child2 ); parent.getChildren().add( child2 );
@ -195,7 +195,7 @@ public class OrderByTwoEntityTest extends BaseEnversJPAFunctionalTestCase {
final Child child = new Child(); final Child child = new Child();
child.setId( 3 ); child.setId( 3 );
child.setIndex( 3 ); child.setIndex1( 3 );
child.setIndex2( 3 ); child.setIndex2( 3 );
child.getParents().add( parent ); child.getParents().add( parent );
parent.getChildren().add( child ); parent.getChildren().add( child );
@ -207,7 +207,7 @@ public class OrderByTwoEntityTest extends BaseEnversJPAFunctionalTestCase {
doInJPA( this::entityManagerFactory, entityManager -> { doInJPA( this::entityManagerFactory, entityManager -> {
final Parent parent = entityManager.find( Parent.class, parentId ); final Parent parent = entityManager.find( Parent.class, parentId );
parent.getChildren().removeIf( c -> { parent.getChildren().removeIf( c -> {
if ( c.getIndex() == 2 ) { if ( c.getIndex1() == 2 ) {
c.getParents().remove( parent ); c.getParents().remove( parent );
return true; return true;
} }