From 6ca1498277fbb55a07b27e1da28f8d95e60b2581 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Mon, 13 Nov 2017 15:49:12 -0500 Subject: [PATCH] Fix tests for spring boot --- appveyor.yml | 5 +++ .../search/LuceneSearchMappingFactory.java | 38 +++++++++---------- .../ca/uhn/fhir/jpa/config/TestR4Config.java | 2 +- .../FhirAutoConfigurationTest.java | 3 +- .../src/main/resources/application.yml | 2 + 5 files changed, 29 insertions(+), 21 deletions(-) create mode 100644 appveyor.yml diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000000..a56e90eafa3 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,5 @@ +version: 1.0.{build} +image: Visual Studio 2017 +cache: C:\Users\appveyor\.m2\repository +build_script: +- cmd: mvn install \ No newline at end of file diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/LuceneSearchMappingFactory.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/LuceneSearchMappingFactory.java index fdf74d57ba3..1f950f28ed4 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/LuceneSearchMappingFactory.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/search/LuceneSearchMappingFactory.java @@ -23,28 +23,28 @@ public class LuceneSearchMappingFactory { SearchMapping mapping = new SearchMapping(); mapping.analyzerDef("autocompleteEdgeAnalyzer", PatternTokenizerFactory.class) - .tokenizerParam("pattern", "(.*)") - .tokenizerParam("group", "1") - .filter(LowerCaseFilterFactory.class) - .filter(StopFilterFactory.class) - .filter(EdgeNGramFilterFactory.class) - .param("minGramSize", "3") - .param("maxGramSize", "50") + .tokenizerParam("pattern", "(.*)") + .tokenizerParam("group", "1") + .filter(LowerCaseFilterFactory.class) + .filter(StopFilterFactory.class) + .filter(EdgeNGramFilterFactory.class) + .param("minGramSize", "3") + .param("maxGramSize", "50") .analyzerDef("autocompletePhoneticAnalyzer", StandardTokenizerFactory.class) - .filter(StandardFilterFactory.class) - .filter(StopFilterFactory.class) - .filter(PhoneticFilterFactory.class) - .param("encoder", "DoubleMetaphone") - .filter(SnowballPorterFilterFactory.class) - .param("language", "English") + .filter(StandardFilterFactory.class) + .filter(StopFilterFactory.class) + .filter(PhoneticFilterFactory.class) + .param("encoder", "DoubleMetaphone") + .filter(SnowballPorterFilterFactory.class) + .param("language", "English") .analyzerDef("autocompleteNGramAnalyzer", StandardTokenizerFactory.class) - .filter(WordDelimiterFilterFactory.class) - .filter(LowerCaseFilterFactory.class) - .filter(NGramFilterFactory.class) - .param("minGramSize", "3") - .param("maxGramSize", "20") + .filter(WordDelimiterFilterFactory.class) + .filter(LowerCaseFilterFactory.class) + .filter(NGramFilterFactory.class) + .param("minGramSize", "3") + .param("maxGramSize", "20") .analyzerDef("standardAnalyzer", StandardTokenizerFactory.class) - .filter(LowerCaseFilterFactory.class) + .filter(LowerCaseFilterFactory.class) .analyzerDef("exactAnalyzer", StandardTokenizerFactory.class) .analyzerDef("conceptParentPidsAnalyzer", WhitespaceTokenizerFactory.class); diff --git a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java index f0ee6652136..d40ea5d2284 100644 --- a/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java +++ b/hapi-fhir-jpaserver-base/src/test/java/ca/uhn/fhir/jpa/config/TestR4Config.java @@ -126,7 +126,7 @@ public class TestR4Config extends BaseJavaConfigR4 { extraProperties.put("hibernate.show_sql", "false"); extraProperties.put("hibernate.hbm2ddl.auto", "update"); extraProperties.put("hibernate.dialect", "org.hibernate.dialect.DerbyTenSevenDialect"); - extraProperties.put("hibernate.search.model_mapping", LuceneSearchMappingFactory.class.getName()); + extraProperties.put("hibernate.search.model_mapping", ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory.class.getName()); extraProperties.put("hibernate.search.default.directory_provider", "ram"); extraProperties.put("hibernate.search.lucene_version", "LUCENE_CURRENT"); extraProperties.put("hibernate.search.autoregister_listeners", "true"); diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/src/test/java/ca/uhn/fhir/spring/boot/autoconfigure/FhirAutoConfigurationTest.java b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/src/test/java/ca/uhn/fhir/spring/boot/autoconfigure/FhirAutoConfigurationTest.java index 7f9f8fc16ff..3b3023e4eff 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/src/test/java/ca/uhn/fhir/spring/boot/autoconfigure/FhirAutoConfigurationTest.java +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-autoconfigure/src/test/java/ca/uhn/fhir/spring/boot/autoconfigure/FhirAutoConfigurationTest.java @@ -76,7 +76,8 @@ public class FhirAutoConfigurationTest { PropertyPlaceholderAutoConfiguration.class, FhirAutoConfiguration.class), "hapi.fhir.version:DSTU3", - "spring.jpa.properties.hibernate.search.default.indexBase:target/lucenefiles"); + "spring.jpa.properties.hibernate.search.default.indexBase:target/lucenefiles", + "spring.jpa.properties.hibernate.search.model_mapping:ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory"); assertThat(this.context.getBeansOfType(DaoConfig.class)).hasSize(1); assertThat(this.context.getBeansOfType(Dstu3.class)).hasSize(1); } diff --git a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jpa/src/main/resources/application.yml b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jpa/src/main/resources/application.yml index a28ca61340f..2c2f591eb69 100644 --- a/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jpa/src/main/resources/application.yml +++ b/hapi-fhir-spring-boot/hapi-fhir-spring-boot-samples/hapi-fhir-spring-boot-sample-server-jpa/src/main/resources/application.yml @@ -11,6 +11,8 @@ spring: hibernate.search.default.directory_provider: filesystem hibernate.search.default.indexBase: target/lucenefiles hibernate.search.lucene_version: LUCENE_CURRENT + hibernate.search.model_mapping: ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory + h2: console: enabled: true