HHH-10693 - Fix PostgreSQL failing tests
This commit is contained in:
parent
8d86770dcc
commit
f201d2829e
|
@ -19,8 +19,10 @@ import org.hibernate.boot.MetadataSources;
|
|||
import org.hibernate.boot.internal.MetadataImpl;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
import org.hibernate.dialect.PostgreSQL81Dialect;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
|
||||
import org.hibernate.testing.SkipForDialect;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||
import org.junit.Test;
|
||||
|
@ -32,6 +34,7 @@ import static org.junit.Assert.assertEquals;
|
|||
*
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
//@SkipForDialect(value = PostgreSQL81Dialect.class, comment = "Postgres does not support ")
|
||||
public class AndNationalizedTests extends BaseUnitTestCase {
|
||||
@Test
|
||||
@TestForIssue( jiraKey = "HHH-9599")
|
||||
|
@ -42,10 +45,18 @@ public class AndNationalizedTests extends BaseUnitTestCase {
|
|||
( (MetadataImpl) metadata ).validate();
|
||||
|
||||
final PersistentClass entityBinding = metadata.getEntityBinding( TestEntity.class.getName() );
|
||||
assertEquals(
|
||||
Types.NVARCHAR,
|
||||
entityBinding.getProperty( "name" ).getType().sqlTypes( metadata )[0]
|
||||
);
|
||||
if(metadata.getDatabase().getDialect() instanceof PostgreSQL81Dialect){
|
||||
// See issue HHH-10693
|
||||
assertEquals(
|
||||
Types.VARCHAR,
|
||||
entityBinding.getProperty( "name" ).getType().sqlTypes( metadata )[0]
|
||||
);
|
||||
}else {
|
||||
assertEquals(
|
||||
Types.NVARCHAR,
|
||||
entityBinding.getProperty( "name" ).getType().sqlTypes( metadata )[0]
|
||||
);
|
||||
}
|
||||
}
|
||||
finally {
|
||||
StandardServiceRegistryBuilder.destroy( ssr );
|
||||
|
|
|
@ -17,13 +17,18 @@ import org.hibernate.boot.Metadata;
|
|||
import org.hibernate.boot.MetadataSources;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
import org.hibernate.dialect.PostgreSQL81Dialect;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.mapping.Property;
|
||||
import org.hibernate.type.CharacterArrayType;
|
||||
import org.hibernate.type.CharacterNCharType;
|
||||
import org.hibernate.type.CharacterType;
|
||||
import org.hibernate.type.MaterializedClobType;
|
||||
import org.hibernate.type.MaterializedNClobType;
|
||||
import org.hibernate.type.NClobType;
|
||||
import org.hibernate.type.NTextType;
|
||||
import org.hibernate.type.StringNVarcharType;
|
||||
import org.hibernate.type.StringType;
|
||||
|
||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||
import org.junit.Test;
|
||||
|
@ -76,11 +81,20 @@ public class SimpleNationalizedTest extends BaseUnitTestCase {
|
|||
assertNotNull( pc );
|
||||
|
||||
Property prop = pc.getProperty( "nvarcharAtt" );
|
||||
assertSame( StringNVarcharType.INSTANCE, prop.getType() );
|
||||
if(metadata.getDatabase().getDialect() instanceof PostgreSQL81Dialect ){
|
||||
// See issue HHH-10693
|
||||
assertSame( StringType.INSTANCE, prop.getType() );
|
||||
}else{
|
||||
assertSame( StringNVarcharType.INSTANCE, prop.getType() );
|
||||
}
|
||||
|
||||
prop = pc.getProperty( "materializedNclobAtt" );
|
||||
assertSame( MaterializedNClobType.INSTANCE, prop.getType() );
|
||||
|
||||
if(metadata.getDatabase().getDialect() instanceof PostgreSQL81Dialect ){
|
||||
// See issue HHH-10693
|
||||
assertSame( MaterializedClobType.INSTANCE, prop.getType() );
|
||||
}else {
|
||||
assertSame( MaterializedNClobType.INSTANCE, prop.getType() );
|
||||
}
|
||||
prop = pc.getProperty( "nclobAtt" );
|
||||
assertSame( NClobType.INSTANCE, prop.getType() );
|
||||
|
||||
|
@ -88,10 +102,21 @@ public class SimpleNationalizedTest extends BaseUnitTestCase {
|
|||
assertSame( NTextType.INSTANCE, prop.getType() );
|
||||
|
||||
prop = pc.getProperty( "ncharArrAtt" );
|
||||
assertSame( StringNVarcharType.INSTANCE, prop.getType() );
|
||||
if(metadata.getDatabase().getDialect() instanceof PostgreSQL81Dialect ){
|
||||
// See issue HHH-10693
|
||||
assertSame( CharacterArrayType.INSTANCE, prop.getType() );
|
||||
}else {
|
||||
assertSame( StringNVarcharType.INSTANCE, prop.getType() );
|
||||
}
|
||||
|
||||
prop = pc.getProperty( "ncharacterAtt" );
|
||||
assertSame( CharacterNCharType.INSTANCE, prop.getType() );
|
||||
if ( metadata.getDatabase().getDialect() instanceof PostgreSQL81Dialect ) {
|
||||
// See issue HHH-10693
|
||||
assertSame( CharacterType.INSTANCE, prop.getType() );
|
||||
}
|
||||
else {
|
||||
assertSame( CharacterNCharType.INSTANCE, prop.getType() );
|
||||
}
|
||||
}
|
||||
finally {
|
||||
StandardServiceRegistryBuilder.destroy( ssr );
|
||||
|
|
|
@ -16,9 +16,11 @@ import org.hibernate.boot.MetadataSources;
|
|||
import org.hibernate.boot.registry.StandardServiceRegistry;
|
||||
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.hibernate.dialect.PostgreSQL81Dialect;
|
||||
import org.hibernate.mapping.PersistentClass;
|
||||
import org.hibernate.mapping.Property;
|
||||
import org.hibernate.type.StringNVarcharType;
|
||||
import org.hibernate.type.StringType;
|
||||
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.junit4.BaseUnitTestCase;
|
||||
|
@ -47,7 +49,12 @@ public class UseNationalizedCharDataSettingTest extends BaseUnitTestCase {
|
|||
final Metadata metadata = ms.buildMetadata();
|
||||
final PersistentClass pc = metadata.getEntityBinding( NationalizedBySettingEntity.class.getName() );
|
||||
final Property nameAttribute = pc.getProperty( "name" );
|
||||
assertSame( StringNVarcharType.INSTANCE, nameAttribute.getType() );
|
||||
if(metadata.getDatabase().getDialect() instanceof PostgreSQL81Dialect ){
|
||||
// See issue HHH-10693
|
||||
assertSame( StringType.INSTANCE, nameAttribute.getType() );
|
||||
}else {
|
||||
assertSame( StringNVarcharType.INSTANCE, nameAttribute.getType() );
|
||||
}
|
||||
|
||||
}
|
||||
finally {
|
||||
|
|
Loading…
Reference in New Issue