diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-03-20 14:12:06 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2019-04-01 09:45:03 -0400 |
commit | aaa93d4351b712762d6951a8c82bbe84c2077795 (patch) | |
tree | 69dab8e5203fe3aa6afb0a26b4da101213a3bf9f /asdc-controller/src/test | |
parent | 24117e55159518d2e3599fd7cf6705d476cfda81 (diff) |
replace all fixed wiremock ports
trying to get the tests that can be threaded to pass
started to remove fixed port references
Change-Id: I7bfe067a8f36c908039700646571681321e9a6f5
Issue-ID: SO-1676
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'asdc-controller/src/test')
4 files changed, 39 insertions, 4 deletions
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/AllTestsTestSuite.java b/asdc-controller/src/test/java/org/onap/so/asdc/AllTestsTestSuite.java new file mode 100644 index 0000000000..a100f26d5a --- /dev/null +++ b/asdc-controller/src/test/java/org/onap/so/asdc/AllTestsTestSuite.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.asdc; +import org.junit.runner.RunWith; + +import com.googlecode.junittoolbox.SuiteClasses; +import com.googlecode.junittoolbox.WildcardPatternSuite; + +@RunWith(WildcardPatternSuite.class) +@SuiteClasses("**/*Test.class") +public class AllTestsTestSuite { + // the class remains empty, + // used only as a holder for the above annotations +} diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java index 74f0d60596..83d60aefea 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/BaseTest.java @@ -29,6 +29,7 @@ import org.onap.so.asdc.installer.VfResourceStructure; import org.onap.so.asdc.installer.heat.ToscaResourceInstaller; import org.onap.so.asdc.tenantIsolation.WatchdogDistribution; import org.onap.so.spring.SpringContextHelper; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.ConfigFileApplicationContextInitializer; import org.springframework.boot.test.context.SpringBootTest; @@ -39,6 +40,8 @@ import org.springframework.test.context.ActiveProfiles; import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringRunner; +import com.github.tomakehurst.wiremock.WireMockServer; + @RunWith(SpringRunner.class) @SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") @@ -53,6 +56,8 @@ public abstract class BaseTest { protected WatchdogDistribution watchdogDistributionSpy; @SpyBean protected ToscaResourceInstaller toscaInstaller; + @Autowired + protected WireMockServer wireMockServer; @Value("${wiremock.server.port}") protected String wireMockPort; diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java index 85ecaaa3ea..03d0a0ff1e 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCControllerITTest.java @@ -21,7 +21,6 @@ package org.onap.so.asdc.client; import static com.github.tomakehurst.wiremock.client.WireMock.ok; import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; @@ -144,7 +143,7 @@ public class ASDCControllerITTest extends BaseTest { String modelEndpoint = "/aai/v15/service-design-and-creation/models/model/" + serviceInvariantUuid + "/model-vers/model-ver/" + serviceUuid + "?depth=0"; - stubFor(post(urlEqualTo(modelEndpoint)).willReturn(ok())); + wireMockServer.stubFor(post(urlEqualTo(modelEndpoint)).willReturn(ok())); } /** diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java index 546c4e2458..947da4f492 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java @@ -22,7 +22,6 @@ package org.onap.so.asdc.client.test.rest; import static com.github.tomakehurst.wiremock.client.WireMock.aResponse; import static com.github.tomakehurst.wiremock.client.WireMock.post; -import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching; import static com.shazam.shazamcrest.MatcherAssert.assertThat; import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs; @@ -98,7 +97,7 @@ public class ASDCRestInterfaceTest extends BaseTest { @Transactional public void testAllottedResourceService() throws Exception { - stubFor(post(urlPathMatching("/aai/.*")) + wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) .willReturn(aResponse() .withStatus(200) .withHeader("Content-Type", "application/json"))); |