From e27650bc7ca78bfc1b54e5423cc72b2a44064df3 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Fri, 24 Aug 2018 13:10:42 -0400 Subject: converted test to dynamic port Change-Id: Iab26b24d9178685061cde7de7f78562f17d20e78 Issue-ID: SO-905 Signed-off-by: Benjamin, Max (mb388a) --- .../src/test/java/org/onap/so/rest/RESTClientTest.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'bpmn/MSORESTClient') diff --git a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java index bbdaa94581..17ede2f2ff 100644 --- a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java +++ b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java @@ -51,7 +51,8 @@ public class RESTClientTest { private String jsonResponseAsString; @Rule - public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(28090)); + public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort()); + @Before public void before() throws Exception { @@ -62,7 +63,7 @@ public class RESTClientTest { jsonResponse = new JSONObject(); jsonResponse.put("response", "responseValue"); jsonResponseAsString = jsonResponse.toString(); - restClient = new RESTClient("http://localhost:28090/example", "localhost", 28090); + restClient = new RESTClient("http://localhost:" + wireMockRule.port() + "/example", "localhost", wireMockRule.port()); } @Test @@ -79,9 +80,9 @@ public class RESTClientTest { assertEquals(1, restClient.getParameters().size()); restClient.addAuthorizationHeader("token"); assertEquals("[token]", restClient.getHeaders().get("Authorization").toString()); - assertEquals("http://localhost:28090/example", restClient.getURL()); - restClient = new RESTClient("http://localhost:28090/example1"); - assertEquals("http://localhost:28090/example1", restClient.getURL()); + assertEquals("http://localhost:" + wireMockRule.port() + "/example", restClient.getURL()); + restClient = new RESTClient("http://localhost:" + wireMockRule.port() + "/example1"); + assertEquals("http://localhost:" + wireMockRule.port() + "/example1", restClient.getURL()); } @Test -- cgit 1.2.3-korg