Fix up samlpe starters
This commit is contained in:
parent
8f6aee64b1
commit
16039af110
|
@ -49,7 +49,6 @@ public class BulkExportJobParameterValidator implements JobParametersValidator {
|
|||
Long readChunkSize = theJobParameters.getLong("readChunkSize");
|
||||
if (readChunkSize == null || readChunkSize < 1) {
|
||||
errorBuilder.append("There must be a valid number for readChunkSize, which is at least 1. ");
|
||||
|
||||
}
|
||||
String jobUUID = theJobParameters.getString("jobUUID");
|
||||
Optional<BulkExportJobEntity> oJob = myBulkExportJobDao.findByJobId(jobUUID);
|
||||
|
|
|
@ -90,14 +90,6 @@ import java.util.concurrent.ScheduledExecutorService;
|
|||
@EnableConfigurationProperties(FhirProperties.class)
|
||||
public class FhirAutoConfiguration {
|
||||
|
||||
@Autowired
|
||||
private EntityManagerFactory emf;
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public PlatformTransactionManager hapiTransactionManager() {
|
||||
return new JpaTransactionManager(emf);
|
||||
}
|
||||
|
||||
private final FhirProperties properties;
|
||||
|
||||
|
@ -191,6 +183,15 @@ public class FhirAutoConfiguration {
|
|||
})
|
||||
static class FhirJpaDaoConfiguration {
|
||||
|
||||
@Autowired
|
||||
private EntityManagerFactory emf;
|
||||
|
||||
@Bean
|
||||
@Primary
|
||||
public PlatformTransactionManager hapiTransactionManager() {
|
||||
return new JpaTransactionManager(emf);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConfigurationProperties("hapi.fhir.jpa")
|
||||
|
|
|
@ -16,7 +16,6 @@ import org.junit.Rule;
|
|||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
|
||||
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
|
||||
import org.springframework.boot.web.servlet.ServletRegistrationBean;
|
||||
|
@ -25,8 +24,6 @@ import org.springframework.mock.env.MockEnvironment;
|
|||
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
|
@ -83,7 +80,11 @@ public class FhirAutoConfigurationTest {
|
|||
|
||||
@Test
|
||||
public void withJpaServer() {
|
||||
load("hapi.fhir.version:DSTU3", "spring.jpa.properties.hibernate.search.default.indexBase:target/lucenefiles", "spring.jpa.properties.hibernate.search.model_mapping:ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory");
|
||||
load(Arrays.array(EmbeddedDataSourceConfiguration.class,
|
||||
HibernateJpaAutoConfiguration.class,
|
||||
FhirAutoConfiguration.class),
|
||||
"hapi.fhir.version:DSTU3", "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);
|
||||
}
|
||||
|
@ -131,14 +132,11 @@ public class FhirAutoConfigurationTest {
|
|||
}
|
||||
|
||||
private void load(String... environment) {
|
||||
load(new Class<?>[]{EmbeddedDataSourceConfiguration.class,HibernateJpaAutoConfiguration.class,PropertyPlaceholderAutoConfiguration.class, FhirAutoConfiguration.class}, null, environment);
|
||||
|
||||
|
||||
|
||||
load(new Class<?>[]{FhirAutoConfiguration.class}, null, environment);
|
||||
}
|
||||
|
||||
private void load(ClassLoader classLoader, String... environment) {
|
||||
load(new Class<?>[]{EmbeddedDataSourceConfiguration.class,HibernateJpaAutoConfiguration.class,PropertyPlaceholderAutoConfiguration.class, FhirAutoConfiguration.class}, classLoader, environment);
|
||||
load(new Class<?>[]{FhirAutoConfiguration.class}, classLoader, environment);
|
||||
}
|
||||
|
||||
private void load(Class<?>[] configs, String... environment) {
|
||||
|
@ -146,18 +144,8 @@ public class FhirAutoConfigurationTest {
|
|||
}
|
||||
|
||||
private void load(Class<?>[] configs, ClassLoader classLoader, String... environment) {
|
||||
List<String> baseEnv = new ArrayList<>();
|
||||
baseEnv.add("hapi.fhir.version:DSTU3");
|
||||
baseEnv.add("spring.jpa.properties.hibernate.search.model_mapping:ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory");
|
||||
baseEnv.add("spring.jpa.properties.hibernate.search.default.indexBase:target/lucenefiles");
|
||||
|
||||
MockEnvironment env = new MockEnvironment();
|
||||
|
||||
for (String next: baseEnv) {
|
||||
String nextKey = next.substring(0, next.indexOf(':'));
|
||||
String nextValue = next.substring(next.indexOf(':') + 1);
|
||||
env.setProperty(nextKey, nextValue);
|
||||
}
|
||||
for (String next : environment) {
|
||||
String nextKey = next.substring(0, next.indexOf(':'));
|
||||
String nextValue = next.substring(next.indexOf(':') + 1);
|
||||
|
|
|
@ -13,9 +13,14 @@ spring:
|
|||
hibernate.search.lucene_version: LUCENE_CURRENT
|
||||
hibernate.search.model_mapping: ca.uhn.fhir.jpa.search.LuceneSearchMappingFactory
|
||||
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
h2:
|
||||
console:
|
||||
enabled: true
|
||||
batch:
|
||||
job:
|
||||
enabled: false
|
||||
hapi:
|
||||
fhir:
|
||||
version: DSTU3
|
||||
|
|
Loading…
Reference in New Issue