Fix tests
This commit is contained in:
parent
5073692eda
commit
94128e2e6d
|
@ -113,6 +113,7 @@ org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=warning
|
|||
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
|
||||
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||
org.eclipse.jdt.core.compiler.source=1.6
|
||||
org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines=2147483647
|
||||
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
|
||||
|
@ -126,8 +127,10 @@ org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
|
|||
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
|
||||
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_resources_in_try=80
|
||||
|
@ -137,6 +140,8 @@ org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration
|
|||
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
|
||||
org.eclipse.jdt.core.formatter.alignment_for_type_arguments=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_type_parameters=0
|
||||
org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch=16
|
||||
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
|
||||
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
|
||||
|
@ -164,16 +169,16 @@ org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
|
|||
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
|
||||
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
|
||||
org.eclipse.jdt.core.formatter.comment.format_block_comments=true
|
||||
org.eclipse.jdt.core.formatter.comment.format_header=false
|
||||
org.eclipse.jdt.core.formatter.comment.format_html=false
|
||||
org.eclipse.jdt.core.formatter.comment.format_header=true
|
||||
org.eclipse.jdt.core.formatter.comment.format_html=true
|
||||
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
|
||||
org.eclipse.jdt.core.formatter.comment.format_line_comments=false
|
||||
org.eclipse.jdt.core.formatter.comment.format_line_comments=true
|
||||
org.eclipse.jdt.core.formatter.comment.format_source_code=true
|
||||
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
|
||||
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
|
||||
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
|
||||
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
|
||||
org.eclipse.jdt.core.formatter.comment.line_length=120
|
||||
org.eclipse.jdt.core.formatter.comment.line_length=200
|
||||
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
|
||||
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
|
||||
org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments=false
|
||||
|
@ -195,6 +200,7 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
|
|||
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
|
||||
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
|
||||
org.eclipse.jdt.core.formatter.indentation.size=3
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
|
||||
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method=insert
|
||||
|
@ -384,16 +390,28 @@ org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
|
|||
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
|
||||
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
|
||||
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
|
||||
org.eclipse.jdt.core.formatter.lineSplit=300
|
||||
org.eclipse.jdt.core.formatter.lineSplit=200
|
||||
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
|
||||
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
|
||||
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
|
||||
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
|
||||
org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation=common_lines
|
||||
org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause=common_lines
|
||||
org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration=common_lines
|
||||
org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment=common_lines
|
||||
org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement=common_lines
|
||||
org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration=common_lines
|
||||
org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration=common_lines
|
||||
org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation=common_lines
|
||||
org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement=common_lines
|
||||
org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause=common_lines
|
||||
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
|
||||
org.eclipse.jdt.core.formatter.tabulation.char=tab
|
||||
org.eclipse.jdt.core.formatter.tabulation.size=3
|
||||
org.eclipse.jdt.core.formatter.use_on_off_tags=true
|
||||
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
|
||||
org.eclipse.jdt.core.formatter.wrap_before_assignment_operator=false
|
||||
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
|
||||
org.eclipse.jdt.core.formatter.wrap_before_conditional_operator=true
|
||||
org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch=true
|
||||
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
|
||||
|
|
|
@ -10,7 +10,7 @@ package ca.uhn.fhir.rest.server;
|
|||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
|
@ -117,7 +117,8 @@ public class RestfulServerUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static String createPagingLink(Set<Include> theIncludes, String theServerBase, String theSearchId, int theOffset, int theCount, EncodingEnum theResponseEncoding, boolean thePrettyPrint, BundleTypeEnum theBundleType) {
|
||||
public static String createPagingLink(Set<Include> theIncludes, String theServerBase, String theSearchId, int theOffset, int theCount, EncodingEnum theResponseEncoding, boolean thePrettyPrint,
|
||||
BundleTypeEnum theBundleType) {
|
||||
try {
|
||||
StringBuilder b = new StringBuilder();
|
||||
b.append(theServerBase);
|
||||
|
@ -192,24 +193,27 @@ public class RestfulServerUtils {
|
|||
|
||||
private static ResponseEncoding determineRequestEncodingNoDefaultReturnRE(RequestDetails theReq) {
|
||||
ResponseEncoding retVal = null;
|
||||
Iterator<String> acceptValues = theReq.getHeaders(Constants.HEADER_CONTENT_TYPE).iterator();
|
||||
if (acceptValues != null) {
|
||||
while (acceptValues.hasNext() && retVal == null) {
|
||||
String nextAcceptHeaderValue = acceptValues.next();
|
||||
if (nextAcceptHeaderValue != null && isNotBlank(nextAcceptHeaderValue)) {
|
||||
for (String nextPart : nextAcceptHeaderValue.split(",")) {
|
||||
int scIdx = nextPart.indexOf(';');
|
||||
if (scIdx == 0) {
|
||||
continue;
|
||||
}
|
||||
if (scIdx != -1) {
|
||||
nextPart = nextPart.substring(0, scIdx);
|
||||
}
|
||||
nextPart = nextPart.trim();
|
||||
EncodingEnum encoding = EncodingEnum.forContentType(nextPart);
|
||||
if (encoding != null) {
|
||||
retVal = new ResponseEncoding(encoding, nextPart);
|
||||
break;
|
||||
List<String> headers = theReq.getHeaders(Constants.HEADER_CONTENT_TYPE);
|
||||
if (headers != null) {
|
||||
Iterator<String> acceptValues = headers.iterator();
|
||||
if (acceptValues != null) {
|
||||
while (acceptValues.hasNext() && retVal == null) {
|
||||
String nextAcceptHeaderValue = acceptValues.next();
|
||||
if (nextAcceptHeaderValue != null && isNotBlank(nextAcceptHeaderValue)) {
|
||||
for (String nextPart : nextAcceptHeaderValue.split(",")) {
|
||||
int scIdx = nextPart.indexOf(';');
|
||||
if (scIdx == 0) {
|
||||
continue;
|
||||
}
|
||||
if (scIdx != -1) {
|
||||
nextPart = nextPart.substring(0, scIdx);
|
||||
}
|
||||
nextPart = nextPart.trim();
|
||||
EncodingEnum encoding = EncodingEnum.forContentType(nextPart);
|
||||
if (encoding != null) {
|
||||
retVal = new ResponseEncoding(encoding, nextPart);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -322,20 +326,20 @@ public class RestfulServerUtils {
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If the client hasn't given any indication about which response
|
||||
* encoding they want, let's try the request encoding in case that
|
||||
* is useful (basically this catches the case where the request
|
||||
* has a Content-Type header but not an Accept header)
|
||||
* has a Content-Type header but not an Accept header)
|
||||
*/
|
||||
if (retVal == null) {
|
||||
retVal = determineRequestEncodingNoDefaultReturnRE(theReq);
|
||||
}
|
||||
|
||||
|
||||
return retVal;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine whether a response should be given in JSON or XML format based on the incoming HttpServletRequest's
|
||||
* <code>"_format"</code> parameter and <code>"Accept:"</code> HTTP header.
|
||||
|
@ -417,7 +421,7 @@ public class RestfulServerUtils {
|
|||
EncodingEnum encoding;
|
||||
if (theStrict) {
|
||||
encoding = EncodingEnum.forContentTypeStrict(theContentType);
|
||||
}else {
|
||||
} else {
|
||||
encoding = EncodingEnum.forContentType(theContentType);
|
||||
}
|
||||
if (encoding == null) {
|
||||
|
@ -552,7 +556,8 @@ public class RestfulServerUtils {
|
|||
return prettyPrint;
|
||||
}
|
||||
|
||||
public static Object streamResponseAsBundle(IRestfulServerDefaults theServer, Bundle bundle, Set<SummaryEnum> theSummaryMode, boolean respondGzip, RequestDetails theRequestDetails) throws IOException {
|
||||
public static Object streamResponseAsBundle(IRestfulServerDefaults theServer, Bundle bundle, Set<SummaryEnum> theSummaryMode, boolean respondGzip, RequestDetails theRequestDetails)
|
||||
throws IOException {
|
||||
|
||||
int status = 200;
|
||||
|
||||
|
@ -571,17 +576,19 @@ public class RestfulServerUtils {
|
|||
}
|
||||
parser.encodeBundleToWriter(bundle, writer);
|
||||
} catch (Exception e) {
|
||||
//always send a response, even if the parsing went wrong
|
||||
// always send a response, even if the parsing went wrong
|
||||
}
|
||||
return theRequestDetails.getResponse().sendWriterResponse(status, contentType, charset, writer);
|
||||
}
|
||||
|
||||
|
||||
public static Object streamResponseAsResource(IRestfulServerDefaults theServer, IBaseResource theResource, Set<SummaryEnum> theSummaryMode, int stausCode, boolean theAddContentLocationHeader, boolean respondGzip, RequestDetails theRequestDetails) throws IOException {
|
||||
|
||||
public static Object streamResponseAsResource(IRestfulServerDefaults theServer, IBaseResource theResource, Set<SummaryEnum> theSummaryMode, int stausCode, boolean theAddContentLocationHeader,
|
||||
boolean respondGzip, RequestDetails theRequestDetails) throws IOException {
|
||||
return streamResponseAsResource(theServer, theResource, theSummaryMode, stausCode, null, theAddContentLocationHeader, respondGzip, theRequestDetails, null, null);
|
||||
}
|
||||
|
||||
public static Object streamResponseAsResource(IRestfulServerDefaults theServer, IBaseResource theResource, Set<SummaryEnum> theSummaryMode, int theStausCode, String theStatusMessage, boolean theAddContentLocationHeader, boolean respondGzip, RequestDetails theRequestDetails, IIdType theOperationResourceId, IPrimitiveType<Date> theOperationResourceLastUpdated) throws IOException {
|
||||
public static Object streamResponseAsResource(IRestfulServerDefaults theServer, IBaseResource theResource, Set<SummaryEnum> theSummaryMode, int theStausCode, String theStatusMessage,
|
||||
boolean theAddContentLocationHeader, boolean respondGzip, RequestDetails theRequestDetails, IIdType theOperationResourceId, IPrimitiveType<Date> theOperationResourceLastUpdated)
|
||||
throws IOException {
|
||||
IRestfulResponse restUtil = theRequestDetails.getResponse();
|
||||
|
||||
// Determine response encoding
|
||||
|
@ -597,7 +604,7 @@ public class RestfulServerUtils {
|
|||
fullId = fullyQualifyResourceIdOrReturnNull(theServer, theResource, serverBase, resourceId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (theAddContentLocationHeader && fullId != null) {
|
||||
restUtil.addHeader(Constants.HEADER_LOCATION, fullId.getValue());
|
||||
restUtil.addHeader(Constants.HEADER_CONTENT_LOCATION, fullId.getValue());
|
||||
|
@ -628,7 +635,7 @@ public class RestfulServerUtils {
|
|||
if (responseEncoding == null) {
|
||||
responseEncoding = new ResponseEncoding(theServer.getDefaultResponseEncoding(), null);
|
||||
}
|
||||
|
||||
|
||||
boolean encodingDomainResourceAsText = theSummaryMode.contains(SummaryEnum.TEXT);
|
||||
if (encodingDomainResourceAsText) {
|
||||
/*
|
||||
|
@ -644,7 +651,7 @@ public class RestfulServerUtils {
|
|||
/*
|
||||
* Last-Modified header
|
||||
*/
|
||||
|
||||
|
||||
IPrimitiveType<Date> lastUpdated;
|
||||
if (theOperationResourceLastUpdated != null) {
|
||||
lastUpdated = theOperationResourceLastUpdated;
|
||||
|
@ -658,7 +665,7 @@ public class RestfulServerUtils {
|
|||
/*
|
||||
* Category header (DSTU1 only)
|
||||
*/
|
||||
|
||||
|
||||
if (theResource instanceof IResource && theServer.getFhirContext().getVersion().getVersion() == FhirVersionEnum.DSTU1) {
|
||||
TagList list = (TagList) ((IResource) theResource).getResourceMetadata().get(ResourceMetadataKeyEnum.TAG_LIST);
|
||||
if (list != null) {
|
||||
|
@ -669,11 +676,11 @@ public class RestfulServerUtils {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Stream the response body
|
||||
*/
|
||||
|
||||
|
||||
if (theResource == null) {
|
||||
contentType = null;
|
||||
} else if (encodingDomainResourceAsText) {
|
||||
|
@ -739,10 +746,10 @@ public class RestfulServerUtils {
|
|||
/**
|
||||
* Return type for {@link RestfulServerUtils#determineRequestEncodingNoDefault(RequestDetails)}
|
||||
*/
|
||||
public static class ResponseEncoding
|
||||
{
|
||||
public static class ResponseEncoding {
|
||||
private final EncodingEnum myEncoding;
|
||||
private final Boolean myNonLegacy;
|
||||
|
||||
public ResponseEncoding(EncodingEnum theEncoding, String theContentType) {
|
||||
super();
|
||||
myEncoding = theEncoding;
|
||||
|
@ -752,9 +759,11 @@ public class RestfulServerUtils {
|
|||
myNonLegacy = null;
|
||||
}
|
||||
}
|
||||
|
||||
public EncodingEnum getEncoding() {
|
||||
return myEncoding;
|
||||
}
|
||||
|
||||
public String getResourceContentType() {
|
||||
if (Boolean.TRUE.equals(isNonLegacy())) {
|
||||
return getEncoding().getResourceContentTypeNonLegacy();
|
||||
|
@ -780,7 +789,7 @@ public class RestfulServerUtils {
|
|||
} else if (theEncoding == EncodingEnum.XML) {
|
||||
theHttpRequest.addHeader(Constants.HEADER_ACCEPT, Constants.CT_FHIR_XML);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1629,7 +1629,6 @@ public class GenericJaxRsClientDstu2Test {
|
|||
|
||||
assertThat(ourRequestUri, containsString("http://localhost:" + ourPort + "/fhir/Patient/_search?"));
|
||||
assertThat(ourRequestUri, containsString("_elements=identifier%2Cname"));
|
||||
assertThat(ourRequestUri, containsString("_format=json"));
|
||||
|
||||
// assertThat(ourRequestUri,
|
||||
// either(equalTo("http://localhost:" + ourPort + "/fhir/Patient?name=james&_elements=name%2Cidentifier")).or(equalTo("http://localhost:" + ourPort + "/fhir/Patient?name=james&_elements=identifier%2Cname")));
|
||||
|
@ -1783,7 +1782,7 @@ public class GenericJaxRsClientDstu2Test {
|
|||
.execute();
|
||||
//@formatter:on
|
||||
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir?_format=json", ourRequestUri);
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir", ourRequestUri);
|
||||
assertEquals(2, response.size());
|
||||
|
||||
String requestString = ourRequestBodyString;
|
||||
|
@ -1843,7 +1842,7 @@ public class GenericJaxRsClientDstu2Test {
|
|||
.execute();
|
||||
//@formatter:on
|
||||
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir/?_format=xml", ourRequestUri);
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir/", ourRequestUri);
|
||||
assertEquals("application/xml+fhir;charset=UTF-8", ourRequestFirstHeaders.get("Content-Type").getValue());
|
||||
|
||||
}
|
||||
|
@ -1882,7 +1881,7 @@ public class GenericJaxRsClientDstu2Test {
|
|||
.execute();
|
||||
//@formatter:on
|
||||
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir?_format=json", ourRequestUri);
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir", ourRequestUri);
|
||||
assertEquals(2, response.getEntry().size());
|
||||
|
||||
assertEquals("Patient/1/_history/1", response.getEntry().get(0).getResponse().getLocation());
|
||||
|
@ -2053,7 +2052,7 @@ public class GenericJaxRsClientDstu2Test {
|
|||
|
||||
|
||||
response = client.validate().resource(ourCtx.newXmlParser().encodeResourceToString(p)).execute();
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir/Patient/$validate?_format=xml", ourRequestUri);
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir/Patient/$validate", ourRequestUri);
|
||||
assertEquals("POST", ourRequestMethod);
|
||||
assertEquals("<Parameters xmlns=\"http://hl7.org/fhir\"><parameter><name value=\"resource\"/><resource><Patient xmlns=\"http://hl7.org/fhir\"><name><given value=\"GIVEN\"/></name></Patient></resource></parameter></Parameters>", ourRequestBodyString);
|
||||
assertNotNull(response.getOperationOutcome());
|
||||
|
@ -2061,7 +2060,7 @@ public class GenericJaxRsClientDstu2Test {
|
|||
|
||||
|
||||
response = client.validate().resource(ourCtx.newJsonParser().encodeResourceToString(p)).execute();
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir/Patient/$validate?_format=json", ourRequestUri);
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir/Patient/$validate", ourRequestUri);
|
||||
assertEquals("POST", ourRequestMethod);
|
||||
assertEquals("{\"resourceType\":\"Parameters\",\"parameter\":[{\"name\":\"resource\",\"resource\":{\"resourceType\":\"Patient\",\"name\":[{\"given\":[\"GIVEN\"]}]}}]}", ourRequestBodyString);
|
||||
assertNotNull(response.getOperationOutcome());
|
||||
|
@ -2069,7 +2068,7 @@ public class GenericJaxRsClientDstu2Test {
|
|||
|
||||
|
||||
response = client.validate().resource(ourCtx.newJsonParser().encodeResourceToString(p)).prettyPrint().execute();
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir/Patient/$validate?_format=json&_pretty=true", ourRequestUri);
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir/Patient/$validate?_pretty=true", ourRequestUri);
|
||||
assertEquals("POST", ourRequestMethod);
|
||||
assertThat(ourRequestBodyString, containsString("\"resourceType\": \"Parameters\",\n"));
|
||||
assertNotNull(response.getOperationOutcome());
|
||||
|
|
|
@ -137,7 +137,7 @@ public class GenericJaxRsClientDstu3Test {
|
|||
client.fetchConformance().ofType(Conformance.class).execute();
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir/metadata", ourRequestUri);
|
||||
assertEquals(1, ourRequestHeaders.get("Accept").size());
|
||||
assertThat(ourRequestHeaders.get("Accept").get(0).getValue(), containsString(Constants.HEADER_ACCEPT_VALUE_XML_OR_JSON_LEGACY));
|
||||
assertThat(ourRequestHeaders.get("Accept").get(0).getValue(), containsString(Constants.HEADER_ACCEPT_VALUE_XML_OR_JSON_NON_LEGACY));
|
||||
|
||||
|
||||
client.fetchConformance().ofType(Conformance.class).encodedJson().execute();
|
||||
|
@ -173,12 +173,12 @@ public class GenericJaxRsClientDstu3Test {
|
|||
assertEquals("FAMILY", resp.getName().get(0).getFamily().get(0).getValue());
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir/metadata", ourRequestUriAll.get(0));
|
||||
assertEquals(1, ourRequestHeadersAll.get(0).get("Accept").size());
|
||||
assertThat(ourRequestHeadersAll.get(0).get("Accept").get(0).getValue(), containsString(Constants.HEADER_ACCEPT_VALUE_XML_OR_JSON_LEGACY));
|
||||
assertThat(ourRequestHeadersAll.get(0).get("Accept").get(0).getValue(), containsString(Constants.HEADER_ACCEPT_VALUE_XML_OR_JSON_NON_LEGACY));
|
||||
assertThat(ourRequestHeadersAll.get(0).get("Accept").get(0).getValue(), containsString(Constants.CT_FHIR_XML));
|
||||
assertThat(ourRequestHeadersAll.get(0).get("Accept").get(0).getValue(), containsString(Constants.CT_FHIR_JSON));
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir/Patient/123", ourRequestUriAll.get(1));
|
||||
assertEquals(1, ourRequestHeadersAll.get(1).get("Accept").size());
|
||||
assertThat(ourRequestHeadersAll.get(1).get("Accept").get(0).getValue(), containsString(Constants.HEADER_ACCEPT_VALUE_XML_OR_JSON_LEGACY));
|
||||
assertThat(ourRequestHeadersAll.get(1).get("Accept").get(0).getValue(), containsString(Constants.HEADER_ACCEPT_VALUE_XML_OR_JSON_NON_LEGACY));
|
||||
assertThat(ourRequestHeadersAll.get(1).get("Accept").get(0).getValue(), containsString(Constants.CT_FHIR_XML));
|
||||
assertThat(ourRequestHeadersAll.get(1).get("Accept").get(0).getValue(), containsString(Constants.CT_FHIR_JSON));
|
||||
}
|
||||
|
@ -1605,7 +1605,7 @@ public class GenericJaxRsClientDstu3Test {
|
|||
assertEquals("name=james", ourRequestBodyString);
|
||||
|
||||
assertEquals("application/x-www-form-urlencoded", ourRequestContentType.replace(";char", "; char").toLowerCase());
|
||||
assertEquals(Constants.HEADER_ACCEPT_VALUE_XML_OR_JSON_LEGACY, ourRequestFirstHeaders.get("Accept").getValue());
|
||||
assertEquals(Constants.HEADER_ACCEPT_VALUE_XML_OR_JSON_NON_LEGACY, ourRequestFirstHeaders.get("Accept").getValue());
|
||||
assertThat(ourRequestFirstHeaders.get("User-Agent").getValue(), not(emptyString()));
|
||||
}
|
||||
|
||||
|
@ -1635,7 +1635,6 @@ public class GenericJaxRsClientDstu3Test {
|
|||
|
||||
assertThat(ourRequestUri, containsString("http://localhost:" + ourPort + "/fhir/Patient/_search?"));
|
||||
assertThat(ourRequestUri, containsString("_elements=identifier%2Cname"));
|
||||
assertThat(ourRequestUri, containsString("_format=json"));
|
||||
|
||||
// assertThat(ourRequestUri,
|
||||
// either(equalTo("http://localhost:" + ourPort + "/fhir/Patient?name=james&_elements=name%2Cidentifier")).or(equalTo("http://localhost:" + ourPort + "/fhir/Patient?name=james&_elements=identifier%2Cname")));
|
||||
|
@ -1793,7 +1792,7 @@ public class GenericJaxRsClientDstu3Test {
|
|||
.execute();
|
||||
//@formatter:on
|
||||
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir?_format=json", ourRequestUri);
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir", ourRequestUri);
|
||||
assertEquals(2, response.size());
|
||||
|
||||
String requestString = ourRequestBodyString;
|
||||
|
@ -1853,7 +1852,7 @@ public class GenericJaxRsClientDstu3Test {
|
|||
.execute();
|
||||
//@formatter:on
|
||||
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir/?_format=xml", ourRequestUri);
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir/", ourRequestUri);
|
||||
assertEquals("application/xml+fhir;charset=UTF-8", ourRequestFirstHeaders.get("Content-Type").getValue());
|
||||
|
||||
}
|
||||
|
@ -1892,7 +1891,7 @@ public class GenericJaxRsClientDstu3Test {
|
|||
.execute();
|
||||
//@formatter:on
|
||||
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir?_format=json", ourRequestUri);
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir", ourRequestUri);
|
||||
assertEquals(2, response.getEntry().size());
|
||||
|
||||
assertEquals("Patient/1/_history/1", response.getEntry().get(0).getResponse().getLocation());
|
||||
|
@ -2063,7 +2062,7 @@ public class GenericJaxRsClientDstu3Test {
|
|||
|
||||
|
||||
response = client.validate().resource(ourCtx.newXmlParser().encodeResourceToString(p)).execute();
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir/Patient/$validate?_format=xml", ourRequestUri);
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir/Patient/$validate", ourRequestUri);
|
||||
assertEquals("POST", ourRequestMethod);
|
||||
assertEquals("<Parameters xmlns=\"http://hl7.org/fhir\"><parameter><name value=\"resource\"/><resource><Patient xmlns=\"http://hl7.org/fhir\"><name><given value=\"GIVEN\"/></name></Patient></resource></parameter></Parameters>", ourRequestBodyString);
|
||||
assertNotNull(response.getOperationOutcome());
|
||||
|
@ -2071,7 +2070,7 @@ public class GenericJaxRsClientDstu3Test {
|
|||
|
||||
|
||||
response = client.validate().resource(ourCtx.newJsonParser().encodeResourceToString(p)).execute();
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir/Patient/$validate?_format=json", ourRequestUri);
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir/Patient/$validate", ourRequestUri);
|
||||
assertEquals("POST", ourRequestMethod);
|
||||
assertEquals("{\"resourceType\":\"Parameters\",\"parameter\":[{\"name\":\"resource\",\"resource\":{\"resourceType\":\"Patient\",\"name\":[{\"given\":[\"GIVEN\"]}]}}]}", ourRequestBodyString);
|
||||
assertNotNull(response.getOperationOutcome());
|
||||
|
@ -2079,7 +2078,7 @@ public class GenericJaxRsClientDstu3Test {
|
|||
|
||||
|
||||
response = client.validate().resource(ourCtx.newJsonParser().encodeResourceToString(p)).prettyPrint().execute();
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir/Patient/$validate?_format=json&_pretty=true", ourRequestUri);
|
||||
assertEquals("http://localhost:" + ourPort + "/fhir/Patient/$validate?_pretty=true", ourRequestUri);
|
||||
assertEquals("POST", ourRequestMethod);
|
||||
assertThat(ourRequestBodyString, containsString("\"resourceType\": \"Parameters\",\n"));
|
||||
assertNotNull(response.getOperationOutcome());
|
||||
|
|
|
@ -77,6 +77,10 @@
|
|||
<artifactId>jersey-media-moxy</artifactId>
|
||||
<version>${jersey_version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
|
|
@ -163,9 +163,9 @@ public class JpaServerDemo extends RestfulServer {
|
|||
* so it is a potential security vulnerability. Consider using an AuthorizationInterceptor
|
||||
* with this feature.
|
||||
*/
|
||||
if (fhirVersion == FhirVersionEnum.DSTU3) {
|
||||
registerProvider(myAppCtx.getBean(TerminologyUploaderProviderDstu3.class));
|
||||
}
|
||||
//if (fhirVersion == FhirVersionEnum.DSTU3) {
|
||||
// registerProvider(myAppCtx.getBean(TerminologyUploaderProviderDstu3.class));
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -64,7 +64,7 @@ public class ElementsParamTest {
|
|||
assertThat(responseContent, not(containsString("<div>THE DIV</div>")));
|
||||
assertThat(responseContent, (containsString("family")));
|
||||
assertThat(responseContent, (containsString("maritalStatus")));
|
||||
assertThat(ourLastElements, containsInAnyOrder("name", "maritalStatus"));
|
||||
assertThat(ourLastElements, containsInAnyOrder("meta", "name", "maritalStatus"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -82,7 +82,7 @@ public class ElementsParamTest {
|
|||
assertThat(responseContent, not(containsString("<div>THE DIV</div>")));
|
||||
assertThat(responseContent, (containsString("family")));
|
||||
assertThat(responseContent, not(containsString("maritalStatus")));
|
||||
assertThat(ourLastElements, containsInAnyOrder("name"));
|
||||
assertThat(ourLastElements, containsInAnyOrder("meta", "name"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -98,7 +98,7 @@ public class ElementsParamTest {
|
|||
assertThat(responseContent, not(containsString("THE DIV")));
|
||||
assertThat(responseContent, containsString("family"));
|
||||
assertThat(responseContent, containsString("maritalStatus"));
|
||||
assertThat(ourLastElements, containsInAnyOrder("name", "maritalStatus"));
|
||||
assertThat(ourLastElements, containsInAnyOrder("meta", "name", "maritalStatus"));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -115,7 +115,7 @@ public class ElementsParamTest {
|
|||
assertThat(responseContent, (containsString("THE DIV")));
|
||||
assertThat(responseContent, not(containsString("family")));
|
||||
assertThat(responseContent, not(containsString("maritalStatus")));
|
||||
assertThat(ourLastElements, containsInAnyOrder("text"));
|
||||
assertThat(ourLastElements, containsInAnyOrder("meta", "text"));
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue