Remove `@NotImplementedYet` from some tests and fix some other tests
This commit is contained in:
parent
f1680fabcd
commit
08b0a705e6
|
@ -73,11 +73,11 @@ public class SharedCacheModesTest {
|
|||
|
||||
query.setHint( AvailableSettings.JPA_SHARED_CACHE_STORE_MODE, CacheStoreMode.USE );
|
||||
assertEquals( CacheStoreMode.USE, query.getHints().get( AvailableSettings.JPA_SHARED_CACHE_STORE_MODE ) );
|
||||
assertEquals( CacheMode.NORMAL, query.getCacheMode() );
|
||||
assertEquals( CacheMode.PUT, query.getCacheMode() );
|
||||
|
||||
query.setHint( AvailableSettings.JPA_SHARED_CACHE_STORE_MODE, CacheStoreMode.BYPASS );
|
||||
assertEquals( CacheStoreMode.BYPASS, query.getHints().get( AvailableSettings.JPA_SHARED_CACHE_STORE_MODE ) );
|
||||
assertEquals( CacheMode.GET, query.getCacheMode() );
|
||||
assertEquals( CacheMode.IGNORE, query.getCacheMode() );
|
||||
|
||||
query.setHint( AvailableSettings.JPA_SHARED_CACHE_STORE_MODE, CacheStoreMode.REFRESH );
|
||||
assertEquals( CacheStoreMode.REFRESH, query.getHints().get( AvailableSettings.JPA_SHARED_CACHE_STORE_MODE ) );
|
||||
|
|
|
@ -15,7 +15,6 @@ import jakarta.persistence.Tuple;
|
|||
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.orm.junit.DomainModel;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||
|
||||
|
@ -34,7 +33,6 @@ public class PackagePrivateAttributeConverterEntityManagerFactoryTest {
|
|||
public final String sql = "select code from Tester where id = :id";
|
||||
|
||||
@Test
|
||||
@NotImplementedYet( strict = false, reason = "Support for passing `resultType` to `#createNativeQuery` not yet implemented" )
|
||||
public void test(SessionFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
(session) -> {
|
||||
|
|
|
@ -15,7 +15,6 @@ import jakarta.persistence.Tuple;
|
|||
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.orm.junit.DomainModel;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
@ -31,7 +30,6 @@ import static org.junit.Assert.assertEquals;
|
|||
public class PackagePrivateAttributeConverterSessionFactoryTest {
|
||||
|
||||
@Test
|
||||
@NotImplementedYet( strict = false, reason = "Support for creating native-query with result-type not implemented" )
|
||||
public void test(SessionFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
(session) -> {
|
||||
|
|
|
@ -26,7 +26,6 @@ import jakarta.persistence.Id;
|
|||
import jakarta.persistence.Table;
|
||||
|
||||
import org.hibernate.testing.orm.junit.DomainModel;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
|
@ -41,7 +40,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
*/
|
||||
@DomainModel( annotatedClasses = ComplexValueGenerationBaselineTests.NonAuditedEntity.class )
|
||||
@SessionFactory
|
||||
@NotImplementedYet( strict = false, reason = "Support for `java.sql.Date` and `java.sql.Time` is currently fubar" )
|
||||
public class ComplexValueGenerationBaselineTests {
|
||||
@Test
|
||||
public void testLoading(SessionFactoryScope scope) {
|
||||
|
|
|
@ -35,7 +35,6 @@ import org.hibernate.dialect.MySQLDialect;
|
|||
import org.hibernate.dialect.SybaseDialect;
|
||||
|
||||
import org.hibernate.testing.orm.junit.DomainModel;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||
import org.hibernate.testing.orm.junit.SkipForDialect;
|
||||
|
@ -51,10 +50,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
@SkipForDialect(dialectClass = MySQLDialect.class, reason = "See HHH-10196")
|
||||
@DomainModel( annotatedClasses = ComplexValueGenerationTests.AuditedEntity.class )
|
||||
@SessionFactory
|
||||
@NotImplementedYet(
|
||||
strict = false,
|
||||
reason = "Support for `java.sql.Date` and `java.sql.Time` is currently fubar"
|
||||
)
|
||||
public class ComplexValueGenerationTests {
|
||||
@Test
|
||||
public void testGenerations(SessionFactoryScope scope) {
|
||||
|
|
|
@ -36,40 +36,27 @@ import org.hibernate.annotations.GenerationTime;
|
|||
import org.hibernate.annotations.GeneratorType;
|
||||
import org.hibernate.annotations.UpdateTimestamp;
|
||||
import org.hibernate.annotations.ValueGenerationType;
|
||||
import org.hibernate.boot.spi.MetadataBuildingContext;
|
||||
import org.hibernate.dialect.MySQLDialect;
|
||||
import org.hibernate.dialect.SybaseDialect;
|
||||
import org.hibernate.engine.jdbc.spi.JdbcServices;
|
||||
import org.hibernate.tuple.AnnotationValueGeneration;
|
||||
import org.hibernate.tuple.GenerationTiming;
|
||||
import org.hibernate.tuple.ValueGenerator;
|
||||
|
||||
import org.hibernate.testing.DialectChecks;
|
||||
import org.hibernate.testing.FailureExpected;
|
||||
import org.hibernate.testing.RequiresDialectFeature;
|
||||
import org.hibernate.testing.SkipForDialect;
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
@SkipForDialect(value = SybaseDialect.class, comment = "CURRENT_TIMESTAMP not supported as default value in Sybase")
|
||||
@SkipForDialect(value = MySQLDialect.class, comment = "See HHH-10196")
|
||||
@RequiresDialectFeature(DialectChecks.SupportsIdentityColumns.class)
|
||||
@FailureExpected(
|
||||
jiraKey = "",
|
||||
message = "Support for `java.sql.Date` and `java.sql.Time` is currently fubar"
|
||||
)
|
||||
//@NotImplementedYet(
|
||||
// strict = false,
|
||||
// reason = "Support for `java.sql.Date` and `java.sql.Time` is currently fubar"
|
||||
//)
|
||||
public class DefaultGeneratedValueIdentityTest extends BaseCoreFunctionalTestCase {
|
||||
|
||||
@Override
|
||||
|
|
|
@ -39,7 +39,6 @@ import org.hibernate.tuple.ValueGenerator;
|
|||
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.orm.junit.DomainModel;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||
import org.hibernate.testing.orm.junit.SkipForDialect;
|
||||
|
@ -61,10 +60,6 @@ import static org.junit.Assert.assertTrue;
|
|||
*/
|
||||
@SkipForDialect( dialectClass = SybaseDialect.class, matchSubTypes = true, reason = "CURRENT_TIMESTAMP not supported as default value in Sybase" )
|
||||
@SkipForDialect( dialectClass = MySQLDialect.class, reason = "See HHH-10196" )
|
||||
@NotImplementedYet(
|
||||
strict = false,
|
||||
reason = "Support for `java.sql.Date` and `java.sql.Time` is currently fubar"
|
||||
)
|
||||
@DomainModel( annotatedClasses = DefaultGeneratedValueTest.TheEntity.class )
|
||||
@SessionFactory
|
||||
public class DefaultGeneratedValueTest {
|
||||
|
@ -163,7 +158,7 @@ public class DefaultGeneratedValueTest {
|
|||
scope.inTransaction( (s) -> {
|
||||
final TheEntity theEntity = s.get( TheEntity.class, 1 );
|
||||
|
||||
assertEquals( "Creation timestamp should not change on update", created, theEntity.vmCreatedSqlTimestamp );
|
||||
assertEquals( "Creation timestamp should not change on update", created.vmCreatedSqlTimestamp, theEntity.vmCreatedSqlTimestamp );
|
||||
assertTrue( "Update timestamp should have changed due to update", theEntity.updated.after( created.updated ) );
|
||||
} );
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import jakarta.persistence.Id;
|
|||
import jakarta.persistence.Table;
|
||||
|
||||
import org.hibernate.testing.orm.junit.DomainModel;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
|
@ -26,7 +25,6 @@ import static org.assertj.core.api.Assertions.assertThat;
|
|||
*/
|
||||
@DomainModel( annotatedClasses = SimpleValueGenerationBaselineTests.NonAuditedEntity.class )
|
||||
@SessionFactory
|
||||
@NotImplementedYet( strict = false, reason = "Support for `java.sql.Date` and `java.sql.Time` is currently fubar" )
|
||||
public class SimpleValueGenerationBaselineTests {
|
||||
@Test
|
||||
public void testLoading(SessionFactoryScope scope) {
|
||||
|
|
|
@ -8,6 +8,8 @@ package org.hibernate.orm.test.mapping.inheritance.discriminator;
|
|||
|
||||
import jakarta.persistence.Tuple;
|
||||
|
||||
import org.hibernate.query.spi.QueryImplementor;
|
||||
|
||||
import org.hibernate.testing.orm.junit.DomainModel;
|
||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||
|
@ -17,6 +19,8 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
import org.assertj.core.api.Assertions;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
|
@ -68,10 +72,17 @@ public class DiscriminatorQueryUsageTests {
|
|||
@Test
|
||||
public void testUsageAsPredicateWithParamOfUnderlyingType(SessionFactoryScope scope) {
|
||||
scope.inTransaction( (session) -> {
|
||||
final Long id = session.createQuery( "select p.id from Person p where type(p) = :type", Long.class )
|
||||
.setParameter( "type", "E" )
|
||||
.uniqueResult();
|
||||
Assertions.assertThat( id ).isEqualTo( steveId );
|
||||
QueryImplementor<Long> query = session.createQuery(
|
||||
"select p.id from Person p where type(p) = :type",
|
||||
Long.class
|
||||
);
|
||||
try {
|
||||
query.setParameter( "type", "E" );
|
||||
fail( "Expected that setting the underlying type for a parameter of type Class<?> to fail!" );
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
// We expect this to fail
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@ package org.hibernate.orm.test.mapping.inheritance.discriminator.joined;
|
|||
|
||||
import jakarta.persistence.Tuple;
|
||||
|
||||
import org.hibernate.query.spi.QueryImplementor;
|
||||
|
||||
import org.hibernate.testing.orm.junit.DomainModel;
|
||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||
|
@ -17,6 +19,8 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
import org.assertj.core.api.Assertions;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.fail;
|
||||
|
||||
/**
|
||||
* @author Steve Ebersole
|
||||
*/
|
||||
|
@ -66,10 +70,17 @@ public class DiscriminatorQueryUsageTests {
|
|||
@Test
|
||||
public void testUsageAsPredicateWithParamOfUnderlyingType(SessionFactoryScope scope) {
|
||||
scope.inTransaction( (session) -> {
|
||||
final Integer id = session.createQuery( "select p.id from ParentEntity p where type(p) = :type", Integer.class )
|
||||
.setParameter( "type", "ce" )
|
||||
.uniqueResult();
|
||||
Assertions.assertThat( id ).isEqualTo( 1 );
|
||||
QueryImplementor<Integer> query = session.createQuery(
|
||||
"select p.id from ParentEntity p where type(p) = :type",
|
||||
Integer.class
|
||||
);
|
||||
try {
|
||||
query.setParameter( "type", "ce" );
|
||||
fail( "Expected that setting the underlying type for a parameter of type Class<?> to fail!" );
|
||||
}
|
||||
catch (IllegalArgumentException ex) {
|
||||
// We expect this to fail
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ import jakarta.persistence.Table;
|
|||
|
||||
import org.hibernate.testing.TestForIssue;
|
||||
import org.hibernate.testing.orm.junit.DomainModel;
|
||||
import org.hibernate.testing.orm.junit.NotImplementedYet;
|
||||
import org.hibernate.testing.orm.junit.SessionFactory;
|
||||
import org.hibernate.testing.orm.junit.SessionFactoryScope;
|
||||
import org.junit.jupiter.api.AfterEach;
|
||||
|
@ -28,10 +27,6 @@ import static org.junit.Assert.assertNull;
|
|||
*/
|
||||
@DomainModel( annotatedClasses = CastNullSelectExpressionTest.Person.class )
|
||||
@SessionFactory
|
||||
@NotImplementedYet(
|
||||
reason = "Combination of https://github.com/hibernate/hibernate-orm/discussions/3921 and https://github.com/hibernate/hibernate-orm/discussions/3889",
|
||||
strict = false
|
||||
)
|
||||
public class CastNullSelectExpressionTest {
|
||||
|
||||
@Test
|
||||
|
@ -57,7 +52,7 @@ public class CastNullSelectExpressionTest {
|
|||
scope.inTransaction(
|
||||
(session) -> {
|
||||
Person result = (Person) session.createQuery(
|
||||
"select Person( id, firstName, cast( null as string ), lastName ) from Person where lastName='Munster'"
|
||||
"select new Person( id, firstName, cast( null as string ), lastName ) from Person where lastName='Munster'"
|
||||
).uniqueResult();
|
||||
assertEquals( "Herman", result.firstName );
|
||||
assertNull( result.middleName );
|
||||
|
|
|
@ -92,8 +92,8 @@ public class ParameterTests extends BaseSqmUnitTest {
|
|||
try (Session session = sessionFactory().openSession()) {
|
||||
final Query query = session.createQuery( "select p.id from Person p where p.anniversary between :start and :end" );
|
||||
|
||||
query.setParameter( "start", Instant.now().minus( 7, ChronoUnit.DAYS ), TemporalType.TIMESTAMP );
|
||||
query.setParameter( "end", Instant.now().plus( 7, ChronoUnit.DAYS ), TemporalType.TIMESTAMP );
|
||||
query.setParameter( "start", Date.from( Instant.now().minus( 7, ChronoUnit.DAYS ) ), TemporalType.TIMESTAMP );
|
||||
query.setParameter( "end", Date.from( Instant.now().plus( 7, ChronoUnit.DAYS ) ), TemporalType.TIMESTAMP );
|
||||
|
||||
final QueryParameterBindings bindings = ( (ExecutionContext) query ).getQueryParameterBindings();
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public abstract class AbstractUsageTest {
|
|||
public void prepareData(SessionFactoryScope scope) {
|
||||
scope.inTransaction(
|
||||
session -> {
|
||||
session.save( new SimpleEntityWithNamedMappings( 1, "test" ) );
|
||||
session.save( new SimpleEntityWithNamedMappings( 1, "test", "notes" ) );
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import org.junit.jupiter.api.Test;
|
|||
|
||||
import static org.hamcrest.CoreMatchers.instanceOf;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.hamcrest.CoreMatchers.nullValue;
|
||||
import static org.hamcrest.MatcherAssert.assertThat;
|
||||
import static org.hamcrest.Matchers.containsInAnyOrder;
|
||||
import static org.hamcrest.Matchers.notNullValue;
|
||||
|
@ -80,6 +81,7 @@ public class EntityResultTests extends AbstractUsageTest {
|
|||
final SimpleEntityWithNamedMappings entity = results.get( 0 );
|
||||
assertThat( entity.getId(), is( 1 ) );
|
||||
assertThat( entity.getName(), is( "test" ) );
|
||||
assertThat( entity.getNotes(), is( "notes" ) );
|
||||
|
||||
// todo (6.0) : should also try executing the ProcedureCall once that functionality is implemented
|
||||
session.createStoredProcedureCall( "abc", "entity" );
|
||||
|
@ -109,6 +111,7 @@ public class EntityResultTests extends AbstractUsageTest {
|
|||
final SimpleEntityWithNamedMappings entity = results.get( 0 );
|
||||
assertThat( entity.getId(), is( 1 ) );
|
||||
assertThat( entity.getName(), is( "test" ) );
|
||||
assertThat( entity.getNotes(), is( "notes" ) );
|
||||
|
||||
// todo (6.0) : should also try executing the ProcedureCall once that functionality is implemented
|
||||
session.createStoredProcedureCall( "abc", "entity-none" );
|
||||
|
@ -137,7 +140,8 @@ public class EntityResultTests extends AbstractUsageTest {
|
|||
|
||||
final SimpleEntityWithNamedMappings entity = results.get( 0 );
|
||||
assertThat( entity.getId(), is( 1 ) );
|
||||
assertThat( entity.getName(), is( "test" ) );
|
||||
assertThat( entity.getName(), is( nullValue() ) );
|
||||
assertThat( entity.getNotes(), is( "notes" ) );
|
||||
|
||||
// todo (6.0) : should also try executing the ProcedureCall once that functionality is implemented
|
||||
session.createStoredProcedureCall( "abc", "entity-id-notes" );
|
||||
|
|
|
@ -194,9 +194,9 @@ public class NativeQueryResultBuilderTests {
|
|||
assertThat( results.size(), is( 1 ) );
|
||||
|
||||
final Object result = results.get( 0 );
|
||||
assertThat( result, instanceOf( String.class ) );
|
||||
assertThat( result, instanceOf( Character.class ) );
|
||||
|
||||
assertThat( result, is( "O" ) );
|
||||
assertThat( result, is( 'O' ) );
|
||||
}
|
||||
);
|
||||
|
||||
|
|
Loading…
Reference in New Issue