Iam opensearch auth (#4011)
* Bump HS version, add support for credential provider * License files * Use index settings file instead of injecting a template at boot * Changelog * Typo * fix logs * Add javadoc
This commit is contained in:
parent
4226cae752
commit
cb3cc1f434
|
@ -25,7 +25,7 @@ public final class Msg {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IMPORTANT: Please update the following comment after you add a new code
|
* IMPORTANT: Please update the following comment after you add a new code
|
||||||
* Last used code value: 2138
|
* Last used code value: 2139
|
||||||
*/
|
*/
|
||||||
|
|
||||||
private Msg() {}
|
private Msg() {}
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
package ca.uhn.fhir.util;
|
package ca.uhn.fhir.util;
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* #%L
|
||||||
|
* HAPI FHIR - Core Library
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||||
|
* %%
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
|
||||||
public class TimeoutException extends RuntimeException {
|
public class TimeoutException extends RuntimeException {
|
||||||
public TimeoutException(String theMessage) {
|
public TimeoutException(String theMessage) {
|
||||||
super(theMessage);
|
super(theMessage);
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
package ca.uhn.fhir.util;
|
package ca.uhn.fhir.util;
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* #%L
|
||||||
|
* HAPI FHIR - Core Library
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||||
|
* %%
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
|
||||||
import ca.uhn.fhir.i18n.Msg;
|
import ca.uhn.fhir.i18n.Msg;
|
||||||
import com.google.common.annotations.VisibleForTesting;
|
import com.google.common.annotations.VisibleForTesting;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
---
|
||||||
|
type: add
|
||||||
|
jira: SMILE-4665
|
||||||
|
title: "Added support for AWS OpenSearch to Fulltext Search. If an AWS Region is configured, HAPI-FHIR will assume you intend to connect to an AWS-managed OpenSearch instance, and will use
|
||||||
|
Amazon's [DefaultAwsCredentialsProviderChain](https://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/auth/DefaultAWSCredentialsProviderChain.html) to authenticate against it. If both username and password are provided, HAPI-FHIR will attempt to use them as a static credentials provider."
|
||||||
|
|
|
@ -332,6 +332,10 @@
|
||||||
<groupId>org.hibernate.search</groupId>
|
<groupId>org.hibernate.search</groupId>
|
||||||
<artifactId>hibernate-search-backend-lucene</artifactId>
|
<artifactId>hibernate-search-backend-lucene</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate.search</groupId>
|
||||||
|
<artifactId>hibernate-search-backend-elasticsearch-aws</artifactId>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.lucene</groupId>
|
<groupId>org.apache.lucene</groupId>
|
||||||
<artifactId>lucene-analyzers-phonetic</artifactId>
|
<artifactId>lucene-analyzers-phonetic</artifactId>
|
||||||
|
|
|
@ -23,13 +23,9 @@ package ca.uhn.fhir.jpa.search.elastic;
|
||||||
import ca.uhn.fhir.context.ConfigurationException;
|
import ca.uhn.fhir.context.ConfigurationException;
|
||||||
import ca.uhn.fhir.i18n.Msg;
|
import ca.uhn.fhir.i18n.Msg;
|
||||||
import ca.uhn.fhir.jpa.search.HapiHSearchAnalysisConfigurers;
|
import ca.uhn.fhir.jpa.search.HapiHSearchAnalysisConfigurers;
|
||||||
import ca.uhn.fhir.jpa.search.lastn.ElasticsearchRestClientFactory;
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.elasticsearch.action.support.master.AcknowledgedResponse;
|
import org.hibernate.search.backend.elasticsearch.aws.cfg.ElasticsearchAwsBackendSettings;
|
||||||
import org.elasticsearch.client.RequestOptions;
|
import org.hibernate.search.backend.elasticsearch.aws.cfg.ElasticsearchAwsCredentialsTypeNames;
|
||||||
import org.elasticsearch.client.RestHighLevelClient;
|
|
||||||
import org.elasticsearch.client.indices.PutIndexTemplateRequest;
|
|
||||||
import org.elasticsearch.common.settings.Settings;
|
|
||||||
import org.hibernate.search.backend.elasticsearch.cfg.ElasticsearchBackendSettings;
|
import org.hibernate.search.backend.elasticsearch.cfg.ElasticsearchBackendSettings;
|
||||||
import org.hibernate.search.backend.elasticsearch.cfg.ElasticsearchIndexSettings;
|
import org.hibernate.search.backend.elasticsearch.cfg.ElasticsearchIndexSettings;
|
||||||
import org.hibernate.search.backend.elasticsearch.index.IndexStatus;
|
import org.hibernate.search.backend.elasticsearch.index.IndexStatus;
|
||||||
|
@ -39,9 +35,6 @@ import org.hibernate.search.mapper.orm.cfg.HibernateOrmMapperSettings;
|
||||||
import org.hibernate.search.mapper.orm.schema.management.SchemaManagementStrategyName;
|
import org.hibernate.search.mapper.orm.schema.management.SchemaManagementStrategyName;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
import static org.hibernate.search.backend.elasticsearch.cfg.ElasticsearchBackendSettings.Defaults.SCROLL_TIMEOUT;
|
import static org.hibernate.search.backend.elasticsearch.cfg.ElasticsearchBackendSettings.Defaults.SCROLL_TIMEOUT;
|
||||||
|
@ -62,6 +55,13 @@ public class ElasticsearchHibernatePropertiesBuilder {
|
||||||
private String myHosts;
|
private String myHosts;
|
||||||
private String myUsername;
|
private String myUsername;
|
||||||
private String myPassword;
|
private String myPassword;
|
||||||
|
|
||||||
|
public String getAwsRegion() {
|
||||||
|
return myAwsRegion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private String myAwsRegion;
|
||||||
private long myIndexManagementWaitTimeoutMillis = 10000L;
|
private long myIndexManagementWaitTimeoutMillis = 10000L;
|
||||||
private long myScrollTimeoutSecs = SCROLL_TIMEOUT;
|
private long myScrollTimeoutSecs = SCROLL_TIMEOUT;
|
||||||
private String myDebugSyncStrategy = AutomaticIndexingSynchronizationStrategyNames.ASYNC;
|
private String myDebugSyncStrategy = AutomaticIndexingSynchronizationStrategyNames.ASYNC;
|
||||||
|
@ -106,7 +106,21 @@ public class ElasticsearchHibernatePropertiesBuilder {
|
||||||
//This tells elasticsearch to use our custom index naming strategy.
|
//This tells elasticsearch to use our custom index naming strategy.
|
||||||
theProperties.put(BackendSettings.backendKey(ElasticsearchBackendSettings.LAYOUT_STRATEGY), IndexNamePrefixLayoutStrategy.class.getName());
|
theProperties.put(BackendSettings.backendKey(ElasticsearchBackendSettings.LAYOUT_STRATEGY), IndexNamePrefixLayoutStrategy.class.getName());
|
||||||
|
|
||||||
injectStartupTemplate(myProtocol, myHosts, myUsername, myPassword);
|
//This tells hibernate search to use this custom file for creating index settings. We use this to add a custom max_ngram_diff
|
||||||
|
theProperties.put(BackendSettings.backendKey(ElasticsearchIndexSettings.SCHEMA_MANAGEMENT_SETTINGS_FILE), "ca/uhn/fhir/jpa/elastic/index-settings.json");
|
||||||
|
|
||||||
|
if (!StringUtils.isBlank(myAwsRegion)) {
|
||||||
|
theProperties.put(BackendSettings.backendKey(ElasticsearchAwsBackendSettings.REGION), myAwsRegion);
|
||||||
|
theProperties.put(BackendSettings.backendKey(ElasticsearchAwsBackendSettings.SIGNING_ENABLED), true);
|
||||||
|
if (!StringUtils.isBlank(myUsername) && !StringUtils.isBlank(myPassword)) {
|
||||||
|
theProperties.put(BackendSettings.backendKey(ElasticsearchAwsBackendSettings.CREDENTIALS_TYPE), ElasticsearchAwsCredentialsTypeNames.STATIC);
|
||||||
|
theProperties.put(BackendSettings.backendKey(ElasticsearchAwsBackendSettings.CREDENTIALS_ACCESS_KEY_ID), myUsername);
|
||||||
|
theProperties.put(BackendSettings.backendKey(ElasticsearchAwsBackendSettings.CREDENTIALS_SECRET_ACCESS_KEY), myPassword);
|
||||||
|
} else {
|
||||||
|
//Default to Standard IAM Auth provider if username or password is absent.
|
||||||
|
theProperties.put(BackendSettings.backendKey(ElasticsearchAwsBackendSettings.CREDENTIALS_TYPE), ElasticsearchAwsCredentialsTypeNames.DEFAULT);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElasticsearchHibernatePropertiesBuilder setRequiredIndexStatus(IndexStatus theRequiredIndexStatus) {
|
public ElasticsearchHibernatePropertiesBuilder setRequiredIndexStatus(IndexStatus theRequiredIndexStatus) {
|
||||||
|
@ -115,6 +129,9 @@ public class ElasticsearchHibernatePropertiesBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ElasticsearchHibernatePropertiesBuilder setHosts(String hosts) {
|
public ElasticsearchHibernatePropertiesBuilder setHosts(String hosts) {
|
||||||
|
if (hosts.contains("://")) {
|
||||||
|
throw new ConfigurationException(Msg.code(2139) + "Elasticsearch URLs cannot include a protocol, that is a separate property. Remove http:// or https:// from this URL.");
|
||||||
|
}
|
||||||
myHosts = hosts;
|
myHosts = hosts;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
@ -151,23 +168,16 @@ public class ElasticsearchHibernatePropertiesBuilder {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* At startup time, injects a template into the elasticsearch cluster, which is needed for handling large ngram diffs.
|
* If this is set to `true`, the AWS region will be used to configure the AWS client. Additionally, this will trigger
|
||||||
* TODO GGG HS: In HS6.1, we should have a native way of performing index settings manipulation at bootstrap time, so this should
|
* HibernateSearch to attempt to use IAM Authentication. If the username and password are set in addition to the region,
|
||||||
* eventually be removed in favour of whatever solution they come up with.
|
* then the username and password will be used as the AWS_ACCESS_KEY_ID and AWS_SECRET_KEY_ID for a static credentials file for IAM.
|
||||||
|
*
|
||||||
|
* @param theAwsRegion The String version of the region, e.g. `us-east-2`.
|
||||||
|
* @return This builder.
|
||||||
*/
|
*/
|
||||||
void injectStartupTemplate(String theProtocol, String theHosts, @Nullable String theUsername, @Nullable String thePassword) {
|
public ElasticsearchHibernatePropertiesBuilder setAwsRegion(String theAwsRegion) {
|
||||||
PutIndexTemplateRequest ngramTemplate = new PutIndexTemplateRequest("ngram-template")
|
myAwsRegion = theAwsRegion;
|
||||||
.patterns(Arrays.asList("*resourcetable-*", "*termconcept-*"))
|
return this;
|
||||||
.settings(Settings.builder().put("index.max_ngram_diff", 50));
|
}
|
||||||
|
|
||||||
try {
|
|
||||||
RestHighLevelClient elasticsearchHighLevelRestClient = ElasticsearchRestClientFactory.createElasticsearchHighLevelRestClient(theProtocol, theHosts, theUsername, thePassword);
|
|
||||||
ourLog.info("Adding starter template for large ngram diffs");
|
|
||||||
AcknowledgedResponse acknowledgedResponse = elasticsearchHighLevelRestClient.indices().putTemplate(ngramTemplate, RequestOptions.DEFAULT);
|
|
||||||
assert acknowledgedResponse.isAcknowledged();
|
|
||||||
} catch (IOException theE) {
|
|
||||||
theE.printStackTrace();
|
|
||||||
throw new ConfigurationException(Msg.code(1169) + "Couldn't connect to the elasticsearch server to create necessary templates. Ensure the Elasticsearch user has permissions to create templates.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,7 @@ public class ElasticsearchRestClientFactory {
|
||||||
clientBuilder.setHttpClientConfigCallback(httpClientBuilder -> httpClientBuilder
|
clientBuilder.setHttpClientConfigCallback(httpClientBuilder -> httpClientBuilder
|
||||||
.setDefaultCredentialsProvider(credentialsProvider));
|
.setDefaultCredentialsProvider(credentialsProvider));
|
||||||
}
|
}
|
||||||
|
|
||||||
Header[] defaultHeaders = new Header[]{new BasicHeader("Content-Type", "application/json")};
|
Header[] defaultHeaders = new Header[]{new BasicHeader("Content-Type", "application/json")};
|
||||||
clientBuilder.setDefaultHeaders(defaultHeaders);
|
clientBuilder.setDefaultHeaders(defaultHeaders);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"max_ngram_diff": 50
|
||||||
|
}
|
|
@ -40,10 +40,9 @@ class ElasticsearchHibernatePropertiesBuilderTest {
|
||||||
.apply(new Properties());
|
.apply(new Properties());
|
||||||
fail();
|
fail();
|
||||||
} catch (ConfigurationException e ) {
|
} catch (ConfigurationException e ) {
|
||||||
assertThat(e.getMessage(), is(equalTo(Msg.code(1173) + failureMessage)));
|
assertThat(e.getMessage(), is(equalTo(Msg.code(2139) + failureMessage)));
|
||||||
}
|
}
|
||||||
|
|
||||||
doNothing().when(myPropertiesBuilder).injectStartupTemplate(any(), any(), any(), any());
|
|
||||||
Properties properties = new Properties();
|
Properties properties = new Properties();
|
||||||
myPropertiesBuilder
|
myPropertiesBuilder
|
||||||
.setHosts(host)
|
.setHosts(host)
|
||||||
|
@ -52,26 +51,4 @@ class ElasticsearchHibernatePropertiesBuilderTest {
|
||||||
assertThat(properties.getProperty(BackendSettings.backendKey(ElasticsearchBackendSettings.HOSTS)), is(equalTo(host)));
|
assertThat(properties.getProperty(BackendSettings.backendKey(ElasticsearchBackendSettings.HOSTS)), is(equalTo(host)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testHostsValueValidation() {
|
|
||||||
String host = "localhost_9200,localhost:9201,localhost:9202";
|
|
||||||
String failureMessage = "Elasticsearch URLs have to contain ':' as a host:port separator. Example: localhost:9200,localhost:9201,localhost:9202";
|
|
||||||
|
|
||||||
myPropertiesBuilder
|
|
||||||
.setProtocol("https")
|
|
||||||
.setHosts(host)
|
|
||||||
.setUsername("whatever")
|
|
||||||
.setPassword("whatever");
|
|
||||||
|
|
||||||
//SUT
|
|
||||||
try {
|
|
||||||
myPropertiesBuilder
|
|
||||||
.apply(new Properties());
|
|
||||||
fail();
|
|
||||||
} catch (ConfigurationException e ) {
|
|
||||||
assertThat(e.getMessage(), is(equalTo(Msg.code(1174) + failureMessage)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,14 +49,12 @@
|
||||||
<appender-ref ref="STDOUT" />
|
<appender-ref ref="STDOUT" />
|
||||||
</logger>
|
</logger>
|
||||||
|
|
||||||
<!--
|
<!-- <logger name="ca.uhn.fhir.jpa.model.search" additivity="false" level="debug"/>-->
|
||||||
<logger name="ca.uhn.fhir.jpa.model.search" additivity="false" level="debug"/>
|
<!-- <logger name="org.elasticsearch.client" additivity="true" level="trace"/>-->
|
||||||
<logger name="org.elasticsearch.client" additivity="true" level="trace"/>
|
<!-- <logger name="org.hibernate.search.elasticsearch.request" additivity="false" level="trace"/>-->
|
||||||
<logger name="org.hibernate.search.elasticsearch.request" additivity="false" level="trace"/>
|
<!-- <logger name="org.hibernate.search" level="TRACE"/>-->
|
||||||
<logger name="org.hibernate.search" level="TRACE"/>
|
<!-- <logger name="org.hibernate.search.query" level="TRACE"/>-->
|
||||||
<logger name="org.hibernate.search.query" level="TRACE"/>
|
<!-- <logger name="org.hibernate.search.elasticsearch.request" level="TRACE"/>-->
|
||||||
<logger name="org.hibernate.search.elasticsearch.request" level="TRACE"/>
|
|
||||||
-->
|
|
||||||
<!-- See https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#backend-lucene-io-writer-infostream for lucene logging
|
<!-- See https://docs.jboss.org/hibernate/stable/search/reference/en-US/html_single/#backend-lucene-io-writer-infostream for lucene logging
|
||||||
<logger name="org.hibernate.search.backend.lucene.infostream" level="TRACE"/> -->
|
<logger name="org.hibernate.search.backend.lucene.infostream" level="TRACE"/> -->
|
||||||
<logger name="org.springframework.test.context.cache" additivity="false" level="info">
|
<logger name="org.springframework.test.context.cache" additivity="false" level="info">
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
package ca.uhn.fhir.jpa.dao;
|
package ca.uhn.fhir.jpa.dao;
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* #%L
|
||||||
|
* HAPI FHIR JPA Server Test Utilities
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||||
|
* %%
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
|
||||||
import ca.uhn.fhir.i18n.Msg;
|
import ca.uhn.fhir.i18n.Msg;
|
||||||
import ca.uhn.fhir.interceptor.api.IInterceptorService;
|
import ca.uhn.fhir.interceptor.api.IInterceptorService;
|
||||||
import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException;
|
import ca.uhn.fhir.rest.server.exceptions.ResourceVersionConflictException;
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
package ca.uhn.fhir.jpa.interceptor.ex;
|
package ca.uhn.fhir.jpa.interceptor.ex;
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* #%L
|
||||||
|
* HAPI FHIR JPA Server Test Utilities
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||||
|
* %%
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
|
||||||
import ca.uhn.fhir.interceptor.api.Hook;
|
import ca.uhn.fhir.interceptor.api.Hook;
|
||||||
import ca.uhn.fhir.interceptor.api.Interceptor;
|
import ca.uhn.fhir.interceptor.api.Interceptor;
|
||||||
import ca.uhn.fhir.interceptor.api.Pointcut;
|
import ca.uhn.fhir.interceptor.api.Pointcut;
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
package ca.uhn.fhir.jpa.interceptor.ex;
|
package ca.uhn.fhir.jpa.interceptor.ex;
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* #%L
|
||||||
|
* HAPI FHIR JPA Server Test Utilities
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||||
|
* %%
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
|
||||||
import ca.uhn.fhir.interceptor.api.Hook;
|
import ca.uhn.fhir.interceptor.api.Hook;
|
||||||
import ca.uhn.fhir.interceptor.api.Interceptor;
|
import ca.uhn.fhir.interceptor.api.Interceptor;
|
||||||
import ca.uhn.fhir.interceptor.api.Pointcut;
|
import ca.uhn.fhir.interceptor.api.Pointcut;
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
package ca.uhn.fhir.jpa.packages;
|
package ca.uhn.fhir.jpa.packages;
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* #%L
|
||||||
|
* HAPI FHIR JPA Server Test Utilities
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||||
|
* %%
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
|
||||||
import ca.uhn.fhir.rest.api.Constants;
|
import ca.uhn.fhir.rest.api.Constants;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
package ca.uhn.fhir.jpa.provider;
|
package ca.uhn.fhir.jpa.provider;
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* #%L
|
||||||
|
* HAPI FHIR JPA Server Test Utilities
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||||
|
* %%
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
|
||||||
public class GraphQLProviderTestUtil {
|
public class GraphQLProviderTestUtil {
|
||||||
public static final String DATA_PREFIX = "{\"data\": ";
|
public static final String DATA_PREFIX = "{\"data\": ";
|
||||||
public static final String DATA_SUFFIX = "}";
|
public static final String DATA_SUFFIX = "}";
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
package ca.uhn.fhir.jpa.subscription;
|
package ca.uhn.fhir.jpa.subscription;
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* #%L
|
||||||
|
* HAPI FHIR JPA Server Test Utilities
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||||
|
* %%
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.messaging.Message;
|
import org.springframework.messaging.Message;
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
package ca.uhn.fhir.jpa.subscription;
|
package ca.uhn.fhir.jpa.subscription;
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* #%L
|
||||||
|
* HAPI FHIR JPA Server Test Utilities
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||||
|
* %%
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
|
||||||
import javax.servlet.ServletException;
|
import javax.servlet.ServletException;
|
||||||
import javax.servlet.http.HttpServlet;
|
import javax.servlet.http.HttpServlet;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
|
|
@ -1,6 +1,26 @@
|
||||||
|
|
||||||
package ca.uhn.fhir.jpa.subscription;
|
package ca.uhn.fhir.jpa.subscription;
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* #%L
|
||||||
|
* HAPI FHIR JPA Server Test Utilities
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||||
|
* %%
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
|
||||||
import ca.uhn.fhir.rest.api.EncodingEnum;
|
import ca.uhn.fhir.rest.api.EncodingEnum;
|
||||||
import org.eclipse.jetty.websocket.api.Session;
|
import org.eclipse.jetty.websocket.api.Session;
|
||||||
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect;
|
import org.eclipse.jetty.websocket.api.annotations.OnWebSocketConnect;
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
package ca.uhn.fhir.jpa.term;
|
package ca.uhn.fhir.jpa.term;
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* #%L
|
||||||
|
* HAPI FHIR JPA Server Test Utilities
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||||
|
* %%
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
|
||||||
import ca.uhn.fhir.jpa.entity.TermConceptDesignation;
|
import ca.uhn.fhir.jpa.entity.TermConceptDesignation;
|
||||||
import ca.uhn.fhir.jpa.term.api.ITermLoaderSvc;
|
import ca.uhn.fhir.jpa.term.api.ITermLoaderSvc;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
package ca.uhn.fhir.jpa.term;
|
package ca.uhn.fhir.jpa.term;
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* #%L
|
||||||
|
* HAPI FHIR JPA Server Test Utilities
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||||
|
* %%
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
|
||||||
import ca.uhn.fhir.jpa.term.api.ITermLoaderSvc;
|
import ca.uhn.fhir.jpa.term.api.ITermLoaderSvc;
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import org.apache.commons.io.IOUtils;
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
|
@ -200,7 +200,6 @@ public class TestHSearchAddInConfig {
|
||||||
.setIndexManagementWaitTimeoutMillis(10000)
|
.setIndexManagementWaitTimeoutMillis(10000)
|
||||||
.setRequiredIndexStatus(IndexStatus.YELLOW)
|
.setRequiredIndexStatus(IndexStatus.YELLOW)
|
||||||
.setScrollTimeoutSecs(60 * 30) // 30 min for tests
|
.setScrollTimeoutSecs(60 * 30) // 30 min for tests
|
||||||
|
|
||||||
.setHosts(host + ":" + httpPort)
|
.setHosts(host + ":" + httpPort)
|
||||||
.setProtocol("http")
|
.setProtocol("http")
|
||||||
.setUsername("")
|
.setUsername("")
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
package ca.uhn.fhir.jpa.util;
|
package ca.uhn.fhir.jpa.util;
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* #%L
|
||||||
|
* HAPI FHIR JPA Server Test Utilities
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||||
|
* %%
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
|
||||||
public final class CoordCalculatorTestUtil {
|
public final class CoordCalculatorTestUtil {
|
||||||
// CHIN and UHN coordinates from Google Maps
|
// CHIN and UHN coordinates from Google Maps
|
||||||
// Distance and bearing from https://www.movable-type.co.uk/scripts/latlong.html
|
// Distance and bearing from https://www.movable-type.co.uk/scripts/latlong.html
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
package ca.uhn.fhir.jpa.util;
|
package ca.uhn.fhir.jpa.util;
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* #%L
|
||||||
|
* HAPI FHIR JPA Server Test Utilities
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||||
|
* %%
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
|
||||||
import ca.uhn.fhir.interceptor.api.Hook;
|
import ca.uhn.fhir.interceptor.api.Hook;
|
||||||
import ca.uhn.fhir.interceptor.api.Pointcut;
|
import ca.uhn.fhir.interceptor.api.Pointcut;
|
||||||
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
|
||||||
|
|
|
@ -130,6 +130,7 @@ public class GoldenResourceHelper {
|
||||||
IAnyResource theIncomingResource, IBase theNewGoldenResource) {
|
IAnyResource theIncomingResource, IBase theNewGoldenResource) {
|
||||||
String incomingResourceType = myFhirContext.getResourceType(theIncomingResource);
|
String incomingResourceType = myFhirContext.getResourceType(theIncomingResource);
|
||||||
String mdmEIDSystem = myMdmSettings.getMdmRules().getEnterpriseEIDSystemForResourceType(incomingResourceType);
|
String mdmEIDSystem = myMdmSettings.getMdmRules().getEnterpriseEIDSystemForResourceType(incomingResourceType);
|
||||||
|
|
||||||
if (mdmEIDSystem == null) {
|
if (mdmEIDSystem == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
package ca.uhn.fhir.jpa.api.dao;
|
package ca.uhn.fhir.jpa.api.dao;
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* #%L
|
||||||
|
* HAPI FHIR Storage api
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||||
|
* %%
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
|
||||||
import ca.uhn.fhir.model.api.annotation.Description;
|
import ca.uhn.fhir.model.api.annotation.Description;
|
||||||
import ca.uhn.fhir.rest.api.SortSpec;
|
import ca.uhn.fhir.rest.api.SortSpec;
|
||||||
import ca.uhn.fhir.rest.param.DateRangeParam;
|
import ca.uhn.fhir.rest.param.DateRangeParam;
|
||||||
|
|
|
@ -1,5 +1,25 @@
|
||||||
package ca.uhn.fhir.test.utilities;
|
package ca.uhn.fhir.test.utilities;
|
||||||
|
|
||||||
|
/*-
|
||||||
|
* #%L
|
||||||
|
* HAPI FHIR Test Utilities
|
||||||
|
* %%
|
||||||
|
* Copyright (C) 2014 - 2022 Smile CDR, Inc.
|
||||||
|
* %%
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
* #L%
|
||||||
|
*/
|
||||||
|
|
||||||
public class getMethodNameUtil {
|
public class getMethodNameUtil {
|
||||||
public static String getTestName() {
|
public static String getTestName() {
|
||||||
return new Exception().getStackTrace()[1].getMethodName();
|
return new Exception().getStackTrace()[1].getMethodName();
|
||||||
|
|
7
pom.xml
7
pom.xml
|
@ -815,7 +815,7 @@
|
||||||
<flexmark_version>0.50.40</flexmark_version>
|
<flexmark_version>0.50.40</flexmark_version>
|
||||||
<flyway_version>8.5.0</flyway_version>
|
<flyway_version>8.5.0</flyway_version>
|
||||||
<hibernate_version>5.6.2.Final</hibernate_version>
|
<hibernate_version>5.6.2.Final</hibernate_version>
|
||||||
<hibernate_search_version>6.1.4.Final</hibernate_search_version>
|
<hibernate_search_version>6.1.6.Final</hibernate_search_version>
|
||||||
<!-- Update lucene version when you update hibernate-search version -->
|
<!-- Update lucene version when you update hibernate-search version -->
|
||||||
<lucene_version>8.11.1</lucene_version>
|
<lucene_version>8.11.1</lucene_version>
|
||||||
<hamcrest_version>2.2</hamcrest_version>
|
<hamcrest_version>2.2</hamcrest_version>
|
||||||
|
@ -1658,6 +1658,11 @@
|
||||||
<artifactId>hibernate-search-backend-lucene</artifactId>
|
<artifactId>hibernate-search-backend-lucene</artifactId>
|
||||||
<version>${hibernate_search_version}</version>
|
<version>${hibernate_search_version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.hibernate.search</groupId>
|
||||||
|
<artifactId>hibernate-search-backend-elasticsearch-aws</artifactId>
|
||||||
|
<version>${hibernate_search_version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.javassist</groupId>
|
<groupId>org.javassist</groupId>
|
||||||
<artifactId>javassist</artifactId>
|
<artifactId>javassist</artifactId>
|
||||||
|
|
Loading…
Reference in New Issue