--- /dev/null
+/*\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");\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