use of org.hibernate.envers.test.entities.StrIntTestEntity in project hibernate-orm by hibernate.
the class SimpleQuery method testEntitiesChangedAtRevision.
@Test
public void testEntitiesChangedAtRevision() {
StrIntTestEntity site1 = new StrIntTestEntity("aBc", 10, id1);
StrIntTestEntity site2 = new StrIntTestEntity("a", 20, id2);
List result = getAuditReader().createQuery().forEntitiesModifiedAtRevision(StrIntTestEntity.class, 2).getResultList();
RevisionType revisionType = (RevisionType) getAuditReader().createQuery().forEntitiesModifiedAtRevision(StrIntTestEntity.class, 2).addProjection(AuditEntity.revisionType()).add(AuditEntity.id().eq(id1)).getSingleResult();
Assert.assertTrue(TestTools.checkCollection(result, site1, site2));
Assert.assertEquals(revisionType, RevisionType.MOD);
}
use of org.hibernate.envers.test.entities.StrIntTestEntity in project hibernate-orm by hibernate.
the class SimpleQuery method testEntitiesRemovedAtRevision.
@Test
public void testEntitiesRemovedAtRevision() {
StrIntTestEntity site1 = new StrIntTestEntity(null, null, id1);
List result = getAuditReader().createQuery().forEntitiesModifiedAtRevision(StrIntTestEntity.class, 4).getResultList();
RevisionType revisionType = (RevisionType) getAuditReader().createQuery().forEntitiesModifiedAtRevision(StrIntTestEntity.class, 4).addProjection(AuditEntity.revisionType()).add(AuditEntity.id().eq(id1)).getSingleResult();
Assert.assertTrue(TestTools.checkCollection(result, site1));
Assert.assertEquals(revisionType, RevisionType.DEL);
}
use of org.hibernate.envers.test.entities.StrIntTestEntity in project hibernate-orm by hibernate.
the class SimpleQuery method testIlike.
@Test
@TestForIssue(jiraKey = "HHH-8495")
public void testIlike() {
StrIntTestEntity site1 = new StrIntTestEntity("aBc", 10, id1);
StrIntTestEntity result = (StrIntTestEntity) getAuditReader().createQuery().forRevisionsOfEntity(StrIntTestEntity.class, true, true).add(AuditEntity.property("str1").ilike("abc")).getSingleResult();
Assert.assertEquals(site1, result);
}
use of org.hibernate.envers.test.entities.StrIntTestEntity in project hibernate-orm by hibernate.
the class SimpleQuery method testBetweenInsideDisjunction.
@Test
@TestForIssue(jiraKey = "HHH-7800")
public void testBetweenInsideDisjunction() {
List result = getAuditReader().createQuery().forRevisionsOfEntity(StrIntTestEntity.class, true, true).add(AuditEntity.disjunction().add(AuditEntity.property("number").between(0, 5)).add(AuditEntity.property("number").between(20, 100))).getResultList();
for (Object o : result) {
StrIntTestEntity entity = (StrIntTestEntity) o;
int number = entity.getNumber();
Assert.assertTrue((number >= 0 && number <= 5) || (number >= 20 && number <= 100));
}
}
use of org.hibernate.envers.test.entities.StrIntTestEntity in project hibernate-orm by hibernate.
the class SimpleQuery method testIlikeWithMatchMode.
@Test
@TestForIssue(jiraKey = "HHH-8495")
public void testIlikeWithMatchMode() {
StrIntTestEntity site1 = new StrIntTestEntity("aBc", 10, id1);
StrIntTestEntity result = (StrIntTestEntity) getAuditReader().createQuery().forRevisionsOfEntity(StrIntTestEntity.class, true, true).add(AuditEntity.property("str1").ilike("BC", MatchMode.ANYWHERE)).getSingleResult();
Assert.assertEquals(site1, result);
}
Aggregations