Informix tests fixes

This commit is contained in:
Vladimír Kuruc 2024-09-03 11:13:38 +02:00 committed by Christian Beikov
parent 7ffd991b80
commit e2a1434017
19 changed files with 55 additions and 8 deletions

View File

@ -908,8 +908,11 @@ informix() {
}
informix_14_10() {
temp_dir=$(mktemp -d)
echo "ALLOW_NEWLINE 1" >$temp_dir/onconfig.mod
chmod 777 -R $temp_dir
$PRIVILEGED_CLI $CONTAINER_CLI rm -f informix || true
$PRIVILEGED_CLI $CONTAINER_CLI run --name informix --privileged -p 9088:9088 -e LICENSE=accept -e GL_USEGLU=1 -d ${DB_IMAGE_INFORMIX_14_10:-icr.io/informix/informix-developer-database:14.10.FC9W1DE}
$PRIVILEGED_CLI $CONTAINER_CLI run --name informix --privileged -p 9088:9088 -v $temp_dir:/opt/ibm/config -e LICENSE=accept -e GL_USEGLU=1 -d ${DB_IMAGE_INFORMIX_14_10:-icr.io/informix/informix-developer-database:14.10.FC9W1DE}
echo "Starting Informix. This can take a few minutes"
# Give the container some time to start
OUTPUT=

View File

@ -295,7 +295,7 @@ ext {
'jdbc.driver': 'com.informix.jdbc.IfxDriver',
'jdbc.user' : 'informix',
'jdbc.pass' : 'in4mix',
'jdbc.url' : 'jdbc:informix-sqli://' + dbHost + ':9088/dev:INFORMIXSERVER=informix;user=informix;password=in4mix;DELIMIDENT=Y;DB_LOCALE=en_US.utf8',
'jdbc.url' : 'jdbc:informix-sqli://' + dbHost + ':9088/dev:INFORMIXSERVER=informix;user=informix;password=in4mix;DBDATE=Y4MD-;DELIMIDENT=Y;DB_LOCALE=en_US.utf8',
'jdbc.datasource' : 'com.informix.jdbc.IfxDriver',
// 'jdbc.datasource' : 'com.informix.jdbcx.IfxDataSource',
'connection.init_sql' : ''

View File

@ -19,6 +19,7 @@ import org.hibernate.annotations.OptimisticLocking;
import org.hibernate.annotations.ParamDef;
import org.hibernate.annotations.SQLRestriction;
import jakarta.persistence.Column;
import jakarta.persistence.Convert;
import jakarta.persistence.ElementCollection;
import jakarta.persistence.Entity;
@ -54,6 +55,7 @@ public class Forest {
@OptimisticLock(excluded=true)
@JdbcTypeCode( Types.LONGVARCHAR )
@Column(length = 10000)
public String getLongDescription() {
return longDescription;
}

View File

@ -5,6 +5,7 @@
package org.hibernate.orm.test.annotations.uniqueconstraint;
import org.hibernate.JDBCException;
import org.hibernate.community.dialect.InformixDialect;
import org.hibernate.dialect.SybaseDialect;
import org.hibernate.testing.orm.junit.DomainModel;
@ -25,6 +26,9 @@ import static org.junit.Assert.fail;
*/
@DomainModel( annotatedClasses = { Room.class, Building.class, House.class } )
@SessionFactory
@SkipForDialect( dialectClass = InformixDialect.class,
matchSubTypes = true,
reason = "Informix does not properly support unique constraints on nullable columns" )
@SkipForDialect( dialectClass = SybaseDialect.class,
matchSubTypes = true,
reason = "Sybase does not properly support unique constraints on nullable columns" )

View File

@ -23,6 +23,7 @@ import org.hibernate.CacheMode;
import org.hibernate.ScrollableResults;
import org.hibernate.Session;
import org.hibernate.community.dialect.FirebirdDialect;
import org.hibernate.community.dialect.InformixDialect;
import org.hibernate.dialect.CockroachDialect;
import org.hibernate.community.dialect.DerbyDialect;
import org.hibernate.dialect.H2Dialect;
@ -1521,6 +1522,7 @@ public class HQLTest extends BaseEntityManagerFunctionalTestCase {
@SkipForDialect(dialectClass = DerbyDialect.class)
@SkipForDialect(dialectClass = SybaseASEDialect.class)
@SkipForDialect(dialectClass = FirebirdDialect.class, reason = "order by not supported in list")
@SkipForDialect(dialectClass = InformixDialect.class)
public void test_hql_aggregate_functions_within_group_example() {
doInJPA(this::entityManagerFactory, entityManager -> {
//tag::hql-aggregate-functions-within-group-example[]

View File

@ -11,6 +11,7 @@ import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Table;
import org.hibernate.community.dialect.InformixDialect;
import org.hibernate.dialect.MySQLDialect;
import org.hibernate.dialect.OracleDialect;
import org.hibernate.query.Query;
@ -33,6 +34,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
*/
@SkipForDialect(dialectClass = MySQLDialect.class, majorVersion = 5, reason = "BLOB/TEXT column 'id' used in key specification without a key length")
@SkipForDialect(dialectClass = OracleDialect.class, matchSubTypes = true, reason = "ORA-02329: column of datatype LOB cannot be unique or a primary key")
@SkipForDialect(dialectClass = InformixDialect.class, reason = "Informix does not support unique / primary constraints on binary columns")
@DomainModel(
annotatedClasses = PrimitiveByteArrayIdTest.DemoEntity.class
)

View File

@ -8,6 +8,7 @@ import java.sql.Types;
import java.util.UUID;
import org.hibernate.annotations.JdbcTypeCode;
import org.hibernate.community.dialect.InformixDialect;
import org.hibernate.dialect.PostgreSQLDialect;
import org.hibernate.dialect.SybaseDialect;
import org.hibernate.metamodel.MappingMetamodel;
@ -37,6 +38,7 @@ import static org.hamcrest.MatcherAssert.assertThat;
@SkipForDialect(dialectClass = PostgreSQLDialect.class, reason = "Postgres has its own UUID type")
@SkipForDialect( dialectClass = SybaseDialect.class, matchSubTypes = true,
reason = "Skipped for Sybase to avoid problems with UUIDs potentially ending with a trailing 0 byte")
@SkipForDialect(dialectClass = InformixDialect.class, reason = "Informix does not support unique / primary constraints on binary columns")
public class UUIDBinaryTest {
private static class UUIDPair {

View File

@ -4,6 +4,7 @@
*/
package org.hibernate.orm.test.inheritance;
import org.hibernate.community.dialect.InformixDialect;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.FunctionalDependencyAnalysisSupport;
import org.hibernate.metamodel.mapping.EntityMappingType;
@ -14,6 +15,7 @@ import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.Jira;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.hibernate.testing.orm.junit.SkipForDialect;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
@ -84,6 +86,7 @@ public class InheritanceQueryGroupByTest {
}
@Test
@SkipForDialect( dialectClass = InformixDialect.class , reason = "Informix does not support case expressions within the GROUP BY clause")
public void testGroupByJoined(SessionFactoryScope scope) {
testGroupBy( scope, "joinedParent", JoinedParent.class, "joined_child_one", 1 );
}
@ -160,6 +163,7 @@ public class InheritanceQueryGroupByTest {
}
@Test
@SkipForDialect( dialectClass = InformixDialect.class , reason = "Informix does not support case expressions within the GROUP BY clause")
public void testGroupByAndOrderByJoined(SessionFactoryScope scope) {
testGroupByAndOrderBy( scope, "joinedParent", JoinedParent.class, "joined_child_one", 1 );
}

View File

@ -18,6 +18,8 @@ import jakarta.persistence.criteria.Root;
import jakarta.persistence.criteria.SetJoin;
import jakarta.persistence.metamodel.EntityType;
import jakarta.persistence.metamodel.Metamodel;
import org.hibernate.community.dialect.InformixDialect;
import org.hibernate.dialect.CockroachDialect;
import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase;
import org.hibernate.orm.test.jpa.metamodel.Address;
@ -36,8 +38,8 @@ import org.hibernate.orm.test.jpa.metamodel.Spouse;
import org.hibernate.query.sqm.tree.predicate.SqmComparisonPredicate;
import org.hibernate.testing.FailureExpected;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.orm.junit.JiraKey;
import org.hibernate.testing.orm.junit.SkipForDialect;
import org.junit.Test;
import static org.hibernate.testing.transaction.TransactionUtil.doInJPA;
@ -227,7 +229,7 @@ public class QueryBuilderTest extends BaseEntityManagerFunctionalTestCase {
}
@Test
@SkipForDialect(value = CockroachDialect.class, strictMatching = true)
@SkipForDialect(dialectClass = CockroachDialect.class)
public void testDateTimeFunctions() {
EntityManager em = getOrCreateEntityManager();
em.getTransaction().begin();
@ -253,6 +255,7 @@ public class QueryBuilderTest extends BaseEntityManagerFunctionalTestCase {
}
@Test
@SkipForDialect(dialectClass = InformixDialect.class, majorVersion = 11, minorVersion = 70, reason = "Informix does not support count literals")
public void testFunctionDialectFunctions() {
EntityManager em = getOrCreateEntityManager();
em.getTransaction().begin();

View File

@ -5,6 +5,7 @@
package org.hibernate.orm.test.length;
import org.hibernate.Length;
import org.hibernate.community.dialect.InformixDialect;
import org.hibernate.dialect.Dialect;
import org.hibernate.metamodel.mapping.BasicValuedMapping;
import org.hibernate.type.SqlTypes;
@ -12,12 +13,14 @@ import org.hibernate.type.SqlTypes;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.hibernate.testing.orm.junit.SkipForDialect;
import org.junit.jupiter.api.Test;
import static org.junit.Assert.assertEquals;
@SessionFactory
@DomainModel(annotatedClasses = {WithLongStrings.class,WithLongTypeStrings.class})
@SkipForDialect(dialectClass = InformixDialect.class, reason = "Informix rowsize to exceed the allowable limit (32767).")
public class LengthTest {
@Test
public void testLength(SessionFactoryScope scope) {

View File

@ -10,6 +10,7 @@ import jakarta.persistence.Id;
import org.hibernate.annotations.GeneratedColumn;
import org.hibernate.community.dialect.AltibaseDialect;
import org.hibernate.community.dialect.DerbyDialect;
import org.hibernate.community.dialect.InformixDialect;
import org.hibernate.dialect.H2Dialect;
import org.hibernate.dialect.HSQLDialect;
import org.hibernate.dialect.PostgreSQLDialect;
@ -36,6 +37,7 @@ import static org.junit.Assert.assertEquals;
@SkipForDialect(dialectClass = SybaseASEDialect.class)
@SkipForDialect(dialectClass = PostgreSQLDialect.class, majorVersion = 11, matchSubTypes = true) // 'generated always' was added in 12
@SkipForDialect(dialectClass = AltibaseDialect.class, reason = "generated always is not supported in Altibase")
@SkipForDialect(dialectClass = InformixDialect.class)
public class GeneratedAlwaysTest {
@Test

View File

@ -260,11 +260,11 @@ public class CteTests {
final QueryImplementor<String> query = session.createQuery(
"select c.name.first from Contact c where c.id in (" +
"with contacts as (" +
"with cte as (" +
"select c.id id, c.name.first firstName from Contact c " +
"where c.id in (1,2)" +
") " +
"select c.id from contacts c" +
"select c.id from cte c" +
")",
String.class
);

View File

@ -10,6 +10,7 @@ import java.util.List;
import java.util.Map;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.community.dialect.InformixDialect;
import org.hibernate.dialect.AbstractTransactSQLDialect;
import org.hibernate.dialect.OracleDialect;
import org.hibernate.dialect.SybaseDialect;
@ -78,6 +79,9 @@ public class QueryTimeOutTest extends BaseNonConfigCoreFunctionalTestCase {
else if ( DialectContext.getDialect() instanceof AbstractTransactSQLDialect ) {
baseQuery = "update ae1_0 set name=? from AnEntity ae1_0";
}
else if (DialectContext.getDialect() instanceof InformixDialect ) {
baseQuery = "update AnEntity set name=?";
}
else {
baseQuery = "update AnEntity ae1_0 set name=?";
}

View File

@ -603,6 +603,7 @@ public class FunctionTests {
@Test
@SkipForDialect(dialectClass = DerbyDialect.class, reason = "Derby doesn't support any form of date truncation")
@SkipForDialect(dialectClass = OracleDialect.class, reason = "See HHH-16442, Oracle trunc() throws away the timezone")
@SkipForDialect(dialectClass = InformixDialect.class, reason = "Informix doesn't support any form of date truncation")
public void testDateTruncWithOffsetFunction(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
@ -1105,6 +1106,7 @@ public class FunctionTests {
@SkipForDialect(dialectClass = OracleDialect.class, reason = "Oracle treats the cast value as a hexadecimal literal")
@SkipForDialect(dialectClass = HSQLDialect.class, reason = "HSQL treats the cast value as a hexadecimal literal")
@SkipForDialect(dialectClass = AltibaseDialect.class, reason = "Altibase doesn't support casting varchar to binary")
@SkipForDialect(dialectClass = InformixDialect.class, reason = "Informix doesn't support casting varchar to byte")
public void testCastFunctionBinary(SessionFactoryScope scope) {
scope.inTransaction(
session -> {

View File

@ -11,6 +11,7 @@ import org.hibernate.testing.orm.junit.JiraKey;
import org.hibernate.testing.orm.junit.ServiceRegistry;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.hibernate.testing.orm.junit.SkipForDialect;
import org.junit.jupiter.api.Test;
import java.math.BigDecimal;
@ -23,6 +24,7 @@ import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import org.hibernate.community.dialect.InformixDialect;
import org.hibernate.query.spi.QueryImplementor;
import org.hibernate.type.descriptor.java.PrimitiveByteArrayJavaType;
@ -43,6 +45,7 @@ import static org.hamcrest.Matchers.is;
public class LiteralTests {
@Test
@SkipForDialect(dialectClass = InformixDialect.class, reason = "Informix does not support binary literals")
public void testBinaryLiteral(SessionFactoryScope scope) {
scope.inTransaction(
session -> {

View File

@ -15,6 +15,7 @@ import jakarta.persistence.Id;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.community.dialect.AltibaseDialect;
import org.hibernate.community.dialect.FirebirdDialect;
import org.hibernate.community.dialect.InformixDialect;
import org.hibernate.dialect.DB2Dialect;
import org.hibernate.community.dialect.DerbyDialect;
import org.hibernate.orm.test.jpa.BaseEntityManagerFunctionalTestCase;
@ -29,6 +30,7 @@ import org.junit.Test;
@SkipForDialect(value = DerbyDialect.class, comment = "Derby is far more resistant to the reserved keyword usage.")
@SkipForDialect(value = FirebirdDialect.class, comment = "FirebirdDialect has autoQuoteKeywords enabled, so it is far more resistant to the reserved keyword usage.")
@SkipForDialect(value = AltibaseDialect.class, comment = "AltibaseDialect has autoQuoteKeywords enabled, so it is far more resistant to the reserved keyword usage.")
@SkipForDialect(value = InformixDialect.class, comment = "Informix is far more resistant to the reserved keyword usage.")
public class SchemaMigratorHaltOnErrorTest extends BaseEntityManagerFunctionalTestCase {
@Override

View File

@ -20,6 +20,7 @@ import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.boot.spi.MetadataImplementor;
import org.hibernate.community.dialect.AltibaseDialect;
import org.hibernate.community.dialect.FirebirdDialect;
import org.hibernate.community.dialect.InformixDialect;
import org.hibernate.dialect.DB2Dialect;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.junit4.CustomRunner;
@ -42,6 +43,7 @@ import org.junit.runner.RunWith;
@SkipForDialect(value = DerbyDialect.class, comment = "Derby is far more resistant to the reserved keyword usage.")
@SkipForDialect(value = FirebirdDialect.class, comment = "FirebirdDialect has autoQuoteKeywords enabled, so it is far more resistant to the reserved keyword usage.")
@SkipForDialect(value = AltibaseDialect.class, comment = "AltibaseDialect has autoQuoteKeywords enabled, so it is far more resistant to the reserved keyword usage.")
@SkipForDialect(value = InformixDialect.class, comment = "Informix is far more resistant to the reserved keyword usage.")
@RunWith(CustomRunner.class)
public class SchemaUpdateHaltOnErrorTest {

View File

@ -9,10 +9,13 @@ import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.hibernate.community.dialect.InformixDialect;
import org.hibernate.testing.orm.junit.JiraKey;
import org.hibernate.testing.orm.junit.DomainModel;
import org.hibernate.testing.orm.junit.SessionFactory;
import org.hibernate.testing.orm.junit.SessionFactoryScope;
import org.hibernate.testing.orm.junit.SkipForDialect;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.Test;
@ -36,6 +39,7 @@ import static org.hibernate.testing.util.uuid.SafeRandomUUIDGenerator.safeRandom
)
@SessionFactory
@JiraKey(value = "HHH-15417")
@SkipForDialect(dialectClass = InformixDialect.class, reason = "Informix does not support unique / primary constraints on binary columns")
public class UUIDTypeConverterTest {
@AfterEach

View File

@ -52,6 +52,7 @@ import org.hibernate.boot.spi.NaturalIdUniqueKeyBinder;
import org.hibernate.boot.spi.PropertyData;
import org.hibernate.boot.spi.SecondPass;
import org.hibernate.community.dialect.FirebirdDialect;
import org.hibernate.community.dialect.InformixDialect;
import org.hibernate.dialect.HANADialect;
import org.hibernate.dialect.CockroachDialect;
import org.hibernate.dialect.DB2Dialect;
@ -386,8 +387,9 @@ abstract public class DialectFeatureChecks {
public static class SupportsRepeat implements DialectFeatureCheck {
public boolean apply(Dialect dialect) {
dialect = DialectDelegateWrapper.extractRealDialect( dialect );
// Derby doesn't support the `REPLACE` function
return !( dialect instanceof DerbyDialect );
// Derby doesn't support the `REPEAT` function
return !( dialect instanceof DerbyDialect
|| dialect instanceof InformixDialect );
}
}
@ -553,6 +555,7 @@ abstract public class DialectFeatureChecks {
|| dialect instanceof DerbyDialect
|| dialect instanceof FirebirdDialect
|| dialect instanceof DB2Dialect && ( (DB2Dialect) dialect ).getDB2Version().isBefore( 11 ) )
|| dialect instanceof InformixDialect
|| dialect instanceof MariaDBDialect;
}
}