HHH-10689 - Fix tests failing when switching to Oracle
This commit is contained in:
parent
412e553c99
commit
7d7aef7ecc
|
@ -496,7 +496,7 @@ public class IndexedCollectionTest extends BaseNonConfigCoreFunctionalTestCase {
|
|||
assertEquals( 1, atm.colorPerDate.size() );
|
||||
final Date date = atm.colorPerDate.keySet().iterator().next();
|
||||
final long diff = new Date( 1234567000 ).getTime() - date.getTime();
|
||||
assertTrue( "24h diff max", diff > 0 && diff < 24*60*60*1000 );
|
||||
assertTrue( "24h diff max", diff >= 0 && diff < 24*60*60*1000 );
|
||||
tx.rollback();
|
||||
s.close();
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ public class EagerIndexedCollectionTest extends BaseNonConfigCoreFunctionalTestC
|
|||
assertEquals( 1, atm.colorPerDate.size() );
|
||||
final Date date = atm.colorPerDate.keySet().iterator().next();
|
||||
final long diff = new Date( 1234567000 ).getTime() - date.getTime();
|
||||
assertTrue( "24h diff max", diff > 0 && diff < 24*60*60*1000 );
|
||||
assertTrue( "24h diff max", diff >= 0 && diff < 24*60*60*1000 );
|
||||
tx.rollback();
|
||||
s.close();
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ public class MapKeyAttributeConverterTest extends BaseNonConfigCoreFunctionalTes
|
|||
MapValue foundValue = found.enumDefaultType.get( EnumMapKey.VALUE_1 );
|
||||
assertEquals( EnumMapKey.VALUE_1, foundValue.enumDefault );
|
||||
|
||||
assertEquals( 0, findDatabaseValue( foundValue, "enumDefault" ) );
|
||||
assertEquals( 0, ( (Number) findDatabaseValue( foundValue, "enumDefault" ) ).intValue() );
|
||||
getSession().close();
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ public class MapKeyAttributeConverterTest extends BaseNonConfigCoreFunctionalTes
|
|||
MapValue foundValue = found.enumExplicitOrdinalType.get( EnumMapKey.VALUE_2 );
|
||||
assertEquals( EnumMapKey.VALUE_2, foundValue.enumExplicitOrdinal );
|
||||
|
||||
assertEquals( 1, findDatabaseValue( foundValue, "enumExplicitOrdinal" ) );
|
||||
assertEquals( 1, ((Number) findDatabaseValue( foundValue, "enumExplicitOrdinal" )).intValue() );
|
||||
getSession().close();
|
||||
}
|
||||
|
||||
|
@ -173,7 +173,7 @@ public class MapKeyAttributeConverterTest extends BaseNonConfigCoreFunctionalTes
|
|||
MapValue foundValue = found.enumImplicitOverrideOrdinalType.get( ImplicitEnumMapKey.VALUE_1 );
|
||||
assertEquals( ImplicitEnumMapKey.VALUE_1, foundValue.enumImplicitOverrideOrdinal );
|
||||
|
||||
assertEquals( 0, findDatabaseValue( foundValue, "enumImplicitOverrideOrdinal" ) );
|
||||
assertEquals( 0, ((Number) findDatabaseValue( foundValue, "enumImplicitOverrideOrdinal" )).intValue() );
|
||||
getSession().close();
|
||||
}
|
||||
|
||||
|
@ -238,7 +238,7 @@ public class MapKeyAttributeConverterTest extends BaseNonConfigCoreFunctionalTes
|
|||
@Table(name = "map_entity")
|
||||
public static class MapEntity {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@OneToMany(mappedBy = "mapEntity", cascade = CascadeType.ALL)
|
||||
|
@ -280,7 +280,7 @@ public class MapKeyAttributeConverterTest extends BaseNonConfigCoreFunctionalTes
|
|||
@Table(name = "map_value")
|
||||
public static class MapValue {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@GeneratedValue(strategy = GenerationType.AUTO)
|
||||
private Integer id;
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "map_entity_id")
|
||||
|
|
|
@ -85,7 +85,7 @@ public class InheritanceManyToManyForeignKeyTest extends BaseNonConfigCoreFuncti
|
|||
session.close();
|
||||
}
|
||||
|
||||
@Entity(name = "LocalDateEvent")
|
||||
@Entity(name = "LDE")
|
||||
public static class LocalDateEvent {
|
||||
|
||||
@Id
|
||||
|
@ -107,7 +107,7 @@ public class InheritanceManyToManyForeignKeyTest extends BaseNonConfigCoreFuncti
|
|||
}
|
||||
}
|
||||
|
||||
@Entity(name = "UserEvents")
|
||||
@Entity(name = "UE")
|
||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||
public static class UserEvents extends AbstractEventsEntityModel {
|
||||
|
||||
|
@ -117,7 +117,7 @@ public class InheritanceManyToManyForeignKeyTest extends BaseNonConfigCoreFuncti
|
|||
|
||||
}
|
||||
|
||||
@Entity(name = "ApplicationEvents")
|
||||
@Entity(name = "AE")
|
||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||
public static class ApplicationEvents extends AbstractEventsEntityModel {
|
||||
|
||||
|
|
|
@ -22,9 +22,9 @@ import org.hibernate.cfg.AvailableSettings;
|
|||
import org.hibernate.dialect.Dialect;
|
||||
import org.hibernate.dialect.H2Dialect;
|
||||
import org.hibernate.dialect.MySQL5Dialect;
|
||||
import org.hibernate.dialect.PostgreSQL81Dialect;
|
||||
import org.hibernate.dialect.PostgreSQL94Dialect;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.testing.RequiresDialect;
|
||||
import org.hibernate.tool.schema.Action;
|
||||
import org.hibernate.type.PostgresUUIDType;
|
||||
import org.hibernate.type.Type;
|
||||
|
@ -103,7 +103,7 @@ public class UUIDBasedIdInterpretationTest extends BaseUnitTestCase {
|
|||
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-10564")
|
||||
@SkipForDialect(PostgreSQL81Dialect.class)
|
||||
@RequiresDialect(H2Dialect.class)
|
||||
public void testBinaryRuntimeUsage() {
|
||||
StandardServiceRegistry ssr = buildStandardServiceRegistry( H2Dialect.class, true );
|
||||
try {
|
||||
|
|
|
@ -93,7 +93,10 @@ public class SchemaExportTest extends BaseUnitTestCase {
|
|||
|
||||
// drop before create again (this time drops the tables before re-creating)
|
||||
schemaExport.execute( EnumSet.of( TargetType.DATABASE ), SchemaExport.Action.BOTH, metadata );
|
||||
assertEquals( 0, schemaExport.getExceptions().size() );
|
||||
int exceptionCount = schemaExport.getExceptions().size();
|
||||
if ( doesDialectSupportDropTableIfExist() ) {
|
||||
assertEquals( 0, exceptionCount);
|
||||
}
|
||||
|
||||
// drop tables
|
||||
schemaExport.execute( EnumSet.of( TargetType.DATABASE ), SchemaExport.Action.DROP, metadata );
|
||||
|
|
|
@ -14,6 +14,7 @@ import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
|||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.cfg.Environment;
|
||||
import org.hibernate.dialect.H2Dialect;
|
||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||
import org.hibernate.tool.hbm2ddl.SchemaUpdate;
|
||||
import org.hibernate.tool.schema.TargetType;
|
||||
|
||||
|
@ -27,7 +28,7 @@ import org.junit.Test;
|
|||
*/
|
||||
@TestForIssue(jiraKey = "HHH-10158")
|
||||
@RequiresDialect( H2Dialect.class )
|
||||
public class SchemaUpdateFormatterTest {
|
||||
public class SchemaUpdateFormatterTest extends BaseUnitTestCase {
|
||||
|
||||
private static final String AFTER_FORMAT =
|
||||
"\n\\s+create table test_entity \\(\n" +
|
||||
|
|
|
@ -23,6 +23,8 @@ import org.hibernate.cfg.AvailableSettings;
|
|||
import org.hibernate.engine.config.spi.ConfigurationService;
|
||||
import org.hibernate.engine.jdbc.env.spi.JdbcEnvironment;
|
||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||
import org.hibernate.testing.DialectChecks;
|
||||
import org.hibernate.testing.RequiresDialectFeature;
|
||||
import org.hibernate.tool.hbm2ddl.SchemaExport;
|
||||
import org.hibernate.tool.hbm2ddl.SchemaUpdate;
|
||||
import org.hibernate.tool.schema.SourceType;
|
||||
|
@ -55,6 +57,7 @@ import static org.junit.Assert.assertThat;
|
|||
* @author Andrea Boriero
|
||||
*/
|
||||
|
||||
@RequiresDialectFeature( value = DialectChecks.SupportSchemaCreation.class)
|
||||
public class CrossSchemaForeignKeyGenerationTest extends BaseUnitTestCase {
|
||||
private File output;
|
||||
private StandardServiceRegistry ssr;
|
||||
|
|
|
@ -12,6 +12,9 @@ import org.hibernate.boot.MetadataSources;
|
|||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.testing.DialectChecks;
|
||||
import org.hibernate.testing.RequiresDialectFeature;
|
||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||
import org.hibernate.tool.hbm2ddl.SchemaExport;
|
||||
import org.hibernate.tool.hbm2ddl.SchemaUpdate;
|
||||
import org.hibernate.tool.schema.TargetType;
|
||||
|
@ -21,7 +24,8 @@ import org.junit.Test;
|
|||
/**
|
||||
* @author Andrea Boriero
|
||||
*/
|
||||
public class InheritanceSchemaUpdateTest {
|
||||
@RequiresDialectFeature( value = DialectChecks.SupportsIdentityColumns.class)
|
||||
public class InheritanceSchemaUpdateTest extends BaseUnitTestCase {
|
||||
|
||||
@Test
|
||||
public void testBidirectionalOneToManyReferencingRootEntity() throws Exception {
|
||||
|
|
|
@ -23,4 +23,5 @@ hibernate.cache.region.factory_class org.hibernate.testing.cache.CachingRegionFa
|
|||
|
||||
javax.persistence.validation.mode=NONE
|
||||
hibernate.service.allow_crawling=false
|
||||
hibernate.session.events.log=true
|
||||
hibernate.session.events.log=true
|
||||
hibernate.hql.bulk_id_strategy.global_temporary.drop_tables=true
|
||||
|
|
|
@ -29,6 +29,8 @@ import org.hibernate.jpa.AvailableSettings;
|
|||
import org.hibernate.jpa.QueryHints;
|
||||
import org.hibernate.jpa.internal.QueryImpl;
|
||||
import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase;
|
||||
import org.hibernate.testing.DialectChecks;
|
||||
import org.hibernate.testing.RequiresDialectFeature;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -334,6 +336,7 @@ public class QueryLockingTest extends BaseEntityManagerFunctionalTestCase {
|
|||
* lock some entities via a query and check the resulting lock mode type via EntityManager
|
||||
*/
|
||||
@Test
|
||||
@RequiresDialectFeature( value = DialectChecks.DoesNotSupportFollowOnLocking.class)
|
||||
public void testEntityLockModeStateAfterQueryLocking() {
|
||||
// Create some test data
|
||||
EntityManager em = getOrCreateEntityManager();
|
||||
|
|
|
@ -189,4 +189,10 @@ abstract public class DialectChecks {
|
|||
return dialect.supportsRowValueConstructorSyntax() == false;
|
||||
}
|
||||
}
|
||||
|
||||
public static class DoesNotSupportFollowOnLocking implements DialectCheck {
|
||||
public boolean isMatch(Dialect dialect) {
|
||||
return !dialect.useFollowOnLocking();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue