summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcin Migdal <marcin.migdal@nokia.com>2019-03-06 15:39:30 +0100
committerMarcin Migdal <marcin.migdal@nokia.com>2019-03-06 15:39:50 +0100
commitc555e55d44d07ee41641bf7e68a3e662997d50e1 (patch)
tree4202c54fa596805099e3b0f1df7745c6ef46222c
parentb7fcb9fe9fbcea697bad1b0bb7e03924664ec0b5 (diff)
Remove DefaultUriBuilderFactory from DMaaP Client
Change-Id: Ia1e340455ebaf9db492670dbec56229af0425036 Issue-ID: DCAEGEN2-1310 Signed-off-by: mmigdal <marcin.migdal@nokia.com> Signed-off-by: Marcin Migdal <marcin.migdal@nokia.com>
-rw-r--r--rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/producer/DMaaPPublisherReactiveHttpClient.java25
1 files changed, 15 insertions, 10 deletions
diff --git a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/producer/DMaaPPublisherReactiveHttpClient.java b/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/producer/DMaaPPublisherReactiveHttpClient.java
index b2a37249..39fdb32c 100644
--- a/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/producer/DMaaPPublisherReactiveHttpClient.java
+++ b/rest-services/dmaap-client/src/main/java/org/onap/dcaegen2/services/sdk/rest/services/dmaap/client/service/producer/DMaaPPublisherReactiveHttpClient.java
@@ -21,9 +21,16 @@
package org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.service.producer;
+import static org.onap.dcaegen2.services.sdk.rest.services.model.logging.MdcVariables.REQUEST_ID;
+import static org.onap.dcaegen2.services.sdk.rest.services.model.logging.MdcVariables.X_INVOCATION_ID;
+import static org.onap.dcaegen2.services.sdk.rest.services.model.logging.MdcVariables.X_ONAP_REQUEST_ID;
+
+import java.net.URI;
+import java.util.UUID;
import org.onap.dcaegen2.services.sdk.rest.services.dmaap.client.config.DmaapPublisherConfiguration;
import org.onap.dcaegen2.services.sdk.rest.services.model.DmaapModel;
import org.onap.dcaegen2.services.sdk.rest.services.model.JsonBodyBuilder;
+import org.onap.dcaegen2.services.sdk.rest.services.uri.URI.URIBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
@@ -32,22 +39,15 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.client.RestTemplate;
-import org.springframework.web.util.DefaultUriBuilderFactory;
import reactor.core.publisher.Mono;
-import java.net.URI;
-import java.util.UUID;
-
-import static org.onap.dcaegen2.services.sdk.rest.services.model.logging.MdcVariables.REQUEST_ID;
-import static org.onap.dcaegen2.services.sdk.rest.services.model.logging.MdcVariables.X_INVOCATION_ID;
-import static org.onap.dcaegen2.services.sdk.rest.services.model.logging.MdcVariables.X_ONAP_REQUEST_ID;
-
/**
* @author <a href="mailto:przemyslaw.wasala@nokia.com">Przemysław Wąsala</a> on 7/4/18
*/
public class DMaaPPublisherReactiveHttpClient {
+ private final static String SLASH = "/";
private final Logger logger = LoggerFactory.getLogger(DMaaPPublisherReactiveHttpClient.class);
private final String dmaapHostName;
private final Integer dmaapPortNumber;
@@ -99,8 +99,13 @@ public class DMaaPPublisherReactiveHttpClient {
}
URI getUri() {
- return new DefaultUriBuilderFactory().builder().scheme(dmaapProtocol).host(dmaapHostName).port(dmaapPortNumber)
- .path(dmaapTopicName).build();
+ return URI.create(
+ new URIBuilder().scheme(dmaapProtocol).host(dmaapHostName).port(dmaapPortNumber).path(createRequestPath())
+ .build().toString());
+ }
+
+ private String createRequestPath() {
+ return new StringBuilder().append(SLASH).append(dmaapTopicName).toString();
}
}