Migrate to new fhirtest.uhn.ca server

This commit is contained in:
James 2016-12-28 17:02:08 -05:00
parent cb526cdd17
commit 65f597aeb1
10 changed files with 63 additions and 125 deletions

View File

@ -137,7 +137,7 @@ public class ExampleDataUploader extends BaseCommand {
specUrl = "http://hl7.org/fhir/dstu2/examples-json.zip";
break;
case DSTU3:
specUrl = "http://hl7-fhir.github.io/examples-json.zip";
specUrl = "http://build.fhir.org/examples-json.zip";
break;
default:
throw new ParseException("Invalid spec version for this command: " + ctx.getVersion().getVersion());

View File

@ -15,6 +15,11 @@
<name>HAPI FHIR - fhirtest.uhn.ca Deployable WAR</name>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.4.1212.jre7</version>
</dependency>
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-jpaserver-base</artifactId>
@ -64,19 +69,6 @@
<artifactId>spring-web</artifactId>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbynet</artifactId>
</dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derbyclient</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf</artifactId>

View File

@ -1,71 +0,0 @@
package ca.uhn.fhirtest;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Writer;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Enumeration;
import org.apache.derby.drda.NetworkServerControl;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
public class DerbyNetworkServer implements InitializingBean, DisposableBean {
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(DerbyNetworkServer.class);
private NetworkServerControl server;
@Override
public void destroy() throws Exception {
server.shutdown();
try {
ourLog.info("Shutting down derby");
// DriverManager.getConnection("jdbc:derby:directory:" + System.getProperty("fhir.db.location") + ";shutdown=true");
Enumeration<Driver> drivers = DriverManager.getDrivers();
while (drivers.hasMoreElements()) {
Driver driver = drivers.nextElement();
try {
ourLog.error("Unregistering driver: {}", driver.getClass());
DriverManager.deregisterDriver(driver);
} catch (SQLException e) {
ourLog.error("Failed to unregister driver", e);
}
}
} catch (Exception e) {
ourLog.info("Failed to shut down database: {}", e.getMessage());
}
}
@Override
public void afterPropertiesSet() throws Exception {
server = new NetworkServerControl();
Writer w = new Writer() {
@Override
public void write(char[] theCbuf, int theOff, int theLen) throws IOException {
ourLog.info("[DERBY] " + new String(theCbuf, theOff, theLen));
}
@Override
public void flush() throws IOException {
// nothing
}
@Override
public void close() throws IOException {
// nothing
}};
server.start (new PrintWriter(w));
}
public static void main(String[] args) throws Exception {
DerbyNetworkServer s = new DerbyNetworkServer();
s.afterPropertiesSet();
s.destroy();
}
}

View File

@ -3,14 +3,12 @@ package ca.uhn.fhirtest.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import ca.uhn.fhirtest.DerbyNetworkServer;
@Configuration
public class DbServerConfig {
@Bean
public DerbyNetworkServer dbServer() {
return new DerbyNetworkServer();
public String dbServer() {
return "";
// For mysql
// return new ca.uhn.fhirtest.MySqlServer();
}

View File

@ -71,7 +71,7 @@ public class TdlDstu2Config extends BaseJavaConfigDstu2 {
@DependsOn("dbServer")
public DataSource dataSource() {
BasicDataSource retVal = new BasicDataSource();
retVal.setDriver(new org.apache.derby.jdbc.ClientDriver());
// retVal.setDriver(new org.apache.derby.jdbc.ClientDriver());
// retVal.setUrl("jdbc:derby:directory:" + myFhirDbLocation + ";create=true");
retVal.setUrl("jdbc:derby://localhost:1527/" + myFhirDbLocation + ";create=true");
retVal.setUsername("SA");

View File

@ -68,7 +68,7 @@ public class TdlDstu3Config extends BaseJavaConfigDstu3 {
@DependsOn("dbServer")
public DataSource dataSource() {
BasicDataSource retVal = new BasicDataSource();
retVal.setDriver(new org.apache.derby.jdbc.ClientDriver());
// retVal.setDriver(new org.apache.derby.jdbc.ClientDriver());
// retVal.setUrl("jdbc:derby:directory:" + myFhirDbLocation + ";create=true");
retVal.setUrl("jdbc:derby://localhost:1527/" + myFhirDbLocation + ";create=true");
retVal.setUsername("SA");

View File

@ -7,6 +7,7 @@ import javax.sql.DataSource;
import org.apache.commons.dbcp2.BasicDataSource;
import org.hibernate.dialect.DerbyTenSevenDialect;
import org.hibernate.dialect.PostgreSQL94Dialect;
import org.hibernate.jpa.HibernatePersistenceProvider;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
@ -26,11 +27,20 @@ import ca.uhn.fhirtest.interceptor.PublicSecurityInterceptor;
@Import(CommonConfig.class)
@EnableTransactionManagement()
public class TestDstu1Config extends BaseJavaConfigDstu1 {
public static final String FHIR_DB_USERNAME = "${fhir.db.username}";
public static final String FHIR_DB_PASSWORD = "${fhir.db.password}";
public static final String FHIR_DB_LOCATION = "${fhir.db.location}";
@Value(FHIR_DB_USERNAME)
private String myDbUsername;
@Value(FHIR_DB_PASSWORD)
private String myDbPassword;
public static final String FHIR_LUCENE_LOCATION_DSTU = "${fhir.lucene.location.dstu}";
@Value(FHIR_LUCENE_LOCATION_DSTU)
private String myFhirLuceneLocation;
@Value(FHIR_DB_LOCATION)
private String myFhirDbLocation;
/**
* This lets the "@Value" fields reference properties from the properties file
@ -54,11 +64,10 @@ public class TestDstu1Config extends BaseJavaConfigDstu1 {
@Bean(name = "myPersistenceDataSourceDstu1", destroyMethod = "close")
public DataSource dataSource() {
BasicDataSource retVal = new BasicDataSource();
retVal.setDriver(new org.apache.derby.jdbc.ClientDriver());
// retVal.setUrl("jdbc:derby:directory:" + myFhirDbLocation + ";create=true");
retVal.setUrl("jdbc:derby://localhost:1527/" + myFhirDbLocation + ";create=true");
retVal.setUsername("SA");
retVal.setPassword("SA");
retVal.setDriver(new org.postgresql.Driver());
retVal.setUrl("jdbc:postgresql://localhost/fhirtest_dstu");
retVal.setUsername(myDbUsername);
retVal.setPassword(myDbPassword);
return retVal;
}
@ -82,7 +91,7 @@ public class TestDstu1Config extends BaseJavaConfigDstu1 {
private Properties jpaProperties() {
Properties extraProperties = new Properties();
extraProperties.put("hibernate.dialect", DerbyTenSevenDialect.class.getName());
extraProperties.put("hibernate.dialect", PostgreSQL94Dialect.class.getName());
extraProperties.put("hibernate.format_sql", "true");
extraProperties.put("hibernate.show_sql", "false");
extraProperties.put("hibernate.hbm2ddl.auto", "update");
@ -91,6 +100,9 @@ public class TestDstu1Config extends BaseJavaConfigDstu1 {
extraProperties.put("hibernate.cache.use_second_level_cache", "false");
extraProperties.put("hibernate.cache.use_structured_entries", "false");
extraProperties.put("hibernate.cache.use_minimal_puts", "false");
extraProperties.put("hibernate.search.default.directory_provider", "filesystem");
extraProperties.put("hibernate.search.default.indexBase", myFhirLuceneLocation);
extraProperties.put("hibernate.search.lucene_version", "LUCENE_CURRENT");
return extraProperties;
}

View File

@ -8,6 +8,7 @@ import javax.sql.DataSource;
import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.commons.lang3.time.DateUtils;
import org.hibernate.dialect.DerbyTenSevenDialect;
import org.hibernate.dialect.PostgreSQL94Dialect;
import org.hibernate.jpa.HibernatePersistenceProvider;
import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.beans.factory.annotation.Value;
@ -32,10 +33,12 @@ import ca.uhn.fhirtest.interceptor.PublicSecurityInterceptor;
public class TestDstu2Config extends BaseJavaConfigDstu2 {
public static final String FHIR_LUCENE_LOCATION_DSTU2 = "${fhir.lucene.location.dstu2}";
public static final String FHIR_DB_LOCATION_DSTU2 = "${fhir.db.location.dstu2}";
@Value(FHIR_DB_LOCATION_DSTU2)
private String myFhirDbLocation;
@Value(TestDstu1Config.FHIR_DB_USERNAME)
private String myDbUsername;
@Value(TestDstu1Config.FHIR_DB_PASSWORD)
private String myDbPassword;
@Value(FHIR_LUCENE_LOCATION_DSTU2)
private String myFhirLuceneLocation;
@ -71,11 +74,10 @@ public class TestDstu2Config extends BaseJavaConfigDstu2 {
@DependsOn("dbServer")
public DataSource dataSource() {
BasicDataSource retVal = new BasicDataSource();
retVal.setDriver(new org.apache.derby.jdbc.ClientDriver());
// retVal.setUrl("jdbc:derby:directory:" + myFhirDbLocation + ";create=true");
retVal.setUrl("jdbc:derby://localhost:1527/" + myFhirDbLocation + ";create=true");
retVal.setUsername("SA");
retVal.setPassword("SA");
retVal.setDriver(new org.postgresql.Driver());
retVal.setUrl("jdbc:postgresql://localhost/fhirtest_dstu2");
retVal.setUsername(myDbUsername);
retVal.setPassword(myDbPassword);
return retVal;
}
@ -99,7 +101,7 @@ public class TestDstu2Config extends BaseJavaConfigDstu2 {
private Properties jpaProperties() {
Properties extraProperties = new Properties();
extraProperties.put("hibernate.dialect", DerbyTenSevenDialect.class.getName());
extraProperties.put("hibernate.dialect", PostgreSQL94Dialect.class.getName());
extraProperties.put("hibernate.format_sql", "false");
extraProperties.put("hibernate.show_sql", "false");
extraProperties.put("hibernate.hbm2ddl.auto", "update");
@ -108,16 +110,15 @@ public class TestDstu2Config extends BaseJavaConfigDstu2 {
extraProperties.put("hibernate.cache.use_second_level_cache", "false");
extraProperties.put("hibernate.cache.use_structured_entries", "false");
extraProperties.put("hibernate.cache.use_minimal_puts", "false");
extraProperties.put("hibernate.search.default.directory_provider" ,"filesystem");
extraProperties.put("hibernate.search.default.directory_provider", "filesystem");
extraProperties.put("hibernate.search.default.indexBase", myFhirLuceneLocation);
extraProperties.put("hibernate.search.lucene_version","LUCENE_CURRENT");
extraProperties.put("hibernate.search.lucene_version", "LUCENE_CURRENT");
return extraProperties;
}
@Bean(autowire=Autowire.BY_TYPE)
@Bean(autowire = Autowire.BY_TYPE)
public IServerInterceptor subscriptionSecurityInterceptor() {
return new SubscriptionsRequireManualActivationInterceptorDstu2();
}
}

View File

@ -8,6 +8,7 @@ import javax.sql.DataSource;
import org.apache.commons.dbcp2.BasicDataSource;
import org.apache.commons.lang3.time.DateUtils;
import org.hibernate.dialect.DerbyTenSevenDialect;
import org.hibernate.dialect.PostgreSQL94Dialect;
import org.hibernate.jpa.HibernatePersistenceProvider;
import org.springframework.beans.factory.annotation.Autowire;
import org.springframework.beans.factory.annotation.Value;
@ -32,10 +33,12 @@ import ca.uhn.fhirtest.interceptor.PublicSecurityInterceptor;
public class TestDstu3Config extends BaseJavaConfigDstu3 {
public static final String FHIR_LUCENE_LOCATION_DSTU3 = "${fhir.lucene.location.dstu3}";
public static final String FHIR_DB_LOCATION_DSTU3 = "${fhir.db.location.dstu3}";
@Value(FHIR_DB_LOCATION_DSTU3)
private String myFhirDbLocation;
@Value(TestDstu1Config.FHIR_DB_USERNAME)
private String myDbUsername;
@Value(TestDstu1Config.FHIR_DB_PASSWORD)
private String myDbPassword;
@Value(FHIR_LUCENE_LOCATION_DSTU3)
private String myFhirLuceneLocation;
@ -74,11 +77,10 @@ public class TestDstu3Config extends BaseJavaConfigDstu3 {
@DependsOn("dbServer")
public DataSource dataSource() {
BasicDataSource retVal = new BasicDataSource();
retVal.setDriver(new org.apache.derby.jdbc.ClientDriver());
// retVal.setUrl("jdbc:derby:directory:" + myFhirDbLocation + ";create=true");
retVal.setUrl("jdbc:derby://localhost:1527/" + myFhirDbLocation + ";create=true");
retVal.setUsername("SA");
retVal.setPassword("SA");
retVal.setDriver(new org.postgresql.Driver());
retVal.setUrl("jdbc:postgresql://localhost/fhirtest_dstu3");
retVal.setUsername(myDbUsername);
retVal.setPassword(myDbPassword);
return retVal;
}
@ -95,7 +97,7 @@ public class TestDstu3Config extends BaseJavaConfigDstu3 {
private Properties jpaProperties() {
Properties extraProperties = new Properties();
extraProperties.put("hibernate.dialect", DerbyTenSevenDialect.class.getName());
extraProperties.put("hibernate.dialect", PostgreSQL94Dialect.class.getName());
extraProperties.put("hibernate.format_sql", "false");
extraProperties.put("hibernate.show_sql", "false");
extraProperties.put("hibernate.hbm2ddl.auto", "update");

View File

@ -171,6 +171,10 @@
return CapabilityStatement instead of the previously used
"Conformance" resource
</action>
<action type="fix">
CLI example uploader couldn't find STU3 examples after CI server
was moved to build.fhir.org
</action>
</release>
<release version="2.1" date="2016-11-11">
<action type="add">