Skip to content

Commit

Permalink
Informix tests fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
VladoKuruc committed Sep 20, 2024
1 parent 052552f commit 449fa85
Show file tree
Hide file tree
Showing 19 changed files with 55 additions and 8 deletions.
5 changes: 4 additions & 1 deletion docker_db.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion gradle/databases.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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' : ''
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
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;
Expand Down Expand Up @@ -54,6 +55,7 @@ public class Forest {

@OptimisticLock(excluded=true)
@JdbcTypeCode( Types.LONGVARCHAR )
@Column(length = 10000)
public String getLongDescription() {
return longDescription;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -25,6 +26,9 @@
*/
@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" )
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
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;
Expand Down Expand Up @@ -1521,6 +1522,7 @@ public void test_hql_aggregate_functions_filter_example() {
@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[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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;
Expand All @@ -33,6 +34,7 @@
*/
@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
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
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;
Expand Down Expand Up @@ -37,6 +38,7 @@
@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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -14,6 +15,7 @@
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;
Expand Down Expand Up @@ -84,6 +86,7 @@ public void testGroupBySingleTable(SessionFactoryScope scope) {
}

@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 );
}
Expand Down Expand Up @@ -160,6 +163,7 @@ public void testGroupByAndOrderBySingleTable(SessionFactoryScope scope) {
}

@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 );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
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;
Expand All @@ -36,8 +38,8 @@
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;
Expand Down Expand Up @@ -227,7 +229,7 @@ public void testMultiselectWithPredicates() {
}

@Test
@SkipForDialect(value = CockroachDialect.class, strictMatching = true)
@SkipForDialect(dialectClass = CockroachDialect.class)
public void testDateTimeFunctions() {
EntityManager em = getOrCreateEntityManager();
em.getTransaction().begin();
Expand All @@ -253,6 +255,7 @@ public void testDateTimeFunctions() {
}

@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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,22 @@
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;

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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
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;
Expand All @@ -36,6 +37,7 @@
@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,11 +260,11 @@ public void testInSubquery(SessionFactoryScope scope) {

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
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
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;
Expand Down Expand Up @@ -78,6 +79,9 @@ else if ( DialectContext.getDialect() instanceof SybaseDialect ) {
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=?";
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,7 @@ public void testDateTruncFunction(SessionFactoryScope scope) {
@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 -> {
Expand Down Expand Up @@ -1105,6 +1106,7 @@ public void testCastDoubleToString(SessionFactoryScope scope) {
@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 -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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;
Expand All @@ -23,6 +24,7 @@
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;

Expand All @@ -43,6 +45,7 @@
public class LiteralTests {

@Test
@SkipForDialect(dialectClass = InformixDialect.class, reason = "Informix does not support binary literals")
public void testBinaryLiteral(SessionFactoryScope scope) {
scope.inTransaction(
session -> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
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;
Expand All @@ -29,6 +30,7 @@
@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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
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;
Expand All @@ -42,6 +43,7 @@
@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 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,13 @@
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;

Expand All @@ -36,6 +39,7 @@
)
@SessionFactory
@JiraKey(value = "HHH-15417")
@SkipForDialect(dialectClass = InformixDialect.class, reason = "Informix does not support unique / primary constraints on binary columns")
public class UUIDTypeConverterTest {

@AfterEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
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;
Expand Down Expand Up @@ -386,8 +387,9 @@ public boolean apply(Dialect dialect) {
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 );
}
}

Expand Down Expand Up @@ -553,6 +555,7 @@ public boolean apply(Dialect dialect) {
|| dialect instanceof DerbyDialect
|| dialect instanceof FirebirdDialect
|| dialect instanceof DB2Dialect && ( (DB2Dialect) dialect ).getDB2Version().isBefore( 11 ) )
|| dialect instanceof InformixDialect
|| dialect instanceof MariaDBDialect;
}
}
Expand Down

0 comments on commit 449fa85

Please sign in to comment.