Changes requested by james
https://github.com/jamesagnew/hapi-fhir/pull/542
This commit is contained in:
parent
1dd0b01e81
commit
6eee5e696e
|
@ -76,8 +76,6 @@ public abstract class BaseClient implements IRestfulClient {
|
|||
private Boolean myPrettyPrint = false;
|
||||
private SummaryEnum mySummary;
|
||||
private final String myUrlBase;
|
||||
private Boolean myAsync = null;
|
||||
private String myResponseUrl = null;
|
||||
|
||||
BaseClient(IHttpClient theClient, String theUrlBase, RestfulClientFactory theFactory) {
|
||||
super();
|
||||
|
@ -219,17 +217,6 @@ public abstract class BaseClient implements IRestfulClient {
|
|||
if (theSubsetElements != null && theSubsetElements.isEmpty() == false) {
|
||||
params.put(Constants.PARAM_ELEMENTS, Collections.singletonList(StringUtils.join(theSubsetElements, ',')));
|
||||
}
|
||||
|
||||
/*
|
||||
Message Client Params
|
||||
*/
|
||||
if(myAsync != null && myAsync == true ) {
|
||||
params.put(Constants.PARAM_ASYNC, Collections.singletonList(myAsync.toString()));
|
||||
}
|
||||
|
||||
if(myResponseUrl != null && !myResponseUrl.isEmpty() ) {
|
||||
params.put(Constants.PARAM_RESPONSE_URL, Collections.singletonList(myResponseUrl));
|
||||
}
|
||||
|
||||
EncodingEnum encoding = getEncoding();
|
||||
if (theEncoding != null) {
|
||||
|
@ -435,7 +422,6 @@ public abstract class BaseClient implements IRestfulClient {
|
|||
public void setSummary(SummaryEnum theSummary) {
|
||||
mySummary = theSummary;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void unregisterInterceptor(IClientInterceptor theInterceptor) {
|
||||
|
@ -451,16 +437,6 @@ public abstract class BaseClient implements IRestfulClient {
|
|||
return preferResponseTypes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMessageAsync(Boolean isAsync) {
|
||||
myAsync = isAsync;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMessageResponseUrl(String responseUrl) {
|
||||
myResponseUrl = responseUrl;
|
||||
}
|
||||
|
||||
protected final class ResourceResponseHandler<T extends IBaseResource> implements IClientResponseHandler<T> {
|
||||
|
||||
private boolean myAllowHtmlResponse;
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -89,22 +89,6 @@ public interface IRestfulClient {
|
|||
*/
|
||||
void setSummary(SummaryEnum theSummary);
|
||||
|
||||
/**
|
||||
* Specifies that the server should process the message Synchronously or Asynchronously. This is only applicable to the
|
||||
* $process-message server operation
|
||||
*
|
||||
* @param isAsync The async print flag to use in the request (default is <code>false</code>)
|
||||
*/
|
||||
void setMessageAsync(Boolean isAsync);
|
||||
|
||||
/**
|
||||
* Specifies that the server should send Asynchronous responses to this url. This is only applicable to the
|
||||
* $process-message server operation
|
||||
*
|
||||
* @param isAsync The async print flag to use in the request (default is <code>false</code>)
|
||||
*/
|
||||
void setMessageResponseUrl(String responseUrl);
|
||||
|
||||
/**
|
||||
* Remove an intercaptor that was previously registered using {@link IRestfulClient#registerInterceptor(IClientInterceptor)}
|
||||
*/
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package ca.uhn.fhir.rest.gclient;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
/*
|
||||
* #%L
|
||||
* HAPI FHIR - Core Library
|
||||
|
@ -19,9 +21,42 @@ package ca.uhn.fhir.rest.gclient;
|
|||
* limitations under the License.
|
||||
* #L%
|
||||
*/
|
||||
|
||||
public interface IOperation extends IBaseOn<IOperationUnnamed> {
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* This operation is called <b><a href="https://www.hl7.org/fhir/messaging.html">$process-message</a></b> as defined by FHIR
|
||||
* DSTU2.<br><br>
|
||||
* Usage :<br>
|
||||
* <code>
|
||||
* <pre>
|
||||
* Bundle response = client
|
||||
* .operation()
|
||||
* .onServer()
|
||||
* .processMessage()
|
||||
* .setResponseUrlParam("http://myserver/fhir")
|
||||
* .setMessageBundle(msgBundle)
|
||||
* .synchronous(Bundle.class)
|
||||
* .execute();
|
||||
*
|
||||
* //if you want to send an async message
|
||||
*
|
||||
* OperationOutcome response = client
|
||||
* .operation()
|
||||
* .onServer()
|
||||
* .processMessage()
|
||||
* .setResponseUrlParam("http://myserver/fhir")
|
||||
* .setMessageBundle(msgBundle)
|
||||
* .asynchronous(OperationOutcome.class)
|
||||
* .execute();
|
||||
*
|
||||
* </pre>
|
||||
* </code>
|
||||
*
|
||||
* @see <a href="https://www.hl7.org/fhir/messaging.html">2.4 Messaging
|
||||
* using FHIR Resources</a>
|
||||
*
|
||||
* @return An interface that defines the operation related to sending
|
||||
* Messages to a Messaging Server
|
||||
*/
|
||||
IOperationProcessMsg processMessage();
|
||||
}
|
||||
|
|
|
@ -6,19 +6,29 @@
|
|||
package ca.uhn.fhir.rest.gclient;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
import org.hl7.fhir.instance.model.api.IBaseOperationOutcome;
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author HGS
|
||||
*/
|
||||
public interface IOperationProcessMsg<T extends IBaseResource> extends IClientExecutable<IOperationProcessMsg<T>, T> {
|
||||
public interface IOperationProcessMsg{
|
||||
|
||||
IOperationProcessMsg<T> setMessageBundle(IBaseBundle theMsgBundle);
|
||||
|
||||
IOperationProcessMsg<T> setAsyncProcessingMode();
|
||||
|
||||
IOperationProcessMsg<T> setResponseUrlParam(String respondToUri);
|
||||
/**
|
||||
* Set the Message Bundle to POST to the messaging server.<br>
|
||||
* After this call you must choose either the method synchronous or asynchronous to set the processing mode.
|
||||
*
|
||||
* @param <R>
|
||||
* @param theMsgBundle A Bundle of type message
|
||||
* @return
|
||||
*/
|
||||
<R extends IBaseResource> IOperationProcessMsgMode<R> setMessageBundle(IBaseBundle theMsgBundle);
|
||||
|
||||
/**
|
||||
* An optional query parameter indicating that responses from the receiving server should be sent to this url
|
||||
*
|
||||
* @param respondToUri The receiving endpoint to witch server response messages should be sent.
|
||||
* @return
|
||||
*/
|
||||
IOperationProcessMsg setResponseUrlParam(String respondToUri);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
package ca.uhn.fhir.rest.gclient;
|
||||
|
||||
import org.hl7.fhir.instance.model.api.IBaseResource;
|
||||
|
||||
/*
|
||||
* #%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%
|
||||
*/
|
||||
public interface IOperationProcessMsgMode<T extends IBaseResource> extends IClientExecutable<IOperationProcessMsgMode<T>, T> {
|
||||
|
||||
<R extends IBaseResource> IOperationProcessMsgMode<R> asynchronous(Class<R> theResponseClass);
|
||||
|
||||
<R extends IBaseResource> IOperationProcessMsgMode<R> synchronous(Class<R> theResponseClass);
|
||||
}
|
|
@ -24,6 +24,4 @@ package ca.uhn.fhir.rest.gclient;
|
|||
public interface IOperationUnnamed {
|
||||
|
||||
IOperationUntyped named(String theName);
|
||||
IOperationProcessMsg processMessage();
|
||||
|
||||
}
|
||||
|
|
|
@ -63,370 +63,373 @@ import org.hl7.fhir.instance.model.api.IBaseBundle;
|
|||
|
||||
public class OperationMethodBinding extends BaseResourceReturningMethodBinding {
|
||||
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(OperationMethodBinding.class);
|
||||
private BundleTypeEnum myBundleType;
|
||||
private boolean myCanOperateAtInstanceLevel;
|
||||
private boolean myCanOperateAtServerLevel;
|
||||
private boolean myCanOperateAtTypeLevel;
|
||||
private String myDescription;
|
||||
private final boolean myIdempotent;
|
||||
private final Integer myIdParamIndex;
|
||||
private final String myName;
|
||||
private final RestOperationTypeEnum myOtherOperatiopnType;
|
||||
private List<ReturnType> myReturnParams;
|
||||
private final ReturnTypeEnum myReturnType;
|
||||
private static final org.slf4j.Logger ourLog = org.slf4j.LoggerFactory.getLogger(OperationMethodBinding.class);
|
||||
private BundleTypeEnum myBundleType;
|
||||
private boolean myCanOperateAtInstanceLevel;
|
||||
private boolean myCanOperateAtServerLevel;
|
||||
private boolean myCanOperateAtTypeLevel;
|
||||
private String myDescription;
|
||||
private final boolean myIdempotent;
|
||||
private final Integer myIdParamIndex;
|
||||
private final String myName;
|
||||
private final RestOperationTypeEnum myOtherOperatiopnType;
|
||||
private List<ReturnType> myReturnParams;
|
||||
private final ReturnTypeEnum myReturnType;
|
||||
|
||||
protected OperationMethodBinding(Class<?> theReturnResourceType, Class<? extends IBaseResource> theReturnTypeFromRp, Method theMethod, FhirContext theContext, Object theProvider, boolean theIdempotent, String theOperationName, Class<? extends IBaseResource> theOperationType,
|
||||
OperationParam[] theReturnParams, BundleTypeEnum theBundleType) {
|
||||
super(theReturnResourceType, theMethod, theContext, theProvider);
|
||||
protected OperationMethodBinding(Class<?> theReturnResourceType, Class<? extends IBaseResource> theReturnTypeFromRp, Method theMethod, FhirContext theContext, Object theProvider, boolean theIdempotent, String theOperationName, Class<? extends IBaseResource> theOperationType,
|
||||
OperationParam[] theReturnParams, BundleTypeEnum theBundleType) {
|
||||
super(theReturnResourceType, theMethod, theContext, theProvider);
|
||||
|
||||
myBundleType = theBundleType;
|
||||
myIdempotent = theIdempotent;
|
||||
myIdParamIndex = MethodUtil.findIdParameterIndex(theMethod, getContext());
|
||||
if (myIdParamIndex != null) {
|
||||
for (Annotation next : theMethod.getParameterAnnotations()[myIdParamIndex]) {
|
||||
if (next instanceof IdParam) {
|
||||
myCanOperateAtTypeLevel = ((IdParam) next).optional() == true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
myCanOperateAtTypeLevel = true;
|
||||
}
|
||||
myBundleType = theBundleType;
|
||||
myIdempotent = theIdempotent;
|
||||
myIdParamIndex = MethodUtil.findIdParameterIndex(theMethod, getContext());
|
||||
if (myIdParamIndex != null) {
|
||||
for (Annotation next : theMethod.getParameterAnnotations()[myIdParamIndex]) {
|
||||
if (next instanceof IdParam) {
|
||||
myCanOperateAtTypeLevel = ((IdParam) next).optional() == true;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
myCanOperateAtTypeLevel = true;
|
||||
}
|
||||
|
||||
Description description = theMethod.getAnnotation(Description.class);
|
||||
if (description != null) {
|
||||
myDescription = description.formalDefinition();
|
||||
if (isBlank(myDescription)) {
|
||||
myDescription = description.shortDefinition();
|
||||
}
|
||||
}
|
||||
if (isBlank(myDescription)) {
|
||||
myDescription = null;
|
||||
}
|
||||
Description description = theMethod.getAnnotation(Description.class);
|
||||
if (description != null) {
|
||||
myDescription = description.formalDefinition();
|
||||
if (isBlank(myDescription)) {
|
||||
myDescription = description.shortDefinition();
|
||||
}
|
||||
}
|
||||
if (isBlank(myDescription)) {
|
||||
myDescription = null;
|
||||
}
|
||||
|
||||
if (isBlank(theOperationName)) {
|
||||
throw new ConfigurationException("Method '" + theMethod.getName() + "' on type " + theMethod.getDeclaringClass().getName() + " is annotated with @" + Operation.class.getSimpleName() + " but this annotation has no name defined");
|
||||
}
|
||||
if (theOperationName.startsWith("$") == false) {
|
||||
theOperationName = "$" + theOperationName;
|
||||
}
|
||||
myName = theOperationName;
|
||||
if (isBlank(theOperationName)) {
|
||||
throw new ConfigurationException("Method '" + theMethod.getName() + "' on type " + theMethod.getDeclaringClass().getName() + " is annotated with @" + Operation.class.getSimpleName() + " but this annotation has no name defined");
|
||||
}
|
||||
if (theOperationName.startsWith("$") == false) {
|
||||
theOperationName = "$" + theOperationName;
|
||||
}
|
||||
myName = theOperationName;
|
||||
|
||||
if (theContext.getVersion().getVersion().isEquivalentTo(FhirVersionEnum.DSTU1)) {
|
||||
throw new ConfigurationException("@" + Operation.class.getSimpleName() + " methods are not supported on servers for FHIR version " + theContext.getVersion().getVersion().name() + " - Found one on class " + theMethod.getDeclaringClass().getName());
|
||||
}
|
||||
if (theContext.getVersion().getVersion().isEquivalentTo(FhirVersionEnum.DSTU1)) {
|
||||
throw new ConfigurationException("@" + Operation.class.getSimpleName() + " methods are not supported on servers for FHIR version " + theContext.getVersion().getVersion().name() + " - Found one on class " + theMethod.getDeclaringClass().getName());
|
||||
}
|
||||
|
||||
if (theReturnTypeFromRp != null) {
|
||||
setResourceName(theContext.getResourceDefinition(theReturnTypeFromRp).getName());
|
||||
} else {
|
||||
if (Modifier.isAbstract(theOperationType.getModifiers()) == false) {
|
||||
setResourceName(theContext.getResourceDefinition(theOperationType).getName());
|
||||
} else {
|
||||
setResourceName(null);
|
||||
}
|
||||
}
|
||||
if (theReturnTypeFromRp != null) {
|
||||
setResourceName(theContext.getResourceDefinition(theReturnTypeFromRp).getName());
|
||||
} else {
|
||||
if (Modifier.isAbstract(theOperationType.getModifiers()) == false) {
|
||||
setResourceName(theContext.getResourceDefinition(theOperationType).getName());
|
||||
} else {
|
||||
setResourceName(null);
|
||||
}
|
||||
}
|
||||
|
||||
if (theMethod.getReturnType().isAssignableFrom(Bundle.class)) {
|
||||
throw new ConfigurationException("Can not return a DSTU1 bundle from an @" + Operation.class.getSimpleName() + " method. Found in method " + theMethod.getName() + " defined in type " + theMethod.getDeclaringClass().getName());
|
||||
}
|
||||
if (theMethod.getReturnType().isAssignableFrom(Bundle.class)) {
|
||||
throw new ConfigurationException("Can not return a DSTU1 bundle from an @" + Operation.class.getSimpleName() + " method. Found in method " + theMethod.getName() + " defined in type " + theMethod.getDeclaringClass().getName());
|
||||
}
|
||||
|
||||
if (theMethod.getReturnType().equals(IBundleProvider.class)) {
|
||||
myReturnType = ReturnTypeEnum.BUNDLE;
|
||||
} else {
|
||||
myReturnType = ReturnTypeEnum.RESOURCE;
|
||||
}
|
||||
if (theMethod.getReturnType().equals(IBundleProvider.class)) {
|
||||
myReturnType = ReturnTypeEnum.BUNDLE;
|
||||
} else {
|
||||
myReturnType = ReturnTypeEnum.RESOURCE;
|
||||
}
|
||||
|
||||
if (getResourceName() == null) {
|
||||
myOtherOperatiopnType = RestOperationTypeEnum.EXTENDED_OPERATION_SERVER;
|
||||
} else if (myIdParamIndex == null) {
|
||||
myOtherOperatiopnType = RestOperationTypeEnum.EXTENDED_OPERATION_TYPE;
|
||||
} else {
|
||||
myOtherOperatiopnType = RestOperationTypeEnum.EXTENDED_OPERATION_INSTANCE;
|
||||
}
|
||||
if (getResourceName() == null) {
|
||||
myOtherOperatiopnType = RestOperationTypeEnum.EXTENDED_OPERATION_SERVER;
|
||||
} else if (myIdParamIndex == null) {
|
||||
myOtherOperatiopnType = RestOperationTypeEnum.EXTENDED_OPERATION_TYPE;
|
||||
} else {
|
||||
myOtherOperatiopnType = RestOperationTypeEnum.EXTENDED_OPERATION_INSTANCE;
|
||||
}
|
||||
|
||||
myReturnParams = new ArrayList<OperationMethodBinding.ReturnType>();
|
||||
if (theReturnParams != null) {
|
||||
for (OperationParam next : theReturnParams) {
|
||||
ReturnType type = new ReturnType();
|
||||
type.setName(next.name());
|
||||
type.setMin(next.min());
|
||||
type.setMax(next.max());
|
||||
if (type.getMax() == OperationParam.MAX_DEFAULT) {
|
||||
type.setMax(1);
|
||||
}
|
||||
if (!next.type().equals(IBase.class)) {
|
||||
if (next.type().isInterface() || Modifier.isAbstract(next.type().getModifiers())) {
|
||||
throw new ConfigurationException("Invalid value for @OperationParam.type(): " + next.type().getName());
|
||||
}
|
||||
type.setType(theContext.getElementDefinition(next.type()).getName());
|
||||
}
|
||||
myReturnParams.add(type);
|
||||
}
|
||||
}
|
||||
myReturnParams = new ArrayList<OperationMethodBinding.ReturnType>();
|
||||
if (theReturnParams != null) {
|
||||
for (OperationParam next : theReturnParams) {
|
||||
ReturnType type = new ReturnType();
|
||||
type.setName(next.name());
|
||||
type.setMin(next.min());
|
||||
type.setMax(next.max());
|
||||
if (type.getMax() == OperationParam.MAX_DEFAULT) {
|
||||
type.setMax(1);
|
||||
}
|
||||
if (!next.type().equals(IBase.class)) {
|
||||
if (next.type().isInterface() || Modifier.isAbstract(next.type().getModifiers())) {
|
||||
throw new ConfigurationException("Invalid value for @OperationParam.type(): " + next.type().getName());
|
||||
}
|
||||
type.setType(theContext.getElementDefinition(next.type()).getName());
|
||||
}
|
||||
myReturnParams.add(type);
|
||||
}
|
||||
}
|
||||
|
||||
if (myIdParamIndex != null) {
|
||||
myCanOperateAtInstanceLevel = true;
|
||||
}
|
||||
if (getResourceName() == null) {
|
||||
myCanOperateAtServerLevel = true;
|
||||
}
|
||||
if (myIdParamIndex != null) {
|
||||
myCanOperateAtInstanceLevel = true;
|
||||
}
|
||||
if (getResourceName() == null) {
|
||||
myCanOperateAtServerLevel = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public OperationMethodBinding(Class<?> theReturnResourceType, Class<? extends IBaseResource> theReturnTypeFromRp, Method theMethod, FhirContext theContext, Object theProvider, Operation theAnnotation) {
|
||||
this(theReturnResourceType, theReturnTypeFromRp, theMethod, theContext, theProvider, theAnnotation.idempotent(), theAnnotation.name(), theAnnotation.type(), theAnnotation.returnParameters(), theAnnotation.bundleType());
|
||||
}
|
||||
public OperationMethodBinding(Class<?> theReturnResourceType, Class<? extends IBaseResource> theReturnTypeFromRp, Method theMethod, FhirContext theContext, Object theProvider, Operation theAnnotation) {
|
||||
this(theReturnResourceType, theReturnTypeFromRp, theMethod, theContext, theProvider, theAnnotation.idempotent(), theAnnotation.name(), theAnnotation.type(), theAnnotation.returnParameters(), theAnnotation.bundleType());
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return myDescription;
|
||||
}
|
||||
public String getDescription() {
|
||||
return myDescription;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the name of the operation, starting with "$"
|
||||
*/
|
||||
public String getName() {
|
||||
return myName;
|
||||
}
|
||||
/**
|
||||
* Returns the name of the operation, starting with "$"
|
||||
*/
|
||||
public String getName() {
|
||||
return myName;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BundleTypeEnum getResponseBundleType() {
|
||||
return myBundleType;
|
||||
}
|
||||
@Override
|
||||
protected BundleTypeEnum getResponseBundleType() {
|
||||
return myBundleType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RestOperationTypeEnum getRestOperationType() {
|
||||
return myOtherOperatiopnType;
|
||||
}
|
||||
@Override
|
||||
public RestOperationTypeEnum getRestOperationType() {
|
||||
return myOtherOperatiopnType;
|
||||
}
|
||||
|
||||
public List<ReturnType> getReturnParams() {
|
||||
return Collections.unmodifiableList(myReturnParams);
|
||||
}
|
||||
public List<ReturnType> getReturnParams() {
|
||||
return Collections.unmodifiableList(myReturnParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ReturnTypeEnum getReturnType() {
|
||||
return myReturnType;
|
||||
}
|
||||
@Override
|
||||
public ReturnTypeEnum getReturnType() {
|
||||
return myReturnType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean incomingServerRequestMatchesMethod(RequestDetails theRequest) {
|
||||
if (getResourceName() == null) {
|
||||
if (isNotBlank(theRequest.getResourceName())) {
|
||||
return false;
|
||||
}
|
||||
} else if (!getResourceName().equals(theRequest.getResourceName())) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
public boolean incomingServerRequestMatchesMethod(RequestDetails theRequest) {
|
||||
if (getResourceName() == null) {
|
||||
if (isNotBlank(theRequest.getResourceName())) {
|
||||
return false;
|
||||
}
|
||||
} else if (!getResourceName().equals(theRequest.getResourceName())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!myName.equals(theRequest.getOperation())) {
|
||||
return false;
|
||||
}
|
||||
if (!myName.equals(theRequest.getOperation())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
RequestTypeEnum requestType = theRequest.getRequestType();
|
||||
if (requestType != RequestTypeEnum.GET && requestType != RequestTypeEnum.POST) {
|
||||
// Operations can only be invoked with GET and POST
|
||||
return false;
|
||||
}
|
||||
RequestTypeEnum requestType = theRequest.getRequestType();
|
||||
if (requestType != RequestTypeEnum.GET && requestType != RequestTypeEnum.POST) {
|
||||
// Operations can only be invoked with GET and POST
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean requestHasId = theRequest.getId() != null;
|
||||
if (requestHasId) {
|
||||
if (isCanOperateAtInstanceLevel() == false) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (myCanOperateAtTypeLevel == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
boolean requestHasId = theRequest.getId() != null;
|
||||
if (requestHasId) {
|
||||
if (isCanOperateAtInstanceLevel() == false) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (myCanOperateAtTypeLevel == false) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BaseHttpClientInvocation invokeClient(Object[] theArgs) throws InternalErrorException {
|
||||
String id = null;
|
||||
if (myIdParamIndex != null) {
|
||||
IIdType idDt = (IIdType) theArgs[myIdParamIndex];
|
||||
id = idDt.getValue();
|
||||
}
|
||||
IBaseParameters parameters = (IBaseParameters) getContext().getResourceDefinition("Parameters").newInstance();
|
||||
@Override
|
||||
public BaseHttpClientInvocation invokeClient(Object[] theArgs) throws InternalErrorException {
|
||||
String id = null;
|
||||
if (myIdParamIndex != null) {
|
||||
IIdType idDt = (IIdType) theArgs[myIdParamIndex];
|
||||
id = idDt.getValue();
|
||||
}
|
||||
IBaseParameters parameters = (IBaseParameters) getContext().getResourceDefinition("Parameters").newInstance();
|
||||
|
||||
if (theArgs != null) {
|
||||
for (int idx = 0; idx < theArgs.length; idx++) {
|
||||
IParameter nextParam = getParameters().get(idx);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null, parameters);
|
||||
}
|
||||
}
|
||||
if (theArgs != null) {
|
||||
for (int idx = 0; idx < theArgs.length; idx++) {
|
||||
IParameter nextParam = getParameters().get(idx);
|
||||
nextParam.translateClientArgumentIntoQueryArgument(getContext(), theArgs[idx], null, parameters);
|
||||
}
|
||||
}
|
||||
|
||||
return createOperationInvocation(getContext(), getResourceName(), id, myName, parameters, false);
|
||||
}
|
||||
return createOperationInvocation(getContext(), getResourceName(), id, myName, parameters, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invokeServer(IRestfulServer<?> theServer, RequestDetails theRequest) throws BaseServerResponseException, IOException {
|
||||
if (theRequest.getRequestType() == RequestTypeEnum.POST) {
|
||||
IBaseResource requestContents = ResourceParameter.loadResourceFromRequest(theRequest, this, null);
|
||||
theRequest.getUserData().put(OperationParameter.REQUEST_CONTENTS_USERDATA_KEY, requestContents);
|
||||
}
|
||||
return super.invokeServer(theServer, theRequest);
|
||||
}
|
||||
@Override
|
||||
public Object invokeServer(IRestfulServer<?> theServer, RequestDetails theRequest) throws BaseServerResponseException, IOException {
|
||||
if (theRequest.getRequestType() == RequestTypeEnum.POST) {
|
||||
IBaseResource requestContents = ResourceParameter.loadResourceFromRequest(theRequest, this, null);
|
||||
theRequest.getUserData().put(OperationParameter.REQUEST_CONTENTS_USERDATA_KEY, requestContents);
|
||||
}
|
||||
return super.invokeServer(theServer, theRequest);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object invokeServer(IRestfulServer<?> theServer, RequestDetails theRequest, Object[] theMethodParams) throws BaseServerResponseException {
|
||||
if (theRequest.getRequestType() == RequestTypeEnum.POST) {
|
||||
// all good
|
||||
} else if (theRequest.getRequestType() == RequestTypeEnum.GET) {
|
||||
if (!myIdempotent) {
|
||||
String message = getContext().getLocalizer().getMessage(OperationMethodBinding.class, "methodNotSupported", theRequest.getRequestType(), RequestTypeEnum.POST.name());
|
||||
throw new MethodNotAllowedException(message, RequestTypeEnum.POST);
|
||||
}
|
||||
} else {
|
||||
if (!myIdempotent) {
|
||||
String message = getContext().getLocalizer().getMessage(OperationMethodBinding.class, "methodNotSupported", theRequest.getRequestType(), RequestTypeEnum.POST.name());
|
||||
throw new MethodNotAllowedException(message, RequestTypeEnum.POST);
|
||||
} else {
|
||||
String message = getContext().getLocalizer().getMessage(OperationMethodBinding.class, "methodNotSupported", theRequest.getRequestType(), RequestTypeEnum.GET.name(), RequestTypeEnum.POST.name());
|
||||
throw new MethodNotAllowedException(message, RequestTypeEnum.GET, RequestTypeEnum.POST);
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public Object invokeServer(IRestfulServer<?> theServer, RequestDetails theRequest, Object[] theMethodParams) throws BaseServerResponseException {
|
||||
if (theRequest.getRequestType() == RequestTypeEnum.POST) {
|
||||
// all good
|
||||
} else if (theRequest.getRequestType() == RequestTypeEnum.GET) {
|
||||
if (!myIdempotent) {
|
||||
String message = getContext().getLocalizer().getMessage(OperationMethodBinding.class, "methodNotSupported", theRequest.getRequestType(), RequestTypeEnum.POST.name());
|
||||
throw new MethodNotAllowedException(message, RequestTypeEnum.POST);
|
||||
}
|
||||
} else {
|
||||
if (!myIdempotent) {
|
||||
String message = getContext().getLocalizer().getMessage(OperationMethodBinding.class, "methodNotSupported", theRequest.getRequestType(), RequestTypeEnum.POST.name());
|
||||
throw new MethodNotAllowedException(message, RequestTypeEnum.POST);
|
||||
} else {
|
||||
String message = getContext().getLocalizer().getMessage(OperationMethodBinding.class, "methodNotSupported", theRequest.getRequestType(), RequestTypeEnum.GET.name(), RequestTypeEnum.POST.name());
|
||||
throw new MethodNotAllowedException(message, RequestTypeEnum.GET, RequestTypeEnum.POST);
|
||||
}
|
||||
}
|
||||
|
||||
if (myIdParamIndex != null) {
|
||||
theMethodParams[myIdParamIndex] = theRequest.getId();
|
||||
}
|
||||
if (myIdParamIndex != null) {
|
||||
theMethodParams[myIdParamIndex] = theRequest.getId();
|
||||
}
|
||||
|
||||
Object response = invokeServerMethod(theServer, theRequest, theMethodParams);
|
||||
IBundleProvider retVal = toResourceList(response);
|
||||
return retVal;
|
||||
}
|
||||
Object response = invokeServerMethod(theServer, theRequest, theMethodParams);
|
||||
IBundleProvider retVal = toResourceList(response);
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public boolean isCanOperateAtInstanceLevel() {
|
||||
return this.myCanOperateAtInstanceLevel;
|
||||
}
|
||||
public boolean isCanOperateAtInstanceLevel() {
|
||||
return this.myCanOperateAtInstanceLevel;
|
||||
}
|
||||
|
||||
public boolean isCanOperateAtServerLevel() {
|
||||
return this.myCanOperateAtServerLevel;
|
||||
}
|
||||
public boolean isCanOperateAtServerLevel() {
|
||||
return this.myCanOperateAtServerLevel;
|
||||
}
|
||||
|
||||
public boolean isCanOperateAtTypeLevel() {
|
||||
return myCanOperateAtTypeLevel;
|
||||
}
|
||||
public boolean isCanOperateAtTypeLevel() {
|
||||
return myCanOperateAtTypeLevel;
|
||||
}
|
||||
|
||||
public boolean isIdempotent() {
|
||||
return myIdempotent;
|
||||
}
|
||||
public boolean isIdempotent() {
|
||||
return myIdempotent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void populateActionRequestDetailsForInterceptor(RequestDetails theRequestDetails, ActionRequestDetails theDetails, Object[] theMethodParams) {
|
||||
super.populateActionRequestDetailsForInterceptor(theRequestDetails, theDetails, theMethodParams);
|
||||
theDetails.setResource((IBaseResource) theRequestDetails.getUserData().get(OperationParameter.REQUEST_CONTENTS_USERDATA_KEY));
|
||||
}
|
||||
@Override
|
||||
protected void populateActionRequestDetailsForInterceptor(RequestDetails theRequestDetails, ActionRequestDetails theDetails, Object[] theMethodParams) {
|
||||
super.populateActionRequestDetailsForInterceptor(theRequestDetails, theDetails, theMethodParams);
|
||||
theDetails.setResource((IBaseResource) theRequestDetails.getUserData().get(OperationParameter.REQUEST_CONTENTS_USERDATA_KEY));
|
||||
}
|
||||
|
||||
public void setDescription(String theDescription) {
|
||||
myDescription = theDescription;
|
||||
}
|
||||
public void setDescription(String theDescription) {
|
||||
myDescription = theDescription;
|
||||
}
|
||||
|
||||
public static BaseHttpClientInvocation createProcessMsgInvocation(FhirContext theContext, String theOperationName, IBaseBundle theInput) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
|
||||
if (b.length() > 0) {
|
||||
b.append('/');
|
||||
}
|
||||
if (!theOperationName.startsWith("$")) {
|
||||
b.append("$");
|
||||
}
|
||||
b.append(theOperationName);
|
||||
public static BaseHttpClientInvocation createProcessMsgInvocation(FhirContext theContext, String theOperationName, IBaseBundle theInput, Map<String, List<String>> urlParams) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
|
||||
|
||||
if (b.length() > 0) {
|
||||
b.append('/');
|
||||
}
|
||||
if (!theOperationName.startsWith("$")) {
|
||||
b.append("$");
|
||||
}
|
||||
b.append(theOperationName);
|
||||
|
||||
BaseHttpClientInvocation.appendExtraParamsWithQuestionMark(urlParams,b, b.indexOf("?") == -1);
|
||||
|
||||
return new HttpPostClientInvocation(theContext, theInput, b.toString());
|
||||
|
||||
}
|
||||
|
||||
public static BaseHttpClientInvocation createOperationInvocation(FhirContext theContext, String theResourceName, String theId, String theOperationName, IBaseParameters theInput, boolean theUseHttpGet) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
if (theResourceName != null) {
|
||||
b.append(theResourceName);
|
||||
if (isNotBlank(theId)) {
|
||||
b.append('/');
|
||||
b.append(theId);
|
||||
}
|
||||
}
|
||||
if (b.length() > 0) {
|
||||
b.append('/');
|
||||
}
|
||||
if (!theOperationName.startsWith("$")) {
|
||||
b.append("$");
|
||||
}
|
||||
b.append(theOperationName);
|
||||
|
||||
if (!theUseHttpGet) {
|
||||
return new HttpPostClientInvocation(theContext, theInput, b.toString());
|
||||
|
||||
}
|
||||
public static BaseHttpClientInvocation createOperationInvocation(FhirContext theContext, String theResourceName, String theId, String theOperationName, IBaseParameters theInput, boolean theUseHttpGet) {
|
||||
StringBuilder b = new StringBuilder();
|
||||
if (theResourceName != null) {
|
||||
b.append(theResourceName);
|
||||
if (isNotBlank(theId)) {
|
||||
b.append('/');
|
||||
b.append(theId);
|
||||
}
|
||||
}
|
||||
if (b.length() > 0) {
|
||||
b.append('/');
|
||||
}
|
||||
if (!theOperationName.startsWith("$")) {
|
||||
b.append("$");
|
||||
}
|
||||
b.append(theOperationName);
|
||||
} else {
|
||||
FhirTerser t = theContext.newTerser();
|
||||
List<Object> parameters = t.getValues(theInput, "Parameters.parameter");
|
||||
|
||||
if (!theUseHttpGet) {
|
||||
return new HttpPostClientInvocation(theContext, theInput, b.toString());
|
||||
} else {
|
||||
FhirTerser t = theContext.newTerser();
|
||||
List<Object> parameters = t.getValues(theInput, "Parameters.parameter");
|
||||
Map<String, List<String>> params = new LinkedHashMap<String, List<String>>();
|
||||
for (Object nextParameter : parameters) {
|
||||
IPrimitiveType<?> nextNameDt = (IPrimitiveType<?>) t.getSingleValueOrNull((IBase) nextParameter, "name");
|
||||
if (nextNameDt == null || nextNameDt.isEmpty()) {
|
||||
ourLog.warn("Ignoring input parameter with no value in Parameters.parameter.name in operation client invocation");
|
||||
continue;
|
||||
}
|
||||
String nextName = nextNameDt.getValueAsString();
|
||||
if (!params.containsKey(nextName)) {
|
||||
params.put(nextName, new ArrayList<String>());
|
||||
}
|
||||
|
||||
Map<String, List<String>> params = new LinkedHashMap<String, List<String>>();
|
||||
for (Object nextParameter : parameters) {
|
||||
IPrimitiveType<?> nextNameDt = (IPrimitiveType<?>) t.getSingleValueOrNull((IBase) nextParameter, "name");
|
||||
if (nextNameDt == null || nextNameDt.isEmpty()) {
|
||||
ourLog.warn("Ignoring input parameter with no value in Parameters.parameter.name in operation client invocation");
|
||||
continue;
|
||||
}
|
||||
String nextName = nextNameDt.getValueAsString();
|
||||
if (!params.containsKey(nextName)) {
|
||||
params.put(nextName, new ArrayList<String>());
|
||||
}
|
||||
IBaseDatatype value = (IBaseDatatype) t.getSingleValueOrNull((IBase) nextParameter, "value[x]");
|
||||
if (value == null) {
|
||||
continue;
|
||||
}
|
||||
if (!(value instanceof IPrimitiveType)) {
|
||||
throw new IllegalArgumentException("Can not invoke operation as HTTP GET when it has parameters with a composite (non priitive) datatype as the value. Found value: " + value.getClass().getName());
|
||||
}
|
||||
IPrimitiveType<?> primitive = (IPrimitiveType<?>) value;
|
||||
params.get(nextName).add(primitive.getValueAsString());
|
||||
}
|
||||
return new HttpGetClientInvocation(theContext, params, b.toString());
|
||||
}
|
||||
}
|
||||
|
||||
IBaseDatatype value = (IBaseDatatype) t.getSingleValueOrNull((IBase) nextParameter, "value[x]");
|
||||
if (value == null) {
|
||||
continue;
|
||||
}
|
||||
if (!(value instanceof IPrimitiveType)) {
|
||||
throw new IllegalArgumentException("Can not invoke operation as HTTP GET when it has parameters with a composite (non priitive) datatype as the value. Found value: " + value.getClass().getName());
|
||||
}
|
||||
IPrimitiveType<?> primitive = (IPrimitiveType<?>) value;
|
||||
params.get(nextName).add(primitive.getValueAsString());
|
||||
}
|
||||
return new HttpGetClientInvocation(theContext, params, b.toString());
|
||||
}
|
||||
}
|
||||
public static class ReturnType {
|
||||
|
||||
public static class ReturnType {
|
||||
private int myMax;
|
||||
private int myMin;
|
||||
private String myName;
|
||||
/**
|
||||
* http://hl7-fhir.github.io/valueset-operation-parameter-type.html
|
||||
*/
|
||||
private String myType;
|
||||
private int myMax;
|
||||
private int myMin;
|
||||
private String myName;
|
||||
/**
|
||||
* http://hl7-fhir.github.io/valueset-operation-parameter-type.html
|
||||
*/
|
||||
private String myType;
|
||||
|
||||
public int getMax() {
|
||||
return myMax;
|
||||
}
|
||||
public int getMax() {
|
||||
return myMax;
|
||||
}
|
||||
|
||||
public int getMin() {
|
||||
return myMin;
|
||||
}
|
||||
public int getMin() {
|
||||
return myMin;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return myName;
|
||||
}
|
||||
public String getName() {
|
||||
return myName;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return myType;
|
||||
}
|
||||
public String getType() {
|
||||
return myType;
|
||||
}
|
||||
|
||||
public void setMax(int theMax) {
|
||||
myMax = theMax;
|
||||
}
|
||||
public void setMax(int theMax) {
|
||||
myMax = theMax;
|
||||
}
|
||||
|
||||
public void setMin(int theMin) {
|
||||
myMin = theMin;
|
||||
}
|
||||
public void setMin(int theMin) {
|
||||
myMin = theMin;
|
||||
}
|
||||
|
||||
public void setName(String theName) {
|
||||
myName = theName;
|
||||
}
|
||||
public void setName(String theName) {
|
||||
myName = theName;
|
||||
}
|
||||
|
||||
public void setType(String theType) {
|
||||
myType = theType;
|
||||
}
|
||||
}
|
||||
public void setType(String theType) {
|
||||
myType = theType;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -173,7 +173,7 @@
|
|||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<argLine>${argLine} -Dfile.encoding=UTF-8 -Xmx712m</argLine>
|
||||
<argLine>-Dfile.encoding=UTF-8 -Xmx712m</argLine>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
|
|
|
@ -2703,16 +2703,6 @@ public class GenericClientDstu2Test {
|
|||
public void unregisterInterceptor(IClientInterceptor theInterceptor) {
|
||||
//nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMessageAsync(Boolean isAsync) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMessageResponseUrl(String responseUrl) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,21 +1,13 @@
|
|||
package ca.uhn.fhir.rest.client;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.io.StringReader;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.io.input.ReaderInputStream;
|
||||
import org.apache.http.HttpResponse;
|
||||
import org.apache.http.ProtocolVersion;
|
||||
import org.apache.http.client.HttpClient;
|
||||
import org.apache.http.client.methods.HttpPost;
|
||||
import org.apache.http.client.methods.HttpUriRequest;
|
||||
import org.apache.http.message.BasicHeader;
|
||||
import org.apache.http.message.BasicStatusLine;
|
||||
|
@ -31,22 +23,15 @@ import ca.uhn.fhir.context.FhirContext;
|
|||
import ca.uhn.fhir.model.dstu2.resource.Bundle;
|
||||
import ca.uhn.fhir.model.dstu2.resource.MessageHeader;
|
||||
import ca.uhn.fhir.model.dstu2.resource.OperationOutcome;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Parameters;
|
||||
import ca.uhn.fhir.model.dstu2.resource.Patient;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.BundleTypeEnum;
|
||||
import ca.uhn.fhir.model.dstu2.valueset.ResponseTypeEnum;
|
||||
import ca.uhn.fhir.model.primitive.IdDt;
|
||||
import ca.uhn.fhir.model.primitive.StringDt;
|
||||
import ca.uhn.fhir.rest.client.apache.ApacheRestfulClientFactory;
|
||||
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor;
|
||||
import ca.uhn.fhir.rest.server.Constants;
|
||||
import ca.uhn.fhir.rest.server.EncodingEnum;
|
||||
import ca.uhn.fhir.util.TestUtil;
|
||||
import java.util.Date;
|
||||
import java.util.UUID;
|
||||
import org.hl7.fhir.instance.model.api.IBaseBundle;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
|
@ -98,7 +83,7 @@ public class MessageClientDstu2Test {
|
|||
}
|
||||
});
|
||||
|
||||
IGenericClient client = ourCtx.getRestfulClientFactory().newGenericClient("http://192.168.4.196:83/fhirServer");
|
||||
IGenericClient client = ourCtx.getRestfulClientFactory().newGenericClient("http://192.168.4.93:83/fhirServer");
|
||||
|
||||
client.setEncoding(EncodingEnum.JSON);
|
||||
|
||||
|
@ -108,17 +93,16 @@ public class MessageClientDstu2Test {
|
|||
"MySource", "http://myServer/fhir/", "MyDestination", "http://myDestinationServer/fhir/");
|
||||
|
||||
// Invoke $process-message
|
||||
Object response = client
|
||||
OperationOutcome response = client
|
||||
.operation()
|
||||
.onServer()
|
||||
.processMessage()
|
||||
.setAsyncProcessingMode()
|
||||
.setResponseUrlParam("http://myserver/fhir")
|
||||
.setMessageBundle(msgBundle)
|
||||
.asynchronous(OperationOutcome.class)
|
||||
.execute();
|
||||
|
||||
//System.out.println(response);
|
||||
assertEquals("http://192.168.4.196:83/fhirServer/$process-message?_format=json&async=true&response-url=http%3A%2F%2Fmyserver%2Ffhir", capt.getAllValues().get(0).getURI().toASCIIString());
|
||||
assertEquals("http://192.168.4.93:83/fhirServer/$process-message?async=true&response-url=http%3A%2F%2Fmyserver%2Ffhir&_format=json", capt.getAllValues().get(0).getURI().toASCIIString());
|
||||
assertEquals("POST", capt.getAllValues().get(0).getRequestLine().getMethod());
|
||||
//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>", extractBody(capt, 0));
|
||||
//assertNotNull(response.getOperationOutcome());
|
||||
|
@ -145,7 +129,7 @@ public class MessageClientDstu2Test {
|
|||
}
|
||||
});
|
||||
|
||||
IGenericClient client = ourCtx.getRestfulClientFactory().newGenericClient("http://192.168.4.196:83/fhirServer");
|
||||
IGenericClient client = ourCtx.getRestfulClientFactory().newGenericClient("http://192.168.4.93:83/fhirServer");
|
||||
|
||||
client.setEncoding(EncodingEnum.JSON);
|
||||
|
||||
|
@ -155,16 +139,15 @@ public class MessageClientDstu2Test {
|
|||
"MySource", "http://myServer/fhir/", "MyDestination", "http://myDestinationServer/fhir/");
|
||||
|
||||
// Invoke $process-message
|
||||
Object response = client
|
||||
.operation()
|
||||
.onServer()
|
||||
Bundle response = client
|
||||
.operation()
|
||||
.processMessage()
|
||||
.setResponseUrlParam("http://myserver/fhir")
|
||||
.setMessageBundle(msgBundle)
|
||||
.synchronous(Bundle.class)
|
||||
.execute();
|
||||
|
||||
//System.out.println(response);
|
||||
assertEquals("http://192.168.4.196:83/fhirServer/$process-message?_format=json&response-url=http%3A%2F%2Fmyserver%2Ffhir", capt.getAllValues().get(0).getURI().toASCIIString());
|
||||
assertEquals("http://192.168.4.93:83/fhirServer/$process-message?async=false&_format=json", capt.getAllValues().get(0).getURI().toASCIIString());
|
||||
assertEquals("POST", capt.getAllValues().get(0).getRequestLine().getMethod());
|
||||
//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>", extractBody(capt, 0));
|
||||
//assertNotNull(response.getOperationOutcome());
|
||||
|
|
Loading…
Reference in New Issue