HHH-7187 - Fixing tests on Sybase
This commit is contained in:
parent
cfa729d8b3
commit
6a7b70d4cc
|
@ -10,7 +10,7 @@ import org.hibernate.envers.test.entities.UnversionedStrTestEntity;
|
|||
*/
|
||||
@Embeddable
|
||||
public class ManyToOneNotAuditedEmbId implements Serializable {
|
||||
@ManyToOne
|
||||
@ManyToOne(optional = false)
|
||||
private UnversionedStrTestEntity id;
|
||||
|
||||
public ManyToOneNotAuditedEmbId() {
|
||||
|
|
|
@ -93,7 +93,8 @@ public class PartialModifiedFlagsEntity {
|
|||
|
||||
@Audited(withModifiedFlag = true)
|
||||
@ManyToMany
|
||||
@CollectionTable(name = "ENTITIESMAP")
|
||||
@CollectionTable(name = "ENTITIESMAP")
|
||||
@MapKeyColumn(nullable = false)
|
||||
private Map<String, StrTestEntity> entitiesMap =
|
||||
new HashMap<String, StrTestEntity>();
|
||||
|
||||
|
|
|
@ -39,6 +39,7 @@ import org.junit.Test;
|
|||
import org.hibernate.Session;
|
||||
import org.hibernate.dialect.PostgreSQL82Dialect;
|
||||
import org.hibernate.dialect.SQLServerDialect;
|
||||
import org.hibernate.dialect.SybaseASE15Dialect;
|
||||
import org.hibernate.ejb.Ejb3Configuration;
|
||||
import org.hibernate.envers.strategy.ValidityAuditStrategy;
|
||||
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
|
||||
|
@ -101,7 +102,7 @@ public class ValidityAuditStrategyRevEndTestCustomRevEnt extends BaseEnversJPAFu
|
|||
.createSQLQuery(
|
||||
"CREATE TABLE children_AUD(REV integer NOT NULL, REVEND integer, "
|
||||
+ revendTimestampColumName + " "
|
||||
+ (getDialect() instanceof SQLServerDialect ? "datetime" : "timestamp")
|
||||
+ ((getDialect() instanceof SQLServerDialect || getDialect() instanceof SybaseASE15Dialect) ? "datetime" : "timestamp")
|
||||
+ ", REVTYPE " + (getDialect() instanceof Oracle8iDialect ? "number(3,0)"
|
||||
: (getDialect() instanceof PostgreSQL82Dialect ? "smallint" : "tinyint"))
|
||||
+ ", parent_id integer, child1_id integer NULL, child2_id integer NULL)")
|
||||
|
|
|
@ -40,6 +40,7 @@ import org.hibernate.Session;
|
|||
import org.hibernate.dialect.MySQL5Dialect;
|
||||
import org.hibernate.dialect.PostgreSQL82Dialect;
|
||||
import org.hibernate.dialect.SQLServerDialect;
|
||||
import org.hibernate.dialect.SybaseASE15Dialect;
|
||||
import org.hibernate.ejb.Ejb3Configuration;
|
||||
import org.hibernate.envers.enhanced.SequenceIdRevisionEntity;
|
||||
import org.hibernate.envers.strategy.ValidityAuditStrategy;
|
||||
|
@ -102,7 +103,7 @@ public class ValidityAuditStrategyRevEndTsTest extends BaseEnversJPAFunctionalTe
|
|||
.createSQLQuery(
|
||||
"CREATE TABLE children_AUD(REV integer NOT NULL, REVEND integer, "
|
||||
+ revendTimestampColumName + " "
|
||||
+ (getDialect() instanceof SQLServerDialect ? "datetime" : "timestamp")
|
||||
+ ((getDialect() instanceof SQLServerDialect || getDialect() instanceof SybaseASE15Dialect ) ? "datetime" : "timestamp")
|
||||
+ ", REVTYPE " + (getDialect() instanceof Oracle8iDialect ? "number(3,0)"
|
||||
: (getDialect() instanceof PostgreSQL82Dialect ? "smallint" : "tinyint"))
|
||||
+ ", parent_id integer, child1_id integer NULL, child2_id integer NULL)")
|
||||
|
@ -431,6 +432,11 @@ public class ValidityAuditStrategyRevEndTsTest extends BaseEnversJPAFunctionalTe
|
|||
if (getDialect() instanceof MySQL5Dialect) {
|
||||
// MySQL5 DATETIME column type does not contain milliseconds.
|
||||
Assert.assertEquals(revendTimestamp.getTime(), (revEnd.getTimestamp() - (revEnd.getTimestamp() % 1000)));
|
||||
} else if (getDialect() instanceof SybaseASE15Dialect) {
|
||||
// Sybase "DATETIME values are accurate to 1/300 second on platforms that support this level of granularity".
|
||||
Assert.assertEquals(
|
||||
revendTimestamp.getTime() / 1000.0, revEnd.getTimestamp() / 1000.0, 1.0 / 300.0
|
||||
);
|
||||
} else {
|
||||
Assert.assertEquals(revendTimestamp.getTime(), revEnd.getTimestamp());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue