From f6fad942df1c25a798c987f3a6d64671b4a103e5 Mon Sep 17 00:00:00 2001 From: hailtondecastro Date: Wed, 23 Oct 2019 17:19:31 -0300 Subject: [PATCH] HHH-13656 Con not build and run test on Eclipse IDE Eclipse windows --- gradle.properties | 1 + gradle/libraries.gradle | 1 + hibernate-core/.gitignore | 3 + hibernate-core/hibernate-core.gradle | 172 +++++++++++++++++- .../metamodel/internal/MetadataContext.java | 2 +- .../hql/internal/SemanticQueryBuilder.java | 2 +- .../dialect/DB2390DialectTestCase.java | 3 +- .../engine/query/InformixFunctionTest.java | 3 +- ...greSQLSequenceGeneratorWithSerialTest.java | 3 +- ...hStrategyFixWithSequenceGeneratorTest.java | 3 +- ...hStrategyWithoutSequenceGeneratorTest.java | 3 +- .../test/graphs/FetchWithRootGraphTest.java | 3 +- ...tialValueTableGeneratorConfiguredTest.java | 4 +- ...tialValueTableGeneratorConfiguredTest.java | 4 +- .../SchemaToolingAutoActionTests.java | 5 + .../jpa/PersistenceUnitInfoTests.java | 20 +- .../jpa/PersistenceUnitOverridesTests.java | 5 + .../orm/test/loading/LoadingSmokeTests.java | 5 + .../mapping/SingleTableInheritanceTests.java | 5 + .../test/metamodel/mapping/SmokeTests.java | 5 + .../criteria/BasicCriteriaExecutionTests.java | 5 + .../test/query/hql/AliasCollisionTest.java | 5 + .../test/query/hql/AttributePathTests.java | 6 +- .../test/query/hql/CaseExpressionsTest.java | 5 + .../query/hql/DynamicInstantiationTests.java | 5 + .../orm/test/query/hql/FromClauseTests.java | 6 +- .../orm/test/query/hql/LiteralTests.java | 5 + .../orm/test/query/hql/PagingTests.java | 5 + .../orm/test/query/hql/ParameterTests.java | 5 + .../test/query/hql/QueryPlanCachingTest.java | 5 + .../orm/test/query/hql/SelectClauseTests.java | 5 + .../orm/test/query/hql/WhereClauseTests.java | 5 + .../orm/test/sql/ast/SmokeTests.java | 5 + .../orm/test/sql/exec/SmokeTests.java | 5 + .../query/InClauseParameterPaddingTest.java | 3 +- .../MaxInExpressionParameterPaddingTest.java | 3 +- .../AnnotationMappingJoinClassTest.java | 3 +- .../hhh12076/HbmMappingJoinClassTest.java | 3 +- .../QueryPlanCacheStatisticsTest.java | 3 +- .../batch/BatchOptimisticLockingTest.java | 3 +- ...chFetchNotFoundIgnoreDefaultStyleTest.java | 3 +- .../proxy/LoadANonExistingEntityTest.java | 3 +- ...adANonExistingNotFoundBatchEntityTest.java | 11 +- .../SQLServerDialectPaginationTest.java | 3 +- .../IdentityJoinedSubclassBatchingTest.java | 13 +- .../JoinedSubclassBatchingTest.java | 7 +- .../SequenceJoinedSubclassBatchingTest.java | 9 +- .../test/locking/AbstractSkipLockedTest.java | 9 +- .../MultiLoadSubSelectCollectionTest.java | 3 +- hibernate-testing/hibernate-testing.gradle | 33 ++++ 50 files changed, 381 insertions(+), 55 deletions(-) create mode 100644 gradle.properties create mode 100644 hibernate-core/.gitignore diff --git a/gradle.properties b/gradle.properties new file mode 100644 index 0000000000..55f4e1eb03 --- /dev/null +++ b/gradle.properties @@ -0,0 +1 @@ +org.gradle.jvmargs=-Duser.language=en_US -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 -Dsun.stderr.encoding=UTF-8 -Dsun.stdout.encoding=UTF-8 -Duser.country=US \ No newline at end of file diff --git a/gradle/libraries.gradle b/gradle/libraries.gradle index d526809639..b924a9c48a 100644 --- a/gradle/libraries.gradle +++ b/gradle/libraries.gradle @@ -109,6 +109,7 @@ ext { junit5_params : "org.junit.jupiter:junit-jupiter-params:${junit5Version}", junit: "junit:junit:${junitVersion}", junit5_vintage: "org.junit.vintage:junit-vintage-engine:${junitVintageVersion}", + junit_pcomms: "org.junit.platform:junit-platform-commons:1.5.2", log4j: "log4j:log4j:1.2.17", diff --git a/hibernate-core/.gitignore b/hibernate-core/.gitignore new file mode 100644 index 0000000000..f0db5661af --- /dev/null +++ b/hibernate-core/.gitignore @@ -0,0 +1,3 @@ +/hibernate-core-IdeTests.launch +/hibernate-core-RunnableIdeTest.launch +/.externalToolBuilders/ diff --git a/hibernate-core/hibernate-core.gradle b/hibernate-core/hibernate-core.gradle index 2e1352fe96..c462098b50 100644 --- a/hibernate-core/hibernate-core.gradle +++ b/hibernate-core/hibernate-core.gradle @@ -4,7 +4,11 @@ * License: GNU Lesser General Public License (LGPL), version 2.1 or later. * See the lgpl.txt file in the root directory or . */ +import groovy.xml.* import org.apache.tools.ant.filters.ReplaceTokens +import org.gradle.plugins.ide.eclipse.model.SourceFolder +import org.gradle.plugins.ide.eclipse.model.Library +import org.apache.tools.ant.taskdefs.condition.Os apply from: rootProject.file( 'gradle/published-java-module.gradle' ) apply plugin: Antlr4Plugin @@ -18,6 +22,9 @@ configurations { tests { description = 'Configuration for the produced test jar' } + + eclipseConfig { + } } dependencies { @@ -51,6 +58,17 @@ dependencies { provided( libraries.jacc ) provided( libraries.validation ) provided( libraries.ant ) + eclipseConfig( compileOnly( libraries.ant ) ) + eclipseConfig( compileOnly( libraries.logging_annotations ) ) + eclipseConfig( runtime( libraries.junit ) ) + eclipseConfig( runtime( libraries.junit5_api ) ) + eclipseConfig( runtime( libraries.junit5_jupiter ) ) + eclipseConfig( runtime( libraries.junit5_params ) ) + eclipseConfig( runtime( libraries.junit_pcomms ) ) + + runtime( libraries.junit5_vintage ) + runtime( libraries.junit5_jupiter ) + provided( libraries.cdi ) testCompile( project(':hibernate-testing') ) @@ -156,6 +174,157 @@ idea { } } +cleanEclipse { + project.delete '.externalToolBuilders' + project.delete 'hibernate-core-RunnableIdeTest.launch' +} +tasks.eclipse.dependsOn(cleanEclipse) +eclipse { + project { + file { + withXml { provider -> + def projectDescriptionNode = provider.asNode() +// projectDescriptionNode.children( ).each { nodeItem -> +// println( 'nodeItem: ' + nodeItem ) +// } + def buildSpecNode = projectDescriptionNode.children().find { child -> child.name( ).equals('buildSpec') } + def buildCommandMkp = new StreamingMarkupBuilder().bind { + buildCommand { + name( 'org.eclipse.ui.externaltools.ExternalToolBuilder' ) + triggers( 'full,incremental,' ) + arguments( ) { + dictionary( ) { + key ( 'LaunchConfigHandle' ) + value ( '/.externalToolBuilders/gradlew_process_test_resources.launch' ) + } + } + } + } + def buildCommandNode = new XmlParser().parseText( buildCommandMkp.toString() ) + buildSpecNode.append( buildCommandNode ) + } + } + } + mkdir '.externalToolBuilders' + file('.externalToolBuilders/gradlew_process_test_resources.launch').withWriter { writer -> + // Create MarkupBuilder with 4 space indent + def xml = new MarkupBuilder(new IndentPrinter(writer, " ", true)) + + xml.doubleQuotes = true + xml.mkp.xmlDeclaration(version: '1.0', encoding: 'utf-8', standalone: 'no') + xml.launchConfiguration( type: 'org.eclipse.ui.externaltools.ProgramBuilderLaunchConfigurationType' ) { + stringAttribute( key: 'org.eclipse.debug.core.ATTR_REFRESH_SCOPE', value: "${project.name}" ) + booleanAttribute( key: 'org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND', value: 'false' ) + + if (Os.isFamily(Os.FAMILY_WINDOWS)) { + stringAttribute( key: 'org.eclipse.ui.externaltools.ATTR_LOCATION', value: file('../gradlew.bat').absolutePath ) + } else { + stringAttribute( key: 'org.eclipse.ui.externaltools.ATTR_LOCATION', value: file('../gradlew').absolutePath ) + } + stringAttribute( key: 'org.eclipse.ui.externaltools.ATTR_RUN_BUILD_KINDS', value: 'incremental,auto,' ) + stringAttribute( key: 'org.eclipse.ui.externaltools.ATTR_TOOL_ARGUMENTS', value: 'hibernate-core:processTestResources --no-daemon' ) + booleanAttribute( key: 'org.eclipse.ui.externaltools.ATTR_TRIGGERS_CONFIGURED', value: 'true' ) + stringAttribute( key: 'org.eclipse.ui.externaltools.ATTR_WORKING_DIRECTORY', value: file('../').absolutePath ) + } + xml.mkp.comment("AUTO-GENERATED FILE. DO NOT MODIFY. This is generated by gradle eclipse task") + } + file('hibernate-core-RunnableIdeTest.launch').withWriter { writer -> + // Create MarkupBuilder with 4 space indent + def xml = new MarkupBuilder(new IndentPrinter(writer, " ", true)) + + xml.doubleQuotes = true + xml.mkp.xmlDeclaration(version: '1.0', encoding: 'utf-8', standalone: 'no') + xml.launchConfiguration( type: 'org.eclipse.jdt.junit.launchconfig' ) { + listAttribute( key: 'org.eclipse.debug.core.MAPPED_RESOURCE_PATHS' ) { + listEntry( value: "${project.name}" ) + } + listAttribute( key: 'org.eclipse.debug.core.MAPPED_RESOURCE_TYPES' ) { + listEntry( value: '4' ) + } + stringAttribute( key: 'org.eclipse.jdt.junit.CONTAINER', value: "=${project.name}" ) + stringAttribute( key: 'org.eclipse.jdt.junit.EXCLUDE_TAGS', value: '' ) + booleanAttribute( key: 'org.eclipse.jdt.junit.HAS_EXCLUDE_TAGS', value: 'false' ) + booleanAttribute( key: 'org.eclipse.jdt.junit.HAS_INCLUDE_TAGS', value: 'true' ) + stringAttribute( key: 'org.eclipse.jdt.junit.INCLUDE_TAGS', value: 'RunnableIdeTest' ) + booleanAttribute( key: 'org.eclipse.jdt.junit.KEEPRUNNING_ATTR', value: 'false' ) + stringAttribute( key: 'org.eclipse.jdt.junit.TESTNAME', value: '' ) + stringAttribute( key: 'org.eclipse.jdt.junit.TEST_KIND', value: 'org.eclipse.jdt.junit.loader.junit5' ) + stringAttribute( key: 'org.eclipse.jdt.launching.MAIN_TYPE', value: '' ) + stringAttribute( key: 'org.eclipse.jdt.launching.PROJECT_ATTR', value: 'hibernate-core' ) + stringAttribute( key: 'org.eclipse.jdt.launching.VM_ARGUMENTS', value: '-ea' ) + } + xml.mkp.comment("AUTO-GENERATED FILE. DO NOT MODIFY. This is generated by gradle eclipse task") + } + + + classpath { + plusConfigurations += [ + configurations.eclipseConfig + ] + def frf = it.fileReferenceFactory + + file { + beforeMerged { classpath -> + } + whenMerged { classpath -> + Set exclusionSourceSet = [ + 'src/main/resources', + 'src/test/resources' + ] + List newSourceSet = [] + classpath.entries.each { item -> + if( !exclusionSourceSet.contains( item.path ) ) { + println( 'INCLUDING: ' + item ) + newSourceSet.add( item ) + } else { + println( 'NOT INCLUDING: ' + item ) + } + } + + def aptMain = new SourceFolder('target/generated-src/apt/main', 'bin/main') + def aptTest = new SourceFolder('target/generated-src/apt/test', 'bin/test') + def resourceMain = new SourceFolder('src/main/resources', 'target/resources/main') + def resourceTest = new SourceFolder('src/test/resources', 'target/resources/test') + newSourceSet += [ + aptMain, + aptTest, + resourceMain, + resourceTest + ] +// def resourceMain = new Library( frf.fromFile( file ( 'target/resources/main' ) ) ) +// def resourceTest = new Library( frf.fromFile( file ( 'target/resources/test' ) ) ) + println( 'newSourceSet:' ) + println( newSourceSet ) + classpath.entries = newSourceSet + +// classpath.configure([ +// aptMain, +// aptTest, +// resourceMain, +// resourceTest +// ]) + + // Find the "source" entry and add the exclude for the folder containing our super-source code +// Set exclusionSourceSet = [ +// 'src/main/resources', +// 'src/test/resources' +// ] +// Set newSourceSet = [] +// classpath.entries.each { item -> +// if( !exclusionSourceSet.contains( item.path ) ) { +// println( 'INCLUDING: ' + item ) +// newSourceSet.add( item ) +// } else { +// println( 'NOT INCLUDING: ' + item ) +// } +// } +// println( 'newSourceSet:' ) +// println( newSourceSet ) + } + } + } +} + xjc { outputDir = project.jaxbTargetDir @@ -190,7 +359,8 @@ task copyBundleResources (type: Copy) { from file('src/test/bundles') into ext.bundlesTargetDir filter( ReplaceTokens, tokens: ext.bundleTokens) - + //println( 'ext: ' + ext ) + //println( 'ext.bundleTokens:' + ext.bundleTokens ) doFirst { ext.bundlesTargetDir.mkdirs() } diff --git a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/MetadataContext.java b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/MetadataContext.java index 6dd55238f0..6b99503d95 100755 --- a/hibernate-core/src/main/java/org/hibernate/metamodel/internal/MetadataContext.java +++ b/hibernate-core/src/main/java/org/hibernate/metamodel/internal/MetadataContext.java @@ -373,7 +373,7 @@ public class MetadataContext { else if ( persistentClass.hasIdentifierMapper() ) { @SuppressWarnings("unchecked") final Iterator propertyIterator = persistentClass.getIdentifierMapper().getPropertyIterator(); - final Set> idClassAttributes = (Set>) buildIdClassAttributes( + final Set> idClassAttributes = (Set>)(Object) buildIdClassAttributes( identifiableType, propertyIterator ); diff --git a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java index 307b39e600..562c92496d 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java +++ b/hibernate-core/src/main/java/org/hibernate/query/hql/internal/SemanticQueryBuilder.java @@ -2419,7 +2419,7 @@ public class SemanticQueryBuilder extends HqlParserBaseVisitor implements SqmCre //noinspection unchecked return getFunctionTemplate("trim").makeSqmFunctionExpression( - asList( + (List>)(Object)asList( interpretTrimSpecification( ctx.trimSpecification() ), visitTrimCharacter( ctx.trimCharacter() ), source diff --git a/hibernate-core/src/test/java/org/hibernate/dialect/DB2390DialectTestCase.java b/hibernate-core/src/test/java/org/hibernate/dialect/DB2390DialectTestCase.java index 9655670443..1cf2de450e 100644 --- a/hibernate-core/src/test/java/org/hibernate/dialect/DB2390DialectTestCase.java +++ b/hibernate-core/src/test/java/org/hibernate/dialect/DB2390DialectTestCase.java @@ -22,6 +22,7 @@ import org.junit.Test; import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.TestForIssue; +import org.hibernate.testing.transaction.TransactionUtil; import static org.hibernate.testing.transaction.TransactionUtil.doInJPA; import static org.junit.Assert.assertEquals; @@ -66,7 +67,7 @@ public class DB2390DialectTestCase extends BaseEntityManagerFunctionalTestCase { @Before public void populateSchema() { - doInJPA( this::entityManagerFactory, entityManager -> { + doInJPA( this::entityManagerFactory, (TransactionUtil.JPATransactionVoidFunction)entityManager -> { for ( int i = 0; i < 10; ++i ) { final SimpleEntity simpleEntity = new SimpleEntity( i, "Entity" + i ); entityManager.persist( simpleEntity ); diff --git a/hibernate-core/src/test/java/org/hibernate/engine/query/InformixFunctionTest.java b/hibernate-core/src/test/java/org/hibernate/engine/query/InformixFunctionTest.java index 2f9b68c426..0de8370641 100644 --- a/hibernate-core/src/test/java/org/hibernate/engine/query/InformixFunctionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/engine/query/InformixFunctionTest.java @@ -13,6 +13,7 @@ import org.hibernate.dialect.InformixDialect; import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; +import org.hibernate.testing.transaction.TransactionUtil; import org.junit.Test; import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate; @@ -126,7 +127,7 @@ public class InformixFunctionTest extends BaseCoreFunctionalTestCase { @Test @TestForIssue( jiraKey = "HHH-10800" ) public void testCurrentTimestamp() throws Exception { - doInHibernate( this::sessionFactory, session -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> { int tries = 2; while ( tries-- > 0 ) { Timestamp timestamp = (Timestamp) session.createQuery( diff --git a/hibernate-core/src/test/java/org/hibernate/id/hhh12973/PostgreSQLSequenceGeneratorWithSerialTest.java b/hibernate-core/src/test/java/org/hibernate/id/hhh12973/PostgreSQLSequenceGeneratorWithSerialTest.java index a30693bcf9..2bfb56f020 100644 --- a/hibernate-core/src/test/java/org/hibernate/id/hhh12973/PostgreSQLSequenceGeneratorWithSerialTest.java +++ b/hibernate-core/src/test/java/org/hibernate/id/hhh12973/PostgreSQLSequenceGeneratorWithSerialTest.java @@ -32,6 +32,7 @@ import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.logger.LoggerInspectionRule; import org.hibernate.testing.logger.Triggerable; +import org.hibernate.testing.transaction.TransactionUtil; import org.junit.Rule; import org.junit.Test; @@ -118,7 +119,7 @@ public class PostgreSQLSequenceGeneratorWithSerialTest extends BaseEntityManager final int ITERATIONS = 51; - doInJPA( this::entityManagerFactory, entityManager -> { + doInJPA( this::entityManagerFactory, (TransactionUtil.JPATransactionVoidFunction)entityManager -> { for ( int i = 1; i <= ITERATIONS; i++ ) { ApplicationConfiguration model = new ApplicationConfiguration(); diff --git a/hibernate-core/src/test/java/org/hibernate/id/hhh12973/SequenceMismatchStrategyFixWithSequenceGeneratorTest.java b/hibernate-core/src/test/java/org/hibernate/id/hhh12973/SequenceMismatchStrategyFixWithSequenceGeneratorTest.java index 6d2e86ae88..6547aac287 100644 --- a/hibernate-core/src/test/java/org/hibernate/id/hhh12973/SequenceMismatchStrategyFixWithSequenceGeneratorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/id/hhh12973/SequenceMismatchStrategyFixWithSequenceGeneratorTest.java @@ -37,6 +37,7 @@ import org.hibernate.testing.RequiresDialectFeature; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.logger.LoggerInspectionRule; import org.hibernate.testing.logger.Triggerable; +import org.hibernate.testing.transaction.TransactionUtil; import org.hibernate.test.schemaupdate.SchemaExportWithGlobalQuotingEnabledTest; import org.junit.Rule; import org.junit.Test; @@ -113,7 +114,7 @@ public class SequenceMismatchStrategyFixWithSequenceGeneratorTest extends BaseEn final int ITERATIONS = 51; - doInJPA( this::entityManagerFactory, entityManager -> { + doInJPA( this::entityManagerFactory, (TransactionUtil.JPATransactionVoidFunction)entityManager -> { for ( int i = 1; i <= ITERATIONS; i++ ) { ApplicationConfiguration model = new ApplicationConfiguration(); diff --git a/hibernate-core/src/test/java/org/hibernate/id/hhh12973/SequenceMismatchStrategyWithoutSequenceGeneratorTest.java b/hibernate-core/src/test/java/org/hibernate/id/hhh12973/SequenceMismatchStrategyWithoutSequenceGeneratorTest.java index 51ef22de42..fd85a83d15 100644 --- a/hibernate-core/src/test/java/org/hibernate/id/hhh12973/SequenceMismatchStrategyWithoutSequenceGeneratorTest.java +++ b/hibernate-core/src/test/java/org/hibernate/id/hhh12973/SequenceMismatchStrategyWithoutSequenceGeneratorTest.java @@ -31,6 +31,7 @@ import org.hibernate.testing.RequiresDialectFeature; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.logger.LoggerInspectionRule; import org.hibernate.testing.logger.Triggerable; +import org.hibernate.testing.transaction.TransactionUtil; import org.junit.Rule; import org.junit.Test; @@ -105,7 +106,7 @@ public class SequenceMismatchStrategyWithoutSequenceGeneratorTest extends BaseEn final int ITERATIONS = 51; - doInJPA( this::entityManagerFactory, entityManager -> { + doInJPA( this::entityManagerFactory, (TransactionUtil.JPATransactionVoidFunction)entityManager -> { for ( int i = 1; i <= ITERATIONS; i++ ) { ApplicationConfiguration model = new ApplicationConfiguration(); diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/FetchWithRootGraphTest.java b/hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/FetchWithRootGraphTest.java index 928bc8b714..7c20922c27 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/FetchWithRootGraphTest.java +++ b/hibernate-core/src/test/java/org/hibernate/jpa/test/graphs/FetchWithRootGraphTest.java @@ -16,6 +16,7 @@ import org.hibernate.Hibernate; import org.hibernate.graph.RootGraph; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; +import org.hibernate.testing.transaction.TransactionUtil; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -32,7 +33,7 @@ public class FetchWithRootGraphTest extends BaseCoreFunctionalTestCase { @Before public void before() { - doInHibernate( this::sessionFactory, s -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> { for ( long i = 0; i < 10; ++i ) { SimpleEntity sim = new SimpleEntity( i, "Entity #" + i ); EntityWithReference ref = new EntityWithReference( i, sim ); diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/indetifier/AssignedInitialValueTableGeneratorConfiguredTest.java b/hibernate-core/src/test/java/org/hibernate/jpa/test/indetifier/AssignedInitialValueTableGeneratorConfiguredTest.java index 0184f90d59..39ab61abba 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/indetifier/AssignedInitialValueTableGeneratorConfiguredTest.java +++ b/hibernate-core/src/test/java/org/hibernate/jpa/test/indetifier/AssignedInitialValueTableGeneratorConfiguredTest.java @@ -19,7 +19,7 @@ import javax.persistence.TableGenerator; import org.hibernate.Session; import org.hibernate.jdbc.Work; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; - +import org.hibernate.testing.transaction.TransactionUtil; import org.junit.Test; import static org.hamcrest.CoreMatchers.notNullValue; @@ -56,7 +56,7 @@ public class AssignedInitialValueTableGeneratorConfiguredTest extends BaseEntity @Test public void testTheGeneratedIdValuesAreCorrect() { - doInJPA( this::entityManagerFactory, entityManager -> { + doInJPA( this::entityManagerFactory, (TransactionUtil.JPATransactionVoidFunction)entityManager -> { for ( long i = 0; i < 3; i++ ) { Product product = new Product(); product.setName( "Hibernate " + i ); diff --git a/hibernate-core/src/test/java/org/hibernate/jpa/test/indetifier/DefaultInitialValueTableGeneratorConfiguredTest.java b/hibernate-core/src/test/java/org/hibernate/jpa/test/indetifier/DefaultInitialValueTableGeneratorConfiguredTest.java index f47f912d79..99e4e08008 100644 --- a/hibernate-core/src/test/java/org/hibernate/jpa/test/indetifier/DefaultInitialValueTableGeneratorConfiguredTest.java +++ b/hibernate-core/src/test/java/org/hibernate/jpa/test/indetifier/DefaultInitialValueTableGeneratorConfiguredTest.java @@ -19,7 +19,7 @@ import javax.persistence.TableGenerator; import org.hibernate.Session; import org.hibernate.jdbc.Work; import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; - +import org.hibernate.testing.transaction.TransactionUtil; import org.junit.Test; import static org.hamcrest.CoreMatchers.notNullValue; @@ -57,7 +57,7 @@ public class DefaultInitialValueTableGeneratorConfiguredTest extends BaseEntityM @Test public void testTheGeneratedIdValuesAreCorrect() { - doInJPA( this::entityManagerFactory, entityManager -> { + doInJPA( this::entityManagerFactory, (TransactionUtil.JPATransactionVoidFunction)entityManager -> { for ( long i = 0; i < 3; i++ ) { Product product = new Product(); product.setName( "Hibernate " + i ); diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/SchemaToolingAutoActionTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/SchemaToolingAutoActionTests.java index cc581d3346..fc9a0ac20f 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/SchemaToolingAutoActionTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/SchemaToolingAutoActionTests.java @@ -13,6 +13,8 @@ import org.hibernate.tool.schema.Action; import org.hibernate.tool.schema.spi.SchemaManagementToolCoordinator; import org.junit.Test; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Tags; import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.MatcherAssert.assertThat; @@ -20,6 +22,9 @@ import static org.hamcrest.MatcherAssert.assertThat; /** * @author Steve Ebersole */ +@Tags({ + @Tag("RunnableIdeTest"), +}) public class SchemaToolingAutoActionTests { @Test public void testLegacySettingAsAction() { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/jpa/PersistenceUnitInfoTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/jpa/PersistenceUnitInfoTests.java index 1c0ca45444..eccc6a6ec6 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/jpa/PersistenceUnitInfoTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/jpa/PersistenceUnitInfoTests.java @@ -6,8 +6,14 @@ */ package org.hibernate.orm.test.bootstrap.jpa; +import static org.hamcrest.CoreMatchers.instanceOf; +import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.assertEquals; + import java.util.Collections; import java.util.Map; + import javax.persistence.EntityManagerFactory; import javax.persistence.spi.PersistenceProvider; import javax.sql.DataSource; @@ -17,22 +23,20 @@ import org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProvid import org.hibernate.engine.jdbc.connections.spi.ConnectionProvider; import org.hibernate.engine.spi.SessionFactoryImplementor; import org.hibernate.jpa.HibernatePersistenceProvider; -import org.hibernate.testing.jdbc.DataSourceStub; - -import org.hibernate.testing.FailureExpected; import org.hibernate.testing.TestForIssue; +import org.hibernate.testing.jdbc.DataSourceStub; import org.hibernate.testing.junit4.BaseUnitTestCase; import org.hibernate.testing.util.jpa.PersistenceUnitInfoAdapter; import org.junit.Test; - -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.junit.Assert.assertEquals; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Tags; /** * @author Steve Ebersole */ +@Tags({ + @Tag("RunnableIdeTest"), +}) public class PersistenceUnitInfoTests extends BaseUnitTestCase { @Test @TestForIssue( jiraKey = "HHH-13432" ) diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/jpa/PersistenceUnitOverridesTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/jpa/PersistenceUnitOverridesTests.java index d9a6bce824..b402beaae0 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/jpa/PersistenceUnitOverridesTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/bootstrap/jpa/PersistenceUnitOverridesTests.java @@ -35,6 +35,8 @@ import org.hibernate.testing.junit4.BaseUnitTestCase; import org.hibernate.testing.util.jpa.DelegatingPersistenceUnitInfo; import org.hibernate.testing.util.jpa.PersistenceUnitInfoAdapter; import org.junit.Test; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Tags; import static org.hamcrest.CoreMatchers.containsString; import static org.hamcrest.CoreMatchers.instanceOf; @@ -46,6 +48,9 @@ import static org.hamcrest.MatcherAssert.assertThat; /** * @author Steve Ebersole */ +@Tags({ + @Tag("RunnableIdeTest"), +}) public class PersistenceUnitOverridesTests extends BaseUnitTestCase { @Test diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/loading/LoadingSmokeTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/loading/LoadingSmokeTests.java index 5d8f612055..c37e5725fc 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/loading/LoadingSmokeTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/loading/LoadingSmokeTests.java @@ -20,6 +20,8 @@ import org.hibernate.testing.orm.junit.SessionFactoryFunctionalTesting; import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Tags; import org.junit.jupiter.api.Test; import org.hamcrest.MatcherAssert; @@ -38,6 +40,9 @@ import static org.junit.jupiter.api.Assertions.assertTrue; @SessionFactory @SessionFactoryFunctionalTesting @SuppressWarnings("WeakerAccess") +@Tags({ + @Tag("RunnableIdeTest"), +}) public class LoadingSmokeTests { @Test public void testBasicLoad(SessionFactoryScope scope) { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/SingleTableInheritanceTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/SingleTableInheritanceTests.java index b85e4acc22..b807b00982 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/SingleTableInheritanceTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/SingleTableInheritanceTests.java @@ -23,6 +23,8 @@ import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Tags; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.instanceOf; @@ -43,6 +45,9 @@ import static org.hamcrest.MatcherAssert.assertThat; ) @ServiceRegistry @SessionFactory +@Tags({ + @Tag("RunnableIdeTest"), +}) public class SingleTableInheritanceTests { @Test public void basicTest(SessionFactoryScope scope) { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/SmokeTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/SmokeTests.java index 3e84731d56..2497a3b5ea 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/SmokeTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/metamodel/mapping/SmokeTests.java @@ -35,6 +35,8 @@ import org.hibernate.testing.orm.junit.FailureExpected; import org.hibernate.testing.orm.junit.ServiceRegistry; import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Tags; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.instanceOf; @@ -51,6 +53,9 @@ import static org.hamcrest.MatcherAssert.assertThat; ) @ServiceRegistry @SessionFactory +@Tags({ + @Tag("RunnableIdeTest"), +}) public class SmokeTests { @Test diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/BasicCriteriaExecutionTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/BasicCriteriaExecutionTests.java index 76df143e15..0b34c8c2e0 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/BasicCriteriaExecutionTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/criteria/BasicCriteriaExecutionTests.java @@ -27,10 +27,15 @@ import org.hibernate.sql.exec.spi.JdbcParameter; import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase; import org.junit.Test; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Tags; /** * @author Steve Ebersole */ +@Tags({ + @Tag("RunnableIdeTest"), +}) public class BasicCriteriaExecutionTests extends BaseNonConfigCoreFunctionalTestCase { @Override diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/AliasCollisionTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/AliasCollisionTest.java index b9a906e500..c93e772fcc 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/AliasCollisionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/AliasCollisionTest.java @@ -21,6 +21,8 @@ import org.hibernate.query.sqm.tree.select.SqmSelection; import org.hibernate.testing.orm.domain.gambit.EntityWithManyToOneSelfReference; import org.hibernate.testing.orm.domain.gambit.SimpleEntity; import org.hibernate.testing.orm.junit.ExpectedException; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Tags; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.instanceOf; @@ -37,6 +39,9 @@ import static org.hibernate.testing.hamcrest.CollectionMatchers.isEmpty; * @author Andrea Boriero */ @SuppressWarnings("WeakerAccess") +@Tags({ + @Tag("RunnableIdeTest"), +}) public class AliasCollisionTest extends BaseSqmUnitTest { @Override diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/AttributePathTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/AttributePathTests.java index 62264f10a4..73f70d2d35 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/AttributePathTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/AttributePathTests.java @@ -20,7 +20,8 @@ import org.hibernate.query.sqm.tree.predicate.SqmComparisonPredicate; import org.hibernate.query.sqm.tree.select.SqmSelectStatement; import org.hibernate.query.sqm.tree.select.SqmSelectableNode; import org.hibernate.query.sqm.tree.select.SqmSelection; - +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Tags; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.instanceOf; @@ -32,6 +33,9 @@ import static org.hamcrest.MatcherAssert.assertThat; * @author Steve Ebersole */ @SuppressWarnings("WeakerAccess") +@Tags({ + @Tag("RunnableIdeTest"), +}) public class AttributePathTests extends BaseSqmUnitTest { @Override diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/CaseExpressionsTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/CaseExpressionsTest.java index 349e4689dd..332bbc12f8 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/CaseExpressionsTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/CaseExpressionsTest.java @@ -19,6 +19,8 @@ import org.hibernate.query.sqm.tree.select.SqmSelectableNode; import org.hibernate.testing.orm.junit.FailureExpected; import org.hibernate.testing.orm.junit.TestingUtil; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Tags; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.instanceOf; @@ -32,6 +34,9 @@ import static org.junit.Assert.assertEquals; * @author Steve Ebersole */ @SuppressWarnings("WeakerAccess") +@Tags({ + @Tag("RunnableIdeTest"), +}) public class CaseExpressionsTest extends BaseSqmUnitTest { @Override diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/DynamicInstantiationTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/DynamicInstantiationTests.java index 4c292e09fa..151bdbbaef 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/DynamicInstantiationTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/DynamicInstantiationTests.java @@ -20,6 +20,8 @@ import org.hibernate.query.sqm.tree.select.SqmSelectStatement; import org.hibernate.testing.orm.domain.gambit.EntityOfBasics; import org.hibernate.testing.orm.junit.TestingUtil; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Tags; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.equalTo; @@ -34,6 +36,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals; * @author Steve Ebersole */ @SuppressWarnings("WeakerAccess") +@Tags({ + @Tag("RunnableIdeTest"), +}) public class DynamicInstantiationTests extends BaseSqmUnitTest { @Override diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FromClauseTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FromClauseTests.java index 5c9605ff3b..e8a49b8bec 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FromClauseTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/FromClauseTests.java @@ -17,7 +17,8 @@ import org.hibernate.query.sqm.tree.from.SqmRoot; import org.hibernate.query.sqm.tree.select.SqmSelectStatement; import org.hibernate.query.sqm.tree.select.SqmSelection; import org.hibernate.query.sqm.tree.select.SqmSortSpecification; - +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Tags; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.containsString; @@ -38,6 +39,9 @@ import static org.junit.jupiter.api.Assertions.fail; * @author Steve Ebersole */ @SuppressWarnings("WeakerAccess") +@Tags({ + @Tag("RunnableIdeTest"), +}) public class FromClauseTests extends BaseSqmUnitTest { @Override diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/LiteralTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/LiteralTests.java index 02e231f751..ae725c2b59 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/LiteralTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/LiteralTests.java @@ -11,11 +11,16 @@ import org.hibernate.orm.test.query.sqm.BaseSqmUnitTest; import org.hibernate.query.sqm.tree.select.SqmSelectStatement; import org.hibernate.testing.orm.domain.StandardDomainModel; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Tags; import org.junit.jupiter.api.Test; /** * @author Steve Ebersole */ +@Tags({ + @Tag("RunnableIdeTest"), +}) public class LiteralTests extends BaseSqmUnitTest { @Override diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/PagingTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/PagingTests.java index cfa5edacdb..c43d040cf8 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/PagingTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/PagingTests.java @@ -13,6 +13,8 @@ import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.ServiceRegistry; import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Tags; import org.junit.jupiter.api.Test; import static org.hibernate.orm.test.query.sqm.BaseSqmUnitTest.interpretSelect; @@ -31,6 +33,9 @@ import static org.hibernate.orm.test.query.sqm.BaseSqmUnitTest.interpretSelect; ) ) @SessionFactory +@Tags({ + @Tag("RunnableIdeTest"), +}) public class PagingTests { @Test diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/ParameterTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/ParameterTests.java index 8f38d84984..24f5bb7641 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/ParameterTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/ParameterTests.java @@ -31,6 +31,8 @@ import org.hibernate.sql.exec.spi.DomainParameterBindingContext; import org.hibernate.testing.orm.junit.ExpectedException; import org.hibernate.testing.orm.junit.ExpectedExceptionExtension; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Tags; import org.junit.jupiter.api.Test; import org.junit.jupiter.api.extension.ExtendWith; @@ -47,6 +49,9 @@ import static org.hibernate.testing.hamcrest.CollectionMatchers.hasSize; */ @SuppressWarnings("WeakerAccess") @ExtendWith( ExpectedExceptionExtension.class ) +@Tags({ + @Tag("RunnableIdeTest"), +}) public class ParameterTests extends BaseSqmUnitTest { @Test @ExpectedException( SemanticException.class ) diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/QueryPlanCachingTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/QueryPlanCachingTest.java index 1d72bdbdd1..4c61b00073 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/QueryPlanCachingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/QueryPlanCachingTest.java @@ -12,6 +12,8 @@ import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.ServiceRegistry; import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Tags; import org.junit.jupiter.api.Test; /** @@ -21,6 +23,9 @@ import org.junit.jupiter.api.Test; @DomainModel( annotatedClasses = SmokeTests.SimpleEntity.class ) @ServiceRegistry @SessionFactory( exportSchema = true ) +@Tags({ + @Tag("RunnableIdeTest"), +}) public class QueryPlanCachingTest { @Test public void testHqlTranslationCaching(SessionFactoryScope scope) { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/SelectClauseTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/SelectClauseTests.java index d0e90f297a..f576c1a75a 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/SelectClauseTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/SelectClauseTests.java @@ -33,6 +33,8 @@ import org.hibernate.testing.orm.domain.gambit.EntityOfLists; import org.hibernate.testing.orm.domain.gambit.EntityOfMaps; import org.hibernate.testing.orm.domain.gambit.EntityOfSets; import org.hibernate.testing.orm.junit.TestingUtil; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Tags; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.endsWith; @@ -49,6 +51,9 @@ import static org.junit.jupiter.api.Assertions.assertEquals; * @author Steve Ebersole */ @SuppressWarnings("WeakerAccess") +@Tags({ + @Tag("RunnableIdeTest"), +}) public class SelectClauseTests extends BaseSqmUnitTest { @Test diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/WhereClauseTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/WhereClauseTests.java index f8e1851544..ffe30a7dce 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/WhereClauseTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/query/hql/WhereClauseTests.java @@ -20,6 +20,8 @@ import org.hibernate.query.sqm.tree.select.SqmSelectStatement; import org.hibernate.testing.orm.domain.gambit.EntityOfLists; import org.hibernate.testing.orm.domain.gambit.EntityOfMaps; import org.hibernate.testing.orm.domain.gambit.EntityOfSets; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Tags; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.instanceOf; @@ -33,6 +35,9 @@ import static org.hamcrest.MatcherAssert.assertThat; * @author Gunnar Morling */ @SuppressWarnings("WeakerAccess") +@Tags({ + @Tag("RunnableIdeTest"), +}) public class WhereClauseTests extends BaseSqmUnitTest { @Override diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/sql/ast/SmokeTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/sql/ast/SmokeTests.java index 0cbd27db4f..f2de8b4e67 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/sql/ast/SmokeTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/sql/ast/SmokeTests.java @@ -45,6 +45,8 @@ import org.hibernate.testing.orm.junit.DomainModel; import org.hibernate.testing.orm.junit.ServiceRegistry; import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Tags; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.endsWith; @@ -69,6 +71,9 @@ import static org.hamcrest.MatcherAssert.assertThat; ) ) @SessionFactory +@Tags({ + @Tag("RunnableIdeTest"), +}) public class SmokeTests { @Test public void testSimpleHqlInterpretation(SessionFactoryScope scope) { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/sql/exec/SmokeTests.java b/hibernate-core/src/test/java/org/hibernate/orm/test/sql/exec/SmokeTests.java index ac538d3e64..d90357de32 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/sql/exec/SmokeTests.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/sql/exec/SmokeTests.java @@ -31,6 +31,8 @@ import org.hibernate.testing.orm.junit.SessionFactory; import org.hibernate.testing.orm.junit.SessionFactoryScope; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Tag; +import org.junit.jupiter.api.Tags; import org.junit.jupiter.api.Test; import static org.hamcrest.CoreMatchers.instanceOf; @@ -61,6 +63,9 @@ import static org.hibernate.orm.test.metamodel.mapping.SmokeTests.Gender.MALE; } ) @SessionFactory( exportSchema = true ) +@Tags({ + @Tag("RunnableIdeTest"), +}) public class SmokeTests { @BeforeEach diff --git a/hibernate-core/src/test/java/org/hibernate/query/InClauseParameterPaddingTest.java b/hibernate-core/src/test/java/org/hibernate/query/InClauseParameterPaddingTest.java index 77860ab63f..3882ea4bbe 100644 --- a/hibernate-core/src/test/java/org/hibernate/query/InClauseParameterPaddingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/query/InClauseParameterPaddingTest.java @@ -16,6 +16,7 @@ import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.jdbc.SQLStatementInterceptor; +import org.hibernate.testing.transaction.TransactionUtil; import org.hibernate.test.util.jdbc.PreparedStatementSpyConnectionProvider; import org.junit.Test; @@ -46,7 +47,7 @@ public class InClauseParameterPaddingTest extends BaseEntityManagerFunctionalTes @Override protected void afterEntityManagerFactoryBuilt() { - doInJPA( this::entityManagerFactory, entityManager -> { + doInJPA( this::entityManagerFactory, (TransactionUtil.JPATransactionVoidFunction)entityManager -> { for ( int i = 1; i < 10; i++ ) { Person person = new Person(); person.setId( i ); diff --git a/hibernate-core/src/test/java/org/hibernate/query/MaxInExpressionParameterPaddingTest.java b/hibernate-core/src/test/java/org/hibernate/query/MaxInExpressionParameterPaddingTest.java index 92fddb1315..03144edd90 100644 --- a/hibernate-core/src/test/java/org/hibernate/query/MaxInExpressionParameterPaddingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/query/MaxInExpressionParameterPaddingTest.java @@ -20,6 +20,7 @@ import org.hibernate.jpa.test.BaseEntityManagerFunctionalTestCase; import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.jdbc.SQLStatementInterceptor; +import org.hibernate.testing.transaction.TransactionUtil; import org.hibernate.test.util.jdbc.PreparedStatementSpyConnectionProvider; import org.junit.Test; @@ -58,7 +59,7 @@ public class MaxInExpressionParameterPaddingTest extends BaseEntityManagerFuncti @Override protected void afterEntityManagerFactoryBuilt() { - doInJPA( this::entityManagerFactory, entityManager -> { + doInJPA( this::entityManagerFactory, (TransactionUtil.JPATransactionVoidFunction)entityManager -> { for ( int i = 0; i < MAX_COUNT; i++ ) { Person person = new Person(); person.setId( i ); diff --git a/hibernate-core/src/test/java/org/hibernate/query/hhh12076/AnnotationMappingJoinClassTest.java b/hibernate-core/src/test/java/org/hibernate/query/hhh12076/AnnotationMappingJoinClassTest.java index 90d082d046..f652a31bfa 100644 --- a/hibernate-core/src/test/java/org/hibernate/query/hhh12076/AnnotationMappingJoinClassTest.java +++ b/hibernate-core/src/test/java/org/hibernate/query/hhh12076/AnnotationMappingJoinClassTest.java @@ -37,6 +37,7 @@ import org.hibernate.annotations.UpdateTimestamp; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; +import org.hibernate.testing.transaction.TransactionUtil; import org.junit.Test; import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate; @@ -62,7 +63,7 @@ public class AnnotationMappingJoinClassTest extends BaseCoreFunctionalTestCase { @Override protected void prepareTest() { - doInHibernate( this::sessionFactory, session -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> { TaskStatus taskStatus = new TaskStatus(); taskStatus.setName("Enabled"); taskStatus.setDisplayName("Enabled"); diff --git a/hibernate-core/src/test/java/org/hibernate/query/hhh12076/HbmMappingJoinClassTest.java b/hibernate-core/src/test/java/org/hibernate/query/hhh12076/HbmMappingJoinClassTest.java index be9fb29624..855244fa13 100644 --- a/hibernate-core/src/test/java/org/hibernate/query/hhh12076/HbmMappingJoinClassTest.java +++ b/hibernate-core/src/test/java/org/hibernate/query/hhh12076/HbmMappingJoinClassTest.java @@ -15,6 +15,7 @@ import org.hibernate.query.Query; import org.hibernate.testing.FailureExpected; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; +import org.hibernate.testing.transaction.TransactionUtil; import org.junit.Test; import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate; @@ -46,7 +47,7 @@ public class HbmMappingJoinClassTest extends BaseCoreFunctionalTestCase { @Override protected void prepareTest() { - doInHibernate( this::sessionFactory, session -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> { TaskStatus taskStatus = new TaskStatus(); taskStatus.setName("Enabled"); taskStatus.setDisplayName("Enabled"); diff --git a/hibernate-core/src/test/java/org/hibernate/stat/internal/QueryPlanCacheStatisticsTest.java b/hibernate-core/src/test/java/org/hibernate/stat/internal/QueryPlanCacheStatisticsTest.java index a0a02b1705..7d5c9027fb 100644 --- a/hibernate-core/src/test/java/org/hibernate/stat/internal/QueryPlanCacheStatisticsTest.java +++ b/hibernate-core/src/test/java/org/hibernate/stat/internal/QueryPlanCacheStatisticsTest.java @@ -18,6 +18,7 @@ import org.hibernate.stat.QueryStatistics; import org.hibernate.stat.Statistics; import org.hibernate.testing.TestForIssue; +import org.hibernate.testing.transaction.TransactionUtil; import org.junit.Test; import static org.hibernate.testing.transaction.TransactionUtil.doInJPA; @@ -48,7 +49,7 @@ public class QueryPlanCacheStatisticsTest extends BaseEntityManagerFunctionalTes SessionFactory sessionFactory = entityManagerFactory().unwrap( SessionFactory.class ); statistics = sessionFactory.getStatistics(); - doInJPA( this::entityManagerFactory, entityManager -> { + doInJPA( this::entityManagerFactory, (TransactionUtil.JPATransactionVoidFunction)entityManager -> { for ( long i = 1; i <= 5; i++ ) { if ( i % 3 == 0 ) { entityManager.flush(); diff --git a/hibernate-core/src/test/java/org/hibernate/test/batch/BatchOptimisticLockingTest.java b/hibernate-core/src/test/java/org/hibernate/test/batch/BatchOptimisticLockingTest.java index c554de19df..34a6771187 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/batch/BatchOptimisticLockingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/batch/BatchOptimisticLockingTest.java @@ -20,6 +20,7 @@ import javax.persistence.Version; import org.hibernate.cfg.AvailableSettings; import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase; +import org.hibernate.testing.transaction.TransactionUtil; import org.junit.Test; import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate; @@ -67,7 +68,7 @@ public class BatchOptimisticLockingTest extends } ); try { - doInHibernate( this::sessionFactory, session -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> { List persons = session.createQuery( "select p from Person p").getResultList(); for ( int i = 0; i < persons.size(); i++ ) { diff --git a/hibernate-core/src/test/java/org/hibernate/test/batchfetch/BatchFetchNotFoundIgnoreDefaultStyleTest.java b/hibernate-core/src/test/java/org/hibernate/test/batchfetch/BatchFetchNotFoundIgnoreDefaultStyleTest.java index f992d5c407..1465875ec0 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/batchfetch/BatchFetchNotFoundIgnoreDefaultStyleTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/batchfetch/BatchFetchNotFoundIgnoreDefaultStyleTest.java @@ -28,6 +28,7 @@ import org.hibernate.persister.entity.EntityPersister; import org.hibernate.resource.jdbc.spi.StatementInspector; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; +import org.hibernate.testing.transaction.TransactionUtil; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -157,7 +158,7 @@ public class BatchFetchNotFoundIgnoreDefaultStyleTest extends BaseCoreFunctional public void testMostNotFoundFromQuery() { doInHibernate( - this::sessionFactory, session -> { + this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> { // delete all but last Task entity for ( int i = 0; i < 7; i++ ) { session.delete( tasks.get( i ) ); diff --git a/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/lazy/proxy/LoadANonExistingEntityTest.java b/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/lazy/proxy/LoadANonExistingEntityTest.java index 639827c46b..e70c042d65 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/lazy/proxy/LoadANonExistingEntityTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/lazy/proxy/LoadANonExistingEntityTest.java @@ -32,6 +32,7 @@ import org.hibernate.testing.TestForIssue; import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner; import org.hibernate.testing.bytecode.enhancement.EnhancementOptions; import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase; +import org.hibernate.testing.transaction.TransactionUtil; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -131,7 +132,7 @@ public class LoadANonExistingEntityTest extends BaseNonConfigCoreFunctionalTestC @Before public void setUpData() { doInHibernate( - this::sessionFactory, session -> { + this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> { for ( int i = 0; i < NUMBER_OF_ENTITIES; i++ ) { final Employee employee = new Employee(); employee.id = i + 1; diff --git a/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/lazy/proxy/LoadANonExistingNotFoundBatchEntityTest.java b/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/lazy/proxy/LoadANonExistingNotFoundBatchEntityTest.java index 94b155aa5d..631f7261c5 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/lazy/proxy/LoadANonExistingNotFoundBatchEntityTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/bytecode/enhancement/lazy/proxy/LoadANonExistingNotFoundBatchEntityTest.java @@ -39,6 +39,7 @@ import org.hibernate.testing.TestForIssue; import org.hibernate.testing.bytecode.enhancement.BytecodeEnhancerRunner; import org.hibernate.testing.bytecode.enhancement.EnhancementOptions; import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase; +import org.hibernate.testing.transaction.TransactionUtil; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -67,7 +68,7 @@ public class LoadANonExistingNotFoundBatchEntityTest extends BaseNonConfigCoreFu statistics.clear(); doInHibernate( - this::sessionFactory, session -> { + this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> { List employees = new ArrayList<>( NUMBER_OF_ENTITIES ); for ( int i = 0 ; i < NUMBER_OF_ENTITIES ; i++ ) { employees.add( session.load( Employee.class, i + 1 ) ); @@ -93,7 +94,7 @@ public class LoadANonExistingNotFoundBatchEntityTest extends BaseNonConfigCoreFu statistics.clear(); doInHibernate( - this::sessionFactory, session -> { + this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> { for ( int i = 0 ; i < NUMBER_OF_ENTITIES ; i++ ) { Employee employee = session.get( Employee.class, i + 1 ); assertNull( employee.employer ); @@ -115,7 +116,7 @@ public class LoadANonExistingNotFoundBatchEntityTest extends BaseNonConfigCoreFu statistics.clear(); doInHibernate( - this::sessionFactory, session -> { + this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> { for ( int i = 0; i < NUMBER_OF_ENTITIES; i++ ) { Employee employee = session.get( Employee.class, i + 1 ); Employer employer = new Employer(); @@ -127,7 +128,7 @@ public class LoadANonExistingNotFoundBatchEntityTest extends BaseNonConfigCoreFu ); doInHibernate( - this::sessionFactory, session -> { + this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> { for ( int i = 0; i < NUMBER_OF_ENTITIES; i++ ) { Employee employee = session.get( Employee.class, i + 1 ); assertTrue( Hibernate.isInitialized( employee.employer ) ); @@ -149,7 +150,7 @@ public class LoadANonExistingNotFoundBatchEntityTest extends BaseNonConfigCoreFu @Before public void setUpData() { doInHibernate( - this::sessionFactory, session -> { + this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> { for ( int i = 0; i < NUMBER_OF_ENTITIES; i++ ) { final Employee employee = new Employee(); employee.id = i + 1; diff --git a/hibernate-core/src/test/java/org/hibernate/test/dialect/functional/SQLServerDialectPaginationTest.java b/hibernate-core/src/test/java/org/hibernate/test/dialect/functional/SQLServerDialectPaginationTest.java index d4c9904942..6209a5e146 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/dialect/functional/SQLServerDialectPaginationTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/dialect/functional/SQLServerDialectPaginationTest.java @@ -21,6 +21,7 @@ import org.junit.Test; import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.TestForIssue; +import org.hibernate.testing.transaction.TransactionUtil; import static org.hibernate.testing.transaction.TransactionUtil.doInJPA; import static org.junit.Assert.assertEquals; @@ -54,7 +55,7 @@ public class SQLServerDialectPaginationTest extends BaseEntityManagerFunctionalT @Test public void testPaginationQuery() { // prepare some test data - doInJPA( this::entityManagerFactory, entityManager -> { + doInJPA( this::entityManagerFactory, (TransactionUtil.JPATransactionVoidFunction)entityManager -> { for ( int i = 1; i <= 20; ++i ) { final SimpleEntity entity = new SimpleEntity( i, "Entity" + i ); entityManager.persist( entity ); diff --git a/hibernate-core/src/test/java/org/hibernate/test/joinedsubclassbatch/IdentityJoinedSubclassBatchingTest.java b/hibernate-core/src/test/java/org/hibernate/test/joinedsubclassbatch/IdentityJoinedSubclassBatchingTest.java index 5efb442de2..a8b13e7e45 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/joinedsubclassbatch/IdentityJoinedSubclassBatchingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/joinedsubclassbatch/IdentityJoinedSubclassBatchingTest.java @@ -29,6 +29,7 @@ import org.hibernate.testing.DialectChecks; import org.hibernate.testing.RequiresDialectFeature; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; +import org.hibernate.testing.transaction.TransactionUtil; import org.junit.Assert; import org.junit.Test; @@ -92,7 +93,7 @@ public class IdentityJoinedSubclassBatchingTest extends BaseCoreFunctionalTestCa public void doBatchInsertUpdateJoined(int nEntities, int nBeforeFlush) { - doInHibernate( this::sessionFactory, s -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> { for ( int i = 0; i < nEntities; i++ ) { Employee e = new Employee(); e.getId(); @@ -110,7 +111,7 @@ public class IdentityJoinedSubclassBatchingTest extends BaseCoreFunctionalTestCa } } ); - doInHibernate( this::sessionFactory, s -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> { int i = 0; ScrollableResults sr = s.createQuery( "select e from Employee e" ) @@ -122,7 +123,7 @@ public class IdentityJoinedSubclassBatchingTest extends BaseCoreFunctionalTestCa } } ); - doInHibernate( this::sessionFactory, s -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> { int i = 0; ScrollableResults sr = s.createQuery( "select e from Employee e" ) @@ -139,7 +140,7 @@ public class IdentityJoinedSubclassBatchingTest extends BaseCoreFunctionalTestCa public void testAssertSubclassInsertedSuccessfullyAfterCommit() { final int nEntities = 10; - doInHibernate( this::sessionFactory, s -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> { for ( int i = 0; i < nEntities; i++ ) { Employee e = new Employee(); e.setName( "Mark" ); @@ -157,7 +158,7 @@ public class IdentityJoinedSubclassBatchingTest extends BaseCoreFunctionalTestCa Assert.assertEquals( nEntities, numberOfInsertedEmployee ); } ); - doInHibernate( this::sessionFactory, s -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> { int i = 0; ScrollableResults sr = s.createQuery( "select e from Employee e" ) @@ -190,7 +191,7 @@ public class IdentityJoinedSubclassBatchingTest extends BaseCoreFunctionalTestCa } ); - doInHibernate( this::sessionFactory, s -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> { int i = 0; ScrollableResults sr = s.createQuery( "select e from Employee e" ) diff --git a/hibernate-core/src/test/java/org/hibernate/test/joinedsubclassbatch/JoinedSubclassBatchingTest.java b/hibernate-core/src/test/java/org/hibernate/test/joinedsubclassbatch/JoinedSubclassBatchingTest.java index 1cce829ae5..59825bdece 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/joinedsubclassbatch/JoinedSubclassBatchingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/joinedsubclassbatch/JoinedSubclassBatchingTest.java @@ -27,6 +27,7 @@ import org.hibernate.cfg.Environment; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; +import org.hibernate.testing.transaction.TransactionUtil; import org.junit.Test; import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate; @@ -88,7 +89,7 @@ public class JoinedSubclassBatchingTest extends BaseCoreFunctionalTestCase { public void doBatchInsertUpdateJoined(int nEntities, int nBeforeFlush) { - doInHibernate( this::sessionFactory, s -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> { for ( int i = 0; i < nEntities; i++ ) { Employee e = new Employee(); e.getId(); @@ -106,7 +107,7 @@ public class JoinedSubclassBatchingTest extends BaseCoreFunctionalTestCase { } } ); - doInHibernate( this::sessionFactory, s -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> { int i = 0; ScrollableResults sr = s.createQuery( "select e from Employee e" ) @@ -118,7 +119,7 @@ public class JoinedSubclassBatchingTest extends BaseCoreFunctionalTestCase { } } ); - doInHibernate( this::sessionFactory, s -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> { int i = 0; ScrollableResults sr = s.createQuery( "select e from Employee e" ) diff --git a/hibernate-core/src/test/java/org/hibernate/test/joinedsubclassbatch/SequenceJoinedSubclassBatchingTest.java b/hibernate-core/src/test/java/org/hibernate/test/joinedsubclassbatch/SequenceJoinedSubclassBatchingTest.java index a310cb3639..e3e1e946c0 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/joinedsubclassbatch/SequenceJoinedSubclassBatchingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/joinedsubclassbatch/SequenceJoinedSubclassBatchingTest.java @@ -29,6 +29,7 @@ import org.hibernate.testing.DialectChecks; import org.hibernate.testing.RequiresDialectFeature; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase; +import org.hibernate.testing.transaction.TransactionUtil; import org.junit.Assert; import org.junit.Test; @@ -92,7 +93,7 @@ public class SequenceJoinedSubclassBatchingTest extends BaseCoreFunctionalTestCa public void doBatchInsertUpdateJoined(int nEntities, int nBeforeFlush) { - doInHibernate( this::sessionFactory, s -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> { for ( int i = 0; i < nEntities; i++ ) { Employee e = new Employee(); e.getId(); @@ -110,7 +111,7 @@ public class SequenceJoinedSubclassBatchingTest extends BaseCoreFunctionalTestCa } } ); - doInHibernate( this::sessionFactory, s -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> { int i = 0; ScrollableResults sr = s.createQuery( "select e from Employee e" ) @@ -122,7 +123,7 @@ public class SequenceJoinedSubclassBatchingTest extends BaseCoreFunctionalTestCa } } ); - doInHibernate( this::sessionFactory, s -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> { int i = 0; ScrollableResults sr = s.createQuery( "select e from Employee e" ) @@ -154,7 +155,7 @@ public class SequenceJoinedSubclassBatchingTest extends BaseCoreFunctionalTestCa } ); - doInHibernate( this::sessionFactory, s -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)s -> { int i = 0; ScrollableResults sr = s.createQuery( "select e from Employee e" ) diff --git a/hibernate-core/src/test/java/org/hibernate/test/locking/AbstractSkipLockedTest.java b/hibernate-core/src/test/java/org/hibernate/test/locking/AbstractSkipLockedTest.java index f22dfe972c..d758a89315 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/locking/AbstractSkipLockedTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/locking/AbstractSkipLockedTest.java @@ -18,6 +18,7 @@ import org.hibernate.query.Query; import org.hibernate.testing.RequiresDialect; import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase; +import org.hibernate.testing.transaction.TransactionUtil; import org.junit.Test; import static org.hibernate.testing.transaction.TransactionUtil.doInHibernate; @@ -40,7 +41,7 @@ public abstract class AbstractSkipLockedTest @RequiresDialect({ SQLServer2005Dialect.class }) public void testSQLServerSkipLocked() { - doInHibernate( this::sessionFactory, session -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> { for ( long i = 1; i <= 10; i++ ) { BatchJob batchJob = new BatchJob(); batchJob.setId( i ); @@ -73,7 +74,7 @@ public abstract class AbstractSkipLockedTest @RequiresDialect({ PostgreSQL95Dialect.class }) public void testPostgreSQLSkipLocked() { - doInHibernate( this::sessionFactory, session -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> { for ( long i = 1; i <= 10; i++ ) { BatchJob batchJob = new BatchJob(); batchJob.setId( i ); @@ -112,7 +113,7 @@ public abstract class AbstractSkipLockedTest @RequiresDialect({ Oracle8iDialect.class }) public void testOracleSkipLocked() { - doInHibernate( this::sessionFactory, session -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> { for ( long i = 1; i <= 10; i++ ) { BatchJob batchJob = new BatchJob(); batchJob.setId( i ); @@ -147,7 +148,7 @@ public abstract class AbstractSkipLockedTest @RequiresDialect({ MySQL8Dialect.class }) public void testMySQLSkipLocked() { - doInHibernate( this::sessionFactory, session -> { + doInHibernate( this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> { for ( long i = 1; i <= 10; i++ ) { BatchJob batchJob = new BatchJob(); batchJob.setId( i ); diff --git a/hibernate-core/src/test/java/org/hibernate/test/ops/multiLoad/MultiLoadSubSelectCollectionTest.java b/hibernate-core/src/test/java/org/hibernate/test/ops/multiLoad/MultiLoadSubSelectCollectionTest.java index 31bf5a1547..1b0a1e6e77 100644 --- a/hibernate-core/src/test/java/org/hibernate/test/ops/multiLoad/MultiLoadSubSelectCollectionTest.java +++ b/hibernate-core/src/test/java/org/hibernate/test/ops/multiLoad/MultiLoadSubSelectCollectionTest.java @@ -29,6 +29,7 @@ import org.hibernate.stat.Statistics; import org.hibernate.testing.TestForIssue; import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase; +import org.hibernate.testing.transaction.TransactionUtil; import org.junit.After; import org.junit.Before; import org.junit.Test; @@ -85,7 +86,7 @@ public class MultiLoadSubSelectCollectionTest extends BaseNonConfigCoreFunctiona @TestForIssue( jiraKey = "HHH-12740" ) public void testSubselect() { doInHibernate( - this::sessionFactory, session -> { + this::sessionFactory, (TransactionUtil.HibernateTransactionConsumer)session -> { List list = session.byMultipleIds( Parent.class ).multiLoad( ids(56) ); diff --git a/hibernate-testing/hibernate-testing.gradle b/hibernate-testing/hibernate-testing.gradle index 82b5d62095..151a558b5b 100644 --- a/hibernate-testing/hibernate-testing.gradle +++ b/hibernate-testing/hibernate-testing.gradle @@ -5,6 +5,8 @@ * See the lgpl.txt file in the root directory or . */ +import org.gradle.plugins.ide.eclipse.model.ProjectDependency + apply from: rootProject.file( 'gradle/published-java-module.gradle' ) description = 'Support for testing Hibernate ORM functionality' @@ -43,6 +45,37 @@ sourceSets.test.resources { setSrcDirs( ['src/test/java'] ) } +tasks.eclipse.dependsOn(cleanEclipse) +eclipse { + classpath { + file { + whenMerged { classpath -> + Set exclusionSourceSet = [ + //May be a saide efect of 'gradlew_process_test_resources' on hibernate-core.gradle. It will be?! + '/org.eclipse.ui.externaltools.ExternalToolBuilder' + ] + List newSourceSet = [] + classpath.entries.each { item -> + if( !exclusionSourceSet.contains( item.path ) ) { + //println( 'INCLUDING: ' + item ) + newSourceSet.add( item ) + } else { + //println( 'NOT INCLUDING: ' + item ) + } + } + println( 'newSourceSet:' ) + println( newSourceSet ) + + def hibernateCore = new ProjectDependency('/hibernate-core') + newSourceSet += [ + hibernateCore + ] + classpath.entries = newSourceSet + } + } + } +} + // todo : Fold into hibernate-core and publish in separate publications // once http://issues.gradle.org/browse/GRADLE-2966 is resolved; // that will allow us to keep the same artifactId and publish the pom