Upgraded to 5.6.0
Subscription tests fail ...
This commit is contained in:
@@ -29,16 +29,6 @@ public class Application extends SpringBootServletInitializer {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
/*
|
||||
* https://github.com/hapifhir/hapi-fhir-jpaserver-starter/issues/246
|
||||
* This will be allowed for a short period until we know how MDM should be configured
|
||||
* or don't have multiple equal bean instantiations.
|
||||
*
|
||||
* This will require changes in the main project as stated in the Github comment
|
||||
* */
|
||||
System.setProperty("spring.main.allow-bean-definition-overriding","true");
|
||||
|
||||
System.setProperty("spring.batch.job.enabled", "false");
|
||||
SpringApplication.run(Application.class, args);
|
||||
|
||||
//Server is now accessible at eg. http://localhost:8080/fhir/metadata
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.hibernate.search.engine.cfg.BackendSettings;
|
||||
import org.hibernate.search.mapper.orm.automaticindexing.session.AutomaticIndexingSynchronizationStrategyNames;
|
||||
import org.hibernate.search.mapper.orm.cfg.HibernateOrmMapperSettings;
|
||||
import org.hibernate.search.mapper.orm.schema.management.SchemaManagementStrategyName;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy;
|
||||
import org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy;
|
||||
import org.springframework.core.env.CompositePropertySource;
|
||||
@@ -25,7 +26,8 @@ import java.util.*;
|
||||
|
||||
public class EnvironmentHelper {
|
||||
|
||||
public static Properties getHibernateProperties(ConfigurableEnvironment environment) {
|
||||
public static Properties getHibernateProperties(ConfigurableEnvironment environment,
|
||||
ConfigurableListableBeanFactory myConfigurableListableBeanFactory) {
|
||||
Properties properties = new Properties();
|
||||
Map<String, Object> jpaProps = getPropertiesStartingWith(environment, "spring.jpa.properties");
|
||||
for (Map.Entry<String, Object> entry : jpaProps.entrySet()) {
|
||||
@@ -41,7 +43,7 @@ public class EnvironmentHelper {
|
||||
//properties.putIfAbsent(AvailableSettings.BEAN_CONTAINER, new SpringBeanContainer(beanFactory));
|
||||
|
||||
//hapi-fhir-jpaserver-base "sensible defaults"
|
||||
Map<String, Object> hapiJpaPropertyMap = new HapiFhirLocalContainerEntityManagerFactoryBean().getJpaPropertyMap();
|
||||
Map<String, Object> hapiJpaPropertyMap = new HapiFhirLocalContainerEntityManagerFactoryBean(myConfigurableListableBeanFactory).getJpaPropertyMap();
|
||||
hapiJpaPropertyMap.forEach(properties::putIfAbsent);
|
||||
|
||||
//hapi-fhir-jpaserver-starter defaults
|
||||
@@ -73,7 +75,7 @@ public class EnvironmentHelper {
|
||||
ElasticsearchHibernatePropertiesBuilder builder = new ElasticsearchHibernatePropertiesBuilder();
|
||||
IndexStatus requiredIndexStatus = environment.getProperty("elasticsearch.required_index_status", IndexStatus.class);
|
||||
builder.setRequiredIndexStatus(requireNonNullElse(requiredIndexStatus, IndexStatus.YELLOW));
|
||||
builder.setRestUrl(getElasticsearchServerUrl(environment));
|
||||
builder.setHosts(getElasticsearchServerUrl(environment));
|
||||
builder.setUsername(getElasticsearchServerUsername(environment));
|
||||
builder.setPassword(getElasticsearchServerPassword(environment));
|
||||
builder.setProtocol(getElasticsearchServerProtocol(environment));
|
||||
|
||||
@@ -8,8 +8,9 @@ import ca.uhn.fhir.jpa.model.config.PartitionSettings;
|
||||
import ca.uhn.fhir.jpa.model.config.PartitionSettings.CrossPartitionReferenceMode;
|
||||
import ca.uhn.fhir.jpa.model.entity.ModelConfig;
|
||||
import ca.uhn.fhir.jpa.subscription.channel.subscription.SubscriptionDeliveryHandlerFactory;
|
||||
import ca.uhn.fhir.jpa.subscription.match.deliver.email.EmailSenderImpl;
|
||||
import ca.uhn.fhir.jpa.subscription.match.deliver.email.IEmailSender;
|
||||
import ca.uhn.fhir.jpa.subscription.match.deliver.email.JavaMailEmailSender;
|
||||
import ca.uhn.fhir.rest.server.mail.MailConfig;
|
||||
import com.google.common.base.Strings;
|
||||
import org.hl7.fhir.dstu2.model.Subscription;
|
||||
import org.springframework.boot.env.YamlPropertySourceLoader;
|
||||
@@ -207,22 +208,21 @@ public class FhirServerConfigCommon {
|
||||
@Bean()
|
||||
public IEmailSender emailSender(AppProperties appProperties, Optional<SubscriptionDeliveryHandlerFactory> subscriptionDeliveryHandlerFactory) {
|
||||
if (appProperties.getSubscription() != null && appProperties.getSubscription().getEmail() != null) {
|
||||
JavaMailEmailSender retVal = new JavaMailEmailSender();
|
||||
MailConfig mailConfig = new MailConfig();
|
||||
|
||||
AppProperties.Subscription.Email email = appProperties.getSubscription().getEmail();
|
||||
retVal.setSmtpServerHostname(email.getHost());
|
||||
retVal.setSmtpServerPort(email.getPort());
|
||||
retVal.setSmtpServerUsername(email.getUsername());
|
||||
retVal.setSmtpServerPassword(email.getPassword());
|
||||
retVal.setAuth(email.getAuth());
|
||||
retVal.setStartTlsEnable(email.getStartTlsEnable());
|
||||
retVal.setStartTlsRequired(email.getStartTlsRequired());
|
||||
retVal.setQuitWait(email.getQuitWait());
|
||||
mailConfig.setSmtpHostname(email.getHost());
|
||||
mailConfig.setSmtpPort(email.getPort());
|
||||
mailConfig.setSmtpUsername(email.getUsername());
|
||||
mailConfig.setSmtpPassword(email.getPassword());
|
||||
mailConfig.setSmtpUseStartTLS(email.getStartTlsEnable());
|
||||
|
||||
IEmailSender emailSender = new EmailSenderImpl(mailConfig);
|
||||
|
||||
if(subscriptionDeliveryHandlerFactory.isPresent())
|
||||
subscriptionDeliveryHandlerFactory.get().setEmailSender(retVal);
|
||||
subscriptionDeliveryHandlerFactory.get().setEmailSender(emailSender);
|
||||
|
||||
return retVal;
|
||||
return emailSender;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
@@ -5,6 +5,7 @@ import ca.uhn.fhir.jpa.config.BaseJavaConfigDstu2;
|
||||
import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
|
||||
import ca.uhn.fhir.jpa.starter.annotations.OnDSTU2Condition;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -58,8 +59,9 @@ public class FhirServerConfigDstu2 extends BaseJavaConfigDstu2 {
|
||||
|
||||
@Override
|
||||
@Bean()
|
||||
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
|
||||
LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory();
|
||||
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
|
||||
ConfigurableListableBeanFactory myConfigurableListableBeanFactory) {
|
||||
LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(myConfigurableListableBeanFactory);
|
||||
retVal.setPersistenceUnitName("HAPI_PU");
|
||||
|
||||
try {
|
||||
@@ -67,7 +69,7 @@ public class FhirServerConfigDstu2 extends BaseJavaConfigDstu2 {
|
||||
} catch (Exception e) {
|
||||
throw new ConfigurationException("Could not set the data source due to a configuration issue", e);
|
||||
}
|
||||
retVal.setJpaProperties(EnvironmentHelper.getHibernateProperties(configurableEnvironment));
|
||||
retVal.setJpaProperties(EnvironmentHelper.getHibernateProperties(configurableEnvironment, myConfigurableListableBeanFactory));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import javax.annotation.PostConstruct;
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.sql.DataSource;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -62,8 +63,9 @@ public class FhirServerConfigDstu3 extends BaseJavaConfigDstu3 {
|
||||
|
||||
@Override
|
||||
@Bean
|
||||
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
|
||||
LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory();
|
||||
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
|
||||
ConfigurableListableBeanFactory myConfigurableListableBeanFactory) {
|
||||
LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(myConfigurableListableBeanFactory);
|
||||
retVal.setPersistenceUnitName("HAPI_PU");
|
||||
|
||||
try {
|
||||
@@ -72,7 +74,8 @@ public class FhirServerConfigDstu3 extends BaseJavaConfigDstu3 {
|
||||
throw new ConfigurationException("Could not set the data source due to a configuration issue", e);
|
||||
}
|
||||
|
||||
retVal.setJpaProperties(EnvironmentHelper.getHibernateProperties(configurableEnvironment));
|
||||
retVal.setJpaProperties(EnvironmentHelper.getHibernateProperties(configurableEnvironment,
|
||||
myConfigurableListableBeanFactory));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -96,8 +99,7 @@ public class FhirServerConfigDstu3 extends BaseJavaConfigDstu3 {
|
||||
}
|
||||
String elasticsearchUsername = EnvironmentHelper.getElasticsearchServerUsername(configurableEnvironment);
|
||||
String elasticsearchPassword = EnvironmentHelper.getElasticsearchServerPassword(configurableEnvironment);
|
||||
int elasticsearchPort = Integer.parseInt(elasticsearchUrl.substring(elasticsearchUrl.lastIndexOf(":")+1));
|
||||
return new ElasticsearchSvcImpl(elasticsearchHost, elasticsearchPort, elasticsearchUsername, elasticsearchPassword);
|
||||
return new ElasticsearchSvcImpl(elasticsearchHost, elasticsearchUsername, elasticsearchPassword);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import ca.uhn.fhir.jpa.search.lastn.ElasticsearchSvcImpl;
|
||||
import ca.uhn.fhir.jpa.starter.annotations.OnR4Condition;
|
||||
import ca.uhn.fhir.jpa.starter.cql.StarterCqlR4Config;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.context.annotation.*;
|
||||
import org.springframework.core.env.ConfigurableEnvironment;
|
||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||
@@ -58,8 +59,9 @@ public class FhirServerConfigR4 extends BaseJavaConfigR4 {
|
||||
|
||||
@Override
|
||||
@Bean()
|
||||
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
|
||||
LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory();
|
||||
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
|
||||
ConfigurableListableBeanFactory myConfigurableListableBeanFactory) {
|
||||
LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(myConfigurableListableBeanFactory);
|
||||
retVal.setPersistenceUnitName("HAPI_PU");
|
||||
|
||||
try {
|
||||
@@ -68,7 +70,8 @@ public class FhirServerConfigR4 extends BaseJavaConfigR4 {
|
||||
throw new ConfigurationException("Could not set the data source due to a configuration issue", e);
|
||||
}
|
||||
|
||||
retVal.setJpaProperties(EnvironmentHelper.getHibernateProperties(configurableEnvironment));
|
||||
retVal.setJpaProperties(EnvironmentHelper.getHibernateProperties(configurableEnvironment,
|
||||
myConfigurableListableBeanFactory));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -93,8 +96,7 @@ public class FhirServerConfigR4 extends BaseJavaConfigR4 {
|
||||
|
||||
String elasticsearchUsername = EnvironmentHelper.getElasticsearchServerUsername(configurableEnvironment);
|
||||
String elasticsearchPassword = EnvironmentHelper.getElasticsearchServerPassword(configurableEnvironment);
|
||||
int elasticsearchPort = Integer.parseInt(elasticsearchUrl.substring(elasticsearchUrl.lastIndexOf(":")+1));
|
||||
return new ElasticsearchSvcImpl(elasticsearchHost, elasticsearchPort, elasticsearchUsername, elasticsearchPassword);
|
||||
return new ElasticsearchSvcImpl(elasticsearchHost, elasticsearchUsername, elasticsearchPassword);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import ca.uhn.fhir.jpa.search.DatabaseBackedPagingProvider;
|
||||
import ca.uhn.fhir.jpa.search.lastn.ElasticsearchSvcImpl;
|
||||
import ca.uhn.fhir.jpa.starter.annotations.OnR5Condition;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Conditional;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -59,8 +60,9 @@ public class FhirServerConfigR5 extends BaseJavaConfigR5 {
|
||||
|
||||
@Override
|
||||
@Bean()
|
||||
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
|
||||
LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory();
|
||||
public LocalContainerEntityManagerFactoryBean entityManagerFactory(
|
||||
ConfigurableListableBeanFactory myConfigurableListableBeanFactory) {
|
||||
LocalContainerEntityManagerFactoryBean retVal = super.entityManagerFactory(myConfigurableListableBeanFactory);
|
||||
retVal.setPersistenceUnitName("HAPI_PU");
|
||||
|
||||
try {
|
||||
@@ -69,7 +71,8 @@ public class FhirServerConfigR5 extends BaseJavaConfigR5 {
|
||||
throw new ConfigurationException("Could not set the data source due to a configuration issue", e);
|
||||
}
|
||||
|
||||
retVal.setJpaProperties(EnvironmentHelper.getHibernateProperties(configurableEnvironment));
|
||||
retVal.setJpaProperties(EnvironmentHelper.getHibernateProperties(configurableEnvironment,
|
||||
myConfigurableListableBeanFactory));
|
||||
return retVal;
|
||||
}
|
||||
|
||||
@@ -93,8 +96,7 @@ public class FhirServerConfigR5 extends BaseJavaConfigR5 {
|
||||
}
|
||||
String elasticsearchUsername = EnvironmentHelper.getElasticsearchServerUsername(configurableEnvironment);
|
||||
String elasticsearchPassword = EnvironmentHelper.getElasticsearchServerPassword(configurableEnvironment);
|
||||
int elasticsearchPort = Integer.parseInt(elasticsearchUrl.substring(elasticsearchUrl.lastIndexOf(":")+1));
|
||||
return new ElasticsearchSvcImpl(elasticsearchHost, elasticsearchPort, elasticsearchUsername, elasticsearchPassword);
|
||||
return new ElasticsearchSvcImpl(elasticsearchHost, elasticsearchUsername, elasticsearchPassword);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user