HHH-7187 - Fix ValidityAuditStrategyRevEnd tests

This commit is contained in:
Lukasz Antoniak 2012-04-29 13:27:28 +02:00
parent a2bbe3cb53
commit 779e70df4d
2 changed files with 22 additions and 22 deletions

View File

@ -23,23 +23,19 @@
*/ */
package org.hibernate.envers.test.integration.strategy; package org.hibernate.envers.test.integration.strategy;
import java.sql.Types;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Properties;
import java.util.Set; import java.util.Set;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.Query; import javax.persistence.Query;
import org.hibernate.dialect.Oracle8iDialect;
import org.junit.Test; import org.junit.Test;
import org.hibernate.Session; 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.ejb.Ejb3Configuration;
import org.hibernate.envers.strategy.ValidityAuditStrategy; import org.hibernate.envers.strategy.ValidityAuditStrategy;
import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase; import org.hibernate.envers.test.BaseEnversJPAFunctionalTestCase;
@ -95,17 +91,20 @@ public class ValidityAuditStrategyRevEndTestCustomRevEnt extends BaseEnversJPAFu
session.createSQLQuery("DROP TABLE children").executeUpdate(); session.createSQLQuery("DROP TABLE children").executeUpdate();
session session
.createSQLQuery( .createSQLQuery(
"CREATE TABLE children(parent_id integer, child1_id integer NULL, child2_id integer NULL)") "CREATE TABLE children ( parent_id " + getDialect().getTypeName(Types.INTEGER) +
", child1_id " + getDialect().getTypeName(Types.INTEGER) + " NULL" +
", child2_id " + getDialect().getTypeName(Types.INTEGER) + " NULL )")
.executeUpdate(); .executeUpdate();
session.createSQLQuery("DROP TABLE children_AUD").executeUpdate(); session.createSQLQuery("DROP TABLE children_AUD").executeUpdate();
session session
.createSQLQuery( .createSQLQuery(
"CREATE TABLE children_AUD(REV integer NOT NULL, REVEND integer, " "CREATE TABLE children_AUD ( REV " + getDialect().getTypeName(Types.INTEGER) + " NOT NULL" +
+ revendTimestampColumName + " " ", REVEND " + getDialect().getTypeName(Types.INTEGER) +
+ ((getDialect() instanceof SQLServerDialect || getDialect() instanceof SybaseASE15Dialect) ? "datetime" : "timestamp") ", " + revendTimestampColumName + " " + getDialect().getTypeName(Types.TIMESTAMP) +
+ ", REVTYPE " + (getDialect() instanceof Oracle8iDialect ? "number(3,0)" ", REVTYPE " + getDialect().getTypeName(Types.TINYINT) +
: (getDialect() instanceof PostgreSQL82Dialect ? "smallint" : "tinyint")) ", parent_id " + getDialect().getTypeName(Types.INTEGER) +
+ ", parent_id integer, child1_id integer NULL, child2_id integer NULL)") ", child1_id " + getDialect().getTypeName(Types.INTEGER) + " NULL" +
", child2_id " + getDialect().getTypeName(Types.INTEGER) + " NULL )")
.executeUpdate(); .executeUpdate();
em.getTransaction().commit(); em.getTransaction().commit();
em.clear(); em.clear();

View File

@ -23,6 +23,7 @@
*/ */
package org.hibernate.envers.test.integration.strategy; package org.hibernate.envers.test.integration.strategy;
import java.sql.Types;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashSet; import java.util.HashSet;
@ -32,14 +33,11 @@ import java.util.Set;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.Query; import javax.persistence.Query;
import org.hibernate.dialect.Oracle8iDialect;
import org.junit.Assert; import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import org.hibernate.Session; import org.hibernate.Session;
import org.hibernate.dialect.MySQL5Dialect; import org.hibernate.dialect.MySQL5Dialect;
import org.hibernate.dialect.PostgreSQL82Dialect;
import org.hibernate.dialect.SQLServerDialect;
import org.hibernate.dialect.SybaseASE15Dialect; import org.hibernate.dialect.SybaseASE15Dialect;
import org.hibernate.ejb.Ejb3Configuration; import org.hibernate.ejb.Ejb3Configuration;
import org.hibernate.envers.enhanced.SequenceIdRevisionEntity; import org.hibernate.envers.enhanced.SequenceIdRevisionEntity;
@ -96,17 +94,20 @@ public class ValidityAuditStrategyRevEndTsTest extends BaseEnversJPAFunctionalTe
session.createSQLQuery("DROP TABLE children").executeUpdate(); session.createSQLQuery("DROP TABLE children").executeUpdate();
session session
.createSQLQuery( .createSQLQuery(
"CREATE TABLE children(parent_id integer, child1_id integer NULL, child2_id integer NULL)") "CREATE TABLE children ( parent_id " + getDialect().getTypeName(Types.INTEGER) +
", child1_id " + getDialect().getTypeName(Types.INTEGER) + " NULL" +
", child2_id " + getDialect().getTypeName(Types.INTEGER) + " NULL )")
.executeUpdate(); .executeUpdate();
session.createSQLQuery("DROP TABLE children_AUD").executeUpdate(); session.createSQLQuery("DROP TABLE children_AUD").executeUpdate();
session session
.createSQLQuery( .createSQLQuery(
"CREATE TABLE children_AUD(REV integer NOT NULL, REVEND integer, " "CREATE TABLE children_AUD ( REV " + getDialect().getTypeName(Types.INTEGER) + " NOT NULL" +
+ revendTimestampColumName + " " ", REVEND " + getDialect().getTypeName(Types.INTEGER) +
+ ((getDialect() instanceof SQLServerDialect || getDialect() instanceof SybaseASE15Dialect ) ? "datetime" : "timestamp") ", " + revendTimestampColumName + " " + getDialect().getTypeName(Types.TIMESTAMP) +
+ ", REVTYPE " + (getDialect() instanceof Oracle8iDialect ? "number(3,0)" ", REVTYPE " + getDialect().getTypeName(Types.TINYINT) +
: (getDialect() instanceof PostgreSQL82Dialect ? "smallint" : "tinyint")) ", parent_id " + getDialect().getTypeName(Types.INTEGER) +
+ ", parent_id integer, child1_id integer NULL, child2_id integer NULL)") ", child1_id " + getDialect().getTypeName(Types.INTEGER) + " NULL" +
", child2_id " + getDialect().getTypeName(Types.INTEGER) + " NULL )")
.executeUpdate(); .executeUpdate();
em.getTransaction().commit(); em.getTransaction().commit();
em.clear(); em.clear();