From 388ceaf1862d7aae1b9f60db9b8e838566948fdf Mon Sep 17 00:00:00 2001 From: Strong Liu Date: Tue, 1 Nov 2011 16:55:41 +0800 Subject: [PATCH] HHH-6773 test fails on sybase --- .../dataTypes/BasicOperationsTest.java | 3 ++ .../annotations/query/QueryAndSQLTest.java | 29 +++++++------------ .../test/cut/CompositeUserTypeTest.java | 5 +++- 3 files changed, 17 insertions(+), 20 deletions(-) diff --git a/hibernate-core/src/matrix/java/org/hibernate/test/annotations/dataTypes/BasicOperationsTest.java b/hibernate-core/src/matrix/java/org/hibernate/test/annotations/dataTypes/BasicOperationsTest.java index ce0b118c96..7fd7fbd562 100644 --- a/hibernate-core/src/matrix/java/org/hibernate/test/annotations/dataTypes/BasicOperationsTest.java +++ b/hibernate-core/src/matrix/java/org/hibernate/test/annotations/dataTypes/BasicOperationsTest.java @@ -32,6 +32,8 @@ import org.junit.Test; import org.hibernate.Session; import org.hibernate.jdbc.Work; +import org.hibernate.testing.DialectChecks; +import org.hibernate.testing.RequiresDialectFeature; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import org.hibernate.type.descriptor.JdbcTypeNameMapper; @@ -41,6 +43,7 @@ import static org.junit.Assert.assertTrue; /** * @author Steve Ebersole */ +@RequiresDialectFeature( DialectChecks.SupportsExpectedLobUsagePattern.class ) public class BasicOperationsTest extends BaseCoreFunctionalTestCase { @Override protected Class[] getAnnotatedClasses() { diff --git a/hibernate-core/src/matrix/java/org/hibernate/test/annotations/query/QueryAndSQLTest.java b/hibernate-core/src/matrix/java/org/hibernate/test/annotations/query/QueryAndSQLTest.java index a01def1df5..c1314d72c8 100644 --- a/hibernate-core/src/matrix/java/org/hibernate/test/annotations/query/QueryAndSQLTest.java +++ b/hibernate-core/src/matrix/java/org/hibernate/test/annotations/query/QueryAndSQLTest.java @@ -39,6 +39,7 @@ import org.hibernate.Transaction; import org.hibernate.cfg.Configuration; import org.hibernate.dialect.PostgreSQLDialect; import org.hibernate.dialect.SQLServerDialect; +import org.hibernate.dialect.SybaseASE15Dialect; import org.hibernate.stat.Statistics; import org.hibernate.test.annotations.A320; import org.hibernate.test.annotations.A320b; @@ -62,10 +63,16 @@ import static org.junit.Assert.fail; public class QueryAndSQLTest extends BaseCoreFunctionalTestCase { @Test - @SkipForDialect(value = {SQLServerDialect.class}) public void testNativeQueryWithFormulaAttribute() { - String sql = "select t.table_name as {t.tableName}, sysdate() as {t.daysOld} from ALL_TABLES t where t.table_name = 'AUDIT_ACTIONS' "; - String sql2 = "select table_name as t_name, sysdate() as t_time from ALL_TABLES where table_name = 'AUDIT_ACTIONS' "; + String sql,sql2; + if ( getDialect() instanceof SQLServerDialect || getDialect() instanceof SybaseASE15Dialect ) { + sql = "select t.table_name as {t.tableName}, getdate() as {t.daysOld} from ALL_TABLES t where t.table_name = 'AUDIT_ACTIONS' "; + sql2 = "select table_name as t_name, getdate() as t_time from ALL_TABLES where table_name = 'AUDIT_ACTIONS' "; + } + else { + sql = "select t.table_name as {t.tableName}, sysdate() as {t.daysOld} from ALL_TABLES t where t.table_name = 'AUDIT_ACTIONS' "; + sql2 = "select table_name as t_name, sysdate() as t_time from ALL_TABLES where table_name = 'AUDIT_ACTIONS' "; + } Session s = openSession(); s.beginTransaction(); s.createSQLQuery( sql ).addEntity( "t", AllTables.class ).list(); @@ -77,22 +84,6 @@ public class QueryAndSQLTest extends BaseCoreFunctionalTestCase { s.close(); } - @Test - @RequiresDialect(value = {SQLServerDialect.class}) - public void testNativeQueryWithFormulaAttributeSqlServer() { - String sql = "select t.table_name as {t.tableName}, getdate() as {t.daysOld} from ALL_TABLES t where t.table_name = 'AUDIT_ACTIONS' "; - String sql2 = "select table_name as t_name, getdate() as t_time from ALL_TABLES where table_name = 'AUDIT_ACTIONS' "; - Session s = openSession(); - s.beginTransaction(); - s.createSQLQuery( sql ).addEntity( "t", AllTables.class ).list(); - s.createSQLQuery( sql2 ).setResultSetMapping( "all" ).list(); - SQLQuery q = s.createSQLQuery( sql2 ); - q.addRoot( "t", AllTables.class ).addProperty( "tableName", "t_name" ).addProperty( "daysOld", "t_time" ); - q.list(); - s.getTransaction().commit(); - s.close(); - } - @Test @FailureExpected( jiraKey = "HHH-2225") public void testNativeQueryWithFormulaAttributeWithoutAlias() { diff --git a/hibernate-core/src/matrix/java/org/hibernate/test/cut/CompositeUserTypeTest.java b/hibernate-core/src/matrix/java/org/hibernate/test/cut/CompositeUserTypeTest.java index 0886e93cea..f4d6c048db 100755 --- a/hibernate-core/src/matrix/java/org/hibernate/test/cut/CompositeUserTypeTest.java +++ b/hibernate-core/src/matrix/java/org/hibernate/test/cut/CompositeUserTypeTest.java @@ -31,6 +31,8 @@ import org.junit.Test; import org.hibernate.Session; import org.hibernate.criterion.Restrictions; import org.hibernate.dialect.HSQLDialect; +import org.hibernate.dialect.SybaseASE15Dialect; +import org.hibernate.testing.SkipForDialect; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; import static org.junit.Assert.assertEquals; @@ -75,6 +77,7 @@ public class CompositeUserTypeTest extends BaseCoreFunctionalTestCase { } @Test + @SkipForDialect( value = SybaseASE15Dialect.class, jiraKey = "HHH-6788") public void testCustomColumnReadAndWrite() { Session s = openSession(); org.hibernate.Transaction t = s.beginTransaction(); @@ -84,7 +87,7 @@ public class CompositeUserTypeTest extends BaseCoreFunctionalTestCase { f.setHoldings( new MonetoryAmount( AMOUNT, Currency.getInstance("USD") ) ); s.persist(f); s.flush(); - + // Test value conversion during insert BigDecimal amountViaSql = (BigDecimal)s.createSQLQuery("select amount_millions from MutualFund").uniqueResult(); assertEquals(AMOUNT_MILLIONS.doubleValue(), amountViaSql.doubleValue(), 0.01d);