Fix broken unit test and allow invalid dates in web testewr UI
This commit is contained in:
parent
5e8fe01af1
commit
3a1cc48048
|
@ -75,6 +75,7 @@ public interface IRestfulClientFactory {
|
|||
/**
|
||||
* @deprecated Use {@link #getServerValidationMode()} instead
|
||||
*/
|
||||
@Deprecated
|
||||
ServerValidationModeEnum getServerValidationModeEnum();
|
||||
|
||||
/**
|
||||
|
@ -168,6 +169,7 @@ public interface IRestfulClientFactory {
|
|||
/**
|
||||
* @deprecated Use {@link #setServerValidationMode(ServerValidationModeEnum)} instead. This method was incorrectly named.
|
||||
*/
|
||||
@Deprecated
|
||||
void setServerValidationModeEnum(ServerValidationModeEnum theServerValidationMode);
|
||||
|
||||
/**
|
||||
|
|
|
@ -1875,7 +1875,7 @@ public abstract class BaseFhirResourceDao<T extends IResource> extends BaseFhirD
|
|||
if (Character.isDigit(theResource.getId().getIdPart().charAt(0))) {
|
||||
throw new InvalidRequestException(getContext().getLocalizer().getMessage(BaseFhirResourceDao.class, "failedToCreateWithClientAssignedNumericId", theResource.getId().getIdPart()));
|
||||
}
|
||||
return doCreate(theResource, null, true);
|
||||
return doCreate(theResource, null, thePerformIndexing);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@ import static org.hamcrest.Matchers.containsString;
|
|||
import static org.hamcrest.Matchers.emptyString;
|
||||
import static org.hamcrest.Matchers.endsWith;
|
||||
import static org.hamcrest.Matchers.not;
|
||||
import static org.hamcrest.Matchers.startsWith;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
@ -11,9 +12,11 @@ import static org.junit.Assert.assertNull;
|
|||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
|
@ -22,10 +25,12 @@ import org.springframework.context.support.ClassPathXmlApplicationContext;
|
|||
import ca.uhn.fhir.context.FhirContext;
|
||||
import ca.uhn.fhir.context.FhirVersionEnum;
|
||||
import ca.uhn.fhir.jpa.entity.TagTypeEnum;
|
||||
import ca.uhn.fhir.jpa.provider.SystemProviderTest;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum;
|
||||
import ca.uhn.fhir.model.api.TagList;
|
||||
import ca.uhn.fhir.model.base.composite.BaseCodingDt;
|
||||
import ca.uhn.fhir.model.dstu2.resource.OperationOutcome;
|
||||
import ca.uhn.fhir.model.dstu2.composite.CodingDt;
|
||||
import ca.uhn.fhir.model.dstu2.composite.MetaDt;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Bundle;
|
||||
|
@ -94,6 +99,30 @@ public class FhirSystemDaoDstu2Test {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testTransactionFromBundle() throws Exception {
|
||||
|
||||
InputStream bundleRes = SystemProviderTest.class.getResourceAsStream("/transaction_link_patient_eve.xml");
|
||||
String bundleStr = IOUtils.toString(bundleRes);
|
||||
Bundle bundle = ourFhirContext.newXmlParser().parseResource(Bundle.class, bundleStr);
|
||||
|
||||
Bundle resp = ourSystemDao.transaction(bundle);
|
||||
|
||||
ourLog.info(ourFhirContext.newJsonParser().setPrettyPrint(true).encodeResourceToString(resp));
|
||||
|
||||
OperationOutcome oo = (OperationOutcome) resp.getEntry().get(0).getResource();
|
||||
assertThat(oo.getIssue().get(0).getDetailsElement().getValue(), containsString("Transaction completed"));
|
||||
|
||||
assertThat(resp.getEntry().get(1).getTransactionResponse().getLocation(), startsWith("Patient/a555-44-4444/_history/"));
|
||||
assertThat(resp.getEntry().get(2).getTransactionResponse().getLocation(), startsWith("Patient/temp6789/_history/"));
|
||||
assertThat(resp.getEntry().get(3).getTransactionResponse().getLocation(), startsWith("Organization/GHH/_history/"));
|
||||
|
||||
Patient p = ourPatientDao.read(new IdDt("Patient/a555-44-4444/_history/1"));
|
||||
assertEquals("Patient/temp6789", p.getLink().get(0).getOther().getReference().getValue());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void testTransactionReadAndSearch() {
|
||||
String methodName = "testTransactionReadAndSearch";
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package ca.uhn.fhir.jpa.provider;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
|
@ -19,8 +17,6 @@ import ca.uhn.fhir.jpa.rp.dstu.ObservationResourceProvider;
|
|||
import ca.uhn.fhir.jpa.rp.dstu.OrganizationResourceProvider;
|
||||
import ca.uhn.fhir.jpa.rp.dstu.PatientResourceProvider;
|
||||
import ca.uhn.fhir.jpa.testutil.RandomServerPortProvider;
|
||||
import ca.uhn.fhir.model.api.Bundle;
|
||||
import ca.uhn.fhir.model.api.IResource;
|
||||
import ca.uhn.fhir.model.dstu.resource.Observation;
|
||||
import ca.uhn.fhir.model.dstu.resource.Organization;
|
||||
import ca.uhn.fhir.model.dstu.resource.Patient;
|
||||
|
@ -30,7 +26,7 @@ import ca.uhn.fhir.rest.server.RestfulServer;
|
|||
|
||||
public class SystemProviderTest {
|
||||
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(SystemProviderTest.class);
|
||||
private static Server ourServer;
|
||||
private static ClassPathXmlApplicationContext ourAppCtx;
|
||||
private static FhirContext ourCtx;
|
||||
|
@ -41,8 +37,8 @@ public class SystemProviderTest {
|
|||
|
||||
InputStream bundleRes = SystemProviderTest.class.getResourceAsStream("/transaction_link_patient_eve.xml");
|
||||
String bundle = IOUtils.toString(bundleRes);
|
||||
String response = ourClient.transaction().withBundle(bundle).execute();
|
||||
|
||||
String response = ourClient.transaction().withBundle(bundle).prettyPrint().execute();
|
||||
ourLog.info(response);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
<Patient>
|
||||
<!-- PID|||555-44-4444||EVERYWOMAN^EVE^E^^^^L|JONES|19620320|F|||153 FERNWOOD DR.^
|
||||
^STATESVILLE^OH^35292||(206)3345232|(206)752-121||||AC555444444||67-A4335^OH^20030520 -->
|
||||
<id value="555-44-4444"/>
|
||||
<id value="a555-44-4444"/>
|
||||
<extension url="http://ihe.net/ITI-78/Profile/pdqm#mothersMaidenName">
|
||||
<valueHumanName>
|
||||
<family value="Jones"/>
|
||||
|
@ -62,8 +62,8 @@
|
|||
</Patient>
|
||||
</resource>
|
||||
<transaction>
|
||||
<method code="PUT"/>
|
||||
<url value="Patient/555-44-4444"/>
|
||||
<method value="PUT"/>
|
||||
<url value="Patient/a555-44-4444"/>
|
||||
</transaction>
|
||||
</entry>
|
||||
<entry>
|
||||
|
@ -88,7 +88,7 @@
|
|||
</managingOrganization>
|
||||
<link>
|
||||
<other>
|
||||
<reference value="Patient/555-44-4444"/>
|
||||
<reference value="Patient/a555-44-4444"/>
|
||||
</other>
|
||||
<type value="replace"/>
|
||||
</link>
|
||||
|
@ -96,8 +96,19 @@
|
|||
</Patient>
|
||||
</resource>
|
||||
<transaction>
|
||||
<method code="PUT"/>
|
||||
<method value="PUT"/>
|
||||
<url value="Patient/temp6789"/>
|
||||
</transaction>
|
||||
</entry>
|
||||
<entry>
|
||||
<resource>
|
||||
<Organization>
|
||||
<id value="GHH"/>
|
||||
</Organization>
|
||||
</resource>
|
||||
<transaction>
|
||||
<method value="PUT"/>
|
||||
<url value="Organization/GHH"/>
|
||||
</transaction>
|
||||
</entry>
|
||||
</Bundle>
|
||||
|
|
|
@ -127,7 +127,8 @@
|
|||
$('#server-history-datetime').datetimepicker({
|
||||
sideBySide: true,
|
||||
use24hours: true,
|
||||
showToday: true
|
||||
showToday: true,
|
||||
keepInvalid: true
|
||||
});
|
||||
});
|
||||
$('#server-history-btn').click(
|
||||
|
|
|
@ -326,7 +326,8 @@
|
|||
$('#resource-history-datetime').datetimepicker({
|
||||
sideBySide: true,
|
||||
use24hours: true,
|
||||
showToday: true
|
||||
showToday: true,
|
||||
keepInvalid: true
|
||||
});
|
||||
});
|
||||
$('#resource-history-btn').click(
|
||||
|
|
|
@ -159,6 +159,11 @@
|
|||
Allow fluent/generic client users to execute a transaction using a raw string (containing a bundle resource)
|
||||
as input instead of a Bundle resource class instance.
|
||||
</action>
|
||||
<action type="fix">
|
||||
Disable date validation in the web tester UI, so that it is possible to
|
||||
enter partial dates, or dates without times, or even test out invalid date
|
||||
options.
|
||||
</action>
|
||||
</release>
|
||||
<release version="0.9" date="2015-Mar-14">
|
||||
<action type="add">
|
||||
|
|
Loading…
Reference in New Issue