diff options
author | Michal Kabaj <michal.kabaj@nokia.com> | 2018-12-17 17:10:24 +0100 |
---|---|---|
committer | Lukasz Muszkieta <lukasz.muszkieta@nokia.com> | 2019-01-04 12:02:36 +0000 |
commit | 61b78a7d5f1eb8f1c5955d6d1439ce9225a39b46 (patch) | |
tree | 4f6ab37c32786ad489f6d8f2130d1b03105f8c32 /bpmn/MSOCommonBPMN/src/test/java/org | |
parent | 85a47c701c3b34c58d2b121ba466d41ffb4fb7b0 (diff) |
HttpClientFactory to create HttpClient instances
-Replace constructor calls with existing factory
-Add create methods to factory for each required Media Type
Change-Id: Ibd03c10230c87a0413c0ec529e0ea9ac800444f9
Issue-ID: SO-1344
Signed-off-by: Michal Kabaj <michal.kabaj@nokia.com>
Diffstat (limited to 'bpmn/MSOCommonBPMN/src/test/java/org')
9 files changed, 36 insertions, 9 deletions
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java index 9b5bb33bf8..8515307394 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterAsyncTransformer.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.mock; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; +import org.onap.so.client.HttpClientFactory; import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; @@ -141,7 +142,9 @@ public class SDNCAdapterAsyncTransformer extends ResponseDefinitionTransformer { e1.printStackTrace(); } try { - HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.SDNC_ADAPTER); + HttpClient client = new HttpClientFactory().newTextXmlClient( + UriBuilder.fromUri(callbackUrl).build().toURL(), + TargetEntity.SDNC_ADAPTER); client.post(payLoad); } catch (Exception e) { // TODO Auto-generated catch block diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java index 8c34b65c00..f129164b4c 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterMockTransformer.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.mock; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; +import org.onap.so.client.HttpClientFactory; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; @@ -131,7 +132,9 @@ public class SDNCAdapterMockTransformer extends ResponseDefinitionTransformer { } LOGGER.debug("Sending callback response:" + callbackUrl); try { - HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.SDNC_ADAPTER); + HttpClient client = new HttpClientFactory().newTextXmlClient( + UriBuilder.fromUri(callbackUrl).build().toURL(), + TargetEntity.SDNC_ADAPTER); client.post(payLoad); } catch (Exception e) { LOGGER.debug("Exception :",e); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java index f53fd6f424..832caae803 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/SDNCAdapterNetworkTopologyMockTransformer.java @@ -24,6 +24,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; +import org.onap.so.client.HttpClientFactory; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; @@ -122,7 +123,9 @@ public class SDNCAdapterNetworkTopologyMockTransformer extends ResponseDefinitio } LOGGER.debug("Sending callback response to url: " + callbackUrl); try { - HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.SDNC_ADAPTER); + HttpClient client = new HttpClientFactory().newTextXmlClient( + UriBuilder.fromUri(callbackUrl).build().toURL(), + TargetEntity.SDNC_ADAPTER); Response response = client.post(payLoad); LOGGER.debug("Successfully posted callback? Status: " + response.getStatus()); } catch (Exception e) { diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java index 63abf4d064..e190535e7e 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterAsyncTransformer.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.mock; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; +import org.onap.so.client.HttpClientFactory; import org.onap.so.utils.TargetEntity; import com.github.tomakehurst.wiremock.client.ResponseDefinitionBuilder; @@ -152,7 +153,9 @@ public class VnfAdapterAsyncTransformer extends ResponseDefinitionTransformer { } try { - HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + HttpClient client = new HttpClientFactory().newTextXmlClient( + UriBuilder.fromUri(callbackUrl).build().toURL(), + TargetEntity.VNF_ADAPTER); client.post(payLoad); } catch (Exception e) { // TODO Auto-generated catch block diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java index de21d64863..107a70d1d0 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterCreateMockTransformer.java @@ -24,6 +24,7 @@ import javax.ws.rs.core.Response; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; +import org.onap.so.client.HttpClientFactory; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; @@ -131,7 +132,9 @@ public class VnfAdapterCreateMockTransformer extends ResponseDefinitionTransform } LOGGER.debug("Sending callback response to url: " + callbackUrl); try { - HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + HttpClient client = new HttpClientFactory().newTextXmlClient( + UriBuilder.fromUri(callbackUrl).build().toURL(), + TargetEntity.VNF_ADAPTER); Response response = client.post(payLoad); LOGGER.debug("Successfully posted callback? Status: " + response.getStatus()); //System.err.println("Successfully posted callback:" + result.getStatus()); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java index 99ad84dad4..cf0f966414 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterDeleteMockTransformer.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.mock; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; +import org.onap.so.client.HttpClientFactory; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; @@ -132,7 +133,9 @@ public class VnfAdapterDeleteMockTransformer extends ResponseDefinitionTransform } try { - HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + HttpClient client = new HttpClientFactory().newTextXmlClient( + UriBuilder.fromUri(callbackUrl).build().toURL(), + TargetEntity.VNF_ADAPTER); client.post(payLoad); } catch (Exception e) { // TODO Auto-generated catch block diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java index 7ad687a2b3..5eaa4e75b0 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterQueryMockTransformer.java @@ -24,6 +24,7 @@ package org.onap.so.bpmn.mock; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; +import org.onap.so.client.HttpClientFactory; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; @@ -148,7 +149,9 @@ public class VnfAdapterQueryMockTransformer extends ResponseDefinitionTransforme } try { - HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + HttpClient client = new HttpClientFactory().newTextXmlClient( + UriBuilder.fromUri(callbackUrl).build().toURL(), + TargetEntity.VNF_ADAPTER); client.post(payLoad); } catch (Exception e) { LOGGER.debug("Exception :",e); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java index 560915d1f1..06f2fb7d5f 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterRollbackMockTransformer.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.mock; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; +import org.onap.so.client.HttpClientFactory; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; @@ -133,7 +134,9 @@ public class VnfAdapterRollbackMockTransformer extends ResponseDefinitionTransfo } try { - HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + HttpClient client = new HttpClientFactory().newTextXmlClient( + UriBuilder.fromUri(callbackUrl).build().toURL(), + TargetEntity.VNF_ADAPTER); client.post(payLoad); } catch (Exception e) { System.out.println("catch error in - request.post() "); diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java index 9e8927102a..9e60e87644 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/VnfAdapterUpdateMockTransformer.java @@ -23,6 +23,7 @@ package org.onap.so.bpmn.mock; import javax.ws.rs.core.UriBuilder; import org.onap.so.client.HttpClient; +import org.onap.so.client.HttpClientFactory; import org.onap.so.logger.MsoLogger; import org.onap.so.utils.TargetEntity; @@ -133,7 +134,9 @@ public class VnfAdapterUpdateMockTransformer extends ResponseDefinitionTransform } try { - HttpClient client = new HttpClient(UriBuilder.fromUri(callbackUrl).build().toURL(), "text/xml", TargetEntity.VNF_ADAPTER); + HttpClient client = new HttpClientFactory().newTextXmlClient( + UriBuilder.fromUri(callbackUrl).build().toURL(), + TargetEntity.VNF_ADAPTER); client.post(payLoad); } catch (Exception e) { System.out.println("catch error in - request.post() "); |