From 7b705aed05d4f2bb94705101870ef2d041537919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Tue, 19 Sep 2023 13:06:18 +0200 Subject: [PATCH 01/10] Force the use of bash even on Windows for GitHub Actions Powershell would not support escaping newlines, and would interpret dots as some object-oriented field accessor. None of this nonsense, let's just use bash. --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fe29d51dafc..b8db53a9044 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -36,8 +36,13 @@ concurrency: group: "workflow = ${{ github.workflow }}, ref = ${{ github.event.ref }}, pr = ${{ github.event.pull_request.id }}" cancel-in-progress: ${{ github.event_name == 'pull_request' || github.repository != 'hibernate/hibernate-search' }} +defaults: + run: + shell: bash + env: MAVEN_ARGS: "-e -B --settings .github/mvn-settings.xml --fail-at-end" + jobs: build: name: ${{matrix.os.name}} From d87e279e778d0b1a5017ef443d3a4fe3d197aeb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Wed, 20 Sep 2023 08:41:09 +0200 Subject: [PATCH 02/10] Change Maven config to allow skipping Lucene or Elasticsearch tests from the Maven CLI --- CONTRIBUTING.md | 22 ++++++++++++ build/parents/build/pom.xml | 18 +++++++--- build/parents/integrationtest/pom.xml | 17 ++++++++-- documentation/pom.xml | 4 ++- integrationtest/backend/elasticsearch/pom.xml | 3 +- integrationtest/backend/lucene/pom.xml | 1 + .../pom.xml | 5 ++- .../java/modules/orm-elasticsearch/pom.xml | 5 ++- .../java/modules/orm-lucene/pom.xml | 3 ++ .../pojo-standalone-elasticsearch/pom.xml | 5 ++- .../modules/pojo-standalone-lucene/pom.xml | 3 ++ .../mapper/orm-batch-jsr352/pom.xml | 2 +- .../mapper/orm-realbackend/pom.xml | 34 ++++++++++++++++++- .../orm-spring-uberjar/application/pom.xml | 16 ++++++++- .../pojo-standalone-realbackend/pom.xml | 4 ++- .../performance/backend/elasticsearch/pom.xml | 5 ++- .../performance/backend/lucene/pom.xml | 3 ++ integrationtest/showcase/library/pom.xml | 4 ++- .../v5migrationhelper/engine/pom.xml | 1 + integrationtest/v5migrationhelper/orm/pom.xml | 1 + 20 files changed, 139 insertions(+), 17 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index c22e7884906..5b7df5e97f0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -222,6 +222,10 @@ and run unit tests and integration tests. ./mvnw clean install ``` +Note: on Windows, you will need a Docker install able to run Linux containers. +If you don't have that, you can skip the Elasticsearch tests: +`./mvnw clean install -Dtest.elasticsearch.skip=true`. + Note: the produced JARs are compatible with Java 8 and later, regardless of the JDK used to build Hibernate Search. @@ -302,6 +306,17 @@ Or more simply, if the newer JDK you want to test against is newer than 17 and i ./mvnw clean install -Djava-version.test.release=18 ``` +### Lucene + +The Lucene integration tests do not, by themselves, +require any external setup. + +If you are not interested in Lucene integration tests (e.g. you only want to test Elasticsearch), +you can skip all Lucene tests with: + +```bash +./mvnw clean install -Dtest.lucene.skip=true +``` ### Elasticsearch The Elasticsearch integration tests run against one single version of Elasticsearch at a time, @@ -324,6 +339,13 @@ For available versions of [OpenSearch](https://www.opensearch.org/) distribution For Amazon OpenSearch Serverless, the version must be unset (set to an empty string). +When necessary (e.g. you don't have Docker, or are on Windows and can't run Linux containers), +you can skip all Elasticsearch tests (and thus the Elasticsearch container startup) with: + +```bash +./mvnw clean install -Dtest.elasticsearch.skip=true +``` + Alternatively, you can prevent the build from launching an Elasticsearch server automatically and run Elasticsearch-related tests against your own server using the `test.elasticsearch.connection.uris` property: diff --git a/build/parents/build/pom.xml b/build/parents/build/pom.xml index af82792ed75..50859f113f9 100644 --- a/build/parents/build/pom.xml +++ b/build/parents/build/pom.xml @@ -183,17 +183,27 @@ false + + + + false + + + false + true - - - - + + false @@ -480,7 +479,21 @@ - true + true + + + + + elasticsearch-test-skip + + + + test.elasticsearch.skip + true + + + + true diff --git a/documentation/pom.xml b/documentation/pom.xml index 745c0a0af4d..a9cb5a08ea6 100644 --- a/documentation/pom.xml +++ b/documentation/pom.xml @@ -20,7 +20,7 @@ Hibernate Search reference documentation - ${test.elasticsearch.connection.uris.defined} + ${test.elasticsearch.run.skip.forRelevantModules} false ${project.build.directory}/asciidoctor/ @@ -128,6 +128,7 @@ integration-test + ${test.lucene.skip} ${surefire.reportNameSuffix}-lucene org.hibernate.search:hibernate-search-backend-elasticsearch @@ -146,6 +147,7 @@ integration-test + ${test.elasticsearch.skip} ${surefire.reportNameSuffix}-elasticsearch org.hibernate.search:hibernate-search-backend-lucene diff --git a/integrationtest/backend/elasticsearch/pom.xml b/integrationtest/backend/elasticsearch/pom.xml index f4f22a06788..69d479e99f1 100644 --- a/integrationtest/backend/elasticsearch/pom.xml +++ b/integrationtest/backend/elasticsearch/pom.xml @@ -15,7 +15,7 @@ elasticsearch - ${test.elasticsearch.connection.uris.defined} + ${test.elasticsearch.run.skip.forRelevantModules} @@ -72,6 +72,7 @@ verify + ${test.elasticsearch.skip} ${project.groupId}:hibernate-search-integrationtest-backend-tck diff --git a/integrationtest/backend/lucene/pom.xml b/integrationtest/backend/lucene/pom.xml index 8c7c2e709b3..e05b425ff24 100644 --- a/integrationtest/backend/lucene/pom.xml +++ b/integrationtest/backend/lucene/pom.xml @@ -52,6 +52,7 @@ verify + ${test.lucene.skip} ${project.groupId}:hibernate-search-integrationtest-backend-tck diff --git a/integrationtest/java/modules/orm-coordination-outbox-polling-elasticsearch/pom.xml b/integrationtest/java/modules/orm-coordination-outbox-polling-elasticsearch/pom.xml index 213572f469a..7bce2dd9dc4 100644 --- a/integrationtest/java/modules/orm-coordination-outbox-polling-elasticsearch/pom.xml +++ b/integrationtest/java/modules/orm-coordination-outbox-polling-elasticsearch/pom.xml @@ -17,7 +17,7 @@ Hibernate Search integration tests for Java 11+ modules - ${test.elasticsearch.connection.uris.defined} + ${test.elasticsearch.run.skip.forRelevantModules} false 11 @@ -89,6 +89,9 @@ integration-test verify + + ${test.elasticsearch.skip} + diff --git a/integrationtest/java/modules/orm-elasticsearch/pom.xml b/integrationtest/java/modules/orm-elasticsearch/pom.xml index 7be3fa94079..ff8f331278c 100644 --- a/integrationtest/java/modules/orm-elasticsearch/pom.xml +++ b/integrationtest/java/modules/orm-elasticsearch/pom.xml @@ -17,7 +17,7 @@ Hibernate Search integration tests for Java 11+ modules - ${test.elasticsearch.connection.uris.defined} + ${test.elasticsearch.run.skip.forRelevantModules} false 11 @@ -71,6 +71,9 @@ integration-test verify + + ${test.elasticsearch.skip} + diff --git a/integrationtest/java/modules/orm-lucene/pom.xml b/integrationtest/java/modules/orm-lucene/pom.xml index 62ca9eb3e30..42099857889 100644 --- a/integrationtest/java/modules/orm-lucene/pom.xml +++ b/integrationtest/java/modules/orm-lucene/pom.xml @@ -66,6 +66,9 @@ integration-test verify + + ${test.lucene.skip} + diff --git a/integrationtest/java/modules/pojo-standalone-elasticsearch/pom.xml b/integrationtest/java/modules/pojo-standalone-elasticsearch/pom.xml index ea149b8e7ba..e3af263297e 100644 --- a/integrationtest/java/modules/pojo-standalone-elasticsearch/pom.xml +++ b/integrationtest/java/modules/pojo-standalone-elasticsearch/pom.xml @@ -17,7 +17,7 @@ Hibernate Search integration tests for Java 11+ modules - ${test.elasticsearch.connection.uris.defined} + ${test.elasticsearch.run.skip.forRelevantModules} false 11 @@ -63,6 +63,9 @@ integration-test verify + + ${test.elasticsearch.skip} + diff --git a/integrationtest/java/modules/pojo-standalone-lucene/pom.xml b/integrationtest/java/modules/pojo-standalone-lucene/pom.xml index 35e6acea286..dff13b01c0b 100644 --- a/integrationtest/java/modules/pojo-standalone-lucene/pom.xml +++ b/integrationtest/java/modules/pojo-standalone-lucene/pom.xml @@ -58,6 +58,9 @@ integration-test verify + + ${test.lucene.skip} + diff --git a/integrationtest/mapper/orm-batch-jsr352/pom.xml b/integrationtest/mapper/orm-batch-jsr352/pom.xml index 3ee02cc51a4..251e1e71866 100644 --- a/integrationtest/mapper/orm-batch-jsr352/pom.xml +++ b/integrationtest/mapper/orm-batch-jsr352/pom.xml @@ -13,7 +13,7 @@ Hibernate Search integration tests for the Batch JSR-352 integration - ${test.elasticsearch.connection.uris.defined} + ${test.elasticsearch.run.skip.forRelevantModules} false diff --git a/integrationtest/mapper/orm-realbackend/pom.xml b/integrationtest/mapper/orm-realbackend/pom.xml index c846cd2ef2d..6ef7eb36593 100644 --- a/integrationtest/mapper/orm-realbackend/pom.xml +++ b/integrationtest/mapper/orm-realbackend/pom.xml @@ -13,8 +13,11 @@ Hibernate Search integration tests for the Hibernate ORM mapper with a real (non-mock) backend - ${test.elasticsearch.connection.uris.defined} + ${test.elasticsearch.run.skip.forRelevantModules} false + + + false @@ -77,6 +80,7 @@ integration-test + ${test.lucene.skip} ${surefire.reportNameSuffix}-lucene org.hibernate.search:hibernate-search-backend-elasticsearch @@ -96,6 +100,7 @@ integration-test + ${test.elasticsearch.skip} ${surefire.reportNameSuffix}-elasticsearch org.hibernate.search:hibernate-search-backend-lucene @@ -115,6 +120,7 @@ integration-test + ${test.multiplebackends.skip} ${surefire.reportNameSuffix}-multiplebackends org.hibernate.search.integrationtest.mapper.orm.realbackend.bootstrap.BackendTypeAutoDetectMultipleBackendTypesInClasspathIT @@ -138,5 +144,31 @@ + + + skipLuceneTests + + + test.lucene.skip + true + + + + true + + + + skipElasticsearchTests + + + test.elasticsearch.skip + true + + + + true + + + diff --git a/integrationtest/mapper/orm-spring-uberjar/application/pom.xml b/integrationtest/mapper/orm-spring-uberjar/application/pom.xml index 126b59883ea..34a230d6cef 100644 --- a/integrationtest/mapper/orm-spring-uberjar/application/pom.xml +++ b/integrationtest/mapper/orm-spring-uberjar/application/pom.xml @@ -68,7 +68,6 @@ - @@ -123,5 +122,20 @@ + + + + skipLuceneTests + + + test.lucene.skip + true + + + + true + + + diff --git a/integrationtest/mapper/pojo-standalone-realbackend/pom.xml b/integrationtest/mapper/pojo-standalone-realbackend/pom.xml index 9c687e374c6..48963149289 100644 --- a/integrationtest/mapper/pojo-standalone-realbackend/pom.xml +++ b/integrationtest/mapper/pojo-standalone-realbackend/pom.xml @@ -13,7 +13,7 @@ Hibernate Search integration tests for the POJO Standalone mapper with a real (non-mock) backend - ${test.elasticsearch.connection.uris.defined} + ${test.elasticsearch.run.skip.forRelevantModules} @@ -63,6 +63,7 @@ integration-test + ${test.lucene.skip} ${surefire.reportNameSuffix}-lucene org.hibernate.search:hibernate-search-backend-elasticsearch @@ -81,6 +82,7 @@ integration-test + ${test.elasticsearch.skip} ${surefire.reportNameSuffix}-elasticsearch org.hibernate.search:hibernate-search-backend-lucene diff --git a/integrationtest/performance/backend/elasticsearch/pom.xml b/integrationtest/performance/backend/elasticsearch/pom.xml index e300f8603d1..3156643b30f 100644 --- a/integrationtest/performance/backend/elasticsearch/pom.xml +++ b/integrationtest/performance/backend/elasticsearch/pom.xml @@ -22,7 +22,7 @@ true - ${test.elasticsearch.connection.uris.defined} + ${test.elasticsearch.run.skip.forRelevantModules} @@ -59,6 +59,9 @@ integration-test verify + + ${test.elasticsearch.skip} + diff --git a/integrationtest/performance/backend/lucene/pom.xml b/integrationtest/performance/backend/lucene/pom.xml index 02b8dee266c..3a84d0af28d 100644 --- a/integrationtest/performance/backend/lucene/pom.xml +++ b/integrationtest/performance/backend/lucene/pom.xml @@ -53,6 +53,9 @@ integration-test verify + + ${test.lucene.skip} + diff --git a/integrationtest/showcase/library/pom.xml b/integrationtest/showcase/library/pom.xml index 044f7cd3d6c..3260aa0f778 100644 --- a/integrationtest/showcase/library/pom.xml +++ b/integrationtest/showcase/library/pom.xml @@ -13,7 +13,7 @@ Hibernate Search showcase based on the ORM and Elasticsearch integrations, using libraries and books as business objects - ${test.elasticsearch.connection.uris.defined} + ${test.elasticsearch.run.skip.forRelevantModules} false @@ -207,6 +208,7 @@ integration-test + ${test.elasticsearch.skip} ${surefire.reportNameSuffix}-elasticsearch diff --git a/integrationtest/v5migrationhelper/engine/pom.xml b/integrationtest/v5migrationhelper/engine/pom.xml index 2bcf836901d..fb440121b3e 100755 --- a/integrationtest/v5migrationhelper/engine/pom.xml +++ b/integrationtest/v5migrationhelper/engine/pom.xml @@ -78,6 +78,7 @@ verify + ${test.lucene.skip} **/*IT.java + true + + + + diff --git a/integrationtest/performance/backend/lucene/pom.xml b/integrationtest/performance/backend/lucene/pom.xml index 3a84d0af28d..51143b3621d 100644 --- a/integrationtest/performance/backend/lucene/pom.xml +++ b/integrationtest/performance/backend/lucene/pom.xml @@ -127,4 +127,19 @@ + + + windows + + + windows + + + + + true + + + + From 8071280068fdad69da8ef8906741c67efc9aecdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Wed, 20 Sep 2023 17:05:48 +0200 Subject: [PATCH 06/10] Fix test filters for Windows The documentation states that we should only get forward slashes here, but that doesn't seem to be the case. --- .../mapper/orm-coordination-outbox-polling/pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/integrationtest/mapper/orm-coordination-outbox-polling/pom.xml b/integrationtest/mapper/orm-coordination-outbox-polling/pom.xml index 397b80fd15d..be54ce1b1e3 100644 --- a/integrationtest/mapper/orm-coordination-outbox-polling/pom.xml +++ b/integrationtest/mapper/orm-coordination-outbox-polling/pom.xml @@ -78,9 +78,9 @@ - %regex[org/hibernate/search/integrationtest/mapper/orm/coordination/outboxpolling/.*IT\.class] + %regex[org[/\\]hibernate[/\\]search[/\\]integrationtest[/\\]mapper[/\\]orm[/\\]coordination[/\\]outboxpolling[/\\].*IT\.class] - %regex[org/hibernate/search/integrationtest/mapper/orm/automaticindexing/.*IT\.class] + %regex[org[/\\]hibernate[/\\]search[/\\]integrationtest[/\\]mapper[/\\]orm[/\\]automaticindexing[/\\].*IT\.class] From 6ddd501ced455eea0ec3f844cea1dd3f2773b573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Thu, 21 Sep 2023 16:34:00 +0200 Subject: [PATCH 07/10] Fix GitHub Actions build reports on Windows --- .github/workflows/build.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c6862ae4635..e2626a78d79 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -117,11 +117,21 @@ jobs: run: ./ci/docker-cleanup.sh - name: Omit produced artifacts from build cache run: rm -r ~/.m2/repository/org/hibernate/search + # Workaround for https://github.com/actions/upload-artifact/issues/240 + - name: List build reports to upload (if build failed) + if: ${{ failure() || cancelled() }} + # The weird syntax is because we're setting a multiline environment variable + # See https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#example-of-a-multiline-string + run: | + { + echo 'buildReportPaths<> "$GITHUB_ENV" - name: Upload build reports (if build failed) uses: actions/upload-artifact@v3 if: ${{ failure() || cancelled() }} with: - name: ${{ format('build-reports-{0}', github.job) }} - path: | - ./**/*-reports/ - retention-days: 2 + name: ${{ format('build-reports-{0}', matrix.os.name ) }} + path: ${{ env.buildReportPaths }} + retention-days: 7 From f70f01f980d1eacfaa0b9ff048da99924e57d765 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Fri, 22 Sep 2023 08:08:38 +0200 Subject: [PATCH 08/10] Skip outbox-polling integration tests on Windows See https://hibernate.atlassian.net/browse/HSEARCH-4965 --- .../orm-coordination-outbox-polling/pom.xml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/integrationtest/mapper/orm-coordination-outbox-polling/pom.xml b/integrationtest/mapper/orm-coordination-outbox-polling/pom.xml index be54ce1b1e3..11af0318c9a 100644 --- a/integrationtest/mapper/orm-coordination-outbox-polling/pom.xml +++ b/integrationtest/mapper/orm-coordination-outbox-polling/pom.xml @@ -111,4 +111,19 @@ + + + windows + + + windows + + + + + true + + + + From 7270857ed31958cfd04359d4fed57c58df362187 Mon Sep 17 00:00:00 2001 From: marko-bekhta Date: Mon, 18 Sep 2023 19:23:01 +0200 Subject: [PATCH 09/10] HSEARCH-4947 Make sure that nested jars can be read on Windows --- .../search/util/common/jar/impl/CodeSource.java | 2 +- .../search/util/common/jar/impl/CodeSourceTest.java | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/util/common/src/main/java/org/hibernate/search/util/common/jar/impl/CodeSource.java b/util/common/src/main/java/org/hibernate/search/util/common/jar/impl/CodeSource.java index 83cd3bf43f2..7248804d362 100644 --- a/util/common/src/main/java/org/hibernate/search/util/common/jar/impl/CodeSource.java +++ b/util/common/src/main/java/org/hibernate/search/util/common/jar/impl/CodeSource.java @@ -150,7 +150,7 @@ else if ( "file".equals( codeSourceLocation.getProtocol() ) ) { else { // The URI points to a regular file, so hopefully an actual JAR file. // We'll try to open a ZIP filesystem to work on the contents of the JAR file. - URI jarUri = new URI( "jar:file", null, path.toString(), null ); + URI jarUri = new URI( "jar:file", null, path.toUri().getPath(), null ); tryInitJarFileSystem( jarUri ); } } diff --git a/util/common/src/test/java/org/hibernate/search/util/common/jar/impl/CodeSourceTest.java b/util/common/src/test/java/org/hibernate/search/util/common/jar/impl/CodeSourceTest.java index 5b8b6714f98..e4fcc766601 100644 --- a/util/common/src/test/java/org/hibernate/search/util/common/jar/impl/CodeSourceTest.java +++ b/util/common/src/test/java/org/hibernate/search/util/common/jar/impl/CodeSourceTest.java @@ -51,13 +51,14 @@ public void directory() throws Exception { addSimpleClass( root ); } ); - try ( URLClassLoader isolatedClassLoader = createIsolatedClassLoader( dirPath.toUri().toURL() ) ) { + URL dirPathUrl = dirPath.toUri().toURL(); + try ( URLClassLoader isolatedClassLoader = createIsolatedClassLoader( dirPathUrl ) ) { Class classInIsolatedClassLoader = isolatedClassLoader.loadClass( SimpleClass.class.getName() ); // Check preconditions: this is the situation that we want to test. URL location = classInIsolatedClassLoader.getProtectionDomain().getCodeSource().getLocation(); assertThat( location.getProtocol() ).isEqualTo( "file" ); - assertThat( location.toExternalForm() ).contains( dirPath.toString() ); + assertThat( location.toExternalForm() ).contains( dirPathUrl.toString() ); // Check that the JAR can be opened and that we can access other files within it try ( CodeSource codeSource = new CodeSource( location ) ) { @@ -86,13 +87,14 @@ public void jar_fileScheme() throws Exception { addSimpleClass( root ); } ); - try ( URLClassLoader isolatedClassLoader = createIsolatedClassLoader( jarPath.toUri().toURL() ) ) { + URL jarPathUrl = jarPath.toUri().toURL(); + try ( URLClassLoader isolatedClassLoader = createIsolatedClassLoader( jarPathUrl ) ) { Class classInIsolatedClassLoader = isolatedClassLoader.loadClass( SimpleClass.class.getName() ); // Check preconditions: this is the situation that we want to test. URL location = classInIsolatedClassLoader.getProtectionDomain().getCodeSource().getLocation(); assertThat( location.getProtocol() ).isEqualTo( "file" ); - assertThat( location.toExternalForm() ).contains( jarPath.toString() ); + assertThat( location.toExternalForm() ).contains( jarPathUrl.toString() ); // Check that the JAR can be opened and that we can access other files within it try ( CodeSource codeSource = new CodeSource( location ) ) { @@ -130,7 +132,7 @@ public void jar_jarScheme_classesInRoot() throws Exception { URL location = classInIsolatedClassLoader.getProtectionDomain().getCodeSource().getLocation(); // For some reason the "jar" scheme gets replaced with "file" assertThat( location.getProtocol() ).isEqualTo( "file" ); - assertThat( location.toExternalForm() ).contains( jarPath.toString() ); + assertThat( location.toExternalForm() ).contains( jarPath.toUri().toURL().toString() ); // Check that the JAR can be opened and that we can access other files within it try ( CodeSource codeSource = new CodeSource( location ) ) { From fb1bdabbd22b1516524551e2015aa6807e50b8c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Wed, 20 Sep 2023 10:58:58 +0200 Subject: [PATCH 10/10] HSEARCH-4947 Fix incomplete configuration in *SchemaManagerExporterIT Not strictly necessary, but while we're at it... --- .../mapper/orm-realbackend/pom.xml | 2 -- .../ElasticsearchSchemaManagerExporterIT.java | 22 ++++++++++--------- .../LuceneSchemaManagerExporterIT.java | 12 +++++----- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/integrationtest/mapper/orm-realbackend/pom.xml b/integrationtest/mapper/orm-realbackend/pom.xml index 6ef7eb36593..8b09f9a6ec4 100644 --- a/integrationtest/mapper/orm-realbackend/pom.xml +++ b/integrationtest/mapper/orm-realbackend/pom.xml @@ -124,8 +124,6 @@ ${surefire.reportNameSuffix}-multiplebackends org.hibernate.search.integrationtest.mapper.orm.realbackend.bootstrap.BackendTypeAutoDetectMultipleBackendTypesInClasspathIT - org.hibernate.search.integrationtest.mapper.orm.realbackend.schema.management.ElasticsearchSchemaManagerExporterIT - org.hibernate.search.integrationtest.mapper.orm.realbackend.schema.management.LuceneSchemaManagerExporterIT diff --git a/integrationtest/mapper/orm-realbackend/src/test/java/org/hibernate/search/integrationtest/mapper/orm/realbackend/schema/management/ElasticsearchSchemaManagerExporterIT.java b/integrationtest/mapper/orm-realbackend/src/test/java/org/hibernate/search/integrationtest/mapper/orm/realbackend/schema/management/ElasticsearchSchemaManagerExporterIT.java index 65d172ee5d7..3f891bbae93 100644 --- a/integrationtest/mapper/orm-realbackend/src/test/java/org/hibernate/search/integrationtest/mapper/orm/realbackend/schema/management/ElasticsearchSchemaManagerExporterIT.java +++ b/integrationtest/mapper/orm-realbackend/src/test/java/org/hibernate/search/integrationtest/mapper/orm/realbackend/schema/management/ElasticsearchSchemaManagerExporterIT.java @@ -14,15 +14,18 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; import jakarta.persistence.EntityManagerFactory; +import org.hibernate.search.backend.elasticsearch.cfg.ElasticsearchBackendSettings; import org.hibernate.search.integrationtest.mapper.orm.realbackend.testsupport.BackendConfigurations; import org.hibernate.search.integrationtest.mapper.orm.realbackend.util.Article; import org.hibernate.search.integrationtest.mapper.orm.realbackend.util.Book; import org.hibernate.search.mapper.orm.Search; +import org.hibernate.search.mapper.orm.cfg.HibernateOrmMapperSettings; import org.hibernate.search.util.impl.integrationtest.backend.elasticsearch.dialect.ElasticsearchTestDialect; import org.hibernate.search.util.impl.integrationtest.mapper.orm.OrmSetupHelper; @@ -35,7 +38,10 @@ public class ElasticsearchSchemaManagerExporterIT { @Rule public final TemporaryFolder temporaryFolder = new TemporaryFolder(); @Rule - public OrmSetupHelper setupHelper = OrmSetupHelper.withSingleBackend( BackendConfigurations.simple() ); + public OrmSetupHelper setupHelper = OrmSetupHelper.withMultipleBackends( + BackendConfigurations.simple(), + Map.of( Article.BACKEND_NAME, BackendConfigurations.simple() ) + ); private EntityManagerFactory entityManagerFactory; @@ -51,15 +57,11 @@ public void elasticsearch() throws IOException { String version = ElasticsearchTestDialect.getActualVersion().toString(); entityManagerFactory = setupHelper.start() // so that we don't try to do anything with the schema and allow to run without ES being up: - .withProperty( "hibernate.search.schema_management.strategy", "none" ) - - .withProperty( "hibernate.search.backend.type", "elasticsearch" ) - .withProperty( "hibernate.search.backend.version_check.enabled", false ) - .withProperty( "hibernate.search.backend.version", version ) - - .withProperty( "hibernate.search.backends." + Article.BACKEND_NAME + ".type", "elasticsearch" ) - .withProperty( "hibernate.search.backends." + Article.BACKEND_NAME + ".version_check.enabled", false ) - .withProperty( "hibernate.search.backends." + Article.BACKEND_NAME + ".version", version ) + .withProperty( HibernateOrmMapperSettings.SCHEMA_MANAGEMENT_STRATEGY, "none" ) + .withBackendProperty( ElasticsearchBackendSettings.VERSION_CHECK_ENABLED, false ) + .withBackendProperty( ElasticsearchBackendSettings.VERSION, version ) + .withBackendProperty( Article.BACKEND_NAME, ElasticsearchBackendSettings.VERSION_CHECK_ENABLED, false ) + .withBackendProperty( Article.BACKEND_NAME, ElasticsearchBackendSettings.VERSION, version ) .setup( Book.class, Article.class ); Path directory = temporaryFolder.newFolder().toPath(); diff --git a/integrationtest/mapper/orm-realbackend/src/test/java/org/hibernate/search/integrationtest/mapper/orm/realbackend/schema/management/LuceneSchemaManagerExporterIT.java b/integrationtest/mapper/orm-realbackend/src/test/java/org/hibernate/search/integrationtest/mapper/orm/realbackend/schema/management/LuceneSchemaManagerExporterIT.java index e99adca80c4..413f8809bb5 100644 --- a/integrationtest/mapper/orm-realbackend/src/test/java/org/hibernate/search/integrationtest/mapper/orm/realbackend/schema/management/LuceneSchemaManagerExporterIT.java +++ b/integrationtest/mapper/orm-realbackend/src/test/java/org/hibernate/search/integrationtest/mapper/orm/realbackend/schema/management/LuceneSchemaManagerExporterIT.java @@ -11,6 +11,7 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.util.Map; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -31,17 +32,16 @@ public class LuceneSchemaManagerExporterIT { @Rule public final TemporaryFolder temporaryFolder = new TemporaryFolder(); @Rule - public OrmSetupHelper setupHelper = OrmSetupHelper.withSingleBackend( BackendConfigurations.simple() ); + public OrmSetupHelper setupHelper = OrmSetupHelper.withMultipleBackends( + BackendConfigurations.simple(), + Map.of( Article.BACKEND_NAME, BackendConfigurations.simple() ) + ); private EntityManagerFactory entityManagerFactory; @Test public void lucene() throws IOException { - entityManagerFactory = setupHelper.start() - .withProperty( "hibernate.search.backend.type", "lucene" ) - - .withProperty( "hibernate.search.backends." + Article.BACKEND_NAME + ".type", "lucene" ) - .setup( Book.class, Article.class ); + entityManagerFactory = setupHelper.start().setup( Book.class, Article.class ); Path directory = temporaryFolder.newFolder().toPath(); Search.mapping( entityManagerFactory ).scope( Object.class ).schemaManager().exportExpectedSchema( directory );