From aaa93d4351b712762d6951a8c82bbe84c2077795 Mon Sep 17 00:00:00 2001 From: "Benjamin, Max (mb388a)" Date: Wed, 20 Mar 2019 14:12:06 -0400 Subject: 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) --- asdc-controller/pom.xml | 21 ++++++++++++-- .../java/org/onap/so/asdc/AllTestsTestSuite.java | 32 ++++++++++++++++++++++ .../src/test/java/org/onap/so/asdc/BaseTest.java | 5 ++++ .../onap/so/asdc/client/ASDCControllerITTest.java | 3 +- .../client/test/rest/ASDCRestInterfaceTest.java | 3 +- 5 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 asdc-controller/src/test/java/org/onap/so/asdc/AllTestsTestSuite.java (limited to 'asdc-controller') diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml index 7b774a2cce..35fbf9108c 100644 --- a/asdc-controller/pom.xml +++ b/asdc-controller/pom.xml @@ -30,7 +30,6 @@ 0.7.7.201606060606 - + **/resource-examples/** @@ -143,6 +142,24 @@ + + org.apache.maven.plugins + maven-surefire-plugin + + + default-test + + test + + + + **/AllTestsTestSuite.java + + suites + + + + @@ -232,7 +249,7 @@ org.antlr antlr4 ${antlr.version} - + test org.springframework.boot 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"))); -- cgit 1.2.3-korg