A bit of client tweaking

This commit is contained in:
James Agnew 2018-11-08 17:10:39 -05:00 committed by Eeva Turkka
parent 5ccb2af3bd
commit ffc391065b
4 changed files with 25 additions and 4 deletions

View File

@ -34,7 +34,7 @@ public interface IOperationUntyped {
* @param theParameters The parameters to use as input. May also be <code>null</code> if the operation
* does not require any input parameters.
*/
<T extends IBaseParameters> IOperationUntypedWithInput<T> withParameters(T theParameters);
<T extends IBaseParameters> IOperationUntypedWithInputAndPartialOutput<T> withParameters(T theParameters);
/**
* The operation does not require any input parameters

View File

@ -38,6 +38,8 @@ public interface IOperationUntypedWithInputAndPartialOutput<T extends IBaseParam
IOperationUntypedWithInputAndPartialOutput<T> andParameter(String theName, IBase theValue);
/**
* Adds a URL parameter to the request.
*
* Use chained method calls to construct a Parameters input. This form is a convenience
* in order to allow simple method chaining to be used to build up a parameters
* resource for the input of an operation without needing to manually construct one.

View File

@ -1276,7 +1276,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
@SuppressWarnings("unchecked")
@Override
public <T extends IBaseParameters> IOperationUntypedWithInput<T> withNoParameters(Class<T> theOutputParameterType) {
public <T extends IBaseParameters> IOperationUntypedWithInputAndPartialOutput<T> withNoParameters(Class<T> theOutputParameterType) {
Validate.notNull(theOutputParameterType, "theOutputParameterType may not be null");
RuntimeResourceDefinition def = myContext.getResourceDefinition(theOutputParameterType);
if (def == null) {
@ -1307,9 +1307,10 @@ public class GenericClient extends BaseClient implements IGenericClient {
@SuppressWarnings({"unchecked"})
@Override
public IOperationUntypedWithInput withParameters(IBaseParameters theParameters) {
public IOperationUntypedWithInputAndPartialOutput withParameters(IBaseParameters theParameters) {
Validate.notNull(theParameters, "theParameters can not be null");
myParameters = theParameters;
myParametersDef = myContext.getResourceDefinition(theParameters.getClass());
return this;
}
@ -1445,7 +1446,7 @@ public class GenericClient extends BaseClient implements IGenericClient {
OutcomeResponseHandler binding = new OutcomeResponseHandler(myPrefer);
Map<String, List<String>> params = new HashMap<String, List<String>>();
Map<String, List<String>> params = new HashMap<>();
return invoke(params, binding, invocation);
}

View File

@ -123,6 +123,24 @@ public class OperationClientR4Test {
assertEquals("http://foo/$nonrepeating?valstr=str&valtok=sys2%7Cval2", value.getURI().toASCIIString());
}
@Test
public void testNonRepeatingGenericUsingUrl2() {
ourGenClient
.operation()
.onServer()
.named("nonrepeating")
.withParameters(new Parameters())
.andSearchParameter("valstr", new StringParam("str"))
.andSearchParameter("valtok", new TokenParam("sys2", "val2"))
.useHttpGet()
.execute();
Parameters response = ourAnnClient.nonrepeating(new StringParam("str"), new TokenParam("sys", "val"));
assertEquals("FOO", response.getParameter().get(0).getName());
HttpGet value = (HttpGet) capt.getAllValues().get(0);
assertEquals("http://foo/$nonrepeating?valstr=str&valtok=sys2%7Cval2", value.getURI().toASCIIString());
}
@Test
public void testOperationOnInstanceWithIncompleteInstanceId() {
try {