Development of NETCONF RPCs for tr-069 adapter to
[oam/tr069-adapter.git] / mapper / src / test / java / org / commscope / tr069adapter / mapper / PnPPreProvisioningHandlerTest.java
index b84b5c6..c813ce6 100644 (file)
-/*\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.mapper;\r
-\r
-import static org.junit.Assert.assertNull;\r
-\r
-import java.util.ArrayList;\r
-import java.util.HashMap;\r
-import java.util.List;\r
-import java.util.Map;\r
-\r
-import org.commscope.tr069adapter.acs.common.DeviceDetails;\r
-import org.commscope.tr069adapter.acs.common.ParameterDTO;\r
-import org.commscope.tr069adapter.acs.common.dto.ConfigurationData;\r
-import org.commscope.tr069adapter.acs.common.inform.BootInform;\r
-import org.commscope.tr069adapter.acs.common.inform.BootstrapInform;\r
-import org.commscope.tr069adapter.mapper.acs.impl.PnPPreProvisioningHandler;\r
-import org.commscope.tr069adapter.mapper.boot.MapperServiceBooter;\r
-import org.junit.Test;\r
-import org.junit.runner.RunWith;\r
-import org.mockito.Mock;\r
-import org.mockito.Mockito;\r
-import org.springframework.beans.factory.annotation.Autowired;\r
-import org.springframework.boot.test.context.SpringBootTest;\r
-import org.springframework.test.context.junit4.SpringRunner;\r
-import org.springframework.web.client.RestTemplate;\r
-\r
-@SpringBootTest(classes = {MapperServiceBooter.class})\r
-@RunWith(SpringRunner.class)\r
-public class PnPPreProvisioningHandlerTest {\r
-\r
-  @Autowired\r
-  PnPPreProvisioningHandler pnPPreProvisioningHandler;\r
-\r
-  @Mock\r
-  RestTemplate restTemplate;\r
-\r
-  @Test\r
-  public void testGetEnodeBName() {\r
-    ConfigurationData configData = new ConfigurationData();\r
-    Map<String, String> paramMap = new HashMap<String, String>();\r
-    paramMap.put("X_0005B9_eNBName", "Enodb1");\r
-    configData.setParameterMONameValueMap(paramMap);\r
-    Mockito.when(restTemplate.getForObject(Mockito.anyString(), Mockito.any()))\r
-        .thenReturn(configData);\r
-    String eNodeBName = pnPPreProvisioningHandler.getEnodeBName("00005B9A1", "4.3.0.0", "*");\r
-    assertNull(eNodeBName);\r
-  }\r
-\r
-  @Test\r
-  public void testOnDeviceBootStrapNotification() {\r
-    BootstrapInform notification = new BootstrapInform();\r
-    List<ParameterDTO> params = new ArrayList<ParameterDTO>();\r
-    ParameterDTO param = new ParameterDTO();\r
-    param.setParamName("ExpeditedEvent");\r
-    params.add(param);\r
-    notification.setDeviceDetails(getDeviceDetails());\r
-    notification.setParameters(params);\r
-    pnPPreProvisioningHandler.onDeviceNotification(notification);\r
-    assertNull(notification.getValueChangeNotification());\r
-  }\r
-\r
-  @Test\r
-  public void testOnDeviceBootNotification() {\r
-    BootInform notification = new BootInform();\r
-    List<ParameterDTO> params = new ArrayList<ParameterDTO>();\r
-    ParameterDTO param = new ParameterDTO();\r
-    param.setParamName("ExpeditedEvent");\r
-    params.add(param);\r
-    notification.setDeviceDetails(getDeviceDetails());\r
-    notification.setParameters(params);\r
-    pnPPreProvisioningHandler.onDeviceNotification(notification);\r
-    assertNull(notification.getValueChangeNotification());\r
-  }\r
-\r
-  private DeviceDetails getDeviceDetails() {\r
-    DeviceDetails nf = new DeviceDetails();\r
-    nf.setDeviceId("00005B9A1");\r
-    nf.setDeviceTypeId(50);\r
-    nf.setOui("0005B9");\r
-    nf.setProductClass("LTE_Enterprise_C-RANSC_Cntrl");\r
-    return nf;\r
-  }\r
-\r
-}\r
+/*
+ * ============LICENSE_START========================================================================
+ * ONAP : tr-069-adapter
+ * =================================================================================================
+ * Copyright (C) 2020 CommScope Inc Intellectual Property.
+ * =================================================================================================
+ * This tr-069-adapter software file is distributed by CommScope Inc under the Apache License,
+ * Version 2.0 (the "License"); you may not use this file except in compliance with the License. You
+ * may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
+ * either express or implied. See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ===============LICENSE_END=======================================================================
+ */
+
+package org.commscope.tr069adapter.mapper;
+
+import static org.junit.Assert.assertNull;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.commscope.tr069adapter.acs.common.DeviceDetails;
+import org.commscope.tr069adapter.acs.common.ParameterDTO;
+import org.commscope.tr069adapter.acs.common.dto.ConfigurationData;
+import org.commscope.tr069adapter.acs.common.inform.BootInform;
+import org.commscope.tr069adapter.acs.common.inform.BootstrapInform;
+import org.commscope.tr069adapter.mapper.acs.impl.PnPPreProvisioningHandler;
+import org.commscope.tr069adapter.mapper.boot.MapperServiceBooter;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.junit4.SpringRunner;
+import org.springframework.web.client.RestTemplate;
+
+@SpringBootTest(classes = {MapperServiceBooter.class})
+@RunWith(SpringRunner.class)
+public class PnPPreProvisioningHandlerTest {
+
+  @Autowired
+  PnPPreProvisioningHandler pnPPreProvisioningHandler;
+
+  @Mock
+  RestTemplate restTemplate;
+
+  @Test
+  public void testGetEnodeBName() {
+    ConfigurationData configData = new ConfigurationData();
+    Map<String, String> paramMap = new HashMap<String, String>();
+    paramMap.put("X_0005B9_eNBName", "Enodb1");
+    configData.setParameterMONameValueMap(paramMap);
+    Mockito.when(restTemplate.getForObject(Mockito.anyString(), Mockito.any()))
+        .thenReturn(configData);
+    String eNodeBName = pnPPreProvisioningHandler.getEnodeBName("00005B9A1", "4.3.0.0", "*");
+    assertNull(eNodeBName);
+  }
+
+  @Test
+  public void testOnDeviceBootStrapNotification() {
+    BootstrapInform notification = new BootstrapInform();
+    List<ParameterDTO> params = new ArrayList<ParameterDTO>();
+    ParameterDTO param = new ParameterDTO();
+    param.setParamName("ExpeditedEvent");
+    params.add(param);
+    notification.setDeviceDetails(getDeviceDetails());
+    notification.setParameters(params);
+    pnPPreProvisioningHandler.onDeviceNotification(notification);
+    assertNull(notification.getValueChangeNotification());
+  }
+
+  @Test
+  public void testOnDeviceBootNotification() {
+    BootInform notification = new BootInform();
+    List<ParameterDTO> params = new ArrayList<ParameterDTO>();
+    ParameterDTO param = new ParameterDTO();
+    param.setParamName("ExpeditedEvent");
+    params.add(param);
+    notification.setDeviceDetails(getDeviceDetails());
+    notification.setParameters(params);
+    pnPPreProvisioningHandler.onDeviceNotification(notification);
+    assertNull(notification.getValueChangeNotification());
+  }
+
+  private DeviceDetails getDeviceDetails() {
+    DeviceDetails nf = new DeviceDetails();
+    nf.setDeviceId("00005B9A1");
+    nf.setDeviceTypeId(50);
+    nf.setOui("0005B9");
+    nf.setProductClass("LTE_Enterprise_C-RANSC_Cntrl");
+    return nf;
+  }
+
+}