100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Refactored WebTargetBuilder
Rich Turnerbea812c5346d
diff --git a/agent/src/main/java/org/openremote/agent/protocol/controller/ControllerProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/controller/ControllerProtocol.javaindex 8277663f6..90298b4a0 100644--- a/agent/src/main/java/org/openremote/agent/protocol/controller/ControllerProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/controller/ControllerProtocol.java@@ -19,7 +19,9 @@*/package org.openremote.agent.protocol.controller;+import org.apache.http.client.utils.URIBuilder;import org.apache.http.conn.HttpHostConnectException;+import org.jboss.resteasy.client.jaxrs.ResteasyClient;import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;import org.openremote.agent.protocol.AbstractProtocol;import org.openremote.agent.protocol.controller.command.ControllerCommandBasic;@@ -36,7 +38,10 @@ import org.openremote.model.value.*;import javax.ws.rs.ProcessingException;import javax.ws.rs.core.MultivaluedMap;import javax.ws.rs.core.Response;+import javax.ws.rs.core.UriBuilder;import java.net.ConnectException;+import java.net.URI;+import java.net.URISyntaxException;import java.net.UnknownHostException;import java.util.*;import java.util.concurrent.ScheduledFuture;@@ -45,6 +50,8 @@ import java.util.function.Consumer;import java.util.logging.Level;import java.util.logging.Logger;+import static org.openremote.agent.protocol.http.WebTargetBuilder.CONNECTION_POOL_SIZE;+import static org.openremote.agent.protocol.http.WebTargetBuilder.createClient;import static org.openremote.container.concurrent.GlobalLock.withLock;import static org.openremote.container.concurrent.GlobalLock.withLockReturning;import static org.openremote.model.Constants.PROTOCOL_NAMESPACE;@@ -170,23 +177,17 @@ public class ControllerProtocol extends AbstractProtocol {public static final String PROTOCOL_DISPLAY_NAME = "Controller Client";public static final String PROTOCOL_VERSION = "1.0";+ protected ResteasyClient client;private Map<PollingKey, ScheduledFuture> pollingSensorList = new HashMap<>();-private Map<AttributeRef, Controller> controllersMap = new HashMap<>();private Map<AttributeRef, ResteasyWebTarget> controllersTargetMap = new HashMap<>();private Map<AttributeRef, ScheduledFuture> controllerHeartbeat = new HashMap<>();-private Map<AttributeRef, Boolean> initStatusDone = new HashMap<>();@Overridepublic void init(Container container) throws Exception {super.init(container);- WebTargetBuilder.setExecutorService(executorService);- }-- @Override- protected void doStop(Container container) {- WebTargetBuilder.close();+ client = createClient(executorService, CONNECTION_POOL_SIZE, 70000);}@Override@@ -208,24 +209,29 @@ public class ControllerProtocol extends AbstractProtocol {String baseURL = protocolConfiguration.getMetaItem(META_PROTOCOL_BASE_URI).flatMap(AbstractValueHolder::getValueAsString).orElseThrow(() -> new IllegalArgumentException("Missing or invalid required meta item: " + META_PROTOCOL_BASE_URI));- WebTargetBuilder webTargetBuilder = new WebTargetBuilder(baseURL, 70000);-- String username = protocolConfiguration.getMetaItem(META_PROTOCOL_USERNAME).flatMap(AbstractValueHolder::getValueAsString).orElse(null);- String password = protocolConfiguration.getMetaItem(META_PROTOCOL_PASSWORD).flatMap(AbstractValueHolder::getValueAsString).orElse(null);+ try {+ URI uri = new URIBuilder(baseURL).build();+ WebTargetBuilder webTargetBuilder = new WebTargetBuilder(client, uri);+ String username = protocolConfiguration.getMetaItem(META_PROTOCOL_USERNAME).flatMap(AbstractValueHolder::getValueAsString).orElse(null);+ String password = protocolConfiguration.getMetaItem(META_PROTOCOL_PASSWORD).flatMap(AbstractValueHolder::getValueAsString).orElse(null);- if (username != null && password != null) {- webTargetBuilder.setBasicAuthentication(username, password);- }+ if (username != null && password != null) {+ webTargetBuilder.setBasicAuthentication(username, password);+ }- controllersTargetMap.put(protocolConfiguration.getReferenceOrThrow(), webTargetBuilder.build());+ controllersTargetMap.put(protocolConfiguration.getReferenceOrThrow(), webTargetBuilder.build());- controllersMap.put(protocolConfiguration.getReferenceOrThrow(), new Controller(protocolConfiguration.getReferenceOrThrow()));+ controllersMap.put(protocolConfiguration.getReferenceOrThrow(), new Controller(protocolConfiguration.getReferenceOrThrow()));- this.updateStatus(protocolConfiguration.getReferenceOrThrow(), ConnectionStatus.DISCONNECTED);+ this.updateStatus(protocolConfiguration.getReferenceOrThrow(), ConnectionStatus.DISCONNECTED);- controllerHeartbeat.put(protocolConfiguration.getReferenceOrThrow(), this.executorService.scheduleWithFixedDelay(() -> this.executeHeartbeat(protocolConfiguration.getReferenceOrThrow(),+ controllerHeartbeat.put(protocolConfiguration.getReferenceOrThrow(), this.executorService.scheduleWithFixedDelay(() -> this.executeHeartbeat(protocolConfiguration.getReferenceOrThrow(),response -> onHeartbeatResponse(protocolConfiguration.getReferenceOrThrow(), response)), 0, HEARTBEAT_DELAY_SECONDS,TimeUnit.SECONDS));+ } catch (URISyntaxException e) {+ LOG.log(Level.SEVERE, "Invalid URI", e);+ updateConnectionStatus(protocolConfiguration.getReferenceOrThrow(), ConnectionStatus.ERROR);+ }}@Overridediff --git a/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientProtocol.java b/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientProtocol.javaindex 5501b35ed..0864bf6f3 100644--- a/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientProtocol.java+++ b/agent/src/main/java/org/openremote/agent/protocol/http/HttpClientProtocol.java@@ -19,6 +19,8 @@*/package org.openremote.agent.protocol.http;+import org.apache.http.client.utils.URIBuilder;+import org.jboss.resteasy.client.jaxrs.ResteasyClient;import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;import org.jboss.resteasy.core.Headers;import org.jboss.resteasy.specimpl.BuiltResponse;@@ -49,6 +51,8 @@ import javax.ws.rs.core.Response;import java.io.IOException;import java.lang.annotation.Annotation;import java.lang.reflect.Type;+import java.net.URI;+import java.net.URISyntaxException;import java.util.*;import java.util.concurrent.Future;import java.util.concurrent.ScheduledFuture;@@ -57,12 +61,13 @@ import java.util.function.Consumer;import java.util.logging.Level;import java.util.logging.Logger;+import static org.openremote.agent.protocol.http.WebTargetBuilder.createClient;import static org.openremote.container.concurrent.GlobalLock.withLock;import static org.openremote.model.Constants.PROTOCOL_NAMESPACE;import static org.openremote.model.attribute.MetaItemDescriptor.Access.ACCESS_PRIVATE;import static org.openremote.model.attribute.MetaItemDescriptorImpl.*;import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;-import static org.openremote.model.util.TextUtil.*;+import static org.openremote.model.util.TextUtil.REGEXP_PATTERN_STRING_NON_EMPTY;/*** This is a HTTP client protocol for communicating with HTTP servers; it uses the {@link WebTargetBuilder} factory to@@ -336,9 +341,9 @@ public class HttpClientProtocol extends AbstractProtocol {public static final String DEFAULT_HTTP_METHOD = HttpMethod.GET;public static final String DEFAULT_CONTENT_TYPE = MediaType.TEXT_PLAIN;protected static final String HEADER_LINK = "Link";- private static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, HttpClientProtocol.class.getName());- private static int MIN_POLLING_MILLIS = 1000;- private static int MIN_PING_MILLIS = 10000;+ protected static final Logger LOG = SyslogCategory.getLogger(PROTOCOL, HttpClientProtocol.class.getName());+ protected static int MIN_POLLING_MILLIS = 1000;+ protected static int MIN_PING_MILLIS = 10000;/*--------------- META ITEMS TO BE USED ON PROTOCOL CONFIGURATIONS ---------------*//**@@ -573,6 +578,7 @@ public class HttpClientProtocol extends AbstractProtocol {protected final Map<AttributeRef, Pair<ResteasyWebTarget, List<Integer>>> clientMap = new HashMap<>();protected final Map<AttributeRef, HttpClientRequest> requestMap = new HashMap<>();protected final Map<AttributeRef, ScheduledFuture> pollingMap = new HashMap<>();+ protected ResteasyClient client;public static Optional<OAuthGrant> getOAuthGrant(AssetAttribute attribute) throws IllegalArgumentException {return !attribute.hasMetaItem(META_PROTOCOL_OAUTH_GRANT)@@ -666,7 +672,7 @@ public class HttpClientProtocol extends AbstractProtocol {@Overridepublic void init(Container container) throws Exception {super.init(container);- WebTargetBuilder.setExecutorService(executorService);+ client = createClient(executorService);}@Override@@ -675,7 +681,6 @@ public class HttpClientProtocol extends AbstractProtocol {pollingMap.clear();requestMap.clear();clientMap.clear();- WebTargetBuilder.close();}@Override@@ -691,6 +696,14 @@ public class HttpClientProtocol extends AbstractProtocol {.flatMap(AbstractValueHolder::getValueAsString).orElseThrow(() ->new IllegalArgumentException("Missing or invalid require meta item: " + META_PROTOCOL_BASE_URI));+ URI uri = null;++ try {+ uri = new URIBuilder(baseUri).build();+ } catch (URISyntaxException e) {+ LOG.log(Level.SEVERE, "Invalid URI", e);+ }+/* We're going to fail hard and fast if optional meta items are incorrectly configured */Optional<OAuthGrant> oAuthGrant = getOAuthGrant(protocolConfiguration);@@ -737,7 +750,7 @@ public class HttpClientProtocol extends AbstractProtocol {.flatMap(Values::getString).orElse(null);- WebTargetBuilder webTargetBuilder = new WebTargetBuilder(baseUri);+ WebTargetBuilder webTargetBuilder = new WebTargetBuilder(client, uri);if (oAuthGrant.isPresent()) {LOG.info("Adding OAuth");webTargetBuilder.setOAuthAuthentication(oAuthGrant.get());diff --git a/agent/src/main/java/org/openremote/agent/protocol/http/WebTargetBuilder.java b/agent/src/main/java/org/openremote/agent/protocol/http/WebTargetBuilder.javaindex 9a25cef0d..bc4deaad0 100644--- a/agent/src/main/java/org/openremote/agent/protocol/http/WebTargetBuilder.java+++ b/agent/src/main/java/org/openremote/agent/protocol/http/WebTargetBuilder.java@@ -23,14 +23,12 @@ import org.jboss.resteasy.client.jaxrs.BasicAuthentication;import org.jboss.resteasy.client.jaxrs.ResteasyClient;import org.jboss.resteasy.client.jaxrs.ResteasyClientBuilder;import org.jboss.resteasy.client.jaxrs.ResteasyWebTarget;-import org.jboss.resteasy.specimpl.ResteasyUriBuilder;import org.openremote.container.json.JacksonConfig;import javax.ws.rs.Priorities;import javax.ws.rs.client.WebTarget;import javax.ws.rs.core.MultivaluedMap;import javax.ws.rs.core.Response;-import javax.ws.rs.core.UriBuilder;import java.net.URI;import java.util.ArrayList;import java.util.Arrays;@@ -52,55 +50,22 @@ import java.util.stream.Collectors;// TODO: This should probably be amalgamated with WebClient somehow to provide a unified JAX-RS Client APIpublic class WebTargetBuilder {- public static final int CONNECTION_POOL_SIZE = 200;+ public static final int CONNECTION_POOL_SIZE = 10;public static final long CONNECTION_CHECKOUT_TIMEOUT_MILLISECONDS = 5000;public static final long CONNECTION_TIMEOUT_MILLISECONDS = 10000;- protected static ResteasyClient client;- protected static ExecutorService asyncExecutorService;+ protected ResteasyClient client;+ protected static ExecutorService executorService;protected BasicAuthentication basicAuthentication;protected OAuthGrant oAuthGrant;- protected UriBuilder uri;+ protected URI baseUri;protected List<Integer> failureResponses = new ArrayList<>();protected MultivaluedMap<String, String> injectHeaders;protected MultivaluedMap<String, String> injectQueryParameters;protected boolean followRedirects = false;- public WebTargetBuilder(String uri) {- this(ResteasyUriBuilder.fromUri(uri));- }-- public WebTargetBuilder(String uri, long overrideSocketTimeout) {- this(ResteasyUriBuilder.fromUri(uri), overrideSocketTimeout);- }-- public WebTargetBuilder(URI uri) {- this(ResteasyUriBuilder.fromUri(uri));- }-- public WebTargetBuilder(UriBuilder uri) {- if (client == null) {- initClient(null);- }- this.uri = uri;- }-- public WebTargetBuilder(UriBuilder uri, long overrideSocketTimeout) {- if (client == null) {- initClient(overrideSocketTimeout);- }- this.uri = uri;- }-- /**- * Set the executor service to be used for async operations (if none is supplied then one will be created- * automatically), this allows fine grained thread management at the application level.- */- public static void setExecutorService(ExecutorService executorService) {- if (client != null) {- throw new IllegalStateException("Executor service must be set before any call to create");- }-- asyncExecutorService = executorService;+ public WebTargetBuilder(ResteasyClient client, URI baseUri) {+ this.client = client;+ this.baseUri = baseUri;}/**@@ -122,7 +87,6 @@ public class WebTargetBuilder {return this;}-public WebTargetBuilder setInjectHeaders(MultivaluedMap<String, String> injectHeaders) {this.injectHeaders = injectHeaders;return this;@@ -149,6 +113,7 @@ public class WebTargetBuilder {);return this;}+public WebTargetBuilder addPermanentFailureResponse(Integer...responseStatus) {Collections.addAll(failureResponses, responseStatus);return this;@@ -174,7 +139,7 @@ public class WebTargetBuilder {}public ResteasyWebTarget build() {- ResteasyWebTarget target = client.target(uri);+ ResteasyWebTarget target = client.target(baseUri);if (!failureResponses.isEmpty()) {// Put a filter with max priority in the filter chain@@ -204,30 +169,22 @@ public class WebTargetBuilder {return target;}- protected static void initClient(Long overrideSocketTimeout) {- if (client != null) {- return;- }+ public static ResteasyClient createClient(ExecutorService executorService) {+ return createClient(executorService, CONNECTION_POOL_SIZE, CONNECTION_TIMEOUT_MILLISECONDS);+ }++ public static ResteasyClient createClient(ExecutorService executorService, int connectionPoolSize, long overrideSocketTimeout) {ResteasyClientBuilder clientBuilder = new ResteasyClientBuilder()- .connectionPoolSize(CONNECTION_POOL_SIZE)+ .connectionPoolSize(connectionPoolSize).connectionCheckoutTimeout(CONNECTION_CHECKOUT_TIMEOUT_MILLISECONDS, TimeUnit.MILLISECONDS)- .socketTimeout(overrideSocketTimeout == null ? CONNECTION_TIMEOUT_MILLISECONDS : overrideSocketTimeout, TimeUnit.MILLISECONDS)+ .socketTimeout(overrideSocketTimeout, TimeUnit.MILLISECONDS).establishConnectionTimeout(CONNECTION_TIMEOUT_MILLISECONDS, TimeUnit.MILLISECONDS).register(new JacksonConfig());- if (asyncExecutorService != null) {- clientBuilder.asyncExecutor(asyncExecutorService);- }-- client = clientBuilder.build();- }-- public static void close() {- if (client == null) {- return;+ if (executorService != null) {+ clientBuilder.asyncExecutor(executorService);}- client.close();- client = null;+ return clientBuilder.build();}}diff --git a/test/src/test/groovy/org/openremote/test/protocol/controller/ControllerProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/controller/ControllerProtocolTest.groovyindex f961fa38c..53fc5281f 100644--- a/test/src/test/groovy/org/openremote/test/protocol/controller/ControllerProtocolTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/controller/ControllerProtocolTest.groovy@@ -163,10 +163,6 @@ class ControllerProtocolTest extends Specification implements ManagerContainerTr}}- def cleanupSpec() {- WebTargetBuilder.close()- }-def cleanup() {mockServer.commandCount = 0mockServer.pollCount = 0@@ -190,10 +186,8 @@ class ControllerProtocolTest extends Specification implements ManagerContainerTr}when: "the web target builder is configured to use the mock server"- // Need to do this here as HTTP protocol must be initialised first- WebTargetBuilder.initClient()- if (!WebTargetBuilder.client.configuration.isRegistered(mockServer)) {- WebTargetBuilder.client.register(mockServer, Integer.MAX_VALUE)+ if (!controllerProtocol.client.configuration.isRegistered(mockServer)) {+ controllerProtocol.client.register(mockServer, Integer.MAX_VALUE)}and: "an agent with a Controller protocol configuration is created"@@ -356,5 +350,8 @@ class ControllerProtocolTest extends Specification implements ManagerContainerTrassert mockServer.commandCount == 2assert true}++ cleanup: "the server should be stopped"+ stopContainer(container)}}\ No newline at end of filediff --git a/test/src/test/groovy/org/openremote/test/protocol/http/HttpClientProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/http/HttpClientProtocolTest.groovyindex e2d587d77..c2b4b7daf 100644--- a/test/src/test/groovy/org/openremote/test/protocol/http/HttpClientProtocolTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/http/HttpClientProtocolTest.groovy@@ -252,10 +252,6 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTr}}- def cleanupSpec() {- WebTargetBuilder.close()- }-def cleanup() {mockServer.supportsRefresh = falsemockServer.accessToken = null@@ -292,10 +288,8 @@ class HttpClientProtocolTest extends Specification implements ManagerContainerTr}when: "the web target builder is configured to use the mock server"- // Need to do this here as HTTP protocol must be initialised first- WebTargetBuilder.initClient()- if (!WebTargetBuilder.client.configuration.isRegistered(mockServer)) {- WebTargetBuilder.client.register(mockServer, Integer.MAX_VALUE)+ if (!httpClientProtocol.client.configuration.isRegistered(mockServer)) {+ httpClientProtocol.client.register(mockServer, Integer.MAX_VALUE)}and: "an agent with a HTTP client protocol configuration is created"diff --git a/test/src/test/groovy/org/openremote/test/protocol/http/HttpServerProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/http/HttpServerProtocolTest.groovyindex 3c6845191..0c3ee6f80 100644--- a/test/src/test/groovy/org/openremote/test/protocol/http/HttpServerProtocolTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/http/HttpServerProtocolTest.groovy@@ -248,10 +248,6 @@ class HttpServerProtocolTest extends Specification implements ManagerContainerTr}}- def cleanupSpec() {- WebTargetBuilder.close()- }-def cleanup() {mockServer.supportsRefresh = falsemockServer.accessToken = nulldiff --git a/test/src/test/groovy/org/openremote/test/protocol/http/WebTargetTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/http/WebTargetTest.groovyindex bd76419aa..f57fc9b37 100644--- a/test/src/test/groovy/org/openremote/test/protocol/http/WebTargetTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/http/WebTargetTest.groovy@@ -19,6 +19,8 @@*/package org.openremote.test.protocol.http+import org.apache.http.client.utils.URIBuilder+import org.jboss.resteasy.client.jaxrs.ResteasyClientimport org.jboss.resteasy.spi.ResteasyUriInfoimport org.jboss.resteasy.util.BasicAuthHelperimport org.openremote.agent.protocol.http.*@@ -204,14 +206,13 @@ class WebTargetTest extends Specification {}}+ @Shared+ ResteasyClient client+def setupSpec() {// Initialise the web target builder and load in the mock 'server'- WebTargetBuilder.initClient()- WebTargetBuilder.client.register(mockServer, Integer.MAX_VALUE)- }-- def cleanupSpec() {- WebTargetBuilder.close()+ client = WebTargetBuilder.createClient(null)+ client.register(mockServer, Integer.MAX_VALUE)}def cleanup() {@@ -251,7 +252,7 @@ class WebTargetTest extends Specification {def "Check Basic authentication"() {given: "a web target for a server requiring basic authentication"- def target = new WebTargetBuilder("https://basicserver")+ def target = new WebTargetBuilder(client, new URIBuilder("https://basicserver").build()).setBasicAuthentication("testuser", "password1").build()@@ -265,7 +266,7 @@ class WebTargetTest extends Specification {def "Check OAuth resource owner credentials (password) grant authentication"() {given: "a web target for a server requiring OAuth 'password' grant authentication"- def target = new WebTargetBuilder("https://oauthserver")+ def target = new WebTargetBuilder(client, new URIBuilder("https://oauthserver").build()).setOAuthAuthentication(new OAuthPasswordGrant("https://oauthserver/token",@@ -320,7 +321,7 @@ class WebTargetTest extends Specification {def "Check OAuth client credentials grant authentication"() {given: "a web target for a server requiring OAuth 'client_credentials' grant authentication"- def target = new WebTargetBuilder("https://oauthserver")+ def target = new WebTargetBuilder(client, new URIBuilder("https://oauthserver").build()).setOAuthAuthentication(new OAuthClientCredentialsGrant("https://oauthserver/token",@@ -351,7 +352,7 @@ class WebTargetTest extends Specification {def "Check OAuth token reuse functionality"() {given: "a web target for a server requiring OAuth 'client_credentials' grant authentication"- def target = new WebTargetBuilder("https://oauthserver/get")+ def target = new WebTargetBuilder(client, new URIBuilder("https://oauthserver/get").build()).setOAuthAuthentication(new OAuthClientCredentialsGrant("https://oauthreuseserver/token",@@ -381,7 +382,7 @@ class WebTargetTest extends Specification {def "Check permanent failure functionality"() {given: "a web target for a server set to permanently fail on 403 errors"- def target = new WebTargetBuilder("https://forbiddenserver")+ def target = new WebTargetBuilder(client, new URIBuilder("https://forbiddenserver").build()).addPermanentFailureResponse(Response.Status.FORBIDDEN).build()@@ -408,7 +409,7 @@ class WebTargetTest extends Specification {headers.put("MyMultiHeader", ["MyMultiHeaderValue1","MyMultiHeaderValue2"])and: "a web target for a server"- def target = new WebTargetBuilder("https://headerserver")+ def target = new WebTargetBuilder(client, new URIBuilder("https://headerserver").build()).setInjectHeaders(headers).build()@@ -435,7 +436,7 @@ class WebTargetTest extends Specification {def "Check redirect handling"() {given: "a web target for a server"- def target = new WebTargetBuilder("https://redirectserver")+ def target = new WebTargetBuilder(client, new URIBuilder("https://redirectserver").build()).followRedirects(true).build()@@ -455,7 +456,7 @@ class WebTargetTest extends Specification {params.put("param2", ["param2Value1","param2Value2"])and: "a web target for a server"- def target = new WebTargetBuilder("https://paramserver")+ def target = new WebTargetBuilder(client, new URIBuilder("https://paramserver").build()).setInjectQueryParameters(params).build()@@ -486,7 +487,7 @@ class WebTargetTest extends Specification {params.put("param2", ["param2Value1","param2Value2"])and: "a web target for a server"- def target = new WebTargetBuilder("https://dynamicparamserver")+ def target = new WebTargetBuilder(client, new URIBuilder("https://dynamicparamserver").build()).build().register(new QueryParameterInjectorFilter(params, /"{0,1}\{\$(value)\}"{0,1}/))@@ -503,7 +504,7 @@ class WebTargetTest extends Specification {// def "Check real OAuth resource owner credentials (password) grant authentication"() {//// given: "A web target for a server requiring OAuth 'password' grant authentication"-// def target = new WebTargetBuilder("https://www.telecontrolnet.nl/api/v1")+// def target = new WebTargetBuilder("client, new URIBuilder(https://www.telecontrolnet.nl/api/v1").build())// .setOAuthAuthentication(// new OAuthPasswordGrant(// "https://www.telecontrolnet.nl/oauth/token",