02b8423f1535fb414778ce313ffad82899dd0df6
[integration.git] /
1 /*
2  * ============LICENSE_START=======================================================
3  * PNF-REGISTRATION-HANDLER
4  * ================================================================================
5  * Copyright (C) 2018 NOKIA 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.pnfsimulator.netconfmonitor;
22
23 import static org.junit.jupiter.api.Assertions.assertNotNull;
24 import static org.mockito.ArgumentMatchers.any;
25 import static org.mockito.Mockito.doReturn;
26 import static org.mockito.Mockito.mock;
27 import static org.mockito.Mockito.spy;
28 import static org.mockito.Mockito.verify;
29
30 import com.tailf.jnc.JNCException;
31 import com.tailf.jnc.NetconfSession;
32 import java.io.IOException;
33 import org.junit.jupiter.api.BeforeEach;
34 import org.junit.jupiter.api.Test;
35 import org.mockito.Mock;
36
37 class NetconfMonitorServiceConfigurationTest {
38
39     private NetconfMonitorServiceConfiguration configuration;
40
41     @Mock
42     private NetconfSession netconfSession;
43
44     @BeforeEach
45     void setup() {
46         netconfSession = mock(NetconfSession.class);
47         configuration = spy(new NetconfMonitorServiceConfiguration());
48     }
49
50     @Test
51     void readNetconfConfiguration() throws IOException, JNCException {
52         doReturn(netconfSession).when(configuration).createNetconfSession(any());
53
54         assertNotNull(configuration.configurationReader());
55         verify(configuration).createNetconfSession(any());
56     }
57
58     @Test
59     void configurationCacheIsNotNull() {
60         assertNotNull(configuration.configurationCache());
61     }
62
63     @Test
64     void netconfConfigurationWriterIsNotNull() {
65         assertNotNull(configuration.netconfConfigurationWriter());
66     }
67
68     @Test
69     void timerIsNotNull() {
70         assertNotNull(configuration.timer());
71     }
72 }