From addd21077e1e5d5a6bbb46ad4347272fc6586140 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] 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 );