Working on #89 - Won't mark it until server is redeployed though
This commit is contained in:
parent
b36932aed4
commit
aa8684c977
|
@ -286,6 +286,7 @@ public class JsonParser extends BaseParser implements IParser {
|
|||
writeOptionalTagWithTextNode(theEventWriter, "versionId", nextEntry.getResource().getId().getVersionIdPart());
|
||||
}
|
||||
writeTagWithTextNode(theEventWriter, "instant", nextEntry.getDeletedAt());
|
||||
theEventWriter.writeEnd();
|
||||
}
|
||||
|
||||
// linkStarted = false;
|
||||
|
|
|
@ -93,6 +93,32 @@ public class CompleteResourceProviderTest {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for issue #60
|
||||
*/
|
||||
@Test
|
||||
public void testReadAllInstancesOfType() throws Exception {
|
||||
Patient pat;
|
||||
|
||||
pat = new Patient();
|
||||
pat.addIdentifier().setSystem("urn:system").setValue("testReadAllInstancesOfType_01");
|
||||
ourClient.create().resource(pat).prettyPrint().encodedXml().execute().getId();
|
||||
|
||||
pat = new Patient();
|
||||
pat.addIdentifier().setSystem("urn:system").setValue("testReadAllInstancesOfType_02");
|
||||
ourClient.create().resource(pat).prettyPrint().encodedXml().execute().getId();
|
||||
|
||||
{
|
||||
Bundle returned = ourClient.search().forResource(Patient.class).encodedXml().execute();
|
||||
assertThat(returned.size(), greaterThan(1));
|
||||
}
|
||||
{
|
||||
Bundle returned = ourClient.search().forResource(Patient.class).encodedJson().execute();
|
||||
assertThat(returned.size(), greaterThan(1));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testSearchWithInclude() throws Exception {
|
||||
Organization org = new Organization();
|
||||
|
|
|
@ -1,21 +1,18 @@
|
|||
package ca.uhn.fhir.parser;
|
||||
|
||||
import static org.hamcrest.Matchers.containsString;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.hamcrest.Matchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.StringReader;
|
||||
import java.io.IOException;
|
||||
|
||||
import net.sf.json.JSON;
|
||||
import net.sf.json.JSONSerializer;
|
||||
import net.sf.json.JsonConfig;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.custommonkey.xmlunit.Diff;
|
||||
import org.junit.Test;
|
||||
|
||||
import ca.uhn.fhir.context.ConfigurationException;
|
||||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.ExtensionDt;
|
||||
|
@ -46,6 +43,25 @@ public class JsonParserTest {
|
|||
assertEquals("{\"resourceType\":\"Binary\",\"id\":\"11\",\"meta\":{\"versionId\":\"22\"},\"contentType\":\"foo\",\"content\":\"AQIDBA==\"}", val);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fixing #89
|
||||
*/
|
||||
@Test
|
||||
public void testEncodeBundleWithDeletedEntry() throws ConfigurationException, DataFormatException, IOException {
|
||||
Bundle b = ourCtx.newXmlParser().parseBundle(IOUtils.toString(JsonParserTest.class.getResourceAsStream("/xml-bundle.xml")));
|
||||
String val = ourCtx.newJsonParser().encodeBundleToString(b);
|
||||
|
||||
ourLog.info(val);
|
||||
|
||||
//@formatter:off
|
||||
assertThat(val, containsString("\"deleted\":{" +
|
||||
"\"type\":\"Patient\"," +
|
||||
"\"resourceId\":\"4384\"," +
|
||||
"\"instant\":\"2015-01-15T11:04:43.054-05:00\"" +
|
||||
"}"));
|
||||
//@formatter:on
|
||||
}
|
||||
|
||||
/**
|
||||
* #65
|
||||
*/
|
||||
|
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue