HHH-13266 : Skip OffsetTimeTest#nativeWriteThenRead and #writeThenRead in some cases due to HHH-13357

when Time is remapped as Timestamp and default JVM is not GMT
This commit is contained in:
Gail Badner 2019-04-19 00:00:52 -07:00 committed by gbadner
parent b328544dc5
commit 664d435b27
2 changed files with 28 additions and 5 deletions

View File

@ -20,16 +20,11 @@ import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.function.Consumer;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import org.hibernate.cfg.AvailableSettings;
import org.hibernate.cfg.Configuration;
import org.hibernate.dialect.Dialect;
import org.hibernate.dialect.H2Dialect;
import org.hibernate.dialect.MariaDB10Dialect;
import org.hibernate.dialect.Oracle8iDialect;
import org.hibernate.dialect.PostgreSQL81Dialect;
import org.hibernate.type.descriptor.sql.SqlTypeDescriptor;
import org.hibernate.testing.TestForIssue;
@ -221,6 +216,10 @@ abstract class AbstractJavaTimeTypeTest<T, E> extends BaseCoreFunctionalTestCase
}
}
protected final ZoneId getDefaultJvmTimeZone() {
return env.defaultJvmTimeZone;
}
protected final Class<? extends AbstractRemappingH2Dialect> getRemappingDialectClass() {
return env.remappingDialectClass;
}

View File

@ -18,6 +18,7 @@ import java.time.ZoneId;
import java.time.ZoneOffset;
import java.util.Arrays;
import java.util.List;
import java.util.TimeZone;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
@ -30,6 +31,7 @@ import org.hibernate.type.descriptor.sql.BigIntTypeDescriptor;
import org.hibernate.type.descriptor.sql.TimestampTypeDescriptor;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.SkipLog;
import org.junit.Test;
import org.junit.runners.Parameterized;
@ -181,6 +183,17 @@ public class OffsetTimeTest extends AbstractJavaTimeTypeTest<OffsetTime, OffsetT
return resultSet.getTimestamp( columnIndex );
}
@Override
@Test
public void nativeWriteThenRead() {
if ( TimeAsTimestampRemappingH2Dialect.class.equals( getRemappingDialectClass() ) &&
!ZONE_GMT.equals( getDefaultJvmTimeZone() ) ) {
SkipLog.reportSkip( "OffsetTimeType remapped as timestamp only works reliably with GMT default JVM for nativeWriteThenRead; see HHH-13357" );
return;
}
super.nativeWriteThenRead();
}
@Override
@Test
@SkipForDialect(value = AbstractHANADialect.class, comment = "HANA seems to return a java.sql.Timestamp instead of a java.sql.Time")
@ -188,6 +201,17 @@ public class OffsetTimeTest extends AbstractJavaTimeTypeTest<OffsetTime, OffsetT
super.writeThenNativeRead();
}
@Override
@Test
public void writeThenRead() {
if ( TimeAsTimestampRemappingH2Dialect.class.equals( getRemappingDialectClass() ) &&
!ZONE_GMT.equals( getDefaultJvmTimeZone() ) ) {
SkipLog.reportSkip( "OffsetTimeType remapped as timestamp only works reliably with GMT default JVM for writeThenRead; see HHH-13357" );
return;
}
super.writeThenRead();
}
@Entity(name = ENTITY_NAME)
static final class EntityWithOffsetTime {
@Id