Removing jackson to mitigate cve-2017-4995
[vfc/nfvo/driver/vnfm/svnfm.git] / nokiav2 / driver / src / test / java / org / onap / vfc / nfvo / driver / vnfm / svnfm / nokia / restapi / TestLcnApi.java
1 /*
2  * Copyright 2016-2017, Nokia Corporation
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 package org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.restapi;
18
19 import com.nokia.cbam.lcm.v32.model.VnfLifecycleChangeNotification;
20 import org.junit.Before;
21 import org.junit.Test;
22 import org.mockito.InjectMocks;
23 import org.mockito.Mock;
24 import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.TestBase;
25 import org.onap.vfc.nfvo.driver.vnfm.svnfm.nokia.vnfm.notification.LifecycleChangeNotificationManager;
26
27 import static org.mockito.Mockito.verify;
28 import static org.springframework.test.util.ReflectionTestUtils.setField;
29
30
31 public class TestLcnApi extends TestBase {
32
33     @Mock
34     private VnfLifecycleChangeNotification lcn;
35     @Mock
36     private LifecycleChangeNotificationManager lcnManager;
37     @InjectMocks
38     private LcnApi lcnApi;
39
40     @Before
41     public void initMocks() throws Exception {
42         setField(LcnApi.class, "logger", logger);
43     }
44
45     /**
46      * test REST "ping" from CBAM to driver
47      */
48     @Test
49     public void testPing() {
50         lcnApi.testLcnConnectivity(null);
51         //verify no exception is thrown
52     }
53
54     /**
55      * test LCN is handled by LCN manager
56      */
57     @Test
58     public void testHandleLcn() {
59         //when
60         lcnApi.handleLcn(lcn);
61         //verify
62         verify(lcnManager).handleLcn(lcn);
63         verify(logger).info("REST: handle LCN");
64     }
65 }