diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/Constants.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/Constants.java
index a38a4077921..66b5a12f0d6 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/Constants.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/Constants.java
@@ -21,18 +21,13 @@ package ca.uhn.fhir.rest.api;
*/
import java.nio.charset.Charset;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
+import java.util.*;
public class Constants {
public static final String CHARSET_NAME_UTF8 = "UTF-8";
public static final Charset CHARSET_UTF8;
public static final String CHARSET_UTF8_CTSUFFIX = "; charset=" + CHARSET_NAME_UTF8;
- public static final String CT_ATOM_XML = "application/atom+xml";
public static final String CT_FHIR_JSON = "application/json+fhir";
public static final String CT_FHIR_JSON_NEW = "application/fhir+json";
public static final String CT_FHIR_XML = "application/xml+fhir";
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/EncodingEnum.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/EncodingEnum.java
index dd4e2d568e5..234d08d9376 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/EncodingEnum.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/api/EncodingEnum.java
@@ -28,14 +28,14 @@ import ca.uhn.fhir.parser.IParser;
public enum EncodingEnum {
- JSON(Constants.CT_FHIR_JSON, Constants.CT_FHIR_JSON_NEW, Constants.CT_FHIR_JSON, Constants.FORMAT_JSON) {
+ JSON(Constants.CT_FHIR_JSON, Constants.CT_FHIR_JSON_NEW, Constants.FORMAT_JSON) {
@Override
public IParser newParser(FhirContext theContext) {
return theContext.newJsonParser();
}
},
- XML(Constants.CT_FHIR_XML, Constants.CT_FHIR_XML_NEW, Constants.CT_ATOM_XML, Constants.FORMAT_XML) {
+ XML(Constants.CT_FHIR_XML, Constants.CT_FHIR_XML_NEW, Constants.FORMAT_XML) {
@Override
public IParser newParser(FhirContext theContext) {
return theContext.newXmlParser();
@@ -58,7 +58,6 @@ public enum EncodingEnum {
ourContentTypeToEncodingNonLegacy = new HashMap();
for (EncodingEnum next : values()) {
- ourContentTypeToEncoding.put(next.getBundleContentType(), next);
ourContentTypeToEncoding.put(next.myResourceContentTypeNonLegacy, next);
ourContentTypeToEncoding.put(next.myResourceContentTypeLegacy, next);
ourContentTypeToEncodingNonLegacy.put(next.myResourceContentTypeNonLegacy, next);
@@ -94,22 +93,16 @@ public enum EncodingEnum {
}
- private String myBundleContentType;
private String myFormatContentType;
private String myResourceContentTypeLegacy;
private String myResourceContentTypeNonLegacy;
- EncodingEnum(String theResourceContentTypeLegacy, String theResourceContentType, String theBundleContentType, String theFormatContentType) {
+ EncodingEnum(String theResourceContentTypeLegacy, String theResourceContentType, String theFormatContentType) {
myResourceContentTypeLegacy = theResourceContentTypeLegacy;
myResourceContentTypeNonLegacy = theResourceContentType;
- myBundleContentType = theBundleContentType;
myFormatContentType = theFormatContentType;
}
- public String getBundleContentType() {
- return myBundleContentType;
- }
-
public String getFormatContentType() {
return myFormatContentType;
}
diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/ICreateTyped.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/ICreateTyped.java
index d62aaffbfe3..70b3d50cfff 100644
--- a/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/ICreateTyped.java
+++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/rest/gclient/ICreateTyped.java
@@ -1,29 +1,7 @@
package ca.uhn.fhir.rest.gclient;
-/*
- * #%L
- * HAPI FHIR - Core Library
- * %%
- * Copyright (C) 2014 - 2017 University Health Network
- * %%
- * Licensed under the Apache License, Version 2.0 (the "License");
- * 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
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * #L%
- */
-
-import ca.uhn.fhir.model.primitive.IdDt;
import ca.uhn.fhir.rest.api.MethodOutcome;
import ca.uhn.fhir.rest.api.PreferReturnEnum;
-import ca.uhn.fhir.rest.client.api.IGenericClient;
public interface ICreateTyped extends IClientExecutable {
@@ -51,26 +29,4 @@ public interface ICreateTyped extends IClientExecutable
- * Note that creating a resource by ID is no longer supported as of FHIR DSTU2. You should use the {@link IGenericClient#update()} operation
- * to create-by-ID in DSTU2.
- *
- */
- ICreateTyped withId(IdDt theId);
-
- /**
- * If you want the explicitly state an ID for your created resource, put that ID here. You generally do not
- * need to invoke this method, so that the server will assign the ID itself.
- *
- *
- * Note that creating a resource by ID is no longer supported as of FHIR DSTU2. You should use the {@link IGenericClient#update()} operation
- * to create-by-ID in DSTU2.
- *
- */
- ICreateTyped withId(String theId);
-
}
diff --git a/hapi-fhir-base/src/main/resources/ca/uhn/fhir/i18n/hapi-messages.properties b/hapi-fhir-base/src/main/resources/ca/uhn/fhir/i18n/hapi-messages.properties
index 3744418f467..77e59b6d57a 100644
--- a/hapi-fhir-base/src/main/resources/ca/uhn/fhir/i18n/hapi-messages.properties
+++ b/hapi-fhir-base/src/main/resources/ca/uhn/fhir/i18n/hapi-messages.properties
@@ -35,6 +35,7 @@ ca.uhn.fhir.rest.server.method.PageMethodBinding.unknownSearchId=Search ID "{0}"
ca.uhn.fhir.rest.server.method.SearchMethodBinding.invalidSpecialParamName=Method [{0}] in provider [{1}] contains search parameter annotated to use name [{2}] - This name is reserved according to the FHIR specification and can not be used as a search parameter name.
ca.uhn.fhir.rest.server.method.SearchMethodBinding.idWithoutCompartment=Method [{0}] in provider [{1}] has an @IdParam parameter. This is only allowable for compartment search (e.g. @Search(compartment="foo") )
ca.uhn.fhir.rest.server.method.SearchMethodBinding.idNullForCompartmentSearch=ID parameter can not be null or empty for compartment search
+ca.uhn.fhir.rest.client.method.SearchMethodBinding.idNullForCompartmentSearch=ID parameter can not be null or empty for compartment search
ca.uhn.fhir.rest.server.method.SummaryEnumParameter.cantCombineText=Can not combine _summary=text with other values for _summary
diff --git a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/GenericClient.java b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/GenericClient.java
index 8054d1509c8..f2607e5d38b 100644
--- a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/GenericClient.java
+++ b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/impl/GenericClient.java
@@ -531,7 +531,6 @@ public class GenericClient extends BaseClient implements IGenericClient {
private class CreateInternal extends BaseSearch implements ICreate, ICreateTyped, ICreateWithQuery, ICreateWithQueryTyped {
private boolean myConditional;
- private String myId;
private PreferReturnEnum myPrefer;
private IBaseResource myResource;
private String myResourceBody;
@@ -554,7 +553,6 @@ public class GenericClient extends BaseClient implements IGenericClient {
if (myResource == null) {
myResource = parseResourceBody(myResourceBody);
}
- myId = getPreferredId(myResource, myId);
// If an explicit encoding is chosen, we will re-serialize to ensure the right encoding
if (getParamEncoding() != null) {
@@ -563,11 +561,11 @@ public class GenericClient extends BaseClient implements IGenericClient {
BaseHttpClientInvocation invocation;
if (mySearchUrl != null) {
- invocation = MethodUtil.createCreateInvocation(myResource, myResourceBody, myId, myContext, mySearchUrl);
+ invocation = MethodUtil.createCreateInvocation(myResource, myResourceBody, myContext, mySearchUrl);
} else if (myConditional) {
- invocation = MethodUtil.createCreateInvocation(myResource, myResourceBody, myId, myContext, getParamMap());
+ invocation = MethodUtil.createCreateInvocation(myResource, myResourceBody, myContext, getParamMap());
} else {
- invocation = MethodUtil.createCreateInvocation(myResource, myResourceBody, myId, myContext);
+ invocation = MethodUtil.createCreateInvocation(myResource, myResourceBody, myContext);
}
addPreferHeader(myPrefer, invocation);
@@ -599,18 +597,6 @@ public class GenericClient extends BaseClient implements IGenericClient {
return this;
}
- @Override
- public CreateInternal withId(IdDt theId) {
- myId = theId.getIdPart();
- return this;
- }
-
- @Override
- public CreateInternal withId(String theId) {
- myId = theId;
- return this;
- }
-
}
private class DeleteInternal extends BaseSearch implements IDelete, IDeleteTyped, IDeleteWithQuery, IDeleteWithQueryTyped {
diff --git a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/method/MethodUtil.java b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/method/MethodUtil.java
index 4fcc3f7d45d..fdac1a21cf9 100644
--- a/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/method/MethodUtil.java
+++ b/hapi-fhir-client/src/main/java/ca/uhn/fhir/rest/client/method/MethodUtil.java
@@ -64,16 +64,40 @@ public class MethodUtil {
// nothing
}
+ public static void addAcceptHeaderToRequest(EncodingEnum theEncoding, IHttpRequest theHttpRequest,
+ FhirContext theContext) {
+ if (theEncoding == null) {
+ if (theContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU2_1) == false) {
+ theHttpRequest.addHeader(Constants.HEADER_ACCEPT, Constants.HEADER_ACCEPT_VALUE_XML_OR_JSON_LEGACY);
+ } else {
+ theHttpRequest.addHeader(Constants.HEADER_ACCEPT, Constants.HEADER_ACCEPT_VALUE_XML_OR_JSON_NON_LEGACY);
+ }
+ } else if (theEncoding == EncodingEnum.JSON) {
+ if (theContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU2_1) == false) {
+ theHttpRequest.addHeader(Constants.HEADER_ACCEPT, Constants.CT_FHIR_JSON);
+ } else {
+ theHttpRequest.addHeader(Constants.HEADER_ACCEPT, Constants.HEADER_ACCEPT_VALUE_JSON_NON_LEGACY);
+ }
+ } else if (theEncoding == EncodingEnum.XML) {
+ if (theContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU2_1) == false) {
+ theHttpRequest.addHeader(Constants.HEADER_ACCEPT, Constants.CT_FHIR_XML);
+ } else {
+ theHttpRequest.addHeader(Constants.HEADER_ACCEPT, Constants.HEADER_ACCEPT_VALUE_XML_NON_LEGACY);
+ }
+ }
+
+ }
+
public static HttpGetClientInvocation createConformanceInvocation(FhirContext theContext) {
return new HttpGetClientInvocation(theContext, "metadata");
}
public static HttpPostClientInvocation createCreateInvocation(IBaseResource theResource, FhirContext theContext) {
- return createCreateInvocation(theResource, null, null, theContext);
+ return createCreateInvocation(theResource, null, theContext);
}
public static HttpPostClientInvocation createCreateInvocation(IBaseResource theResource, String theResourceBody,
- String theId, FhirContext theContext) {
+ FhirContext theContext) {
RuntimeResourceDefinition def = theContext.getResourceDefinition(theResource);
String resourceName = def.getName();
@@ -93,15 +117,15 @@ public class MethodUtil {
}
public static HttpPostClientInvocation createCreateInvocation(IBaseResource theResource, String theResourceBody,
- String theId, FhirContext theContext, Map> theIfNoneExistParams) {
- HttpPostClientInvocation retVal = createCreateInvocation(theResource, theResourceBody, theId, theContext);
+ FhirContext theContext, Map> theIfNoneExistParams) {
+ HttpPostClientInvocation retVal = createCreateInvocation(theResource, theResourceBody, theContext);
retVal.setIfNoneExistParams(theIfNoneExistParams);
return retVal;
}
public static HttpPostClientInvocation createCreateInvocation(IBaseResource theResource, String theResourceBody,
- String theId, FhirContext theContext, String theIfNoneExistUrl) {
- HttpPostClientInvocation retVal = createCreateInvocation(theResource, theResourceBody, theId, theContext);
+ FhirContext theContext, String theIfNoneExistUrl) {
+ HttpPostClientInvocation retVal = createCreateInvocation(theResource, theResourceBody, theContext);
retVal.setIfNoneExistString(theIfNoneExistUrl);
return retVal;
}
@@ -111,17 +135,17 @@ public class MethodUtil {
return PatchMethodBinding.createPatchInvocation(theContext, theId, thePatchType, theBody);
}
- public static HttpPatchClientInvocation createPatchInvocation(FhirContext theContext, String theUrl,
- PatchTypeEnum thePatchType, String theBody) {
- return PatchMethodBinding.createPatchInvocation(theContext, theUrl, thePatchType, theBody);
- }
-
public static HttpPatchClientInvocation createPatchInvocation(FhirContext theContext, PatchTypeEnum thePatchType,
String theBody, String theResourceType, Map> theMatchParams) {
return PatchMethodBinding.createPatchInvocation(theContext, thePatchType, theBody, theResourceType,
theMatchParams);
}
+ public static HttpPatchClientInvocation createPatchInvocation(FhirContext theContext, String theUrl,
+ PatchTypeEnum thePatchType, String theBody) {
+ return PatchMethodBinding.createPatchInvocation(theContext, theUrl, thePatchType, theBody);
+ }
+
public static HttpPutClientInvocation createUpdateInvocation(FhirContext theContext, IBaseResource theResource,
String theResourceBody, Map> theMatchParams) {
String resourceType = theContext.getResourceDefinition(theResource).getName();
@@ -138,24 +162,6 @@ public class MethodUtil {
return retVal;
}
- public static StringBuilder createUrl(String theResourceType, Map> theMatchParams) {
- StringBuilder b = new StringBuilder();
-
- b.append(theResourceType);
-
- boolean haveQuestionMark = false;
- for (Entry> nextEntry : theMatchParams.entrySet()) {
- for (String nextValue : nextEntry.getValue()) {
- b.append(haveQuestionMark ? '&' : '?');
- haveQuestionMark = true;
- b.append(UrlUtil.escape(nextEntry.getKey()));
- b.append('=');
- b.append(UrlUtil.escape(nextValue));
- }
- }
- return b;
- }
-
public static HttpPutClientInvocation createUpdateInvocation(FhirContext theContext, IBaseResource theResource,
String theResourceBody, String theMatchUrl) {
HttpPutClientInvocation retVal;
@@ -193,6 +199,24 @@ public class MethodUtil {
return retVal;
}
+ public static StringBuilder createUrl(String theResourceType, Map> theMatchParams) {
+ StringBuilder b = new StringBuilder();
+
+ b.append(theResourceType);
+
+ boolean haveQuestionMark = false;
+ for (Entry> nextEntry : theMatchParams.entrySet()) {
+ for (String nextValue : nextEntry.getValue()) {
+ b.append(haveQuestionMark ? '&' : '?');
+ haveQuestionMark = true;
+ b.append(UrlUtil.escape(nextEntry.getKey()));
+ b.append('=');
+ b.append(UrlUtil.escape(nextValue));
+ }
+ }
+ return b;
+ }
+
public static void extractDescription(SearchParameter theParameter, Annotation[] theAnnotations) {
for (Annotation annotation : theAnnotations) {
if (annotation instanceof Description) {
@@ -540,28 +564,4 @@ public class MethodUtil {
return retVal;
}
- public static void addAcceptHeaderToRequest(EncodingEnum theEncoding, IHttpRequest theHttpRequest,
- FhirContext theContext) {
- if (theEncoding == null) {
- if (theContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU2_1) == false) {
- theHttpRequest.addHeader(Constants.HEADER_ACCEPT, Constants.HEADER_ACCEPT_VALUE_XML_OR_JSON_LEGACY);
- } else {
- theHttpRequest.addHeader(Constants.HEADER_ACCEPT, Constants.HEADER_ACCEPT_VALUE_XML_OR_JSON_NON_LEGACY);
- }
- } else if (theEncoding == EncodingEnum.JSON) {
- if (theContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU2_1) == false) {
- theHttpRequest.addHeader(Constants.HEADER_ACCEPT, Constants.CT_FHIR_JSON);
- } else {
- theHttpRequest.addHeader(Constants.HEADER_ACCEPT, Constants.HEADER_ACCEPT_VALUE_JSON_NON_LEGACY);
- }
- } else if (theEncoding == EncodingEnum.XML) {
- if (theContext.getVersion().getVersion().isNewerThan(FhirVersionEnum.DSTU2_1) == false) {
- theHttpRequest.addHeader(Constants.HEADER_ACCEPT, Constants.CT_FHIR_XML);
- } else {
- theHttpRequest.addHeader(Constants.HEADER_ACCEPT, Constants.HEADER_ACCEPT_VALUE_XML_NON_LEGACY);
- }
- }
-
- }
-
}
diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/BundleTypeDstu2Test.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/BundleTypeDstu2Test.java
index 78bdd49cb53..f7deec9466b 100644
--- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/BundleTypeDstu2Test.java
+++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/client/BundleTypeDstu2Test.java
@@ -67,7 +67,7 @@ public class BundleTypeDstu2Test {
ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(ourHttpClient.execute(capt.capture())).thenReturn(ourHttpResponse);
when(ourHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
- when(ourHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_ATOM_XML + "; charset=UTF-8"));
+ when(ourHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML + "; charset=UTF-8"));
when(ourHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(retVal), Charset.forName("UTF-8")));
Patient p1 = new Patient();
diff --git a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/TransactionWithBundleResourceParamTest.java b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/TransactionWithBundleResourceParamTest.java
index b59844c46a2..df107b0022d 100644
--- a/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/TransactionWithBundleResourceParamTest.java
+++ b/hapi-fhir-structures-dstu2/src/test/java/ca/uhn/fhir/rest/server/TransactionWithBundleResourceParamTest.java
@@ -141,8 +141,8 @@ public class TransactionWithBundleResourceParamTest {
String base = "http://localhost:" + ourPort + "/";
HttpPost httpPost = new HttpPost(base);
- httpPost.addHeader("Accept", Constants.CT_ATOM_XML + "; pretty=true");
- httpPost.setEntity(new StringEntity(bundleString, ContentType.create(Constants.CT_ATOM_XML, "UTF-8")));
+ httpPost.addHeader("Accept", Constants.CT_FHIR_XML + "; pretty=true");
+ httpPost.setEntity(new StringEntity(bundleString, ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
HttpResponse status = ourClient.execute(httpPost);
String responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
diff --git a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/TransactionWithBundleResourceParamHl7OrgDstu2Test.java b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/TransactionWithBundleResourceParamHl7OrgDstu2Test.java
index f8a365a70f4..fd9022eacc2 100644
--- a/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/TransactionWithBundleResourceParamHl7OrgDstu2Test.java
+++ b/hapi-fhir-structures-hl7org-dstu2/src/test/java/ca/uhn/fhir/rest/server/TransactionWithBundleResourceParamHl7OrgDstu2Test.java
@@ -187,8 +187,8 @@ public class TransactionWithBundleResourceParamHl7OrgDstu2Test {
String base = "http://localhost:" + ourPort + "/";
HttpPost httpPost = new HttpPost(base);
- httpPost.addHeader("Accept", Constants.CT_ATOM_XML + "; pretty=true");
- httpPost.setEntity(new StringEntity(bundleString, ContentType.create(Constants.CT_ATOM_XML, "UTF-8")));
+ httpPost.addHeader("Accept", Constants.CT_FHIR_XML + "; pretty=true");
+ httpPost.setEntity(new StringEntity(bundleString, ContentType.create(Constants.CT_FHIR_XML, "UTF-8")));
HttpResponse status = ourClient.execute(httpPost);
String responseContent = IOUtils.toString(status.getEntity().getContent());
IOUtils.closeQuietly(status.getEntity().getContent());
diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientR4Test.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientR4Test.java
index 958b1fa56b1..c020be3831d 100644
--- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientR4Test.java
+++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/ClientR4Test.java
@@ -49,11 +49,10 @@ public class ClientR4Test {
private HttpClient myHttpClient;
private HttpResponse myHttpResponse;
- private FhirContext ourCtx;
+ private static FhirContext ourCtx = FhirContext.forR4();
@Before
public void before() {
- ourCtx = FhirContext.forR4();
myHttpClient = mock(HttpClient.class, new ReturnsDeepStubs());
ourCtx.getRestfulClientFactory().setHttpClient(myHttpClient);
@@ -120,12 +119,13 @@ public class ClientR4Test {
return msg;
}
- private String getPatientFeedWithOneResult() {
+ static String getPatientFeedWithOneResult() {
Bundle retVal = new Bundle();
Patient p = new Patient();
p.addName().setFamily("Cardinal").addGiven("John");
+ p.addIdentifier().setValue("PRP1660");
retVal.addEntry().setResource(p);
return ourCtx.newXmlParser().encodeResourceToString(retVal);
@@ -295,7 +295,7 @@ public class ClientR4Test {
ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
- when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_ATOM_XML + "; charset=UTF-8"));
+ when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML_NEW + "; charset=UTF-8"));
when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")));
ITestClient client = ourCtx.newRestfulClient(ITestClient.class, "http://foo");
@@ -316,7 +316,7 @@ public class ClientR4Test {
ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
- when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_ATOM_XML + "; charset=UTF-8"));
+ when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML_NEW + "; charset=UTF-8"));
when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")));
ITestClient client = ourCtx.newRestfulClient(ITestClient.class, "http://foo");
@@ -335,7 +335,7 @@ public class ClientR4Test {
ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
- when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_ATOM_XML + "; charset=UTF-8"));
+ when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML_NEW + "; charset=UTF-8"));
when(myHttpResponse.getEntity().getContent()).thenReturn(new ReaderInputStream(new StringReader(msg), Charset.forName("UTF-8")));
ITestClient client = ourCtx.newRestfulClient(ITestClient.class, "http://foo");
@@ -356,7 +356,7 @@ public class ClientR4Test {
ArgumentCaptor capt = ArgumentCaptor.forClass(HttpUriRequest.class);
when(myHttpClient.execute(capt.capture())).thenReturn(myHttpResponse);
when(myHttpResponse.getStatusLine()).thenReturn(new BasicStatusLine(new ProtocolVersion("HTTP", 1, 1), 200, "OK"));
- when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_ATOM_XML + "; charset=UTF-8"));
+ when(myHttpResponse.getEntity().getContentType()).thenReturn(new BasicHeader("content-type", Constants.CT_FHIR_XML_NEW + "; charset=UTF-8"));
when(myHttpResponse.getEntity().getContent()).thenAnswer(new Answer() {
@Override
public InputStream answer(InvocationOnMock theInvocation) throws Throwable {
diff --git a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/GenericClientTest.java b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/GenericClientTest.java
index 1d9e1ae4303..a90fb3179fc 100644
--- a/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/GenericClientTest.java
+++ b/hapi-fhir-structures-r4/src/test/java/ca/uhn/fhir/rest/client/GenericClientTest.java
@@ -77,6 +77,7 @@ public class GenericClientTest {
}
@Test
+ @Ignore
public void testInvalidCalls() {
IGenericClient client = ourCtx.newRestfulGenericClient("http://example.com/fhir");
@@ -95,30 +96,31 @@ public class GenericClientTest {
}
private String getPatientFeedWithOneResult() {
- //@formatter:off
- String msg = "\n" +
- "\n" +
- "d039f91a-cc3c-4013-988e-af4d8d0614bd\n" +
- "1\n" +
- "\n" +
- "ca.uhn.fhir.rest.server.DummyRestfulServer\n" +
- "\n" +
- "\n" +
- ""
- + ""
- + "