FIx a bunch more unit tests

This commit is contained in:
James 2014-07-02 18:01:29 -04:00
parent 1c05bcb29c
commit 0ece666c88
32 changed files with 283 additions and 90 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<assembly xmlns="urn:assembly" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:assembly http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
<id>all</id>

View File

@ -241,10 +241,6 @@ public class FhirContext {
myNarrativeGenerator = theNarrativeGenerator;
}
public void setRestfulClientFactory(IRestfulClientFactory theRestfulClientFactory) {
myRestfulClientFactory = theRestfulClientFactory;
}
private RuntimeResourceDefinition scanResourceType(Class<? extends IResource> theResourceType) {
ArrayList<Class<? extends IResource>> resourceTypes = new ArrayList<Class<? extends IResource>>();
resourceTypes.add(theResourceType);

View File

@ -656,7 +656,7 @@ public class XmlParser extends BaseParser implements IParser {
} else {
if (StringUtils.isBlank(se.getName().getPrefix())) {
theEventWriter.writeStartElement(se.getName().getLocalPart());
theEventWriter.writeDefaultNamespace(se.getName().getNamespaceURI());
// theEventWriter.writeDefaultNamespace(se.getName().getNamespaceURI());
} else {
theEventWriter.writeStartElement(se.getName().getNamespaceURI(), se.getName().getLocalPart());
}

View File

@ -391,7 +391,8 @@ public class GenericClient extends BaseClient implements IGenericClient {
public ForInternal(Class<? extends IResource> theResourceType) {
myResourceType = theResourceType;
myResourceName = myContext.getResourceDefinition(theResourceType).getName();
RuntimeResourceDefinition definition = myContext.getResourceDefinition(theResourceType);
myResourceName = definition.getName();
}
public ForInternal(String theResourceName) {

View File

@ -66,4 +66,13 @@ public interface IRestfulClientFactory {
*/
IGenericClient newGenericClient(String theServerBase);
void setSocketTimeout(int theSocketTimeout);
void setConnectTimeout(int theConnectTimeout);
void setConnectionRequestTimeout(int theConnectionRequestTimeout);
}

View File

@ -155,11 +155,13 @@ public class RestfulClientFactory implements IRestfulClientFactory {
return new GenericClient(myContext, getHttpClient(), theServerBase);
}
@Override
public synchronized void setConnectionRequestTimeout(int theConnectionRequestTimeout) {
myConnectionRequestTimeout = theConnectionRequestTimeout;
myHttpClient=null;
}
@Override
public synchronized void setConnectTimeout(int theConnectTimeout) {
myConnectTimeout = theConnectTimeout;
myHttpClient=null;
@ -177,6 +179,7 @@ public class RestfulClientFactory implements IRestfulClientFactory {
myHttpClient = theHttpClient;
}
@Override
public synchronized void setSocketTimeout(int theSocketTimeout) {
mySocketTimeout = theSocketTimeout;
myHttpClient=null;

View File

@ -121,7 +121,7 @@ public class RestfulServer extends HttpServlet {
* </p>
*/
public void addHeadersToResponse(HttpServletResponse theHttpResponse) {
theHttpResponse.addHeader("X-PoweredBy", "HAPI FHIR " + VersionUtil.getVersion() + " RESTful Server");
theHttpResponse.addHeader("X-Powered-By", "HAPI FHIR " + VersionUtil.getVersion() + " RESTful Server");
}
private void assertProviderIsValid(Object theNext) throws ConfigurationException {

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<project xmlns="urn:site" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:site http://maven.apache.org/xsd/decoration-1.1.0.xsd" name="HAPI">
<project xmlns="http://maven.apache.org/DECORATION/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/DECORATION/1.1.0 http://maven.apache.org/xsd/decoration-1.1.0.xsd" name="HAPI">
<bannerLeft>
<name>HAPI</name>
@ -21,6 +21,23 @@
<version position="left" />
<body>
<head>
<!-- Syntax Highlighter -->
<script type="text/javascript" src="syntaxhighlighter/shCore.js"></script>
<script type="text/javascript" src="syntaxhighlighter/shBrushJScript.js"></script>
<script type="text/javascript" src="syntaxhighlighter/shBrushJava.js"></script>
<script type="text/javascript" src="syntaxhighlighter/shBrushBash.js"></script>
<script type="text/javascript" src="syntaxhighlighter/shBrushXml.js"></script>
<link href="syntaxhighlighter/shCore.css" rel="stylesheet" type="text/css" />
<link href="syntaxhighlighter/shThemeDefault.css" rel="stylesheet" type="text/css" />
<!--
HAPI stylesheet comes after because it overwrites the Syntax Highlighter
font size
-->
<link rel="shortcut icon" href="http://hl7api.sourceforge.net/images/favicon.png" />
<link rel="stylesheet" type="text/css" href="hapi.css" />
</head>
<links>
<item name="Sourceforge Project Page" href="https://sourceforge.net/projects/hl7api/" />
@ -57,24 +74,6 @@
<item name="Source Code" href="http://sourceforge.net/p/hl7api/fhircode/ci/master/tree/" />
</menu>
<head>
<!-- Syntax Highlighter -->
<script type="text/javascript" src="syntaxhighlighter/shCore.js"></script>
<script type="text/javascript" src="syntaxhighlighter/shBrushJScript.js"></script>
<script type="text/javascript" src="syntaxhighlighter/shBrushJava.js"></script>
<script type="text/javascript" src="syntaxhighlighter/shBrushBash.js"></script>
<script type="text/javascript" src="syntaxhighlighter/shBrushXml.js"></script>
<link href="syntaxhighlighter/shCore.css" rel="stylesheet" type="text/css" />
<link href="syntaxhighlighter/shThemeDefault.css" rel="stylesheet" type="text/css" />
<!--
HAPI stylesheet comes after because it overwrites the Syntax Highlighter
font size
-->
<link rel="shortcut icon" href="http://hl7api.sourceforge.net/images/favicon.png" />
<link rel="stylesheet" type="text/css" href="hapi.css" />
</head>
</body>
<skin>
@ -91,3 +90,4 @@
</custom>
</project>

View File

@ -33,7 +33,7 @@
to the Maven repos and the Sourceforge download system. This release corrects a large number of
bugs and includes fixes which were implemented in the recent FHIR Connectathon.
<br/>
&nbsp;&nbsp;&nbsp;&emdash;&nbsp;<a href="mailto:jamesagnew@users.sourceforge.net">James Agnew</a>
<![CDATA[&nbsp;&nbsp;&nbsp;&emdash;&nbsp;]]><a href="mailto:jamesagnew@users.sourceforge.net">James Agnew</a>
</p>
</section>

View File

@ -74,7 +74,7 @@ public class XmlParserTest {
patient.getGender().setValueAsEnum(AdministrativeGenderCodesEnum.M);
String val = new FhirContext().newXmlParser().encodeResourceToString(patient);
String val = ourCtx.newXmlParser().encodeResourceToString(patient);
ourLog.info(val);
}
@ -149,7 +149,7 @@ public class XmlParserTest {
parameter.setUrl("http://foo").setValue(new StringDt("bar"));
String val = new FhirContext().newXmlParser().encodeResourceToString(q);
String val = ourCtx.newXmlParser().encodeResourceToString(q);
ourLog.info(val);
assertEquals("<Query xmlns=\"http://hl7.org/fhir\"><parameter url=\"http://foo\"><valueString value=\"bar\"/></parameter></Query>", val);
@ -214,7 +214,7 @@ public class XmlParserTest {
"</taglist>";
//@formatter:on
String encoded = new FhirContext().newXmlParser().encodeTagListToString(tagList);
String encoded = ourCtx.newXmlParser().encodeTagListToString(tagList);
assertEquals(expected,encoded);
}
@ -235,13 +235,13 @@ public class XmlParserTest {
"</feed>";
//@formatter:off
Bundle bundleR = new FhirContext().newXmlParser().parseBundle(bundle);
Bundle bundleR = ourCtx.newXmlParser().parseBundle(bundle);
assertEquals(15, bundleR.getTotalResults().getValue().intValue());
}
@Test
public void testEncodeExtensionWithResourceContent() {
IParser parser = new FhirContext().newXmlParser();
IParser parser = ourCtx.newXmlParser();
Patient patient = new Patient();
patient.addAddress().setUse(AddressUseEnum.HOME);
@ -262,7 +262,7 @@ public class XmlParserTest {
@Test
public void testEncodeDeclaredExtensionWithResourceContent() {
IParser parser = new FhirContext().newXmlParser();
IParser parser = ourCtx.newXmlParser();
MyPatientWithOneDeclaredExtension patient = new MyPatientWithOneDeclaredExtension();
patient.addAddress().setUse(AddressUseEnum.HOME);
@ -281,7 +281,7 @@ public class XmlParserTest {
@Test
public void testEncodeDeclaredExtensionWithAddressContent() {
IParser parser = new FhirContext().newXmlParser();
IParser parser = ourCtx.newXmlParser();
MyPatientWithOneDeclaredAddressExtension patient = new MyPatientWithOneDeclaredAddressExtension();
patient.addAddress().setUse(AddressUseEnum.HOME);
@ -300,7 +300,7 @@ public class XmlParserTest {
@Test
public void testEncodeUndeclaredExtensionWithAddressContent() {
IParser parser = new FhirContext().newXmlParser();
IParser parser = ourCtx.newXmlParser();
Patient patient = new Patient();
patient.addAddress().setUse(AddressUseEnum.HOME);
@ -323,7 +323,7 @@ public class XmlParserTest {
Bundle b = new Bundle();
b.getTotalResults().setValue(123);
String val = new FhirContext().newXmlParser().setPrettyPrint(true).encodeBundleToString(b);
String val = ourCtx.newXmlParser().setPrettyPrint(true).encodeBundleToString(b);
ourLog.info(val);
assertThat(val, StringContains.containsString("<os:totalResults xmlns:os=\"http://a9.com/-/spec/opensearch/1.1/\">123</os:totalResults>"));
@ -338,12 +338,12 @@ public class XmlParserTest {
e.setResource(new Patient());
e.addCategory().setLabel("label").setTerm("term").setScheme("scheme");
String val = new FhirContext().newXmlParser().setPrettyPrint(true).encodeBundleToString(b);
String val = ourCtx.newXmlParser().setPrettyPrint(true).encodeBundleToString(b);
ourLog.info(val);
assertThat(val, StringContains.containsString("<category term=\"term\" label=\"label\" scheme=\"scheme\"/>"));
b = new FhirContext().newXmlParser().parseBundle(val);
b = ourCtx.newXmlParser().parseBundle(val);
assertEquals(1, b.getEntries().size());
assertEquals(1, b.getEntries().get(0).getCategories().size());
assertEquals("term", b.getEntries().get(0).getCategories().get(0).getTerm());
@ -398,7 +398,7 @@ public class XmlParserTest {
spm.getText().setDiv("AAA");
rpt.addSpecimen().setResource(spm);
IParser p = new FhirContext(DiagnosticReport.class).newXmlParser().setPrettyPrint(true);
IParser p = ourCtx.newXmlParser().setPrettyPrint(true);
String str = p.encodeResourceToString(rpt);
ourLog.info(str);
@ -418,7 +418,7 @@ public class XmlParserTest {
Observation obs = new Observation();
obs.setValue(new DecimalDt(112.22));
IParser p = new FhirContext(Observation.class).newJsonParser();
IParser p = ourCtx.newJsonParser();
try {
p.encodeResourceToString(obs);
@ -435,7 +435,7 @@ public class XmlParserTest {
patient.addName().addFamily("Family").addGiven("Given");
//@formatter:off
String encoded = new FhirContext().newXmlParser().setPrettyPrint(false).encodeResourceToString(patient);
String encoded = ourCtx.newXmlParser().setPrettyPrint(false).encodeResourceToString(patient);
ourLog.info(encoded);
/*
* Note at least one space is placed where any whitespace was, as
@ -447,7 +447,7 @@ public class XmlParserTest {
+ "</i> </div></text><name><family value=\"Family\"/><given value=\"Given\"/></name></Patient>";
assertEquals(expected, encoded);
encoded = new FhirContext().newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
encoded = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
ourLog.info(encoded);
expected = "<Patient xmlns=\"http://hl7.org/fhir\">\n"
+ " <text>\n"
@ -476,7 +476,7 @@ public class XmlParserTest {
Patient patient = new Patient();
patient.setManagingOrganization(new ResourceReferenceDt());
IParser p = new FhirContext().newXmlParser();
IParser p = ourCtx.newXmlParser();
String str = p.encodeResourceToString(patient);
assertThat(str, IsNot.not(StringContains.containsString("managingOrganization")));
@ -502,7 +502,7 @@ public class XmlParserTest {
patient.addName().addFamily("Smith");
IParser p = new FhirContext().newXmlParser();
IParser p = ourCtx.newXmlParser();
String str = p.encodeResourceToString(patient);
ourLog.info(str);
@ -745,7 +745,7 @@ public class XmlParserTest {
NarrativeDt nar = new NarrativeDt(xhtmlDt, NarrativeStatusEnum.GENERATED);
when(gen.generateNarrative(eq("http://hl7.org/fhir/profiles/Patient"), eq(patient))).thenReturn(nar);
FhirContext context = new FhirContext();
FhirContext context = ourCtx;
context.setNarrativeGenerator(gen);
IParser p = context.newXmlParser();
String str = p.encodeResourceToString(patient);
@ -946,6 +946,26 @@ public class XmlParserTest {
assertEquals("_id", res.getSearchParam().get(1).getName().getValue());
}
@Test
public void testParseEncodeNarrative() {
String input = "<Patient xmlns=\"http://hl7.org/fhir\"><text><status value=\"generated\"/><div xmlns=\"http://www.w3.org/1999/xhtml\"><div class=\"hapiHeaderText\"> Donald null <b>DUCK </b></div><table class=\"hapiPropertyTable\"><tbody><tr><td>Identifier</td><td>7000135</td></tr><tr><td>Address</td><td><span>10 Duxon Street </span><br/><span>VICTORIA </span><span>BC </span><span>Can </span></td></tr><tr><td>Date of birth</td><td><span>01 June 1980</span></td></tr></tbody></table></div></text><identifier><use value=\"official\"/><label value=\"University Health Network MRN 7000135\"/><system value=\"urn:oid:2.16.840.1.113883.3.239.18.148\"/><value value=\"7000135\"/><assigner><reference value=\"Organization/1.3.6.1.4.1.12201\"/></assigner></identifier><name><family value=\"Duck\"/><given value=\"Donald\"/></name><telecom><system value=\"phone\"/><use value=\"home\"/></telecom><telecom><system value=\"phone\"/><use value=\"work\"/></telecom><telecom><system value=\"phone\"/><use value=\"mobile\"/></telecom><telecom><system value=\"email\"/><use value=\"home\"/></telecom><gender><coding><system value=\"http://hl7.org/fhir/v3/AdministrativeGender\"/><code value=\"M\"/></coding></gender><birthDate value=\"1980-06-01T00:00:00\"/><address><use value=\"home\"/><line value=\"10 Duxon Street\"/><city value=\"VICTORIA\"/><state value=\"BC\"/><zip value=\"V8N 1Y4\"/><country value=\"Can\"/></address><managingOrganization><reference value=\"Organization/1.3.6.1.4.1.12201\"/></managingOrganization></Patient>";
IResource res = ourCtx.newXmlParser().parseResource(input);
String output = ourCtx.newXmlParser().encodeResourceToString(res);
// Should occur exactly twice (once for the resource, once for the DIV
assertThat(output, (StringContainsInOrder.stringContainsInOrder(Arrays.asList("Patient xmlns", "div xmlns"))));
assertThat(output, not(StringContainsInOrder.stringContainsInOrder(Arrays.asList("b xmlns"))));
output = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(res);
// Should occur exactly twice (once for the resource, once for the DIV
assertThat(output, (StringContainsInOrder.stringContainsInOrder(Arrays.asList("Patient xmlns", "div xmlns"))));
assertThat(output, not(StringContainsInOrder.stringContainsInOrder(Arrays.asList("b xmlns"))));
}
@BeforeClass
public static void beforeClass() {
XMLUnit.setIgnoreAttributeOrder(true);
@ -989,10 +1009,10 @@ public class XmlParserTest {
parent.addUndeclaredExtension(child2);
// END SNIPPET: subExtension
String output = new FhirContext().newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
String output = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
ourLog.info(output);
String enc = new FhirContext().newXmlParser().encodeResourceToString(patient);
String enc = ourCtx.newXmlParser().encodeResourceToString(patient);
assertThat(enc, containsString("<Patient xmlns=\"http://hl7.org/fhir\"><extension url=\"http://example.com/extensions#someext\"><valueDateTime value=\"2011-01-02T11:13:15\"/></extension>"));
assertThat(enc, containsString("<extension url=\"http://example.com#parent\"><extension url=\"http://example.com#child\"><valueString value=\"value1\"/></extension><extension url=\"http://example.com#child\"><valueString value=\"value1\"/></extension></extension>"));
assertThat(enc, containsString("<given value=\"Joe\"><extension url=\"http://examples.com#givenext\"><valueString value=\"given\"/></extension></given>"));
@ -1008,13 +1028,13 @@ public class XmlParserTest {
HumanNameDt given = name.addGiven("Joe");
ExtensionDt ext2 = new ExtensionDt(false, "http://examples.com#givenext", new StringDt("Hello"));
given.addUndeclaredExtension(ext2);
String output = new FhirContext().newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
String output = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
ourLog.info(output);
String enc = new FhirContext().newXmlParser().encodeResourceToString(patient);
String enc = ourCtx.newXmlParser().encodeResourceToString(patient);
assertThat(enc, containsString("<name><extension url=\"http://examples.com#givenext\"><valueString value=\"Hello\"/></extension><family value=\"Shmoe\"/><given value=\"Joe\"/></name>"));
Patient parsed = new FhirContext().newXmlParser().parseResource(Patient.class, new StringReader(enc));
Patient parsed = ourCtx.newXmlParser().parseResource(Patient.class, new StringReader(enc));
assertEquals(1, parsed.getNameFirstRep().getUndeclaredExtensionsByUrl("http://examples.com#givenext").size());
ExtensionDt ext = parsed.getNameFirstRep().getUndeclaredExtensionsByUrl("http://examples.com#givenext").get(0);
assertEquals("Hello", ext.getValueAsPrimitive().getValue());
@ -1032,13 +1052,13 @@ public class XmlParserTest {
ExtensionDt ext2 = new ExtensionDt(false, "http://examples.com#givenext", new StringDt("Hello"));
family.addUndeclaredExtension(ext2);
String output = new FhirContext().newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
String output = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
ourLog.info(output);
String enc = new FhirContext().newXmlParser().encodeResourceToString(patient);
String enc = ourCtx.newXmlParser().encodeResourceToString(patient);
assertThat(enc, containsString("<name><family value=\"Shmoe\"><extension url=\"http://examples.com#givenext\"><valueString value=\"Hello\"/></extension></family></name>"));
Patient parsed = new FhirContext().newXmlParser().parseResource(Patient.class, new StringReader(enc));
Patient parsed = ourCtx.newXmlParser().parseResource(Patient.class, new StringReader(enc));
assertEquals(1, parsed.getNameFirstRep().getFamilyFirstRep().getUndeclaredExtensionsByUrl("http://examples.com#givenext").size());
ExtensionDt ext = parsed.getNameFirstRep().getFamilyFirstRep().getUndeclaredExtensionsByUrl("http://examples.com#givenext").get(0);
assertEquals("Hello", ext.getValueAsPrimitive().getValue());

View File

@ -374,7 +374,10 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
throw new IllegalArgumentException("Invalid token type: " + params.getClass());
}
Predicate singleCode = builder.equal(from.get("myValueNormalized"), normalizeString(string));
String likeExpression = normalizeString(string);
likeExpression = likeExpression.replace("%", "[%]") + "%";
Predicate singleCode = builder.like(from.get("myValueNormalized").as(String.class), likeExpression);
if (params instanceof StringParam && ((StringParam) params).isExact()) {
Predicate exactCode = builder.equal(from.get("myValueExact"), string);
singleCode = builder.and(singleCode, exactCode);
@ -772,6 +775,10 @@ public class FhirResourceDao<T extends IResource> extends BaseFhirDao implements
}
private void loadResourcesByPid(Collection<Long> theIncludePids, List<IResource> theResourceListToPopulate) {
if (theIncludePids.isEmpty()) {
return;
}
CriteriaBuilder builder = myEntityManager.getCriteriaBuilder();
CriteriaQuery<ResourceTable> cq = builder.createQuery(ResourceTable.class);
Root<ResourceTable> from = cq.from(ResourceTable.class);

View File

@ -16,6 +16,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import ca.uhn.fhir.context.FhirContext;
import ca.uhn.fhir.model.api.IQueryParameterType;
import ca.uhn.fhir.model.api.IResource;
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
@ -37,6 +38,7 @@ import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.model.primitive.InstantDt;
import ca.uhn.fhir.model.primitive.StringDt;
import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.client.exceptions.FhirClientConnectionException;
import ca.uhn.fhir.rest.param.DateRangeParam;
import ca.uhn.fhir.rest.param.QualifiedDateParam;
import ca.uhn.fhir.rest.param.ReferenceParam;
@ -58,6 +60,49 @@ public class FhirResourceDaoTest {
private static Date ourTestStarted;
private static IFhirResourceDao<Encounter> ourEncounterDao;
private static FhirContext ourFhirCtx;
@Test
public void testOrganizationName() {
//@formatter:off
String inputStr = "{\"resourceType\":\"Organization\",\n" +
" \"extension\":[\n" +
" {\n" +
" \"url\":\"http://fhir.connectinggta.ca/Profile/organization#providerIdPool\",\n" +
" \"valueUri\":\"urn:oid:2.16.840.1.113883.3.239.23.21.1\"\n" +
" }\n" +
" ],\n" +
" \"text\":{\n" +
" \"status\":\"empty\",\n" +
" \"div\":\"<div xmlns=\\\"http://www.w3.org/1999/xhtml\\\">No narrative template available for resource profile: http://fhir.connectinggta.ca/Profile/organization</div>\"\n" +
" },\n" +
" \"identifier\":[\n" +
" {\n" +
" \"use\":\"official\",\n" +
" \"label\":\"HSP 2.16.840.1.113883.3.239.23.21\",\n" +
" \"system\":\"urn:cgta:hsp_ids\",\n" +
" \"value\":\"urn:oid:2.16.840.1.113883.3.239.23.21\"\n" +
" }\n" +
" ],\n" +
" \"name\":\"Peterborough Regional Health Centre\"\n" +
" }\n" +
" }";
//@formatter:on
Set<Long> val = ourOrganizationDao.searchForIds("name", new StringParam("P"));
int initial = val.size();
Organization org = ourFhirCtx.newJsonParser().parseResource(Organization.class,inputStr);
ourOrganizationDao.create(org);
val = ourOrganizationDao.searchForIds("name", new StringParam("P"));
assertEquals(initial+1, val.size());
}
@Test
public void testStoreUnversionedResources() {
@ -206,6 +251,23 @@ public class FhirResourceDaoTest {
}
@Test
public void testSearchWithNoResults() {
IBundleProvider value = ourObservationDao.search(new SearchParameterMap());
/*
* This may fail at some point, which means another test has probably added a device
* resource. This test depends on there being none, so if that happens this test
* should be refactored to use another resource type
*/
assertEquals(0, value.size());
List<IResource> res = value.getResources(0, 0);
assertTrue(res.isEmpty());
}
@Test
public void testPersistSearchParamQuantity() {
Observation obs = new Observation();
@ -222,6 +284,8 @@ public class FhirResourceDaoTest {
}
@Test
public void testPersistSearchParams() {
Patient patient = new Patient();
@ -878,6 +942,7 @@ public class FhirResourceDaoTest {
ourOrganizationDao = ourCtx.getBean("myOrganizationDao", IFhirResourceDao.class);
ourLocationDao = ourCtx.getBean("myLocationDao", IFhirResourceDao.class);
ourEncounterDao = ourCtx.getBean("myEncounterDao", IFhirResourceDao.class);
ourFhirCtx = new FhirContext();
}
}

View File

@ -1,4 +1,5 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/test/java=UTF-8
encoding//src/test/java/ca/uhn/fhir/jpa/test/Upload.java=UTF-8

View File

@ -32,7 +32,6 @@ public class CompleteResourceProviderTest {
private static ClassPathXmlApplicationContext ourAppCtx;
private static FhirContext ourCtx;
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(CompleteResourceProviderTest.class);
private static Server ourServer;
private static IFhirResourceDao<Patient> patientDao;

View File

@ -23,16 +23,16 @@
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -21,12 +21,12 @@
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>

View File

@ -1,7 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
@ -10,4 +10,4 @@ org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6
org.eclipse.jdt.core.compiler.source=1.7

View File

@ -1,18 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="hapi-fhir-jpaserver-uhnfhirtest">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-resources/tinder"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/target/generated-sources/tinder"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<dependent-module archiveName="hapi-fhir-jpaserver-base-0.4-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-jpaserver-base/hapi-fhir-jpaserver-base">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="hapi-fhir-base-0.4-SNAPSHOT.jar" deploy-path="/WEB-INF/lib" handle="module:/resource/hapi-fhir-base/hapi-fhir-base">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module deploy-path="/" handle="module:/overlay/prj/hapi-fhir-tester-overlay?includes=**/**&amp;excludes=META-INF/MANIFEST.MF">
<dependent-module deploy-path="/" handle="module:/overlay/prj/hapi-fhir-testpage-overlay?includes=**/**&amp;excludes=META-INF/MANIFEST.MF">
<dependency-type>consumes</dependency-type>
</dependent-module>
<dependent-module deploy-path="/" handle="module:/overlay/slf/?includes=**/**&amp;excludes=META-INF/MANIFEST.MF">

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.6"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.7"/>
<installed facet="jst.web" version="3.1"/>
</faceted-project>

View File

@ -144,8 +144,8 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>

View File

@ -0,0 +1,35 @@
<!DOCTYPE html>
<html lang="en">
<div th:fragment="banner" class="well">
<p>
This is the home for the FHIR test server operated by
<a href="http://uhn.ca">University Health Network</a>.
</p>
<p>
<b style="color: red;">This is not a production server!</b>
Do not store any information here that contains personal health information
or otherwise confidential information. This server will be regularly purged
and reloaded with fixed test data.
</p>
<p>
Here are some things you might wish to try:
</p>
<ul>
<li>
View a
<a href="http://fhirtest.uhn.ca/search?serverId=home&encoding=json&pretty=true&resource=Patient&param.0.type=string&param.0.name=_id&param.0.0=&resource-search-limit=">list of patients</a>
on this server.
</li>
<li>
Construct a
<a href="http://fhirtest.uhn.ca/resource?serverId=home&encoding=json&pretty=true&resource=Patient">search query</a>
on this server.
</li>
<li>
Access a
<a href="http://fhirtest.uhn.ca/home?serverId=furore">different server</a>
(use the <b>Server</b> menu at the top of the page to see a list of public FHIR servers)
</li>
</ul>
</div>
</html>

View File

@ -127,7 +127,6 @@
type="javaee:ejb-local-refType"
minOccurs="0"
maxOccurs="unbounded"/>
<xsd:group ref="javaee:service-refGroup"/>
<xsd:element name="resource-ref"
type="javaee:resource-refType"
minOccurs="0"

View File

@ -23,12 +23,7 @@
<!-- ** Default Home ** -->
<!-- ********************************************************** -->
<div th:if="${requestUrl} == null">
<div class="well">
This is a RESTful server tester, which can be used to send
requests to, and receive responses from the server at the
following URL:
</div>
<div th:replace="tmpl-home-welcome :: banner"/>
<table class="table table-bordered table-striped" th:if="${resourceName.empty}">
<colgroup>
@ -180,8 +175,6 @@
</div>
</div>
</div>
</div>
</div>

View File

@ -100,7 +100,7 @@
controls for viewing/editing/etc results
-->
<div th:if="${bundle} != null" class="panel-group" id="accordion" style="margin-bottom: 0px;">
<div class="panel panel-default">
<div class="panel panel-default" style="border: none; border-bottom: 1px solid #ddd; border-radius: 0px;">
<div class="panel-heading">
<h4 class="panel-title">
<a data-toggle="collapse" data-parent="#accordion" href="#collapseOne">

View File

@ -0,0 +1,8 @@
<!DOCTYPE html>
<html lang="en">
<div th:fragment="banner" class="well">
<div>
This is a RESTful server tester, which can be used to send
requests to, and receive responses from the server.
</div>
</html>

View File

@ -133,6 +133,41 @@
</configuration> <executions> <execution> <id>mojo-descriptor</id> <goals>
<goal>descriptor</goal> </goals> </execution> </executions> </plugin> -->
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-plugin-plugin
</artifactId>
<versionRange>
[3.2,)
</versionRange>
<goals>
<goal>descriptor</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@ -1,12 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="target/generated-sources/tinder"/>
<classpathentry kind="src" path="src/test/resources"/>
<classpathentry kind="src" path="src/test/java"/>
<classpathentry including="**/*.java" kind="src" path="src/test/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/hapi-fhir-base"/>
<classpathentry kind="var" path="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2.jar" sourcepath="M2_REPO/javax/xml/stream/stax-api/1.0-2/stax-api-1.0-2-sources.jar"/>
<classpathentry kind="var" path="M2_REPO/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0.jar" sourcepath="M2_REPO/javax/servlet/javax.servlet-api/3.1.0/javax.servlet-api-3.1.0-sources.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="M2_REPO/ca/uhn/hapi/fhir/hapi-fhir-base/1.0-SNAPSHOT/hapi-fhir-base-1.0-SNAPSHOT.jar"/>
<classpathentry kind="var" path="M2_REPO/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar" sourcepath="M2_REPO/com/google/code/gson/gson/2.2.4/gson-2.2.4-sources.jar">
<attributes>
@ -43,5 +47,21 @@
<attribute name="javadoc_location" value="jar:file:/Users/james/.m2/repository/junit/junit/4.11/junit-4.11-javadoc.jar!/"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>

View File

@ -1,2 +1,4 @@
eclipse.preferences.version=1
encoding//src/test/java=UTF-8
encoding//src/test/resources=UTF-8
encoding/<project>=UTF-8

View File

@ -1,5 +1,5 @@
#Mon Mar 03 17:20:36 EST 2014
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.6