Skip to content

Commit

Permalink
Align Hibernate Search's error messages and documentation for .enable…
Browse files Browse the repository at this point in the history
…/.active on ORM's
  • Loading branch information
yrodiere authored and miador committed Sep 6, 2022
1 parent 28d3225 commit 4aacb86
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ public class ConfigEnabledFalseAndActiveTrueTest {
.assertException(throwable -> assertThat(throwable)
.isInstanceOf(ConfigurationException.class)
.hasMessageContainingAll(
"Hibernate Search activated explicitly, but Hibernate Search was disabled at build time",
"If you want Hibernate Search to be active at runtime, you must set 'quarkus.hibernate-search-orm.enabled' to 'true' at build time",
"If you don't want Hibernate Search to be active at runtime, you must leave 'quarkus.hibernate-search-orm.active' unset or set it to 'false'"));
"Hibernate Search activated explicitly for persistence unit '<default>', but the Hibernate Search extension was disabled at build time",
"If you want Hibernate Search to be active for this persistence unit, you must set 'quarkus.hibernate-search-orm.enabled' to 'true' at build time",
"If you don't want Hibernate Search to be active for this persistence unit, you must leave 'quarkus.hibernate-search-orm.active' unset or set it to 'false'"));

@Test
public void test() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,12 @@ public void checkNoExplicitActiveTrue(HibernateSearchElasticsearchRuntimeConfig
String enabledPropertyKey = HibernateSearchElasticsearchRuntimeConfig.extensionPropertyKey("enabled");
String activePropertyKey = HibernateSearchElasticsearchRuntimeConfig.mapperPropertyKey(puName, "active");
throw new ConfigurationException(
"Hibernate Search activated explicitly, but Hibernate Search was disabled at build time."
+ " If you want Hibernate Search to be active at runtime, you must set '" + enabledPropertyKey
"Hibernate Search activated explicitly for persistence unit '" + puName
+ "', but the Hibernate Search extension was disabled at build time."
+ " If you want Hibernate Search to be active for this persistence unit, you must set '"
+ enabledPropertyKey
+ "' to 'true' at build time."
+ " If you don't want Hibernate Search to be active at runtime, you must leave '"
+ " If you don't want Hibernate Search to be active for this persistence unit, you must leave '"
+ activePropertyKey
+ "' unset or set it to 'false'.",
Set.of(enabledPropertyKey, activePropertyKey));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@
public class HibernateSearchElasticsearchRuntimeConfigPersistenceUnit {

/**
* Whether Hibernate Search should be active at runtime.
* Whether Hibernate Search should be active for this persistence unit at runtime.
*
* If Hibernate Search is not active, it won't index Hibernate ORM entities,
* and accessing the SearchMapping/SearchSession for search or other operation will not be possible.
* and accessing the SearchMapping/SearchSession of the relevant persistence unit
* for search or other operation will not be possible.
*
* Note that if Hibernate Search is disabled (i.e. `quarkus.hibernate-search-orm.enabled` is set to `false`),
* it won't be active, and setting this property to `true` will fail.
* it won't be active for any persistence unit, and setting this property to `true` will fail.
*
* @asciidoclet
*/
Expand Down

0 comments on commit 4aacb86

Please sign in to comment.