Fix tester breakage

This commit is contained in:
James 2014-07-02 18:10:20 -04:00
parent 0ece666c88
commit ca83de38b8
2 changed files with 66 additions and 6 deletions

View File

@ -0,0 +1,65 @@
package ca.uhn.fhirtest;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import ca.uhn.fhir.context.FhirContext;
public class FhirContextFactory implements FactoryBean<FhirContext>, InitializingBean {
private int myConnectionRequestTimeout = 5000;
private int mySocketTimeout = 10000;
private int myConnectTimeout = 4000;
public int getConnectionRequestTimeout() {
return myConnectionRequestTimeout;
}
public void setConnectionRequestTimeout(int theConnectionRequestTimeout) {
myConnectionRequestTimeout = theConnectionRequestTimeout;
}
public int getSocketTimeout() {
return mySocketTimeout;
}
public void setSocketTimeout(int theSocketTimeout) {
mySocketTimeout = theSocketTimeout;
}
public int getConnectTimeout() {
return myConnectTimeout;
}
public void setConnectTimeout(int theConnectTimeout) {
myConnectTimeout = theConnectTimeout;
}
private FhirContext myCtx;
public FhirContextFactory() {
}
@Override
public FhirContext getObject() throws Exception {
return myCtx;
}
@Override
public Class<FhirContext> getObjectType() {
return FhirContext.class;
}
@Override
public boolean isSingleton() {
return true;
}
@Override
public void afterPropertiesSet() throws Exception {
myCtx=new FhirContext();
myCtx.getRestfulClientFactory().setConnectTimeout(myConnectTimeout);
myCtx.getRestfulClientFactory().setSocketTimeout(mySocketTimeout);
myCtx.getRestfulClientFactory().setConnectionRequestTimeout(myConnectionRequestTimeout);
}
}

View File

@ -20,12 +20,7 @@
</property>
</bean>
<bean id="fhirContext" class="ca.uhn.fhir.context.FhirContext">
<property name="restfulClientFactory" ref="restfulClientFactory"/>
</bean>
<bean id="restfulClientFactory" class="ca.uhn.fhir.rest.client.RestfulClientFactory">
<property name="fhirContext" ref="fhirContext"/>
<bean id="fhirContext" class="ca.uhn.fhirtest.FhirContextFactory">
<property name="connectTimeout" value="4000"/>
<property name="socketTimeout" value="10000"/>
</bean>