HHH-8505: Test that counts the revisions

This commit is contained in:
zuchos 2013-10-01 11:08:23 +02:00 committed by adamw
parent 4e93c91050
commit e971a8e14a
1 changed files with 14 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package org.hibernate.envers.test.integration.components.dynamic; package org.hibernate.envers.test.integration.components.dynamic;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@ -176,6 +177,11 @@ public class AuditedDynamicComponentsAdvancedCasesTest extends BaseEnversFunctio
session.save( advancedEntity ); session.save( advancedEntity );
session.getTransaction().commit(); session.getTransaction().commit();
//rev this, should not create revision
session.getTransaction().begin();
session.getTransaction().commit();
//sanity check. Loaded entity should be equal to one that we created.
AdvancedEntity advancedEntityActual = (AdvancedEntity) session.load( AdvancedEntity.class, 1L ); AdvancedEntity advancedEntityActual = (AdvancedEntity) session.load( AdvancedEntity.class, 1L );
Assert.assertEquals( advancedEntity, advancedEntityActual ); Assert.assertEquals( advancedEntity, advancedEntityActual );
@ -353,4 +359,12 @@ public class AuditedDynamicComponentsAdvancedCasesTest extends BaseEnversFunctio
} }
} }
@Test
public void testRevisionsCounts() {
Assert.assertEquals(
Arrays.asList( 1, 2, 3, 4, 5, 6, 7, 8, 9 ),
getAuditReader().getRevisions( AdvancedEntity.class, 1L )
);
}
} }