HHH-5845 - Collection proxy of deleted state
This commit is contained in:
parent
ca4aeb53f0
commit
063d88013a
|
@ -72,7 +72,7 @@ public final class OneAuditEntityQueryGenerator extends AbstractRelationQueryGen
|
|||
final QueryBuilder validQuery = commonPart.deepCopy();
|
||||
final QueryBuilder removedQuery = commonPart.deepCopy();
|
||||
createValidDataRestrictions(
|
||||
globalCfg, auditStrategy, referencedIdData, validQuery, validQuery.getRootParameters(), true
|
||||
globalCfg, auditStrategy, referencedIdData, validQuery, validQuery.getRootParameters()
|
||||
);
|
||||
createValidAndRemovedDataRestrictions( globalCfg, auditStrategy, referencedIdData, removedQuery );
|
||||
|
||||
|
@ -97,8 +97,7 @@ public final class OneAuditEntityQueryGenerator extends AbstractRelationQueryGen
|
|||
* Creates query restrictions used to retrieve only actual data.
|
||||
*/
|
||||
private void createValidDataRestrictions(GlobalConfiguration globalCfg, AuditStrategy auditStrategy,
|
||||
MiddleIdData referencedIdData, QueryBuilder qb, Parameters rootParameters,
|
||||
boolean inclusive) {
|
||||
MiddleIdData referencedIdData, QueryBuilder qb, Parameters rootParameters) {
|
||||
final String revisionPropertyPath = verEntCfg.getRevisionNumberPath();
|
||||
// (selecting e entities at revision :revision)
|
||||
// --> based on auditStrategy (see above)
|
||||
|
@ -106,7 +105,7 @@ public final class OneAuditEntityQueryGenerator extends AbstractRelationQueryGen
|
|||
globalCfg, qb, rootParameters, revisionPropertyPath,
|
||||
verEntCfg.getRevisionEndFieldName(), true, referencedIdData, revisionPropertyPath,
|
||||
verEntCfg.getOriginalIdPropName(), REFERENCED_ENTITY_ALIAS, REFERENCED_ENTITY_ALIAS_DEF_AUD_STR,
|
||||
inclusive
|
||||
true
|
||||
);
|
||||
// e.revision_type != DEL
|
||||
rootParameters.addWhereWithNamedParam( getRevisionTypePath(), false, "!=", DEL_REVISION_TYPE_PARAMETER );
|
||||
|
@ -121,7 +120,7 @@ public final class OneAuditEntityQueryGenerator extends AbstractRelationQueryGen
|
|||
final Parameters valid = disjoint.addSubParameters( "and" ); // Restrictions to match all valid rows.
|
||||
final Parameters removed = disjoint.addSubParameters( "and" ); // Restrictions to match all rows deleted at exactly given revision.
|
||||
// Excluding current revision, because we need to match data valid at the previous one.
|
||||
createValidDataRestrictions( globalCfg, auditStrategy, referencedIdData, remQb, valid, false );
|
||||
createValidDataRestrictions( globalCfg, auditStrategy, referencedIdData, remQb, valid );
|
||||
// e.revision = :revision
|
||||
removed.addWhereWithNamedParam( verEntCfg.getRevisionNumberPath(), false, "=", REVISION_PARAMETER );
|
||||
// e.revision_type = DEL
|
||||
|
|
|
@ -163,14 +163,14 @@ public final class ThreeEntityQueryGenerator extends AbstractRelationQueryGenera
|
|||
auditStrategy.addEntityAtRevisionRestriction(
|
||||
globalCfg, qb, rootParameters, REFERENCED_ENTITY_ALIAS + "." + revisionPropertyPath,
|
||||
REFERENCED_ENTITY_ALIAS + "." + verEntCfg.getRevisionEndFieldName(), false, referencedIdData, revisionPropertyPath,
|
||||
originalIdPropertyName, REFERENCED_ENTITY_ALIAS, REFERENCED_ENTITY_ALIAS_DEF_AUD_STR, inclusive
|
||||
originalIdPropertyName, REFERENCED_ENTITY_ALIAS, REFERENCED_ENTITY_ALIAS_DEF_AUD_STR, true
|
||||
);
|
||||
// (selecting f entities at revision :revision)
|
||||
// --> based on auditStrategy (see above)
|
||||
auditStrategy.addEntityAtRevisionRestriction(
|
||||
globalCfg, qb, rootParameters, REFERENCED_ENTITY_ALIAS + "." + revisionPropertyPath,
|
||||
REFERENCED_ENTITY_ALIAS + "." + verEntCfg.getRevisionEndFieldName(), false, referencedIdData, revisionPropertyPath,
|
||||
originalIdPropertyName, INDEX_ENTITY_ALIAS, INDEX_ENTITY_ALIAS_DEF_AUD_STR, inclusive
|
||||
globalCfg, qb, rootParameters, INDEX_ENTITY_ALIAS + "." + revisionPropertyPath,
|
||||
INDEX_ENTITY_ALIAS + "." + verEntCfg.getRevisionEndFieldName(), false, referencedIdData, revisionPropertyPath,
|
||||
originalIdPropertyName, INDEX_ENTITY_ALIAS, INDEX_ENTITY_ALIAS_DEF_AUD_STR, true
|
||||
);
|
||||
// (with ee association at revision :revision)
|
||||
// --> based on auditStrategy (see above)
|
||||
|
|
|
@ -136,7 +136,7 @@ public final class TwoEntityQueryGenerator extends AbstractRelationQueryGenerato
|
|||
auditStrategy.addEntityAtRevisionRestriction(
|
||||
globalCfg, qb, rootParameters, REFERENCED_ENTITY_ALIAS + "." + revisionPropertyPath,
|
||||
REFERENCED_ENTITY_ALIAS + "." + verEntCfg.getRevisionEndFieldName(), false, referencedIdData, revisionPropertyPath,
|
||||
originalIdPropertyName, REFERENCED_ENTITY_ALIAS, REFERENCED_ENTITY_ALIAS_DEF_AUD_STR, inclusive
|
||||
originalIdPropertyName, REFERENCED_ENTITY_ALIAS, REFERENCED_ENTITY_ALIAS_DEF_AUD_STR, true
|
||||
);
|
||||
// (with ee association at revision :revision)
|
||||
// --> based on auditStrategy (see above)
|
||||
|
|
|
@ -55,9 +55,9 @@ public class CollectionRefIngEntity implements Serializable {
|
|||
this.reference = reference;
|
||||
}
|
||||
|
||||
public CollectionRefIngEntity(String data, CollectionRefEdEntity reference) {
|
||||
this.data = data;
|
||||
this.reference = reference;
|
||||
public CollectionRefIngEntity(Integer id, String data) {
|
||||
this.id = id;
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
|
|
|
@ -106,7 +106,6 @@ public class NotOwnedBidirectional extends BaseEnversJPAFunctionalTestCase {
|
|||
|
||||
@Test
|
||||
public void testHistoryOfPersonalContact() {
|
||||
System.out.println(getAuditReader().find(PersonalContact.class, pc_id, 1).getAddresses());
|
||||
assert getAuditReader().find(PersonalContact.class, pc_id, 1).getAddresses().equals(
|
||||
TestTools.makeSet(new Address(a1_id, "a1")));
|
||||
|
||||
|
|
|
@ -106,7 +106,6 @@ public class NotOwnedBidirectional extends BaseEnversJPAFunctionalTestCase {
|
|||
|
||||
@Test
|
||||
public void testHistoryOfPersonalContact() {
|
||||
System.out.println(getAuditReader().find(PersonalContact.class, pc_id, 1).getAddresses());
|
||||
assert getAuditReader().find(PersonalContact.class, pc_id, 1).getAddresses().equals(
|
||||
TestTools.makeSet(new Address(a1_id, "a1")));
|
||||
|
||||
|
|
|
@ -152,10 +152,10 @@ public class BasicList extends BaseEnversJPAFunctionalTestCase {
|
|||
ListOwnedEntity rev5 = getAuditReader().find(ListOwnedEntity.class, ed1_id, 5);
|
||||
|
||||
assert rev1.getReferencing().equals(Collections.EMPTY_LIST);
|
||||
assert TestTools.checkList(rev2.getReferencing(), ing1, ing2);
|
||||
assert TestTools.checkList(rev3.getReferencing(), ing1, ing2);
|
||||
assert TestTools.checkList(rev4.getReferencing(), ing2);
|
||||
assert TestTools.checkList(rev5.getReferencing(), ing2);
|
||||
assert TestTools.checkCollection( rev2.getReferencing(), ing1, ing2 );
|
||||
assert TestTools.checkCollection( rev3.getReferencing(), ing1, ing2 );
|
||||
assert TestTools.checkCollection( rev4.getReferencing(), ing2 );
|
||||
assert TestTools.checkCollection( rev5.getReferencing(), ing2 );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -170,10 +170,10 @@ public class BasicList extends BaseEnversJPAFunctionalTestCase {
|
|||
ListOwnedEntity rev5 = getAuditReader().find(ListOwnedEntity.class, ed2_id, 5);
|
||||
|
||||
assert rev1.getReferencing().equals(Collections.EMPTY_LIST);
|
||||
assert TestTools.checkList(rev2.getReferencing(), ing2);
|
||||
assert TestTools.checkList(rev3.getReferencing(), ing1, ing2);
|
||||
assert TestTools.checkList(rev4.getReferencing(), ing1, ing2);
|
||||
assert TestTools.checkList(rev5.getReferencing(), ing2);
|
||||
assert TestTools.checkCollection( rev2.getReferencing(), ing2 );
|
||||
assert TestTools.checkCollection( rev3.getReferencing(), ing1, ing2 );
|
||||
assert TestTools.checkCollection( rev4.getReferencing(), ing1, ing2 );
|
||||
assert TestTools.checkCollection( rev5.getReferencing(), ing2 );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -188,9 +188,9 @@ public class BasicList extends BaseEnversJPAFunctionalTestCase {
|
|||
ListOwningEntity rev5 = getAuditReader().find(ListOwningEntity.class, ing1_id, 5);
|
||||
|
||||
assert rev1.getReferences().equals(Collections.EMPTY_LIST);
|
||||
assert TestTools.checkList(rev2.getReferences(), ed1);
|
||||
assert TestTools.checkList(rev3.getReferences(), ed1, ed2);
|
||||
assert TestTools.checkList(rev4.getReferences(), ed2);
|
||||
assert TestTools.checkCollection( rev2.getReferences(), ed1 );
|
||||
assert TestTools.checkCollection( rev3.getReferences(), ed1, ed2 );
|
||||
assert TestTools.checkCollection( rev4.getReferences(), ed2 );
|
||||
assert rev5.getReferences().equals(Collections.EMPTY_LIST);
|
||||
}
|
||||
|
||||
|
@ -206,9 +206,9 @@ public class BasicList extends BaseEnversJPAFunctionalTestCase {
|
|||
ListOwningEntity rev5 = getAuditReader().find(ListOwningEntity.class, ing2_id, 5);
|
||||
|
||||
assert rev1.getReferences().equals(Collections.EMPTY_LIST);
|
||||
assert TestTools.checkList(rev2.getReferences(), ed1, ed2);
|
||||
assert TestTools.checkList(rev3.getReferences(), ed1, ed2);
|
||||
assert TestTools.checkList(rev4.getReferences(), ed1, ed2);
|
||||
assert TestTools.checkList(rev5.getReferences(), ed1, ed2);
|
||||
assert TestTools.checkCollection( rev2.getReferences(), ed1, ed2 );
|
||||
assert TestTools.checkCollection( rev3.getReferences(), ed1, ed2 );
|
||||
assert TestTools.checkCollection( rev4.getReferences(), ed1, ed2 );
|
||||
assert TestTools.checkCollection( rev5.getReferences(), ed1, ed2 );
|
||||
}
|
||||
}
|
|
@ -151,16 +151,16 @@ public class BasicWhereJoinTable extends BaseEnversJPAFunctionalTestCase {
|
|||
WhereJoinTableEntity rev4 = getAuditReader().find(WhereJoinTableEntity.class, wjte1_id, 4);
|
||||
|
||||
// Checking 1st list
|
||||
assert TestTools.checkList(rev1.getReferences1());
|
||||
assert TestTools.checkList(rev2.getReferences1(), ite1_1);
|
||||
assert TestTools.checkList(rev3.getReferences1(), ite1_1);
|
||||
assert TestTools.checkList(rev4.getReferences1());
|
||||
assert TestTools.checkCollection( rev1.getReferences1() );
|
||||
assert TestTools.checkCollection( rev2.getReferences1(), ite1_1 );
|
||||
assert TestTools.checkCollection( rev3.getReferences1(), ite1_1 );
|
||||
assert TestTools.checkCollection( rev4.getReferences1() );
|
||||
|
||||
// Checking 2nd list
|
||||
assert TestTools.checkList(rev1.getReferences2());
|
||||
assert TestTools.checkList(rev2.getReferences2(), ite2_1);
|
||||
assert TestTools.checkList(rev3.getReferences2(), ite2_1);
|
||||
assert TestTools.checkList(rev4.getReferences2(), ite2_1);
|
||||
assert TestTools.checkCollection( rev1.getReferences2() );
|
||||
assert TestTools.checkCollection( rev2.getReferences2(), ite2_1 );
|
||||
assert TestTools.checkCollection( rev3.getReferences2(), ite2_1 );
|
||||
assert TestTools.checkCollection( rev4.getReferences2(), ite2_1 );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -175,15 +175,15 @@ public class BasicWhereJoinTable extends BaseEnversJPAFunctionalTestCase {
|
|||
WhereJoinTableEntity rev4 = getAuditReader().find(WhereJoinTableEntity.class, wjte2_id, 4);
|
||||
|
||||
// Checking 1st list
|
||||
assert TestTools.checkList(rev1.getReferences1());
|
||||
assert TestTools.checkList(rev2.getReferences1());
|
||||
assert TestTools.checkList(rev3.getReferences1(), ite1_1, ite1_2);
|
||||
assert TestTools.checkList(rev4.getReferences1(), ite1_1, ite1_2);
|
||||
assert TestTools.checkCollection( rev1.getReferences1() );
|
||||
assert TestTools.checkCollection( rev2.getReferences1() );
|
||||
assert TestTools.checkCollection( rev3.getReferences1(), ite1_1, ite1_2 );
|
||||
assert TestTools.checkCollection( rev4.getReferences1(), ite1_1, ite1_2 );
|
||||
|
||||
// Checking 2nd list
|
||||
assert TestTools.checkList(rev1.getReferences2());
|
||||
assert TestTools.checkList(rev2.getReferences2());
|
||||
assert TestTools.checkList(rev3.getReferences2());
|
||||
assert TestTools.checkList(rev4.getReferences2(), ite2_2);
|
||||
assert TestTools.checkCollection( rev1.getReferences2() );
|
||||
assert TestTools.checkCollection( rev2.getReferences2() );
|
||||
assert TestTools.checkCollection( rev3.getReferences2() );
|
||||
assert TestTools.checkCollection( rev4.getReferences2(), ite2_2 );
|
||||
}
|
||||
}
|
|
@ -159,11 +159,11 @@ public class BasicBiowned extends BaseEnversJPAFunctionalTestCase {
|
|||
ListBiowning1Entity rev4 = getAuditReader().find(ListBiowning1Entity.class, o1_1_id, 4);
|
||||
ListBiowning1Entity rev5 = getAuditReader().find(ListBiowning1Entity.class, o1_1_id, 5);
|
||||
|
||||
assert TestTools.checkList(rev1.getReferences());
|
||||
assert TestTools.checkList(rev2.getReferences(), o2_1);
|
||||
assert TestTools.checkList(rev3.getReferences(), o2_1, o2_2);
|
||||
assert TestTools.checkList(rev4.getReferences());
|
||||
assert TestTools.checkList(rev5.getReferences(), o2_2);
|
||||
assert TestTools.checkCollection( rev1.getReferences() );
|
||||
assert TestTools.checkCollection( rev2.getReferences(), o2_1 );
|
||||
assert TestTools.checkCollection( rev3.getReferences(), o2_1, o2_2 );
|
||||
assert TestTools.checkCollection( rev4.getReferences() );
|
||||
assert TestTools.checkCollection( rev5.getReferences(), o2_2 );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -177,12 +177,11 @@ public class BasicBiowned extends BaseEnversJPAFunctionalTestCase {
|
|||
ListBiowning1Entity rev4 = getAuditReader().find(ListBiowning1Entity.class, o1_2_id, 4);
|
||||
ListBiowning1Entity rev5 = getAuditReader().find(ListBiowning1Entity.class, o1_2_id, 5);
|
||||
|
||||
assert TestTools.checkList(rev1.getReferences());
|
||||
assert TestTools.checkList(rev2.getReferences(), o2_2);
|
||||
assert TestTools.checkList(rev3.getReferences(), o2_2);
|
||||
assert TestTools.checkList(rev4.getReferences(), o2_1, o2_2);
|
||||
System.out.println("rev5.getReferences() = " + rev5.getReferences());
|
||||
assert TestTools.checkList(rev5.getReferences(), o2_2);
|
||||
assert TestTools.checkCollection( rev1.getReferences() );
|
||||
assert TestTools.checkCollection( rev2.getReferences(), o2_2 );
|
||||
assert TestTools.checkCollection( rev3.getReferences(), o2_2 );
|
||||
assert TestTools.checkCollection( rev4.getReferences(), o2_1, o2_2 );
|
||||
assert TestTools.checkCollection( rev5.getReferences(), o2_2 );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -196,11 +195,11 @@ public class BasicBiowned extends BaseEnversJPAFunctionalTestCase {
|
|||
ListBiowning2Entity rev4 = getAuditReader().find(ListBiowning2Entity.class, o2_1_id, 4);
|
||||
ListBiowning2Entity rev5 = getAuditReader().find(ListBiowning2Entity.class, o2_1_id, 5);
|
||||
|
||||
assert TestTools.checkList(rev1.getReferences());
|
||||
assert TestTools.checkList(rev2.getReferences(), o1_1);
|
||||
assert TestTools.checkList(rev3.getReferences(), o1_1);
|
||||
assert TestTools.checkList(rev4.getReferences(), o1_2);
|
||||
assert TestTools.checkList(rev5.getReferences());
|
||||
assert TestTools.checkCollection( rev1.getReferences() );
|
||||
assert TestTools.checkCollection( rev2.getReferences(), o1_1 );
|
||||
assert TestTools.checkCollection( rev3.getReferences(), o1_1 );
|
||||
assert TestTools.checkCollection( rev4.getReferences(), o1_2 );
|
||||
assert TestTools.checkCollection( rev5.getReferences() );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -214,10 +213,10 @@ public class BasicBiowned extends BaseEnversJPAFunctionalTestCase {
|
|||
ListBiowning2Entity rev4 = getAuditReader().find(ListBiowning2Entity.class, o2_2_id, 4);
|
||||
ListBiowning2Entity rev5 = getAuditReader().find(ListBiowning2Entity.class, o2_2_id, 5);
|
||||
|
||||
assert TestTools.checkList(rev1.getReferences());
|
||||
assert TestTools.checkList(rev2.getReferences(), o1_2);
|
||||
assert TestTools.checkList(rev3.getReferences(), o1_1, o1_2);
|
||||
assert TestTools.checkList(rev4.getReferences(), o1_2);
|
||||
assert TestTools.checkList(rev5.getReferences(), o1_1, o1_2);
|
||||
assert TestTools.checkCollection( rev1.getReferences() );
|
||||
assert TestTools.checkCollection( rev2.getReferences(), o1_2 );
|
||||
assert TestTools.checkCollection( rev3.getReferences(), o1_1, o1_2 );
|
||||
assert TestTools.checkCollection( rev4.getReferences(), o1_2 );
|
||||
assert TestTools.checkCollection( rev5.getReferences(), o1_1, o1_2 );
|
||||
}
|
||||
}
|
|
@ -196,17 +196,17 @@ public class BasicSametable extends BaseEnversJPAFunctionalTestCase {
|
|||
ParentEntity rev4 = getAuditReader().find(ParentEntity.class, p1_id, 4);
|
||||
ParentEntity rev5 = getAuditReader().find(ParentEntity.class, p1_id, 5);
|
||||
|
||||
assert TestTools.checkList(rev1.getChildren1());
|
||||
assert TestTools.checkList(rev2.getChildren1(), c1_1);
|
||||
assert TestTools.checkList(rev3.getChildren1(), c1_1, c1_2);
|
||||
assert TestTools.checkList(rev4.getChildren1(), c1_2);
|
||||
assert TestTools.checkList(rev5.getChildren1());
|
||||
assert TestTools.checkCollection( rev1.getChildren1() );
|
||||
assert TestTools.checkCollection( rev2.getChildren1(), c1_1 );
|
||||
assert TestTools.checkCollection( rev3.getChildren1(), c1_1, c1_2 );
|
||||
assert TestTools.checkCollection( rev4.getChildren1(), c1_2 );
|
||||
assert TestTools.checkCollection( rev5.getChildren1() );
|
||||
|
||||
assert TestTools.checkList(rev1.getChildren2());
|
||||
assert TestTools.checkList(rev2.getChildren2());
|
||||
assert TestTools.checkList(rev3.getChildren2(), c2_2);
|
||||
assert TestTools.checkList(rev4.getChildren2(), c2_2);
|
||||
assert TestTools.checkList(rev5.getChildren2(), c2_2);
|
||||
assert TestTools.checkCollection( rev1.getChildren2() );
|
||||
assert TestTools.checkCollection( rev2.getChildren2() );
|
||||
assert TestTools.checkCollection( rev3.getChildren2(), c2_2 );
|
||||
assert TestTools.checkCollection( rev4.getChildren2(), c2_2 );
|
||||
assert TestTools.checkCollection( rev5.getChildren2(), c2_2 );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -221,17 +221,17 @@ public class BasicSametable extends BaseEnversJPAFunctionalTestCase {
|
|||
ParentEntity rev4 = getAuditReader().find(ParentEntity.class, p2_id, 4);
|
||||
ParentEntity rev5 = getAuditReader().find(ParentEntity.class, p2_id, 5);
|
||||
|
||||
assert TestTools.checkList(rev1.getChildren1());
|
||||
assert TestTools.checkList(rev2.getChildren1());
|
||||
assert TestTools.checkList(rev3.getChildren1(), c1_1);
|
||||
assert TestTools.checkList(rev4.getChildren1(), c1_1);
|
||||
assert TestTools.checkList(rev5.getChildren1(), c1_1);
|
||||
assert TestTools.checkCollection( rev1.getChildren1() );
|
||||
assert TestTools.checkCollection( rev2.getChildren1() );
|
||||
assert TestTools.checkCollection( rev3.getChildren1(), c1_1 );
|
||||
assert TestTools.checkCollection( rev4.getChildren1(), c1_1 );
|
||||
assert TestTools.checkCollection( rev5.getChildren1(), c1_1 );
|
||||
|
||||
assert TestTools.checkList(rev1.getChildren2());
|
||||
assert TestTools.checkList(rev2.getChildren2(), c2_1);
|
||||
assert TestTools.checkList(rev3.getChildren2(), c2_1);
|
||||
assert TestTools.checkList(rev4.getChildren2(), c2_1, c2_2);
|
||||
assert TestTools.checkList(rev5.getChildren2(), c2_1);
|
||||
assert TestTools.checkCollection( rev1.getChildren2() );
|
||||
assert TestTools.checkCollection( rev2.getChildren2(), c2_1 );
|
||||
assert TestTools.checkCollection( rev3.getChildren2(), c2_1 );
|
||||
assert TestTools.checkCollection( rev4.getChildren2(), c2_1, c2_2 );
|
||||
assert TestTools.checkCollection( rev5.getChildren2(), c2_1 );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -245,11 +245,11 @@ public class BasicSametable extends BaseEnversJPAFunctionalTestCase {
|
|||
Child1Entity rev4 = getAuditReader().find(Child1Entity.class, c1_1_id, 4);
|
||||
Child1Entity rev5 = getAuditReader().find(Child1Entity.class, c1_1_id, 5);
|
||||
|
||||
assert TestTools.checkList(rev1.getParents());
|
||||
assert TestTools.checkList(rev2.getParents(), p1);
|
||||
assert TestTools.checkList(rev3.getParents(), p1, p2);
|
||||
assert TestTools.checkList(rev4.getParents(), p2);
|
||||
assert TestTools.checkList(rev5.getParents(), p2);
|
||||
assert TestTools.checkCollection( rev1.getParents() );
|
||||
assert TestTools.checkCollection( rev2.getParents(), p1 );
|
||||
assert TestTools.checkCollection( rev3.getParents(), p1, p2 );
|
||||
assert TestTools.checkCollection( rev4.getParents(), p2 );
|
||||
assert TestTools.checkCollection( rev5.getParents(), p2 );
|
||||
}
|
||||
|
||||
// TODO: was disabled?
|
||||
|
@ -263,11 +263,11 @@ public class BasicSametable extends BaseEnversJPAFunctionalTestCase {
|
|||
Child1Entity rev4 = getAuditReader().find(Child1Entity.class, c1_2_id, 4);
|
||||
Child1Entity rev5 = getAuditReader().find(Child1Entity.class, c1_2_id, 5);
|
||||
|
||||
assert TestTools.checkList(rev1.getParents());
|
||||
assert TestTools.checkList(rev2.getParents());
|
||||
assert TestTools.checkList(rev3.getParents(), p1);
|
||||
assert TestTools.checkList(rev4.getParents(), p1);
|
||||
assert TestTools.checkList(rev5.getParents());
|
||||
assert TestTools.checkCollection( rev1.getParents() );
|
||||
assert TestTools.checkCollection( rev2.getParents() );
|
||||
assert TestTools.checkCollection( rev3.getParents(), p1 );
|
||||
assert TestTools.checkCollection( rev4.getParents(), p1 );
|
||||
assert TestTools.checkCollection( rev5.getParents() );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -280,11 +280,11 @@ public class BasicSametable extends BaseEnversJPAFunctionalTestCase {
|
|||
Child2Entity rev4 = getAuditReader().find(Child2Entity.class, c2_1_id, 4);
|
||||
Child2Entity rev5 = getAuditReader().find(Child2Entity.class, c2_1_id, 5);
|
||||
|
||||
assert TestTools.checkList(rev1.getParents());
|
||||
assert TestTools.checkList(rev2.getParents(), p2);
|
||||
assert TestTools.checkList(rev3.getParents(), p2);
|
||||
assert TestTools.checkList(rev4.getParents(), p2);
|
||||
assert TestTools.checkList(rev5.getParents(), p2);
|
||||
assert TestTools.checkCollection( rev1.getParents() );
|
||||
assert TestTools.checkCollection( rev2.getParents(), p2 );
|
||||
assert TestTools.checkCollection( rev3.getParents(), p2 );
|
||||
assert TestTools.checkCollection( rev4.getParents(), p2 );
|
||||
assert TestTools.checkCollection( rev5.getParents(), p2 );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -298,10 +298,10 @@ public class BasicSametable extends BaseEnversJPAFunctionalTestCase {
|
|||
Child2Entity rev4 = getAuditReader().find(Child2Entity.class, c2_2_id, 4);
|
||||
Child2Entity rev5 = getAuditReader().find(Child2Entity.class, c2_2_id, 5);
|
||||
|
||||
assert TestTools.checkList(rev1.getParents());
|
||||
assert TestTools.checkList(rev2.getParents());
|
||||
assert TestTools.checkList(rev3.getParents(), p1);
|
||||
assert TestTools.checkList(rev4.getParents(), p1, p2);
|
||||
assert TestTools.checkList(rev5.getParents(), p1);
|
||||
assert TestTools.checkCollection( rev1.getParents() );
|
||||
assert TestTools.checkCollection( rev2.getParents() );
|
||||
assert TestTools.checkCollection( rev3.getParents(), p1 );
|
||||
assert TestTools.checkCollection( rev4.getParents(), p1, p2 );
|
||||
assert TestTools.checkCollection( rev5.getParents(), p1 );
|
||||
}
|
||||
}
|
|
@ -152,9 +152,9 @@ public class BasicUniList extends BaseEnversJPAFunctionalTestCase {
|
|||
ListUniEntity rev5 = getAuditReader().find(ListUniEntity.class, ing1_id, 5);
|
||||
|
||||
assert rev1.getReferences().equals(Collections.EMPTY_LIST);
|
||||
assert TestTools.checkList(rev2.getReferences(), ed1);
|
||||
assert TestTools.checkList(rev3.getReferences(), ed1, ed2);
|
||||
assert TestTools.checkList(rev4.getReferences(), ed2);
|
||||
assert TestTools.checkCollection( rev2.getReferences(), ed1 );
|
||||
assert TestTools.checkCollection( rev3.getReferences(), ed1, ed2 );
|
||||
assert TestTools.checkCollection( rev4.getReferences(), ed2 );
|
||||
assert rev5.getReferences().equals(Collections.EMPTY_LIST);
|
||||
}
|
||||
|
||||
|
@ -170,9 +170,9 @@ public class BasicUniList extends BaseEnversJPAFunctionalTestCase {
|
|||
ListUniEntity rev5 = getAuditReader().find(ListUniEntity.class, ing2_id, 5);
|
||||
|
||||
assert rev1.getReferences().equals(Collections.EMPTY_LIST);
|
||||
assert TestTools.checkList(rev2.getReferences(), ed1, ed2);
|
||||
assert TestTools.checkList(rev3.getReferences(), ed1, ed2);
|
||||
assert TestTools.checkList(rev4.getReferences(), ed1, ed2);
|
||||
assert TestTools.checkList(rev5.getReferences(), ed1, ed2);
|
||||
assert TestTools.checkCollection( rev2.getReferences(), ed1, ed2 );
|
||||
assert TestTools.checkCollection( rev3.getReferences(), ed1, ed2 );
|
||||
assert TestTools.checkCollection( rev4.getReferences(), ed1, ed2 );
|
||||
assert TestTools.checkCollection( rev5.getReferences(), ed1, ed2 );
|
||||
}
|
||||
}
|
|
@ -12,7 +12,7 @@ import org.hibernate.envers.test.Priority;
|
|||
import org.hibernate.envers.test.entities.UnversionedStrTestEntity;
|
||||
import org.hibernate.envers.test.entities.manytomany.unidirectional.M2MIndexedListTargetNotAuditedEntity;
|
||||
|
||||
import static org.hibernate.envers.test.tools.TestTools.checkList;
|
||||
import static org.hibernate.envers.test.tools.TestTools.checkCollection;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
@ -104,9 +104,9 @@ public class M2MIndexedListNotAuditedTarget extends BaseEnversJPAFunctionalTestC
|
|||
M2MIndexedListTargetNotAuditedEntity rev2 = getAuditReader().find(M2MIndexedListTargetNotAuditedEntity.class, itnae1_id, 2);
|
||||
M2MIndexedListTargetNotAuditedEntity rev3 = getAuditReader().find(M2MIndexedListTargetNotAuditedEntity.class, itnae1_id, 3);
|
||||
|
||||
assertTrue(checkList(rev1.getReferences(), uste1, uste2));
|
||||
assertTrue(checkList(rev2.getReferences(), uste1, uste2));
|
||||
assertTrue(checkList(rev3.getReferences(), uste2, uste1));
|
||||
assertTrue( checkCollection( rev1.getReferences(), uste1, uste2 ));
|
||||
assertTrue( checkCollection( rev2.getReferences(), uste1, uste2 ));
|
||||
assertTrue( checkCollection( rev3.getReferences(), uste2, uste1 ));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -116,7 +116,7 @@ public class M2MIndexedListNotAuditedTarget extends BaseEnversJPAFunctionalTestC
|
|||
M2MIndexedListTargetNotAuditedEntity rev3 = getAuditReader().find(M2MIndexedListTargetNotAuditedEntity.class, itnae2_id, 3);
|
||||
|
||||
assertNull(rev1);
|
||||
assertTrue(checkList(rev2.getReferences(), uste2));
|
||||
assertTrue(checkList(rev3.getReferences(), uste2));
|
||||
assertTrue( checkCollection( rev2.getReferences(), uste2 ));
|
||||
assertTrue( checkCollection( rev3.getReferences(), uste2 ));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ import org.hibernate.envers.test.Priority;
|
|||
import org.hibernate.envers.test.entities.UnversionedStrTestEntity;
|
||||
import org.hibernate.envers.test.entities.manytomany.unidirectional.M2MTargetNotAuditedEntity;
|
||||
|
||||
import static org.hibernate.envers.test.tools.TestTools.checkList;
|
||||
import static org.hibernate.envers.test.tools.TestTools.checkCollection;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
|
@ -145,10 +145,10 @@ public class M2MRelationNotAuditedTarget extends BaseEnversJPAFunctionalTestCase
|
|||
M2MTargetNotAuditedEntity rev3 = getAuditReader().find(M2MTargetNotAuditedEntity.class, tnae1_id, 3);
|
||||
M2MTargetNotAuditedEntity rev4 = getAuditReader().find(M2MTargetNotAuditedEntity.class, tnae1_id, 4);
|
||||
|
||||
assertTrue(checkList(rev1.getReferences()));
|
||||
assertTrue(checkList(rev2.getReferences(), uste1));
|
||||
assertTrue(checkList(rev3.getReferences(), uste1));
|
||||
assertTrue(checkList(rev4.getReferences(), uste1, uste2));
|
||||
assertTrue( checkCollection( rev1.getReferences() ));
|
||||
assertTrue( checkCollection( rev2.getReferences(), uste1 ));
|
||||
assertTrue( checkCollection( rev3.getReferences(), uste1 ));
|
||||
assertTrue( checkCollection( rev4.getReferences(), uste1, uste2 ));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -161,9 +161,9 @@ public class M2MRelationNotAuditedTarget extends BaseEnversJPAFunctionalTestCase
|
|||
M2MTargetNotAuditedEntity rev3 = getAuditReader().find(M2MTargetNotAuditedEntity.class, tnae2_id, 3);
|
||||
M2MTargetNotAuditedEntity rev4 = getAuditReader().find(M2MTargetNotAuditedEntity.class, tnae2_id, 4);
|
||||
|
||||
assertTrue(checkList(rev1.getReferences(), uste1, uste2));
|
||||
assertTrue(checkList(rev2.getReferences(), uste2));
|
||||
assertTrue(checkList(rev3.getReferences()));
|
||||
assertTrue(checkList(rev4.getReferences(), uste1));
|
||||
assertTrue( checkCollection( rev1.getReferences(), uste1, uste2 ));
|
||||
assertTrue( checkCollection( rev2.getReferences(), uste2 ));
|
||||
assertTrue( checkCollection( rev3.getReferences() ));
|
||||
assertTrue( checkCollection( rev4.getReferences(), uste1 ));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,9 +118,9 @@ public class BasicList extends BaseEnversJPAFunctionalTestCase {
|
|||
ListRefEdEntity rev2 = getAuditReader().find(ListRefEdEntity.class, ed1_id, 2);
|
||||
ListRefEdEntity rev3 = getAuditReader().find(ListRefEdEntity.class, ed1_id, 3);
|
||||
|
||||
assert TestTools.checkList(rev1.getReffering(), ing1, ing2);
|
||||
assert TestTools.checkList(rev2.getReffering(), ing2);
|
||||
assert TestTools.checkList(rev3.getReffering());
|
||||
assert TestTools.checkCollection( rev1.getReffering(), ing1, ing2 );
|
||||
assert TestTools.checkCollection( rev2.getReffering(), ing2 );
|
||||
assert TestTools.checkCollection( rev3.getReffering() );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -132,9 +132,9 @@ public class BasicList extends BaseEnversJPAFunctionalTestCase {
|
|||
ListRefEdEntity rev2 = getAuditReader().find(ListRefEdEntity.class, ed2_id, 2);
|
||||
ListRefEdEntity rev3 = getAuditReader().find(ListRefEdEntity.class, ed2_id, 3);
|
||||
|
||||
assert TestTools.checkList(rev1.getReffering());
|
||||
assert TestTools.checkList(rev2.getReffering(), ing1);
|
||||
assert TestTools.checkList(rev3.getReffering(), ing1, ing2);
|
||||
assert TestTools.checkCollection( rev1.getReffering() );
|
||||
assert TestTools.checkCollection( rev2.getReffering(), ing1 );
|
||||
assert TestTools.checkCollection( rev3.getReffering(), ing1, ing2 );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -127,10 +127,10 @@ public class BasicDetachedList extends BaseEnversJPAFunctionalTestCase {
|
|||
ListRefCollEntity rev3 = getAuditReader().find(ListRefCollEntity.class, coll1_id, 3);
|
||||
ListRefCollEntity rev4 = getAuditReader().find(ListRefCollEntity.class, coll1_id, 4);
|
||||
|
||||
assert TestTools.checkList(rev1.getCollection(), str1);
|
||||
assert TestTools.checkList(rev2.getCollection(), str1, str2);
|
||||
assert TestTools.checkList(rev3.getCollection(), str2);
|
||||
assert TestTools.checkList(rev4.getCollection());
|
||||
assert TestTools.checkCollection( rev1.getCollection(), str1 );
|
||||
assert TestTools.checkCollection( rev2.getCollection(), str1, str2 );
|
||||
assert TestTools.checkCollection( rev3.getCollection(), str2 );
|
||||
assert TestTools.checkCollection( rev4.getCollection() );
|
||||
|
||||
assert "coll1".equals(rev1.getData());
|
||||
assert "coll1".equals(rev2.getData());
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.hibernate.envers.test.entities.onetomany.detached.DoubleListJoinColum
|
|||
import org.hibernate.envers.test.entities.onetomany.detached.DoubleListJoinColumnBidirectionalRefEdEntity2;
|
||||
import org.hibernate.envers.test.entities.onetomany.detached.DoubleListJoinColumnBidirectionalRefIngEntity;
|
||||
|
||||
import static org.hibernate.envers.test.tools.TestTools.checkList;
|
||||
import static org.hibernate.envers.test.tools.TestTools.checkCollection;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
@ -183,15 +183,15 @@ public class DoubleJoinColumnBidirectionalList extends BaseEnversJPAFunctionalTe
|
|||
DoubleListJoinColumnBidirectionalRefIngEntity rev3 = getAuditReader().find(DoubleListJoinColumnBidirectionalRefIngEntity.class, ing1_id, 3);
|
||||
DoubleListJoinColumnBidirectionalRefIngEntity rev4 = getAuditReader().find(DoubleListJoinColumnBidirectionalRefIngEntity.class, ing1_id, 4);
|
||||
|
||||
assertTrue(checkList(rev1.getReferences1(), ed1_1_fromRev1));
|
||||
assertTrue(checkList(rev2.getReferences1(), ed1_1_fromRev1, ed1_2));
|
||||
assertTrue(checkList(rev3.getReferences1(), ed1_1_fromRev3, ed1_2));
|
||||
assertTrue(checkList(rev4.getReferences1()));
|
||||
assertTrue( checkCollection( rev1.getReferences1(), ed1_1_fromRev1 ));
|
||||
assertTrue( checkCollection( rev2.getReferences1(), ed1_1_fromRev1, ed1_2 ));
|
||||
assertTrue( checkCollection( rev3.getReferences1(), ed1_1_fromRev3, ed1_2 ));
|
||||
assertTrue( checkCollection( rev4.getReferences1() ));
|
||||
|
||||
assertTrue(checkList(rev1.getReferences2(), ed2_1));
|
||||
assertTrue(checkList(rev2.getReferences2(), ed2_1, ed2_2_fromRev1));
|
||||
assertTrue(checkList(rev3.getReferences2(), ed2_1, ed2_2_fromRev3));
|
||||
assertTrue(checkList(rev4.getReferences2(), ed2_2_fromRev3));
|
||||
assertTrue( checkCollection( rev1.getReferences2(), ed2_1 ));
|
||||
assertTrue( checkCollection( rev2.getReferences2(), ed2_1, ed2_2_fromRev1 ));
|
||||
assertTrue( checkCollection( rev3.getReferences2(), ed2_1, ed2_2_fromRev3 ));
|
||||
assertTrue( checkCollection( rev4.getReferences2(), ed2_2_fromRev3 ));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -206,15 +206,15 @@ public class DoubleJoinColumnBidirectionalList extends BaseEnversJPAFunctionalTe
|
|||
DoubleListJoinColumnBidirectionalRefIngEntity rev3 = getAuditReader().find(DoubleListJoinColumnBidirectionalRefIngEntity.class, ing2_id, 3);
|
||||
DoubleListJoinColumnBidirectionalRefIngEntity rev4 = getAuditReader().find(DoubleListJoinColumnBidirectionalRefIngEntity.class, ing2_id, 4);
|
||||
|
||||
assertTrue(checkList(rev1.getReferences1(), ed1_2));
|
||||
assertTrue(checkList(rev2.getReferences1()));
|
||||
assertTrue(checkList(rev3.getReferences1()));
|
||||
assertTrue(checkList(rev4.getReferences1(), ed1_1_fromRev3, ed1_2));
|
||||
assertTrue( checkCollection( rev1.getReferences1(), ed1_2 ));
|
||||
assertTrue( checkCollection( rev2.getReferences1() ));
|
||||
assertTrue( checkCollection( rev3.getReferences1() ));
|
||||
assertTrue( checkCollection( rev4.getReferences1(), ed1_1_fromRev3, ed1_2 ));
|
||||
|
||||
assertTrue(checkList(rev1.getReferences2(), ed2_2_fromRev1));
|
||||
assertTrue(checkList(rev2.getReferences2()));
|
||||
assertTrue(checkList(rev3.getReferences2()));
|
||||
assertTrue(checkList(rev4.getReferences2(), ed2_1));
|
||||
assertTrue( checkCollection( rev1.getReferences2(), ed2_2_fromRev1 ));
|
||||
assertTrue( checkCollection( rev2.getReferences2() ));
|
||||
assertTrue( checkCollection( rev3.getReferences2() ));
|
||||
assertTrue( checkCollection( rev4.getReferences2(), ed2_1 ));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -34,7 +34,7 @@ import org.hibernate.envers.test.Priority;
|
|||
import org.hibernate.envers.test.entities.onetomany.detached.ListJoinColumnBidirectionalRefEdEntity;
|
||||
import org.hibernate.envers.test.entities.onetomany.detached.ListJoinColumnBidirectionalRefIngEntity;
|
||||
|
||||
import static org.hibernate.envers.test.tools.TestTools.checkList;
|
||||
import static org.hibernate.envers.test.tools.TestTools.checkCollection;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
@ -157,10 +157,10 @@ public class JoinColumnBidirectionalList extends BaseEnversJPAFunctionalTestCase
|
|||
ListJoinColumnBidirectionalRefIngEntity rev3 = getAuditReader().find(ListJoinColumnBidirectionalRefIngEntity.class, ing1_id, 3);
|
||||
ListJoinColumnBidirectionalRefIngEntity rev4 = getAuditReader().find(ListJoinColumnBidirectionalRefIngEntity.class, ing1_id, 4);
|
||||
|
||||
assertTrue(checkList(rev1.getReferences(), ed1_fromRev1));
|
||||
assertTrue(checkList(rev2.getReferences(), ed1_fromRev1, ed2));
|
||||
assertTrue(checkList(rev3.getReferences(), ed1_fromRev3, ed2));
|
||||
assertTrue(checkList(rev4.getReferences()));
|
||||
assertTrue( checkCollection( rev1.getReferences(), ed1_fromRev1 ));
|
||||
assertTrue( checkCollection( rev2.getReferences(), ed1_fromRev1, ed2 ));
|
||||
assertTrue( checkCollection( rev3.getReferences(), ed1_fromRev3, ed2 ));
|
||||
assertTrue( checkCollection( rev4.getReferences() ));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -173,10 +173,10 @@ public class JoinColumnBidirectionalList extends BaseEnversJPAFunctionalTestCase
|
|||
ListJoinColumnBidirectionalRefIngEntity rev3 = getAuditReader().find(ListJoinColumnBidirectionalRefIngEntity.class, ing2_id, 3);
|
||||
ListJoinColumnBidirectionalRefIngEntity rev4 = getAuditReader().find(ListJoinColumnBidirectionalRefIngEntity.class, ing2_id, 4);
|
||||
|
||||
assertTrue(checkList(rev1.getReferences(), ed2));
|
||||
assertTrue(checkList(rev2.getReferences()));
|
||||
assertTrue(checkList(rev3.getReferences()));
|
||||
assertTrue(checkList(rev4.getReferences(), ed1, ed2));
|
||||
assertTrue( checkCollection( rev1.getReferences(), ed2 ));
|
||||
assertTrue( checkCollection( rev2.getReferences() ));
|
||||
assertTrue( checkCollection( rev3.getReferences() ));
|
||||
assertTrue( checkCollection( rev4.getReferences(), ed1, ed2 ));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -35,7 +35,7 @@ import org.hibernate.envers.test.entities.onetomany.detached.ListJoinColumnBidir
|
|||
import org.hibernate.envers.test.entities.onetomany.detached.ListJoinColumnBidirectionalInheritanceRefEdParentEntity;
|
||||
import org.hibernate.envers.test.entities.onetomany.detached.ListJoinColumnBidirectionalInheritanceRefIngEntity;
|
||||
|
||||
import static org.hibernate.envers.test.tools.TestTools.checkList;
|
||||
import static org.hibernate.envers.test.tools.TestTools.checkCollection;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
@ -118,8 +118,8 @@ public class JoinColumnBidirectionalListWithInheritance extends BaseEnversJPAFun
|
|||
ListJoinColumnBidirectionalInheritanceRefIngEntity rev1 = getAuditReader().find(ListJoinColumnBidirectionalInheritanceRefIngEntity.class, ing1_id, 1);
|
||||
ListJoinColumnBidirectionalInheritanceRefIngEntity rev2 = getAuditReader().find(ListJoinColumnBidirectionalInheritanceRefIngEntity.class, ing1_id, 2);
|
||||
|
||||
assertTrue(checkList(rev1.getReferences(), ed1));
|
||||
assertTrue(checkList(rev2.getReferences(), ed1, ed2));
|
||||
assertTrue( checkCollection( rev1.getReferences(), ed1 ));
|
||||
assertTrue( checkCollection( rev2.getReferences(), ed1, ed2 ));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -129,8 +129,8 @@ public class JoinColumnBidirectionalListWithInheritance extends BaseEnversJPAFun
|
|||
ListJoinColumnBidirectionalInheritanceRefIngEntity rev1 = getAuditReader().find(ListJoinColumnBidirectionalInheritanceRefIngEntity.class, ing2_id, 1);
|
||||
ListJoinColumnBidirectionalInheritanceRefIngEntity rev2 = getAuditReader().find(ListJoinColumnBidirectionalInheritanceRefIngEntity.class, ing2_id, 2);
|
||||
|
||||
assertTrue(checkList(rev1.getReferences(), ed2));
|
||||
assertTrue(checkList(rev2.getReferences()));
|
||||
assertTrue( checkCollection( rev1.getReferences(), ed2 ));
|
||||
assertTrue( checkCollection( rev2.getReferences() ));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -74,17 +74,17 @@ public class HierarchyTest extends BaseEnversJPAFunctionalTestCase {
|
|||
|
||||
Node ver1 = getAuditReader().find(Node.class, parentId, 1);
|
||||
Assert.assertEquals(parent, ver1);
|
||||
Assert.assertTrue(TestTools.checkList(ver1.getChildren(), child1, child2));
|
||||
Assert.assertTrue(TestTools.checkCollection( ver1.getChildren(), child1, child2 ));
|
||||
|
||||
child1.setData("child1 modified");
|
||||
|
||||
Node ver2 = getAuditReader().find(Node.class, parentId, 2);
|
||||
Assert.assertEquals(parent, ver2);
|
||||
Assert.assertTrue(TestTools.checkList(ver2.getChildren(), child1, child2));
|
||||
Assert.assertTrue(TestTools.checkCollection( ver2.getChildren(), child1, child2 ));
|
||||
|
||||
Node ver3 = getAuditReader().find(Node.class, parentId, 3);
|
||||
Assert.assertEquals(parent, ver3);
|
||||
Assert.assertTrue(TestTools.checkList(ver3.getChildren(), child1));
|
||||
Assert.assertTrue(TestTools.checkCollection( ver3.getChildren(), child1 ));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.hibernate.envers.test.integration.proxy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -19,9 +20,13 @@ import org.hibernate.envers.test.entities.IntTestPrivSeqEntity;
|
|||
import org.hibernate.envers.test.entities.StrTestPrivSeqEntity;
|
||||
import org.hibernate.envers.test.entities.UnversionedStrTestEntity;
|
||||
import org.hibernate.envers.test.entities.collection.StringSetEntity;
|
||||
import org.hibernate.envers.test.entities.manytomany.ListOwnedEntity;
|
||||
import org.hibernate.envers.test.entities.manytomany.ListOwningEntity;
|
||||
import org.hibernate.envers.test.entities.manytomany.SetOwnedEntity;
|
||||
import org.hibernate.envers.test.entities.manytomany.SetOwningEntity;
|
||||
import org.hibernate.envers.test.entities.manytomany.unidirectional.M2MIndexedListTargetNotAuditedEntity;
|
||||
import org.hibernate.envers.test.entities.onetomany.CollectionRefEdEntity;
|
||||
import org.hibernate.envers.test.entities.onetomany.CollectionRefIngEntity;
|
||||
import org.hibernate.envers.test.entities.onetomany.SetRefEdEntity;
|
||||
import org.hibernate.envers.test.entities.onetomany.SetRefIngEntity;
|
||||
import org.hibernate.envers.test.integration.manytomany.ternary.TernaryMapEntity;
|
||||
|
@ -53,7 +58,8 @@ public class RemovedObjectQueryTest extends BaseEnversJPAFunctionalTestCase {
|
|||
return new Class<?>[] {
|
||||
SetRefEdEntity.class, SetRefIngEntity.class, SetOwnedEntity.class, SetOwningEntity.class,
|
||||
StringSetEntity.class, UnversionedStrTestEntity.class, M2MIndexedListTargetNotAuditedEntity.class,
|
||||
TernaryMapEntity.class, StrTestPrivSeqEntity.class, IntTestPrivSeqEntity.class
|
||||
TernaryMapEntity.class, StrTestPrivSeqEntity.class, IntTestPrivSeqEntity.class,
|
||||
CollectionRefEdEntity.class, CollectionRefIngEntity.class, ListOwnedEntity.class, ListOwningEntity.class
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -204,27 +210,108 @@ public class RemovedObjectQueryTest extends BaseEnversJPAFunctionalTestCase {
|
|||
|
||||
ternaryMapId = mapEntity.getId();
|
||||
|
||||
// Revision 16 - removing ternary map
|
||||
// Revision 16 - updating ternary map
|
||||
em.getTransaction().begin();
|
||||
intEntity2 = em.find( IntTestPrivSeqEntity.class, intEntity2.getId() );
|
||||
intEntity2.setNumber( 3 );
|
||||
intEntity2 = em.merge( intEntity2 );
|
||||
stringEntity2 = em.find( StrTestPrivSeqEntity.class, stringEntity2.getId() );
|
||||
stringEntity2.setStr( "Value 3" );
|
||||
stringEntity2 = em.merge( stringEntity2 );
|
||||
em.getTransaction().commit();
|
||||
|
||||
// Revision 17 - removing ternary map
|
||||
em.getTransaction().begin();
|
||||
mapEntity = em.find( TernaryMapEntity.class, mapEntity.getId() );
|
||||
em.remove( mapEntity );
|
||||
em.getTransaction().commit();
|
||||
|
||||
CollectionRefEdEntity collEd1 = new CollectionRefEdEntity( 1, "data_ed_1" );
|
||||
CollectionRefIngEntity collIng1 = new CollectionRefIngEntity( 2, "data_ing_1", collEd1 );
|
||||
collEd1.setReffering( new ArrayList<CollectionRefIngEntity>() );
|
||||
collEd1.getReffering().add( collIng1 );
|
||||
|
||||
// Revision 18 - testing one-to-many collection
|
||||
em.getTransaction().begin();
|
||||
em.persist( collEd1 );
|
||||
em.persist( collIng1 );
|
||||
em.getTransaction().commit();
|
||||
|
||||
// Revision 19
|
||||
em.getTransaction().begin();
|
||||
collIng1 = em.find( CollectionRefIngEntity.class, collIng1.getId() );
|
||||
collIng1.setData( "modified data_ing_1" );
|
||||
collIng1 = em.merge( collIng1 );
|
||||
em.getTransaction().commit();
|
||||
|
||||
// Revision 20
|
||||
em.getTransaction().begin();
|
||||
collEd1 = em.find( CollectionRefEdEntity.class, collEd1.getId() );
|
||||
collIng1 = em.find( CollectionRefIngEntity.class, collIng1.getId() );
|
||||
em.remove( collIng1 );
|
||||
em.remove( collEd1 );
|
||||
em.getTransaction().commit();
|
||||
|
||||
ListOwnedEntity listEd1 = new ListOwnedEntity( 1, "data_ed_1" );
|
||||
ListOwningEntity listIng1 = new ListOwningEntity( 2, "data_ing_1" );
|
||||
listEd1.setReferencing( new ArrayList<ListOwningEntity>() );
|
||||
listIng1.setReferences( new ArrayList<ListOwnedEntity>() );
|
||||
listEd1.getReferencing().add( listIng1 );
|
||||
listIng1.getReferences().add( listEd1 );
|
||||
|
||||
// Revision 21 - testing many-to-many collection
|
||||
em.getTransaction().begin();
|
||||
em.persist( listEd1 );
|
||||
em.persist( listIng1 );
|
||||
em.getTransaction().commit();
|
||||
|
||||
// Revision 22
|
||||
em.getTransaction().begin();
|
||||
listIng1 = em.find( ListOwningEntity.class, listIng1.getId() );
|
||||
listIng1.setData( "modified data_ing_1" );
|
||||
listIng1 = em.merge( listIng1 );
|
||||
em.getTransaction().commit();
|
||||
|
||||
// Revision 23
|
||||
em.getTransaction().begin();
|
||||
listIng1 = em.find( ListOwningEntity.class, listIng1.getId() );
|
||||
listEd1 = em.find( ListOwnedEntity.class, listEd1.getId() );
|
||||
em.remove( listIng1 );
|
||||
em.remove( listEd1 );
|
||||
em.getTransaction().commit();
|
||||
|
||||
em.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTernaryMap() {
|
||||
final TernaryMapEntity ternaryMap = new TernaryMapEntity();
|
||||
ternaryMap.setId( ternaryMapId );
|
||||
ternaryMap.getMap().put( intEntity1, stringEntity1 );
|
||||
ternaryMap.getMap().put( new IntTestPrivSeqEntity( 2, intEntity2.getId() ) , new StrTestPrivSeqEntity( "Value 2", stringEntity2.getId() ) );
|
||||
|
||||
TernaryMapEntity entity = getAuditReader().find( TernaryMapEntity.class, ternaryMapId, 15 );
|
||||
|
||||
Assert.assertEquals( ternaryMap.getMap(), entity.getMap() );
|
||||
|
||||
ternaryMap.getMap().clear();
|
||||
ternaryMap.getMap().put( intEntity1, stringEntity1 );
|
||||
ternaryMap.getMap().put( intEntity2, stringEntity2 );
|
||||
|
||||
entity = getAuditReader().find( TernaryMapEntity.class, ternaryMapId, 16 );
|
||||
|
||||
Assert.assertEquals( ternaryMap.getMap(), entity.getMap() );
|
||||
|
||||
List queryResult = getAuditReader().createQuery().forRevisionsOfEntity( TernaryMapEntity.class, false, true )
|
||||
.add( AuditEntity.id().eq( ternaryMapId ) )
|
||||
.add( AuditEntity.revisionType().eq( RevisionType.DEL ) )
|
||||
.getResultList();
|
||||
Object[] objArray = (Object[]) queryResult.get( 0 );
|
||||
|
||||
Assert.assertEquals( 16, getRevisionNumber( objArray[1] ) );
|
||||
Assert.assertEquals( 17, getRevisionNumber( objArray[1] ) );
|
||||
|
||||
TernaryMapEntity mapEntity = (TernaryMapEntity) objArray[0];
|
||||
Assert.assertEquals( TestTools.makeMap( intEntity1, stringEntity1, intEntity2, stringEntity2 ), mapEntity.getMap() );
|
||||
entity = (TernaryMapEntity) objArray[0];
|
||||
Assert.assertEquals( ternaryMap.getMap(), entity.getMap() );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -239,7 +326,7 @@ public class RemovedObjectQueryTest extends BaseEnversJPAFunctionalTestCase {
|
|||
|
||||
M2MIndexedListTargetNotAuditedEntity relationNotAuditedEntity = (M2MIndexedListTargetNotAuditedEntity) objArray[0];
|
||||
Assert.assertTrue(
|
||||
TestTools.checkList(
|
||||
TestTools.checkCollection(
|
||||
relationNotAuditedEntity.getReferences(),
|
||||
unversionedEntity1, unversionedEntity2
|
||||
)
|
||||
|
@ -262,6 +349,34 @@ public class RemovedObjectQueryTest extends BaseEnversJPAFunctionalTestCase {
|
|||
|
||||
// One to many tests.
|
||||
|
||||
@Test
|
||||
public void testOneToManyCollectionSemantics() {
|
||||
final CollectionRefEdEntity edVer1 = new CollectionRefEdEntity( 1, "data_ed_1" );
|
||||
final CollectionRefIngEntity ingVer1 = new CollectionRefIngEntity( 2, "data_ing_1" );
|
||||
final CollectionRefIngEntity ingVer2 = new CollectionRefIngEntity( 2, "modified data_ing_1" );
|
||||
|
||||
CollectionRefEdEntity entity = getAuditReader().find( CollectionRefEdEntity.class, 1, 18 );
|
||||
|
||||
Assert.assertEquals( edVer1, entity );
|
||||
Assert.assertTrue( TestTools.checkCollection( entity.getReffering(), ingVer1 ) );
|
||||
|
||||
entity = getAuditReader().find( CollectionRefEdEntity.class, 1, 19 );
|
||||
|
||||
Assert.assertTrue( TestTools.checkCollection( entity.getReffering(), ingVer2 ) );
|
||||
|
||||
List queryResult = getAuditReader().createQuery().forRevisionsOfEntity( CollectionRefEdEntity.class, false, true )
|
||||
.add( AuditEntity.id().eq( 1 ) )
|
||||
.add( AuditEntity.revisionType().eq( RevisionType.DEL ) )
|
||||
.getResultList();
|
||||
Object[] objArray = (Object[]) queryResult.get( 0 );
|
||||
|
||||
Assert.assertEquals( 20, getRevisionNumber( objArray[1] ) );
|
||||
|
||||
entity = (CollectionRefEdEntity) objArray[0];
|
||||
Assert.assertEquals( "data_ed_1", entity.getData() );
|
||||
Assert.assertTrue( TestTools.checkCollection( entity.getReffering(), ingVer2 ) );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReferencedOneToManySameRevision() {
|
||||
List queryResult = getAuditReader().createQuery().forRevisionsOfEntity( SetRefIngEntity.class, false, true )
|
||||
|
@ -348,6 +463,34 @@ public class RemovedObjectQueryTest extends BaseEnversJPAFunctionalTestCase {
|
|||
|
||||
// Many to many tests.
|
||||
|
||||
@Test
|
||||
public void testManyToManyCollectionSemantics() {
|
||||
final ListOwnedEntity edVer1 = new ListOwnedEntity( 1, "data_ed_1" );
|
||||
final ListOwningEntity ingVer1 = new ListOwningEntity( 2, "data_ing_1" );
|
||||
final ListOwningEntity ingVer2 = new ListOwningEntity( 2, "modified data_ing_1" );
|
||||
|
||||
ListOwnedEntity entity = getAuditReader().find( ListOwnedEntity.class, 1, 21 );
|
||||
|
||||
Assert.assertEquals( edVer1, entity );
|
||||
Assert.assertTrue( TestTools.checkCollection( entity.getReferencing(), ingVer1 ) );
|
||||
|
||||
entity = getAuditReader().find( ListOwnedEntity.class, 1, 22 );
|
||||
|
||||
Assert.assertTrue( TestTools.checkCollection( entity.getReferencing(), ingVer2 ) );
|
||||
|
||||
List queryResult = getAuditReader().createQuery().forRevisionsOfEntity( ListOwnedEntity.class, false, true )
|
||||
.add( AuditEntity.id().eq( 1 ) )
|
||||
.add( AuditEntity.revisionType().eq( RevisionType.DEL ) )
|
||||
.getResultList();
|
||||
Object[] objArray = (Object[]) queryResult.get( 0 );
|
||||
|
||||
Assert.assertEquals( 23, getRevisionNumber( objArray[1] ) );
|
||||
|
||||
entity = (ListOwnedEntity) objArray[0];
|
||||
Assert.assertEquals( "data_ed_1", entity.getData() );
|
||||
Assert.assertTrue( TestTools.checkCollection( entity.getReferencing(), ingVer2 ) );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOwnedManyToManySameRevision() {
|
||||
List queryResult = getAuditReader().createQuery().forRevisionsOfEntity( SetOwningEntity.class, false, true )
|
||||
|
|
|
@ -30,7 +30,6 @@ import javax.persistence.EntityManager;
|
|||
import org.junit.Assert;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.hibernate.ejb.Ejb3Configuration;
|
||||
import org.hibernate.envers.query.AuditEntity;
|
||||
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
|
||||
import org.hibernate.envers.test.Priority;
|
||||
|
@ -130,7 +129,8 @@ public class AggregateQuery extends BaseEnversJPAFunctionalTestCase {
|
|||
.add( AuditEntity.id().between( 2, 3 ) )
|
||||
.getResultList();
|
||||
Assert.assertTrue(
|
||||
TestTools.checkList( list,
|
||||
TestTools.checkCollection(
|
||||
list,
|
||||
new IntTestEntity( 10, 2 ), new IntTestEntity( 8, 3 ), new IntTestEntity( 52, 2 )
|
||||
)
|
||||
);
|
||||
|
|
|
@ -283,7 +283,7 @@ public class SimpleQuery extends BaseEnversJPAFunctionalTestCase {
|
|||
.addProjection(AuditEntity.revisionType()).add(AuditEntity.id().eq(id1))
|
||||
.getSingleResult();
|
||||
|
||||
Assert.assertTrue(TestTools.checkList(result, site1, site2, site3));
|
||||
Assert.assertTrue(TestTools.checkCollection( result, site1, site2, site3 ));
|
||||
Assert.assertEquals(revisionType, RevisionType.ADD);
|
||||
}
|
||||
|
||||
|
@ -297,7 +297,7 @@ public class SimpleQuery extends BaseEnversJPAFunctionalTestCase {
|
|||
.addProjection(AuditEntity.revisionType()).add(AuditEntity.id().eq(id1))
|
||||
.getSingleResult();
|
||||
|
||||
Assert.assertTrue(TestTools.checkList(result, site1, site2));
|
||||
Assert.assertTrue(TestTools.checkCollection( result, site1, site2 ));
|
||||
Assert.assertEquals(revisionType, RevisionType.MOD);
|
||||
}
|
||||
|
||||
|
@ -310,7 +310,7 @@ public class SimpleQuery extends BaseEnversJPAFunctionalTestCase {
|
|||
.addProjection(AuditEntity.revisionType()).add(AuditEntity.id().eq(id1))
|
||||
.getSingleResult();
|
||||
|
||||
Assert.assertTrue(TestTools.checkList(result, site1));
|
||||
Assert.assertTrue(TestTools.checkCollection( result, site1 ));
|
||||
Assert.assertEquals(revisionType, RevisionType.DEL);
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.hibernate.envers.test.integration.reventity.trackmodifiedentities;
|
|||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import javax.persistence.EntityManager;
|
||||
|
||||
import org.junit.Test;
|
||||
|
@ -92,14 +91,14 @@ public class DefaultTrackingEntitiesTest extends BaseEnversJPAFunctionalTestCase
|
|||
StrTestEntity ste = new StrTestEntity("x", steId);
|
||||
StrIntTestEntity site = new StrIntTestEntity("y", 1, siteId);
|
||||
|
||||
assert TestTools.checkList(getCrossTypeRevisionChangesReader().findEntities(1), ste, site);
|
||||
assert TestTools.checkCollection( getCrossTypeRevisionChangesReader().findEntities( 1 ), ste, site );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTrackModifiedEntities() {
|
||||
StrIntTestEntity site = new StrIntTestEntity("y", 2, siteId);
|
||||
|
||||
assert TestTools.checkList(getCrossTypeRevisionChangesReader().findEntities(2), site);
|
||||
assert TestTools.checkCollection( getCrossTypeRevisionChangesReader().findEntities( 2 ), site );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -107,7 +106,7 @@ public class DefaultTrackingEntitiesTest extends BaseEnversJPAFunctionalTestCase
|
|||
StrTestEntity ste = new StrTestEntity(null, steId);
|
||||
StrIntTestEntity site = new StrIntTestEntity(null, null, siteId);
|
||||
|
||||
assert TestTools.checkList(getCrossTypeRevisionChangesReader().findEntities(3), site, ste);
|
||||
assert TestTools.checkCollection( getCrossTypeRevisionChangesReader().findEntities( 3 ), site, ste );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -121,9 +120,9 @@ public class DefaultTrackingEntitiesTest extends BaseEnversJPAFunctionalTestCase
|
|||
StrIntTestEntity site = new StrIntTestEntity("y", 1, siteId);
|
||||
|
||||
Map<RevisionType, List<Object>> result = getCrossTypeRevisionChangesReader().findEntitiesGroupByRevisionType(1);
|
||||
assert TestTools.checkList(result.get(RevisionType.ADD), site, ste);
|
||||
assert TestTools.checkList(result.get(RevisionType.MOD));
|
||||
assert TestTools.checkList(result.get(RevisionType.DEL));
|
||||
assert TestTools.checkCollection( result.get( RevisionType.ADD ), site, ste );
|
||||
assert TestTools.checkCollection( result.get( RevisionType.MOD ) );
|
||||
assert TestTools.checkCollection( result.get( RevisionType.DEL ) );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -131,9 +130,9 @@ public class DefaultTrackingEntitiesTest extends BaseEnversJPAFunctionalTestCase
|
|||
StrIntTestEntity site = new StrIntTestEntity("y", 2, siteId);
|
||||
|
||||
Map<RevisionType, List<Object>> result = getCrossTypeRevisionChangesReader().findEntitiesGroupByRevisionType(2);
|
||||
assert TestTools.checkList(result.get(RevisionType.ADD));
|
||||
assert TestTools.checkList(result.get(RevisionType.MOD), site);
|
||||
assert TestTools.checkList(result.get(RevisionType.DEL));
|
||||
assert TestTools.checkCollection( result.get( RevisionType.ADD ) );
|
||||
assert TestTools.checkCollection( result.get( RevisionType.MOD ), site );
|
||||
assert TestTools.checkCollection( result.get( RevisionType.DEL ) );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -142,9 +141,9 @@ public class DefaultTrackingEntitiesTest extends BaseEnversJPAFunctionalTestCase
|
|||
StrIntTestEntity site = new StrIntTestEntity(null, null, siteId);
|
||||
|
||||
Map<RevisionType, List<Object>> result = getCrossTypeRevisionChangesReader().findEntitiesGroupByRevisionType(3);
|
||||
assert TestTools.checkList(result.get(RevisionType.ADD));
|
||||
assert TestTools.checkList(result.get(RevisionType.MOD));
|
||||
assert TestTools.checkList(result.get(RevisionType.DEL), site, ste);
|
||||
assert TestTools.checkCollection( result.get( RevisionType.ADD ) );
|
||||
assert TestTools.checkCollection( result.get( RevisionType.MOD ) );
|
||||
assert TestTools.checkCollection( result.get( RevisionType.DEL ), site, ste );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -152,14 +151,21 @@ public class DefaultTrackingEntitiesTest extends BaseEnversJPAFunctionalTestCase
|
|||
StrTestEntity ste = new StrTestEntity("x", steId);
|
||||
StrIntTestEntity site = new StrIntTestEntity("y", 1, siteId);
|
||||
|
||||
assert TestTools.checkList(getCrossTypeRevisionChangesReader().findEntities(1, RevisionType.ADD), ste, site);
|
||||
assert TestTools.checkCollection(
|
||||
getCrossTypeRevisionChangesReader().findEntities( 1, RevisionType.ADD ),
|
||||
ste,
|
||||
site
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testFindChangedEntitiesByRevisionTypeMOD() {
|
||||
StrIntTestEntity site = new StrIntTestEntity("y", 2, siteId);
|
||||
|
||||
assert TestTools.checkList(getCrossTypeRevisionChangesReader().findEntities(2, RevisionType.MOD), site);
|
||||
assert TestTools.checkCollection(
|
||||
getCrossTypeRevisionChangesReader().findEntities( 2, RevisionType.MOD ),
|
||||
site
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -167,7 +173,11 @@ public class DefaultTrackingEntitiesTest extends BaseEnversJPAFunctionalTestCase
|
|||
StrTestEntity ste = new StrTestEntity(null, steId);
|
||||
StrIntTestEntity site = new StrIntTestEntity(null, null, siteId);
|
||||
|
||||
assert TestTools.checkList(getCrossTypeRevisionChangesReader().findEntities(3, RevisionType.DEL), ste, site);
|
||||
assert TestTools.checkCollection(
|
||||
getCrossTypeRevisionChangesReader().findEntities( 3, RevisionType.DEL ),
|
||||
ste,
|
||||
site
|
||||
);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -266,17 +266,17 @@ public class ValidityAuditStrategyRevEndTestCustomRevEnt extends BaseEnversJPAFu
|
|||
ParentEntity rev4 = getAuditReader().find(ParentEntity.class, p1_id, 4);
|
||||
ParentEntity rev5 = getAuditReader().find(ParentEntity.class, p1_id, 5);
|
||||
|
||||
assert TestTools.checkList(rev1.getChildren1());
|
||||
assert TestTools.checkList(rev2.getChildren1(), c1_1);
|
||||
assert TestTools.checkList(rev3.getChildren1(), c1_1, c1_2);
|
||||
assert TestTools.checkList(rev4.getChildren1(), c1_2);
|
||||
assert TestTools.checkList(rev5.getChildren1());
|
||||
assert TestTools.checkCollection( rev1.getChildren1() );
|
||||
assert TestTools.checkCollection( rev2.getChildren1(), c1_1 );
|
||||
assert TestTools.checkCollection( rev3.getChildren1(), c1_1, c1_2 );
|
||||
assert TestTools.checkCollection( rev4.getChildren1(), c1_2 );
|
||||
assert TestTools.checkCollection( rev5.getChildren1() );
|
||||
|
||||
assert TestTools.checkList(rev1.getChildren2());
|
||||
assert TestTools.checkList(rev2.getChildren2());
|
||||
assert TestTools.checkList(rev3.getChildren2(), c2_2);
|
||||
assert TestTools.checkList(rev4.getChildren2(), c2_2);
|
||||
assert TestTools.checkList(rev5.getChildren2(), c2_2);
|
||||
assert TestTools.checkCollection( rev1.getChildren2() );
|
||||
assert TestTools.checkCollection( rev2.getChildren2() );
|
||||
assert TestTools.checkCollection( rev3.getChildren2(), c2_2 );
|
||||
assert TestTools.checkCollection( rev4.getChildren2(), c2_2 );
|
||||
assert TestTools.checkCollection( rev5.getChildren2(), c2_2 );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -294,17 +294,17 @@ public class ValidityAuditStrategyRevEndTestCustomRevEnt extends BaseEnversJPAFu
|
|||
ParentEntity rev4 = getAuditReader().find(ParentEntity.class, p2_id, 4);
|
||||
ParentEntity rev5 = getAuditReader().find(ParentEntity.class, p2_id, 5);
|
||||
|
||||
assert TestTools.checkList(rev1.getChildren1());
|
||||
assert TestTools.checkList(rev2.getChildren1());
|
||||
assert TestTools.checkList(rev3.getChildren1(), c1_1);
|
||||
assert TestTools.checkList(rev4.getChildren1(), c1_1);
|
||||
assert TestTools.checkList(rev5.getChildren1(), c1_1);
|
||||
assert TestTools.checkCollection( rev1.getChildren1() );
|
||||
assert TestTools.checkCollection( rev2.getChildren1() );
|
||||
assert TestTools.checkCollection( rev3.getChildren1(), c1_1 );
|
||||
assert TestTools.checkCollection( rev4.getChildren1(), c1_1 );
|
||||
assert TestTools.checkCollection( rev5.getChildren1(), c1_1 );
|
||||
|
||||
assert TestTools.checkList(rev1.getChildren2());
|
||||
assert TestTools.checkList(rev2.getChildren2(), c2_1);
|
||||
assert TestTools.checkList(rev3.getChildren2(), c2_1);
|
||||
assert TestTools.checkList(rev4.getChildren2(), c2_1, c2_2);
|
||||
assert TestTools.checkList(rev5.getChildren2(), c2_1);
|
||||
assert TestTools.checkCollection( rev1.getChildren2() );
|
||||
assert TestTools.checkCollection( rev2.getChildren2(), c2_1 );
|
||||
assert TestTools.checkCollection( rev3.getChildren2(), c2_1 );
|
||||
assert TestTools.checkCollection( rev4.getChildren2(), c2_1, c2_2 );
|
||||
assert TestTools.checkCollection( rev5.getChildren2(), c2_1 );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -323,11 +323,11 @@ public class ValidityAuditStrategyRevEndTestCustomRevEnt extends BaseEnversJPAFu
|
|||
Child1Entity rev5 = getAuditReader().find(Child1Entity.class, c1_1_id,
|
||||
5);
|
||||
|
||||
assert TestTools.checkList(rev1.getParents());
|
||||
assert TestTools.checkList(rev2.getParents(), p1);
|
||||
assert TestTools.checkList(rev3.getParents(), p1, p2);
|
||||
assert TestTools.checkList(rev4.getParents(), p2);
|
||||
assert TestTools.checkList(rev5.getParents(), p2);
|
||||
assert TestTools.checkCollection( rev1.getParents() );
|
||||
assert TestTools.checkCollection( rev2.getParents(), p1 );
|
||||
assert TestTools.checkCollection( rev3.getParents(), p1, p2 );
|
||||
assert TestTools.checkCollection( rev4.getParents(), p2 );
|
||||
assert TestTools.checkCollection( rev5.getParents(), p2 );
|
||||
}
|
||||
|
||||
// TODO: this was disabled?
|
||||
|
@ -346,11 +346,11 @@ public class ValidityAuditStrategyRevEndTestCustomRevEnt extends BaseEnversJPAFu
|
|||
Child1Entity rev5 = getAuditReader().find(Child1Entity.class, c1_2_id,
|
||||
5);
|
||||
|
||||
assert TestTools.checkList(rev1.getParents());
|
||||
assert TestTools.checkList(rev2.getParents());
|
||||
assert TestTools.checkList(rev3.getParents(), p1);
|
||||
assert TestTools.checkList(rev4.getParents(), p1);
|
||||
assert TestTools.checkList(rev5.getParents());
|
||||
assert TestTools.checkCollection( rev1.getParents() );
|
||||
assert TestTools.checkCollection( rev2.getParents() );
|
||||
assert TestTools.checkCollection( rev3.getParents(), p1 );
|
||||
assert TestTools.checkCollection( rev4.getParents(), p1 );
|
||||
assert TestTools.checkCollection( rev5.getParents() );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -368,11 +368,11 @@ public class ValidityAuditStrategyRevEndTestCustomRevEnt extends BaseEnversJPAFu
|
|||
Child2Entity rev5 = getAuditReader().find(Child2Entity.class, c2_1_id,
|
||||
5);
|
||||
|
||||
assert TestTools.checkList(rev1.getParents());
|
||||
assert TestTools.checkList(rev2.getParents(), p2);
|
||||
assert TestTools.checkList(rev3.getParents(), p2);
|
||||
assert TestTools.checkList(rev4.getParents(), p2);
|
||||
assert TestTools.checkList(rev5.getParents(), p2);
|
||||
assert TestTools.checkCollection( rev1.getParents() );
|
||||
assert TestTools.checkCollection( rev2.getParents(), p2 );
|
||||
assert TestTools.checkCollection( rev3.getParents(), p2 );
|
||||
assert TestTools.checkCollection( rev4.getParents(), p2 );
|
||||
assert TestTools.checkCollection( rev5.getParents(), p2 );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -391,11 +391,11 @@ public class ValidityAuditStrategyRevEndTestCustomRevEnt extends BaseEnversJPAFu
|
|||
Child2Entity rev5 = getAuditReader().find(Child2Entity.class, c2_2_id,
|
||||
5);
|
||||
|
||||
assert TestTools.checkList(rev1.getParents());
|
||||
assert TestTools.checkList(rev2.getParents());
|
||||
assert TestTools.checkList(rev3.getParents(), p1);
|
||||
assert TestTools.checkList(rev4.getParents(), p1, p2);
|
||||
assert TestTools.checkList(rev5.getParents(), p1);
|
||||
assert TestTools.checkCollection( rev1.getParents() );
|
||||
assert TestTools.checkCollection( rev2.getParents() );
|
||||
assert TestTools.checkCollection( rev3.getParents(), p1 );
|
||||
assert TestTools.checkCollection( rev4.getParents(), p1, p2 );
|
||||
assert TestTools.checkCollection( rev5.getParents(), p1 );
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> getRevisions(
|
||||
|
|
|
@ -270,17 +270,17 @@ public class ValidityAuditStrategyRevEndTsTest extends BaseEnversJPAFunctionalTe
|
|||
ParentEntity rev4 = getAuditReader().find(ParentEntity.class, p1_id, 4);
|
||||
ParentEntity rev5 = getAuditReader().find(ParentEntity.class, p1_id, 5);
|
||||
|
||||
assert TestTools.checkList(rev1.getChildren1());
|
||||
assert TestTools.checkList(rev2.getChildren1(), c1_1);
|
||||
assert TestTools.checkList(rev3.getChildren1(), c1_1, c1_2);
|
||||
assert TestTools.checkList(rev4.getChildren1(), c1_2);
|
||||
assert TestTools.checkList(rev5.getChildren1());
|
||||
assert TestTools.checkCollection( rev1.getChildren1() );
|
||||
assert TestTools.checkCollection( rev2.getChildren1(), c1_1 );
|
||||
assert TestTools.checkCollection( rev3.getChildren1(), c1_1, c1_2 );
|
||||
assert TestTools.checkCollection( rev4.getChildren1(), c1_2 );
|
||||
assert TestTools.checkCollection( rev5.getChildren1() );
|
||||
|
||||
assert TestTools.checkList(rev1.getChildren2());
|
||||
assert TestTools.checkList(rev2.getChildren2());
|
||||
assert TestTools.checkList(rev3.getChildren2(), c2_2);
|
||||
assert TestTools.checkList(rev4.getChildren2(), c2_2);
|
||||
assert TestTools.checkList(rev5.getChildren2(), c2_2);
|
||||
assert TestTools.checkCollection( rev1.getChildren2() );
|
||||
assert TestTools.checkCollection( rev2.getChildren2() );
|
||||
assert TestTools.checkCollection( rev3.getChildren2(), c2_2 );
|
||||
assert TestTools.checkCollection( rev4.getChildren2(), c2_2 );
|
||||
assert TestTools.checkCollection( rev5.getChildren2(), c2_2 );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -298,17 +298,17 @@ public class ValidityAuditStrategyRevEndTsTest extends BaseEnversJPAFunctionalTe
|
|||
ParentEntity rev4 = getAuditReader().find(ParentEntity.class, p2_id, 4);
|
||||
ParentEntity rev5 = getAuditReader().find(ParentEntity.class, p2_id, 5);
|
||||
|
||||
assert TestTools.checkList(rev1.getChildren1());
|
||||
assert TestTools.checkList(rev2.getChildren1());
|
||||
assert TestTools.checkList(rev3.getChildren1(), c1_1);
|
||||
assert TestTools.checkList(rev4.getChildren1(), c1_1);
|
||||
assert TestTools.checkList(rev5.getChildren1(), c1_1);
|
||||
assert TestTools.checkCollection( rev1.getChildren1() );
|
||||
assert TestTools.checkCollection( rev2.getChildren1() );
|
||||
assert TestTools.checkCollection( rev3.getChildren1(), c1_1 );
|
||||
assert TestTools.checkCollection( rev4.getChildren1(), c1_1 );
|
||||
assert TestTools.checkCollection( rev5.getChildren1(), c1_1 );
|
||||
|
||||
assert TestTools.checkList(rev1.getChildren2());
|
||||
assert TestTools.checkList(rev2.getChildren2(), c2_1);
|
||||
assert TestTools.checkList(rev3.getChildren2(), c2_1);
|
||||
assert TestTools.checkList(rev4.getChildren2(), c2_1, c2_2);
|
||||
assert TestTools.checkList(rev5.getChildren2(), c2_1);
|
||||
assert TestTools.checkCollection( rev1.getChildren2() );
|
||||
assert TestTools.checkCollection( rev2.getChildren2(), c2_1 );
|
||||
assert TestTools.checkCollection( rev3.getChildren2(), c2_1 );
|
||||
assert TestTools.checkCollection( rev4.getChildren2(), c2_1, c2_2 );
|
||||
assert TestTools.checkCollection( rev5.getChildren2(), c2_1 );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -327,11 +327,11 @@ public class ValidityAuditStrategyRevEndTsTest extends BaseEnversJPAFunctionalTe
|
|||
Child1Entity rev5 = getAuditReader().find(Child1Entity.class, c1_1_id,
|
||||
5);
|
||||
|
||||
assert TestTools.checkList(rev1.getParents());
|
||||
assert TestTools.checkList(rev2.getParents(), p1);
|
||||
assert TestTools.checkList(rev3.getParents(), p1, p2);
|
||||
assert TestTools.checkList(rev4.getParents(), p2);
|
||||
assert TestTools.checkList(rev5.getParents(), p2);
|
||||
assert TestTools.checkCollection( rev1.getParents() );
|
||||
assert TestTools.checkCollection( rev2.getParents(), p1 );
|
||||
assert TestTools.checkCollection( rev3.getParents(), p1, p2 );
|
||||
assert TestTools.checkCollection( rev4.getParents(), p2 );
|
||||
assert TestTools.checkCollection( rev5.getParents(), p2 );
|
||||
}
|
||||
|
||||
// TODO: this was disabled?
|
||||
|
@ -350,11 +350,11 @@ public class ValidityAuditStrategyRevEndTsTest extends BaseEnversJPAFunctionalTe
|
|||
Child1Entity rev5 = getAuditReader().find(Child1Entity.class, c1_2_id,
|
||||
5);
|
||||
|
||||
assert TestTools.checkList(rev1.getParents());
|
||||
assert TestTools.checkList(rev2.getParents());
|
||||
assert TestTools.checkList(rev3.getParents(), p1);
|
||||
assert TestTools.checkList(rev4.getParents(), p1);
|
||||
assert TestTools.checkList(rev5.getParents());
|
||||
assert TestTools.checkCollection( rev1.getParents() );
|
||||
assert TestTools.checkCollection( rev2.getParents() );
|
||||
assert TestTools.checkCollection( rev3.getParents(), p1 );
|
||||
assert TestTools.checkCollection( rev4.getParents(), p1 );
|
||||
assert TestTools.checkCollection( rev5.getParents() );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -372,11 +372,11 @@ public class ValidityAuditStrategyRevEndTsTest extends BaseEnversJPAFunctionalTe
|
|||
Child2Entity rev5 = getAuditReader().find(Child2Entity.class, c2_1_id,
|
||||
5);
|
||||
|
||||
assert TestTools.checkList(rev1.getParents());
|
||||
assert TestTools.checkList(rev2.getParents(), p2);
|
||||
assert TestTools.checkList(rev3.getParents(), p2);
|
||||
assert TestTools.checkList(rev4.getParents(), p2);
|
||||
assert TestTools.checkList(rev5.getParents(), p2);
|
||||
assert TestTools.checkCollection( rev1.getParents() );
|
||||
assert TestTools.checkCollection( rev2.getParents(), p2 );
|
||||
assert TestTools.checkCollection( rev3.getParents(), p2 );
|
||||
assert TestTools.checkCollection( rev4.getParents(), p2 );
|
||||
assert TestTools.checkCollection( rev5.getParents(), p2 );
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -395,11 +395,11 @@ public class ValidityAuditStrategyRevEndTsTest extends BaseEnversJPAFunctionalTe
|
|||
Child2Entity rev5 = getAuditReader().find(Child2Entity.class, c2_2_id,
|
||||
5);
|
||||
|
||||
assert TestTools.checkList(rev1.getParents());
|
||||
assert TestTools.checkList(rev2.getParents());
|
||||
assert TestTools.checkList(rev3.getParents(), p1);
|
||||
assert TestTools.checkList(rev4.getParents(), p1, p2);
|
||||
assert TestTools.checkList(rev5.getParents(), p1);
|
||||
assert TestTools.checkCollection( rev1.getParents() );
|
||||
assert TestTools.checkCollection( rev2.getParents() );
|
||||
assert TestTools.checkCollection( rev3.getParents(), p1 );
|
||||
assert TestTools.checkCollection( rev4.getParents(), p1, p2 );
|
||||
assert TestTools.checkCollection( rev5.getParents(), p1 );
|
||||
}
|
||||
|
||||
private List<Map<String, Object>> getRevisions(
|
||||
|
|
|
@ -25,6 +25,7 @@ package org.hibernate.envers.test.tools;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
@ -66,7 +67,7 @@ public class TestTools {
|
|||
return ret;
|
||||
}
|
||||
|
||||
public static <T> boolean checkList(List<T> list, T... objects) {
|
||||
public static <T> boolean checkCollection(Collection<T> list, T... objects) {
|
||||
if (list.size() != objects.length) {
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue