Implement interface to SDC for ActivitySpec
[so.git] / asdc-controller / src / test / java / org / onap / so / asdc / BaseTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
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
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
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=========================================================
19  */
20
21 package org.onap.so.asdc;
22
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;
42
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)
48
49 public abstract class BaseTest {
50     @MockBean
51     protected VfResourceStructure vfResourceStructure;
52     @MockBean
53     protected ToscaResourceStructure toscaResourceStruct;
54     @SpyBean
55     protected WatchdogDistribution watchdogDistributionSpy;
56     @SpyBean
57     protected ToscaResourceInstaller toscaInstaller;
58     @Autowired
59     protected WireMockServer wireMockServer;
60
61     @Value("${wiremock.server.port}")
62     protected String wireMockPort;
63
64     @After
65     public void after() {
66         reset(vfResourceStructure);
67         reset(toscaResourceStruct);
68     }
69 }