Initial source code
[oam/tr069-adapter.git] / netconf-server / src / test / java / org / commscope / tr069adapter / netconf / restapi / NotificationServerRestApiTest.java
diff --git a/netconf-server/src/test/java/org/commscope/tr069adapter/netconf/restapi/NotificationServerRestApiTest.java b/netconf-server/src/test/java/org/commscope/tr069adapter/netconf/restapi/NotificationServerRestApiTest.java
new file mode 100644 (file)
index 0000000..3a865c5
--- /dev/null
@@ -0,0 +1,68 @@
+/*\r
+ * ============LICENSE_START========================================================================\r
+ * ONAP : tr-069-adapter\r
+ * =================================================================================================\r
+ * Copyright (C) 2020 CommScope Inc Intellectual Property.\r
+ * =================================================================================================\r
+ * This tr-069-adapter software file is distributed by CommScope Inc under the Apache License,\r
+ * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You\r
+ * may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,\r
+ * either express or implied. See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ * ===============LICENSE_END=======================================================================\r
+ */\r
+\r
+package org.commscope.tr069adapter.netconf.restapi;\r
+\r
+import java.util.ArrayList;\r
+import java.util.List;\r
+\r
+import org.commscope.tr069adapter.acs.common.DeviceDetails;\r
+import org.commscope.tr069adapter.acs.common.DeviceInform;\r
+import org.commscope.tr069adapter.acs.common.InformType;\r
+import org.commscope.tr069adapter.acs.common.ParameterDTO;\r
+import org.commscope.tr069adapter.acs.common.dto.TR069DeviceDetails;\r
+import org.commscope.tr069adapter.acs.common.dto.TR069InformType;\r
+import org.commscope.tr069adapter.netconf.boot.NetConfServiceBooter;\r
+import org.junit.FixMethodOrder;\r
+import org.junit.jupiter.api.Test;\r
+import org.junit.jupiter.api.extension.ExtendWith;\r
+import org.junit.runners.MethodSorters;\r
+import org.springframework.beans.factory.annotation.Autowired;\r
+import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;\r
+import org.springframework.boot.test.context.SpringBootTest;\r
+import org.springframework.test.context.junit.jupiter.SpringExtension;\r
+\r
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)\r
+@ExtendWith(SpringExtension.class)\r
+@SpringBootTest(classes = {NetConfServiceBooter.class},\r
+    args = "--schemas-dir test-schemas --debug true --starting-port 17830")\r
+@AutoConfigureMockMvc\r
+public class NotificationServerRestApiTest {\r
+\r
+  @Autowired\r
+  NotificationReceiverService service;\r
+\r
+  @Test\r
+  public void createNetconfServer() {\r
+\r
+    DeviceInform notification = new DeviceInform();\r
+\r
+    DeviceDetails deviceDetails = new TR069DeviceDetails();\r
+    notification.setDeviceDetails(deviceDetails);\r
+    List<InformType> notificationTypeList = new ArrayList<>();\r
+    InformType itype = TR069InformType.BOOTSTRAP;\r
+    notificationTypeList.add(itype);\r
+    notification.setInformTypeList(notificationTypeList);\r
+    List<ParameterDTO> parameters = new ArrayList<>();\r
+    ParameterDTO param1 = new ParameterDTO("Device.Info", "info-details");\r
+    parameters.add(param1);\r
+    notification.setParameters(parameters);\r
+    service.processNotification(notification);\r
+\r
+  }\r
+}\r