Last commit broke cobertura
This commit is contained in:
parent
19b3aeed32
commit
bb1e8b9ddd
|
@ -110,7 +110,6 @@
|
|||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>${logback_version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
|
|
|
@ -1,12 +1,8 @@
|
|||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<!--
|
||||
The parent of this project is the deployable POM. This project isn't deployable,
|
||||
but this keeps it before the root pom in the reactor order when building the site.
|
||||
I don't know why this works... Need to investigate this.
|
||||
-->
|
||||
<!-- The parent of this project is the deployable POM. This project isn't deployable, but this keeps it before the root pom in the reactor order when building the site. I don't know why this works...
|
||||
Need to investigate this. -->
|
||||
<parent>
|
||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||
<artifactId>hapi-deployable-pom</artifactId>
|
||||
|
@ -62,17 +58,20 @@
|
|||
<version>${thymeleaf-version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- Use an older version of SLF4j -->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.6.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-simple</artifactId>
|
||||
<version>1.6.0</version>
|
||||
</dependency>
|
||||
<!--
|
||||
Use an older version of SLF4j just to make sure we compile correctly
|
||||
against old SLF4j - Some people can't upgrade and we have no real
|
||||
need for recent features.
|
||||
-->
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>1.6.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- Test Database -->
|
||||
<dependency>
|
||||
|
@ -84,13 +83,11 @@
|
|||
<dependency>
|
||||
<groupId>org.apache.derby</groupId>
|
||||
<artifactId>derby</artifactId>
|
||||
<version>${derby_version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-dbcp</groupId>
|
||||
<artifactId>commons-dbcp</artifactId>
|
||||
<version>1.4</version>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-dbcp2</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
@ -205,7 +202,6 @@
|
|||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>cobertura-maven-plugin</artifactId>
|
||||
<version>${maven_cobertura_plugin_version}</version>
|
||||
<configuration>
|
||||
<skip>false</skip>
|
||||
<formats>
|
||||
|
@ -221,8 +217,7 @@
|
|||
<ignore>**/valueset/*.class</ignore>
|
||||
<ignore>**/exceptions/*.class</ignore>
|
||||
</excludes>
|
||||
<!-- <ignoreMethodAnnotations> <ignoreMethodAnnotation>net.sourceforge.cobertura.CoverageIgnore</ignoreMethodAnnotation>
|
||||
</ignoreMethodAnnotations> -->
|
||||
<!-- <ignoreMethodAnnotations> <ignoreMethodAnnotation>net.sourceforge.cobertura.CoverageIgnore</ignoreMethodAnnotation> </ignoreMethodAnnotations> -->
|
||||
</instrumentation>
|
||||
</configuration>
|
||||
<executions>
|
||||
|
@ -321,8 +316,10 @@
|
|||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>cobertura-maven-plugin</artifactId>
|
||||
<version>${maven_cobertura_plugin_version}</version>
|
||||
<configuration>
|
||||
<check>
|
||||
<haltOnFailure>true</haltOnFailure>
|
||||
</check>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
|
@ -333,15 +330,10 @@
|
|||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<!-- <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId>
|
||||
<version>${maven_cobertura_plugin_version}</version> <configuration> <check>
|
||||
<branchRate>85</branchRate> <lineRate>85</lineRate> <haltOnFailure>true</haltOnFailure>
|
||||
<totalBranchRate>85</totalBranchRate> <totalLineRate>85</totalLineRate> <packageLineRate>85</packageLineRate>
|
||||
<packageBranchRate>85</packageBranchRate> <regexes> <regex> <pattern>com.example.reallyimportant.*</pattern>
|
||||
<branchRate>90</branchRate> <lineRate>80</lineRate> </regex> <regex> <pattern>com.example.boringcode.*</pattern>
|
||||
<branchRate>40</branchRate> <lineRate>30</lineRate> </regex> </regexes> </check>
|
||||
</configuration> <executions> <execution> <goals> <goal>clean</goal> <goal>check</goal>
|
||||
</goals> </execution> </executions> </plugin> -->
|
||||
<!-- <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>cobertura-maven-plugin</artifactId> <version>${maven_cobertura_plugin_version}</version> <configuration> <check> <branchRate>85</branchRate>
|
||||
<lineRate>85</lineRate> <haltOnFailure>true</haltOnFailure> <totalBranchRate>85</totalBranchRate> <totalLineRate>85</totalLineRate> <packageLineRate>85</packageLineRate> <packageBranchRate>85</packageBranchRate>
|
||||
<regexes> <regex> <pattern>com.example.reallyimportant.*</pattern> <branchRate>90</branchRate> <lineRate>80</lineRate> </regex> <regex> <pattern>com.example.boringcode.*</pattern> <branchRate>40</branchRate>
|
||||
<lineRate>30</lineRate> </regex> </regexes> </check> </configuration> <executions> <execution> <goals> <goal>clean</goal> <goal>check</goal> </goals> </execution> </executions> </plugin> -->
|
||||
</plugins>
|
||||
<resources>
|
||||
</resources>
|
||||
|
@ -365,12 +357,16 @@
|
|||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>cobertura-maven-plugin</artifactId>
|
||||
<version>${maven_cobertura_plugin_version}</version>
|
||||
<reportSets>
|
||||
<reportSet>
|
||||
<reports>
|
||||
<report>cobertura</report>
|
||||
</reports>
|
||||
<configuration>
|
||||
<check>
|
||||
<haltOnFailure>true</haltOnFailure>
|
||||
</check>
|
||||
</configuration>
|
||||
</reportSet>
|
||||
</reportSets>
|
||||
</plugin>
|
||||
|
|
|
@ -47,9 +47,12 @@ public class LoggingInterceptorTest {
|
|||
/*
|
||||
* This is a bit funky, but it's useful for verifying that the headers actually get logged
|
||||
*/
|
||||
myLoggerRoot = (ch.qos.logback.classic.Logger) LoggerFactory.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);
|
||||
myMockAppender = mock(Appender.class);
|
||||
when(myMockAppender.getName()).thenReturn("MOCK");
|
||||
|
||||
org.slf4j.Logger logger = LoggerFactory.getLogger(ch.qos.logback.classic.Logger.ROOT_LOGGER_NAME);
|
||||
|
||||
myLoggerRoot = (ch.qos.logback.classic.Logger) logger;
|
||||
myLoggerRoot.addAppender(myMockAppender);
|
||||
}
|
||||
|
||||
|
|
|
@ -43,174 +43,170 @@ import ca.uhn.fhir.util.PortUtil;
|
|||
*/
|
||||
public class ETagServerHl7OrgTest {
|
||||
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static FhirContext ourCtx;
|
||||
private static Date ourLastModifiedDate;
|
||||
private static int ourPort;
|
||||
private static Server ourServer;
|
||||
private static PoolingHttpClientConnectionManager ourConnectionManager;
|
||||
private static CloseableHttpClient ourClient;
|
||||
private static FhirContext ourCtx = FhirContext.forDstu2Hl7Org();
|
||||
private static Date ourLastModifiedDate;
|
||||
private static int ourPort;
|
||||
private static Server ourServer;
|
||||
private static PoolingHttpClientConnectionManager ourConnectionManager;
|
||||
|
||||
@Test
|
||||
public void testETagHeader() throws Exception {
|
||||
ourLastModifiedDate = new InstantDt("2012-11-25T02:34:45.2222Z").getValue();
|
||||
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/2/_history/3");
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
String responseContent = IOUtils.toString(status.getEntity().getContent());
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
@Test
|
||||
public void testETagHeader() throws Exception {
|
||||
ourLastModifiedDate = new InstantDt("2012-11-25T02:34:45.2222Z").getValue();
|
||||
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
Identifier dt = ourCtx.newXmlParser().parseResource(Patient.class, responseContent).getIdentifier().get(0);
|
||||
assertEquals("2", dt.getSystemElement().getValueAsString());
|
||||
assertEquals("3", dt.getValue());
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/2/_history/3");
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
String responseContent = IOUtils.toString(status.getEntity().getContent());
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
|
||||
Header cl = status.getFirstHeader(Constants.HEADER_ETAG_LC);
|
||||
assertNotNull(cl);
|
||||
assertEquals("W/\"222\"", cl.getValue());
|
||||
}
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
Identifier dt = ourCtx.newXmlParser().parseResource(Patient.class, responseContent).getIdentifier().get(0);
|
||||
assertEquals("2", dt.getSystemElement().getValueAsString());
|
||||
assertEquals("3", dt.getValue());
|
||||
|
||||
|
||||
@Test
|
||||
public void testAutomaticNotModified() throws Exception {
|
||||
ourLastModifiedDate = new InstantDt("2012-11-25T02:34:45.2222Z").getValue();
|
||||
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/2");
|
||||
httpGet.addHeader(Constants.HEADER_IF_NONE_MATCH, "\"222\"");
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
assertEquals(Constants.STATUS_HTTP_304_NOT_MODIFIED, status.getStatusLine().getStatusCode());
|
||||
}
|
||||
Header cl = status.getFirstHeader(Constants.HEADER_ETAG_LC);
|
||||
assertNotNull(cl);
|
||||
assertEquals("W/\"222\"", cl.getValue());
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testLastModifiedHeader() throws Exception {
|
||||
ourLastModifiedDate = new InstantDt("2012-11-25T02:34:45.2222Z").getValue();
|
||||
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/2/_history/3");
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
String responseContent = IOUtils.toString(status.getEntity().getContent());
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
@Test
|
||||
public void testAutomaticNotModified() throws Exception {
|
||||
ourLastModifiedDate = new InstantDt("2012-11-25T02:34:45.2222Z").getValue();
|
||||
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
Identifier dt = ourCtx.newXmlParser().parseResource(Patient.class, responseContent).getIdentifier().get(0);
|
||||
assertEquals("2", dt.getSystemElement().getValueAsString());
|
||||
assertEquals("3", dt.getValue());
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/2");
|
||||
httpGet.addHeader(Constants.HEADER_IF_NONE_MATCH, "\"222\"");
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
assertEquals(Constants.STATUS_HTTP_304_NOT_MODIFIED, status.getStatusLine().getStatusCode());
|
||||
}
|
||||
|
||||
Header cl = status.getFirstHeader(Constants.HEADER_LAST_MODIFIED_LOWERCASE);
|
||||
assertNotNull(cl);
|
||||
assertEquals("Sun, 25 Nov 2012 02:34:47 GMT", cl.getValue());
|
||||
}
|
||||
@Test
|
||||
public void testLastModifiedHeader() throws Exception {
|
||||
ourLastModifiedDate = new InstantDt("2012-11-25T02:34:45.2222Z").getValue();
|
||||
|
||||
@Before
|
||||
public void before() throws IOException {
|
||||
ourLastId=null;
|
||||
}
|
||||
HttpGet httpGet = new HttpGet("http://localhost:" + ourPort + "/Patient/2/_history/3");
|
||||
HttpResponse status = ourClient.execute(httpGet);
|
||||
String responseContent = IOUtils.toString(status.getEntity().getContent());
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
|
||||
@Test
|
||||
public void testUpdateWithNoVersion() throws Exception {
|
||||
Patient p = new Patient();
|
||||
p.addIdentifier().setSystem("urn:system").setValue("001");
|
||||
String resBody = ourCtx.newXmlParser().encodeResourceToString(p);
|
||||
|
||||
HttpPut http;
|
||||
http = new HttpPut("http://localhost:" + ourPort + "/Patient/2");
|
||||
http.setEntity(new StringEntity(resBody, ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
||||
HttpResponse status = ourClient.execute(http);
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
|
||||
}
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
Identifier dt = ourCtx.newXmlParser().parseResource(Patient.class, responseContent).getIdentifier().get(0);
|
||||
assertEquals("2", dt.getSystemElement().getValueAsString());
|
||||
assertEquals("3", dt.getValue());
|
||||
|
||||
@Test
|
||||
public void testUpdateWithIfMatch() throws Exception {
|
||||
Patient p = new Patient();
|
||||
p.addIdentifier().setSystem("urn:system").setValue("001");
|
||||
String resBody = ourCtx.newXmlParser().encodeResourceToString(p);
|
||||
|
||||
HttpPut http;
|
||||
http = new HttpPut("http://localhost:" + ourPort + "/Patient/2");
|
||||
http.setEntity(new StringEntity(resBody, ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
||||
http.addHeader(Constants.HEADER_IF_MATCH, "\"221\"");
|
||||
CloseableHttpResponse status = ourClient.execute(http);
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
assertEquals("Patient/2/_history/221", ourLastId.toUnqualified().getValue());
|
||||
|
||||
}
|
||||
Header cl = status.getFirstHeader(Constants.HEADER_LAST_MODIFIED_LOWERCASE);
|
||||
assertNotNull(cl);
|
||||
assertEquals("Sun, 25 Nov 2012 02:34:47 GMT", cl.getValue());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testUpdateWithIfMatchPreconditionFailed() throws Exception {
|
||||
Patient p = new Patient();
|
||||
p.addIdentifier().setSystem("urn:system").setValue("001");
|
||||
String resBody = ourCtx.newXmlParser().encodeResourceToString(p);
|
||||
|
||||
HttpPut http;
|
||||
http = new HttpPut("http://localhost:" + ourPort + "/Patient/2");
|
||||
http.setEntity(new StringEntity(resBody, ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
||||
http.addHeader(Constants.HEADER_IF_MATCH, "\"222\"");
|
||||
CloseableHttpResponse status = ourClient.execute(http);
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
assertEquals(Constants.STATUS_HTTP_412_PRECONDITION_FAILED, status.getStatusLine().getStatusCode());
|
||||
assertEquals("Patient/2/_history/222", ourLastId.toUnqualified().getValue());
|
||||
}
|
||||
@Before
|
||||
public void before() throws IOException {
|
||||
ourLastId = null;
|
||||
}
|
||||
|
||||
|
||||
@AfterClass
|
||||
public static void afterClass() throws Exception {
|
||||
ourServer.stop();
|
||||
}
|
||||
@Test
|
||||
public void testUpdateWithNoVersion() throws Exception {
|
||||
Patient p = new Patient();
|
||||
p.addIdentifier().setSystem("urn:system").setValue("001");
|
||||
String resBody = ourCtx.newXmlParser().encodeResourceToString(p);
|
||||
|
||||
@BeforeClass
|
||||
public static void beforeClass() throws Exception {
|
||||
ourPort = PortUtil.findFreePort();
|
||||
ourServer = new Server(ourPort);
|
||||
HttpPut http;
|
||||
http = new HttpPut("http://localhost:" + ourPort + "/Patient/2");
|
||||
http.setEntity(new StringEntity(resBody, ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
||||
HttpResponse status = ourClient.execute(http);
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
|
||||
PatientProvider patientProvider = new PatientProvider();
|
||||
}
|
||||
|
||||
ServletHandler proxyHandler = new ServletHandler();
|
||||
RestfulServer servlet = new RestfulServer(ourCtx);
|
||||
ourCtx = servlet.getFhirContext();
|
||||
servlet.setResourceProviders(patientProvider);
|
||||
ServletHolder servletHolder = new ServletHolder(servlet);
|
||||
proxyHandler.addServletWithMapping(servletHolder, "/*");
|
||||
ourServer.setHandler(proxyHandler);
|
||||
ourServer.start();
|
||||
@Test
|
||||
public void testUpdateWithIfMatch() throws Exception {
|
||||
Patient p = new Patient();
|
||||
p.addIdentifier().setSystem("urn:system").setValue("001");
|
||||
String resBody = ourCtx.newXmlParser().encodeResourceToString(p);
|
||||
|
||||
ourConnectionManager = new PoolingHttpClientConnectionManager(50000, TimeUnit.MILLISECONDS);
|
||||
HttpClientBuilder builder = HttpClientBuilder.create();
|
||||
builder.setConnectionManager(ourConnectionManager);
|
||||
ourClient = builder.build();
|
||||
HttpPut http;
|
||||
http = new HttpPut("http://localhost:" + ourPort + "/Patient/2");
|
||||
http.setEntity(new StringEntity(resBody, ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
||||
http.addHeader(Constants.HEADER_IF_MATCH, "\"221\"");
|
||||
CloseableHttpResponse status = ourClient.execute(http);
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
assertEquals(200, status.getStatusLine().getStatusCode());
|
||||
assertEquals("Patient/2/_history/221", ourLastId.toUnqualified().getValue());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private static IdDt ourLastId;
|
||||
|
||||
public static class PatientProvider implements IResourceProvider {
|
||||
@Test
|
||||
public void testUpdateWithIfMatchPreconditionFailed() throws Exception {
|
||||
Patient p = new Patient();
|
||||
p.addIdentifier().setSystem("urn:system").setValue("001");
|
||||
String resBody = ourCtx.newXmlParser().encodeResourceToString(p);
|
||||
|
||||
@Read(version = true)
|
||||
public Patient findPatient(@IdParam IdDt theId) {
|
||||
Patient patient = new Patient();
|
||||
patient.getMeta().setLastUpdated(ourLastModifiedDate);
|
||||
patient.addIdentifier().setSystem(theId.getIdPart()).setValue(theId.getVersionIdPart());
|
||||
patient.setId(theId.withVersion("222"));
|
||||
return patient;
|
||||
}
|
||||
HttpPut http;
|
||||
http = new HttpPut("http://localhost:" + ourPort + "/Patient/2");
|
||||
http.setEntity(new StringEntity(resBody, ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
|
||||
http.addHeader(Constants.HEADER_IF_MATCH, "\"222\"");
|
||||
CloseableHttpResponse status = ourClient.execute(http);
|
||||
IOUtils.closeQuietly(status.getEntity().getContent());
|
||||
assertEquals(Constants.STATUS_HTTP_412_PRECONDITION_FAILED, status.getStatusLine().getStatusCode());
|
||||
assertEquals("Patient/2/_history/222", ourLastId.toUnqualified().getValue());
|
||||
}
|
||||
|
||||
@Update
|
||||
public MethodOutcome updatePatient(@IdParam IdDt theId, @ResourceParam Patient theResource) {
|
||||
ourLastId = theId;
|
||||
|
||||
if ("222".equals(theId.getVersionIdPart())) {
|
||||
throw new PreconditionFailedException("Bad version");
|
||||
}
|
||||
|
||||
return new MethodOutcome(theId.withVersion(theId.getVersionIdPart() + "0"));
|
||||
}
|
||||
@AfterClass
|
||||
public static void afterClass() throws Exception {
|
||||
ourServer.stop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Patient> getResourceType() {
|
||||
return Patient.class;
|
||||
}
|
||||
@BeforeClass
|
||||
public static void beforeClass() throws Exception {
|
||||
ourPort = PortUtil.findFreePort();
|
||||
ourServer = new Server(ourPort);
|
||||
|
||||
}
|
||||
PatientProvider patientProvider = new PatientProvider();
|
||||
|
||||
ServletHandler proxyHandler = new ServletHandler();
|
||||
RestfulServer servlet = new RestfulServer(ourCtx);
|
||||
servlet.setResourceProviders(patientProvider);
|
||||
ServletHolder servletHolder = new ServletHolder(servlet);
|
||||
proxyHandler.addServletWithMapping(servletHolder, "/*");
|
||||
ourServer.setHandler(proxyHandler);
|
||||
ourServer.start();
|
||||
|
||||
ourConnectionManager = new PoolingHttpClientConnectionManager(50000, TimeUnit.MILLISECONDS);
|
||||
HttpClientBuilder builder = HttpClientBuilder.create();
|
||||
builder.setConnectionManager(ourConnectionManager);
|
||||
ourClient = builder.build();
|
||||
|
||||
}
|
||||
|
||||
private static IdDt ourLastId;
|
||||
|
||||
public static class PatientProvider implements IResourceProvider {
|
||||
|
||||
@Read(version = true)
|
||||
public Patient findPatient(@IdParam IdDt theId) {
|
||||
Patient patient = new Patient();
|
||||
patient.getMeta().setLastUpdated(ourLastModifiedDate);
|
||||
patient.addIdentifier().setSystem(theId.getIdPart()).setValue(theId.getVersionIdPart());
|
||||
patient.setId(theId.withVersion("222"));
|
||||
return patient;
|
||||
}
|
||||
|
||||
@Update
|
||||
public MethodOutcome updatePatient(@IdParam IdDt theId, @ResourceParam Patient theResource) {
|
||||
ourLastId = theId;
|
||||
|
||||
if ("222".equals(theId.getVersionIdPart())) {
|
||||
throw new PreconditionFailedException("Bad version");
|
||||
}
|
||||
|
||||
return new MethodOutcome(theId.withVersion(theId.getVersionIdPart() + "0"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<Patient> getResourceType() {
|
||||
return Patient.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
8
pom.xml
8
pom.xml
|
@ -194,7 +194,6 @@
|
|||
<maven_antrun_plugin_version>1.8</maven_antrun_plugin_version>
|
||||
<maven_build_helper_plugin_version>1.9.1</maven_build_helper_plugin_version>
|
||||
<maven_assembly_plugin_version>2.5.3</maven_assembly_plugin_version>
|
||||
<maven_cobertura_plugin_version>2.7</maven_cobertura_plugin_version>
|
||||
<maven_failsafe_plugin_version>2.18.1</maven_failsafe_plugin_version>
|
||||
<maven_gpg_plugin_version>1.6</maven_gpg_plugin_version>
|
||||
<maven_javadoc_plugin_version>2.10.1</maven_javadoc_plugin_version>
|
||||
|
@ -222,6 +221,11 @@
|
|||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<!-- Set dependency versions -->
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
<version>1.1.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>javax.servlet-api</artifactId>
|
||||
|
@ -276,7 +280,7 @@
|
|||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>cobertura-maven-plugin</artifactId>
|
||||
<version>${maven_cobertura_plugin_version}</version>
|
||||
<version>2.7</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
|
|
Loading…
Reference in New Issue