HHH-7187 - tests fail on sybase

This commit is contained in:
Strong Liu 2012-03-26 13:53:07 +08:00
parent 37aecde965
commit 96e23180d7
3 changed files with 23 additions and 27 deletions

View File

@ -27,6 +27,7 @@ package org.hibernate.envers.test.integration.accesstype;
import java.util.Arrays;
import javax.persistence.EntityManager;
import org.junit.Assert;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
@ -61,15 +62,14 @@ public class FieldAccessType extends AbstractEntityTest {
@Test
public void testRevisionsCounts() {
assert Arrays.asList(1, 2).equals(getAuditReader().getRevisions(FieldAccessTypeEntity.class, id1));
Assert.assertEquals( Arrays.asList( 1, 2 ), getAuditReader().getRevisions(FieldAccessTypeEntity.class, id1) );
}
@Test
public void testHistoryOfId1() {
FieldAccessTypeEntity ver1 = new FieldAccessTypeEntity(id1, "data");
FieldAccessTypeEntity ver2 = new FieldAccessTypeEntity(id1, "data2");
assert getAuditReader().find(FieldAccessTypeEntity.class, id1, 1).equals(ver1);
assert getAuditReader().find(FieldAccessTypeEntity.class, id1, 2).equals(ver2);
Assert.assertEquals(getAuditReader().find(FieldAccessTypeEntity.class, id1, 1), ver1);
Assert.assertEquals(getAuditReader().find(FieldAccessTypeEntity.class, id1, 2), ver2);
}
}

View File

@ -28,6 +28,7 @@ import javax.persistence.EntityManager;
import javax.transaction.RollbackException;
import javax.transaction.TransactionManager;
import org.junit.Assert;
import org.junit.Test;
import org.hibernate.ejb.Ejb3Configuration;
@ -83,7 +84,7 @@ public class JtaExceptionListener extends AbstractEntityTest {
newEntityManager();
EntityManager em = getEntityManager();
Long count = (Long) em.createQuery("select count(s) from StrTestEntity s where s.str = 'x'").getSingleResult();
assert count == 0l;
Assert.assertEquals( Long.valueOf( 0 ), count );
} finally {
tryCommit(tm);
}

View File

@ -29,7 +29,7 @@ import java.util.Set;
import javax.persistence.EntityManager;
import org.junit.Test;
import static org.junit.Assert.*;
import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.query.AuditEntity;
import org.hibernate.envers.test.AbstractEntityTest;
@ -133,15 +133,13 @@ public class MulIdOneToManyQuery extends AbstractEntityTest {
.forEntitiesAtRevision(SetRefIngMulIdEntity.class, 3)
.add(AuditEntity.property("reference").eq(new SetRefEdMulIdEntity(id3, null)))
.getResultList());
assert rev1.equals(rev1_related);
assert rev2.equals(rev2_related);
assert rev3.equals(rev3_related);
assert rev1.equals(TestTools.makeSet());
assert rev2.equals(TestTools.makeSet(new SetRefIngMulIdEntity(id1, "x", null)));
assert rev3.equals(TestTools.makeSet(new SetRefIngMulIdEntity(id1, "x", null),
new SetRefIngMulIdEntity(id2, "y", null)));
assertEquals( rev1, rev1_related );
assertEquals( rev2, rev2_related );
assertEquals( rev3, rev3_related );
assertEquals( rev1, TestTools.makeSet() );
assertEquals( rev2, TestTools.makeSet(new SetRefIngMulIdEntity(id1, "x", null)) );
assertEquals( rev3, TestTools.makeSet(new SetRefIngMulIdEntity(id1, "x", null),
new SetRefIngMulIdEntity(id2, "y", null)) );
}
@Test
@ -160,10 +158,9 @@ public class MulIdOneToManyQuery extends AbstractEntityTest {
.forEntitiesAtRevision(SetRefIngMulIdEntity.class, 3)
.add(AuditEntity.relatedId("reference").eq(id4))
.getResultList());
assert rev1_related.equals(TestTools.makeSet());
assert rev2_related.equals(TestTools.makeSet(new SetRefIngMulIdEntity(id2, "y", null)));
assert rev3_related.equals(TestTools.makeSet());
assertEquals( rev1_related, TestTools.makeSet( ));
assertEquals( rev2_related, TestTools.makeSet(new SetRefIngMulIdEntity(id2, "y", null)));
assertEquals( rev3_related, TestTools.makeSet( ));
}
@Test
@ -185,10 +182,9 @@ public class MulIdOneToManyQuery extends AbstractEntityTest {
.add(AuditEntity.relatedId("reference").eq(id3))
.add(AuditEntity.id().eq(id1))
.getSingleResult();
assert rev1_related.size() == 0;
assert rev2_related.equals(new SetRefIngMulIdEntity(id1, "x", null));
assert rev3_related.equals(new SetRefIngMulIdEntity(id1, "x", null));
assertEquals( 0, rev1_related.size() );
assertEquals( rev2_related,new SetRefIngMulIdEntity(id1, "x", null) );
assertEquals( rev3_related, new SetRefIngMulIdEntity(id1, "x", null) );
}
@Test
@ -210,9 +206,8 @@ public class MulIdOneToManyQuery extends AbstractEntityTest {
.add(AuditEntity.relatedId("reference").eq(id3))
.add(AuditEntity.id().eq(id2))
.getSingleResult();
assert rev1_related.size() == 0;
assert rev2_related.size() == 0;
assert rev3_related.equals(new SetRefIngMulIdEntity(id2, "y", null));
assertEquals( 0, rev1_related );
assertEquals( 0, rev2_related );
assertEquals( new SetRefIngMulIdEntity(id2, "y", null), rev3_related );
}
}