Skip to content

Commit 70d02d2

Browse files
committed
skip/fix some tests on Informix
1 parent 0603593 commit 70d02d2

File tree

6 files changed

+38
-18
lines changed

6 files changed

+38
-18
lines changed

hibernate-core/src/test/java/org/hibernate/orm/test/annotations/manytoonewithformula/ManyToOneWithFormulaTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package org.hibernate.orm.test.annotations.manytoonewithformula;
66

77
import org.hibernate.community.dialect.AltibaseDialect;
8+
import org.hibernate.community.dialect.InformixDialect;
89
import org.hibernate.dialect.HSQLDialect;
910
import org.hibernate.dialect.OracleDialect;
1011
import org.hibernate.dialect.SQLServerDialect;
@@ -22,7 +23,6 @@
2223
/**
2324
* @author Sharath Reddy
2425
*/
25-
@SuppressWarnings("JUnitMalformedDeclaration")
2626
public class ManyToOneWithFormulaTest {
2727
@Test
2828
@DomainModel( annotatedClasses = { Menu.class, FoodItem.class } )
@@ -148,8 +148,9 @@ public void testReferencedColumnNameBelongsToEmbeddedIdOfReferencedEntity(Sessio
148148
@Test
149149
@DomainModel( annotatedClasses = Product.class )
150150
@SessionFactory
151-
@SkipForDialect( dialectClass =HSQLDialect.class, reason = "The used join conditions does not work in HSQLDB. See HHH-4497." )
152-
@SkipForDialect( dialectClass = OracleDialect.class, reason = "Oracle do not support 'substring' function" )
151+
@SkipForDialect( dialectClass = HSQLDialect.class, reason = "The used join conditions does not work in HSQLDB. See HHH-4497." )
152+
@SkipForDialect( dialectClass = OracleDialect.class, reason = "Oracle do not support 'substring' function JDBC escape" )
153+
@SkipForDialect( dialectClass = InformixDialect.class, reason = "Oracle do not support 'substring' function JDBC escape" )
153154
@SkipForDialect( dialectClass = AltibaseDialect.class, reason = " Altibase char type returns with trailing spaces")
154155
public void testManyToOneFromNonPkToNonPk(SessionFactoryScope scope) {
155156
// also tests usage of the stand-alone @JoinFormula annotation

hibernate-core/src/test/java/org/hibernate/orm/test/hql/CoalesceTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
/**
2121
* @author Johannes Buehler
2222
*/
23-
@SuppressWarnings("JUnitMalformedDeclaration")
2423
@JiraKey( value = "HHH-10463")
2524
@DomainModel(annotatedClasses = org.hibernate.testing.orm.domain.gambit.EntityOfBasics.class)
2625
@SessionFactory

hibernate-core/src/test/java/org/hibernate/orm/test/mapping/generated/sql/SqlGeneratedTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import jakarta.persistence.Entity;
88
import jakarta.persistence.Id;
99
import org.hibernate.annotations.Generated;
10+
import org.hibernate.community.dialect.InformixDialect;
1011
import org.hibernate.dialect.SybaseASEDialect;
1112
import org.hibernate.generator.EventType;
1213
import org.hibernate.testing.orm.junit.DomainModel;
@@ -26,11 +27,12 @@
2627
/**
2728
* @author Gavin King
2829
*/
29-
@SuppressWarnings("JUnitMalformedDeclaration")
3030
@DomainModel(annotatedClasses = SqlGeneratedTest.OrderLine.class)
3131
@SessionFactory
3232
@SkipForDialect(dialectClass = SybaseASEDialect.class,
3333
reason = "The name 'current_timestamp' is illegal in this context. Only constants, constant expressions, or variables allowed here.")
34+
@SkipForDialect( dialectClass = InformixDialect.class,
35+
reason = "No 'current_timestamp' function on Informix (test passes with 'current')")
3436
public class SqlGeneratedTest {
3537

3638
@Test

hibernate-core/src/test/java/org/hibernate/orm/test/onetoone/singletable/SingleTableOneToOneTest.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import java.util.List;
88

9+
import org.hibernate.community.dialect.InformixDialect;
910
import org.hibernate.dialect.SybaseDialect;
1011
import org.hibernate.exception.ConstraintViolationException;
1112

@@ -55,7 +56,10 @@ public void tearDown(SessionFactoryScope scope) {
5556
}
5657

5758
@Test
58-
@SkipForDialect(dialectClass = SybaseDialect.class, matchSubTypes = true, reason = "Sybase ignores unique constraints on nullable columns")
59+
@SkipForDialect(dialectClass = SybaseDialect.class, matchSubTypes = true,
60+
reason = "SybaseDialect ignores unique constraints on nullable columns")
61+
@SkipForDialect(dialectClass = InformixDialect.class, matchSubTypes = true,
62+
reason = "InformixDialect ignores unique constraints on nullable columns")
5963
public void testMultipleRelationshipsOnSingleTableInheritanceWronglyMappedAsOneToOne(SessionFactoryScope scope) {
6064
assertThrows(
6165
ConstraintViolationException.class,

hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/CountExpressionTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@
1515
import jakarta.persistence.MapKeyColumn;
1616
import jakarta.persistence.OneToMany;
1717

18+
import org.hibernate.community.dialect.InformixDialect;
1819
import org.hibernate.testing.orm.junit.JiraKey;
1920
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
21+
import org.hibernate.testing.orm.junit.SkipForDialect;
2022
import org.junit.Test;
2123

2224
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
@@ -87,6 +89,8 @@ public void testCountDistinctExpression() {
8789

8890
@Test
8991
@JiraKey(value = "HHH-11042")
92+
@SkipForDialect(dialectClass = InformixDialect.class,
93+
reason = "Informix allows only one column in count(distinct)")
9094
public void testCountDistinctTuple() {
9195
doInHibernate( this::sessionFactory, session -> {
9296
List results = session.createQuery(
@@ -108,6 +112,8 @@ public void testCountDistinctTuple() {
108112

109113
@Test
110114
@JiraKey(value = "HHH-11042")
115+
@SkipForDialect(dialectClass = InformixDialect.class,
116+
reason = "Informix allows only one column in count(distinct)")
111117
public void testCountDistinctTupleSanity() {
112118
doInHibernate( this::sessionFactory, session -> {
113119
// A simple concatenation of tuple arguments would produce a distinct count of 1 in this case

hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FunctionTests.java

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,7 +1024,7 @@ public void testCastFunction(SessionFactoryScope scope) {
10241024
assertThat( session.createQuery("select cast('1911-10-09 12:13:14.123' as Timestamp)", Timestamp.class).getSingleResult(), instanceOf(Timestamp.class) );
10251025

10261026
assertThat( session.createQuery("select cast(date 1911-10-09 as String)", String.class).getSingleResult(), is("1911-10-09") );
1027-
assertThat( session.createQuery("select cast(time 12:13:14 as String)", String.class).getSingleResult(), anyOf( is("12:13:14"), is("12:13:14.0000"), is("12.13.14") ) );
1027+
assertThat( session.createQuery("select cast(time 12:13:14 as String)", String.class).getSingleResult(), anyOf( is("12:13:14"), is("12:13:14.0000"), is("12:13:14.000"), is("12.13.14") ) );
10281028
assertThat( session.createQuery("select cast(datetime 1911-10-09 12:13:14 as String)", String.class).getSingleResult(), anyOf( startsWith("1911-10-09 12:13:14"), startsWith("1911-10-09-12.13.14") ) );
10291029

10301030
assertThat( session.createQuery("select cast(local datetime as Instant)", Instant.class).getSingleResult(), instanceOf(Instant.class) );
@@ -1224,7 +1224,7 @@ public void testStrFunction(SessionFactoryScope scope) {
12241224
.list();
12251225
assertThat( session.createQuery("select str(69)", String.class).getSingleResult(), is("69") );
12261226
assertThat( session.createQuery("select str(date 1911-10-09)", String.class).getSingleResult(), is("1911-10-09") );
1227-
assertThat( session.createQuery("select str(time 12:13:14)", String.class).getSingleResult(), anyOf( is( "12:13:14"), is( "12:13:14.0000"), is( "12.13.14") ) );
1227+
assertThat( session.createQuery("select str(time 12:13:14)", String.class).getSingleResult(), anyOf( is( "12:13:14"), is( "12:13:14.0000"), is( "12:13:14.000"), is( "12.13.14") ) );
12281228
}
12291229
);
12301230
}
@@ -2078,11 +2078,6 @@ public void testExtractFunction(SessionFactoryScope scope) {
20782078
session.createQuery("select extract(day from e.theDate) from EntityOfBasics e", Integer.class)
20792079
.list();
20802080

2081-
session.createQuery("select extract(day of year from e.theDate) from EntityOfBasics e", Integer.class)
2082-
.list();
2083-
session.createQuery("select extract(day of month from e.theDate) from EntityOfBasics e", Integer.class)
2084-
.list();
2085-
20862081
session.createQuery("select extract(quarter from e.theDate) from EntityOfBasics e", Integer.class)
20872082
.list();
20882083

@@ -2113,11 +2108,6 @@ public void testExtractFunction(SessionFactoryScope scope) {
21132108
session.createQuery("select extract(time from local datetime), extract(date from local datetime) from EntityOfBasics e", Object[].class)
21142109
.list();
21152110

2116-
session.createQuery("select extract(week of month from current date) from EntityOfBasics e", Integer.class)
2117-
.list();
2118-
session.createQuery("select extract(week of year from current date) from EntityOfBasics e", Integer.class)
2119-
.list();
2120-
21212111
assertThat( session.createQuery("select extract(year from date 1974-03-25)", Integer.class).getSingleResult(), is(1974) );
21222112
assertThat( session.createQuery("select extract(month from date 1974-03-25)", Integer.class).getSingleResult(), is(3) );
21232113
assertThat( session.createQuery("select extract(day from date 1974-03-25)", Integer.class).getSingleResult(), is(25) );
@@ -2128,6 +2118,24 @@ public void testExtractFunction(SessionFactoryScope scope) {
21282118
);
21292119
}
21302120

2121+
@Test
2122+
public void testExtractFunctionDayOfWeekOf(SessionFactoryScope scope) {
2123+
scope.inTransaction(
2124+
session -> {
2125+
session.createQuery("select extract(day of year from e.theDate) from EntityOfBasics e", Integer.class)
2126+
.list();
2127+
session.createQuery("select extract(day of month from e.theDate) from EntityOfBasics e", Integer.class)
2128+
.list();
2129+
2130+
session.createQuery("select extract(week of month from current date) from EntityOfBasics e", Integer.class)
2131+
.list();
2132+
session.createQuery("select extract(week of year from current date) from EntityOfBasics e", Integer.class)
2133+
.list();
2134+
2135+
}
2136+
);
2137+
}
2138+
21312139
@Test
21322140
public void testExtractFunctionEpoch(SessionFactoryScope scope) {
21332141
scope.inTransaction(

0 commit comments

Comments
 (0)