2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.asdc;
23 import static org.mockito.Mockito.reset;
24 import org.junit.After;
25 import org.junit.runner.RunWith;
26 import org.onap.so.asdc.installer.ToscaResourceStructure;
27 import org.onap.so.asdc.installer.VfResourceStructure;
28 import org.onap.so.asdc.installer.heat.ToscaResourceInstaller;
29 import org.onap.so.asdc.tenantIsolation.WatchdogDistribution;
30 import org.onap.so.spring.SpringContextHelper;
31 import org.springframework.beans.factory.annotation.Autowired;
32 import org.springframework.beans.factory.annotation.Value;
33 import org.springframework.boot.test.context.ConfigFileApplicationContextInitializer;
34 import org.springframework.boot.test.context.SpringBootTest;
35 import org.springframework.boot.test.mock.mockito.MockBean;
36 import org.springframework.boot.test.mock.mockito.SpyBean;
37 import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
38 import org.springframework.test.context.ActiveProfiles;
39 import org.springframework.test.context.ContextConfiguration;
40 import org.springframework.test.context.junit4.SpringRunner;
41 import com.github.tomakehurst.wiremock.WireMockServer;
43 @RunWith(SpringRunner.class)
44 @SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
45 @ActiveProfiles("test")
46 @ContextConfiguration(classes = SpringContextHelper.class, initializers = ConfigFileApplicationContextInitializer.class)
47 @AutoConfigureWireMock(port = 0)
49 public abstract class BaseTest {
51 protected VfResourceStructure vfResourceStructure;
53 protected ToscaResourceStructure toscaResourceStruct;
55 protected WatchdogDistribution watchdogDistributionSpy;
57 protected ToscaResourceInstaller toscaInstaller;
59 protected WireMockServer wireMockServer;
61 @Value("${wiremock.server.port}")
62 protected String wireMockPort;
66 reset(vfResourceStructure);
67 reset(toscaResourceStruct);