3a865c5f799ea3cb0b06639b461fb8d0819adafe
[oam/tr069-adapter.git] / netconf-server / src / test / java / org / commscope / tr069adapter / netconf / restapi / NotificationServerRestApiTest.java
1 /*\r
2  * ============LICENSE_START========================================================================\r
3  * ONAP : tr-069-adapter\r
4  * =================================================================================================\r
5  * Copyright (C) 2020 CommScope Inc Intellectual Property.\r
6  * =================================================================================================\r
7  * This tr-069-adapter software file is distributed by CommScope Inc under the Apache License,\r
8  * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You\r
9  * may obtain a copy of the License at\r
10  *\r
11  * http://www.apache.org/licenses/LICENSE-2.0\r
12  *\r
13  * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\r
14  * either express or implied. See the License for the specific language governing permissions and\r
15  * limitations under the License.\r
16  * ===============LICENSE_END=======================================================================\r
17  */\r
18 \r
19 package org.commscope.tr069adapter.netconf.restapi;\r
20 \r
21 import java.util.ArrayList;\r
22 import java.util.List;\r
23 \r
24 import org.commscope.tr069adapter.acs.common.DeviceDetails;\r
25 import org.commscope.tr069adapter.acs.common.DeviceInform;\r
26 import org.commscope.tr069adapter.acs.common.InformType;\r
27 import org.commscope.tr069adapter.acs.common.ParameterDTO;\r
28 import org.commscope.tr069adapter.acs.common.dto.TR069DeviceDetails;\r
29 import org.commscope.tr069adapter.acs.common.dto.TR069InformType;\r
30 import org.commscope.tr069adapter.netconf.boot.NetConfServiceBooter;\r
31 import org.junit.FixMethodOrder;\r
32 import org.junit.jupiter.api.Test;\r
33 import org.junit.jupiter.api.extension.ExtendWith;\r
34 import org.junit.runners.MethodSorters;\r
35 import org.springframework.beans.factory.annotation.Autowired;\r
36 import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;\r
37 import org.springframework.boot.test.context.SpringBootTest;\r
38 import org.springframework.test.context.junit.jupiter.SpringExtension;\r
39 \r
40 @FixMethodOrder(MethodSorters.NAME_ASCENDING)\r
41 @ExtendWith(SpringExtension.class)\r
42 @SpringBootTest(classes = {NetConfServiceBooter.class},\r
43     args = "--schemas-dir test-schemas --debug true --starting-port 17830")\r
44 @AutoConfigureMockMvc\r
45 public class NotificationServerRestApiTest {\r
46 \r
47   @Autowired\r
48   NotificationReceiverService service;\r
49 \r
50   @Test\r
51   public void createNetconfServer() {\r
52 \r
53     DeviceInform notification = new DeviceInform();\r
54 \r
55     DeviceDetails deviceDetails = new TR069DeviceDetails();\r
56     notification.setDeviceDetails(deviceDetails);\r
57     List<InformType> notificationTypeList = new ArrayList<>();\r
58     InformType itype = TR069InformType.BOOTSTRAP;\r
59     notificationTypeList.add(itype);\r
60     notification.setInformTypeList(notificationTypeList);\r
61     List<ParameterDTO> parameters = new ArrayList<>();\r
62     ParameterDTO param1 = new ParameterDTO("Device.Info", "info-details");\r
63     parameters.add(param1);\r
64     notification.setParameters(parameters);\r
65     service.processNotification(notification);\r
66 \r
67   }\r
68 }\r