Springboot 2.0 upgrade
[so.git] / bpmn / so-bpmn-tasks / src / test / java / org / onap / so / client / orchestration / SDNOHealthCheckResourcesTest.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 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.client.orchestration;
22
23 import static org.junit.Assert.assertTrue;
24 import static org.mockito.Matchers.eq;
25 import static org.mockito.Mockito.doReturn;
26 import static org.mockito.ArgumentMatchers.any;
27
28 import java.util.UUID;
29
30 import org.junit.Before;
31 import org.junit.Test;
32 import org.junit.runner.RunWith;
33 import org.mockito.InjectMocks;
34 import org.mockito.Mock;
35 import org.mockito.junit.MockitoJUnitRunner;
36 import org.onap.so.bpmn.common.data.TestDataSetup;
37 import org.onap.so.bpmn.common.InjectionHelper;
38 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
39 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
40 import org.onap.so.client.sdno.SDNOValidator;
41
42 @RunWith(MockitoJUnitRunner.Silent.class)
43 public class SDNOHealthCheckResourcesTest extends TestDataSetup{
44         @InjectMocks
45         private SDNOHealthCheckResources sdnoHealthCheckResources = new SDNOHealthCheckResources();
46         
47         private GenericVnf genericVnf;
48         private RequestContext requestContext;
49         
50         @Mock
51         protected SDNOValidator MOCK_sdnoValidator;
52         
53         @Mock
54         protected InjectionHelper MOCK_injectionHelper;
55         
56         @Before
57         public void before() {
58                 genericVnf = buildGenericVnf(); 
59                 requestContext = buildRequestContext();
60                 doReturn(MOCK_sdnoValidator).when(MOCK_injectionHelper).getSdnoValidator();
61         }
62         
63         @Test
64         public void healthCheckTest() throws Exception {
65                 doReturn(true).when(MOCK_sdnoValidator).healthDiagnostic(any(String.class), any(UUID.class), any(String.class));
66                 assertTrue(sdnoHealthCheckResources.healthCheck(genericVnf, requestContext));
67         }       
68 }