X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=mapper%2Fsrc%2Ftest%2Fjava%2Forg%2Fcommscope%2Ftr069adapter%2Fmapper%2FPnPPreProvisioningHandlerTest.java;fp=mapper%2Fsrc%2Ftest%2Fjava%2Forg%2Fcommscope%2Ftr069adapter%2Fmapper%2FPnPPreProvisioningHandlerTest.java;h=c813ce605d06d8671384c678505993ec740824fe;hb=76744e810f35c84ecbd1d9998e361052466e9483;hp=b84b5c6af78cbe1cbe13c42394d86ef0d5125cfe;hpb=ce4e2d38e3d42725f61c39dd172325d2def4bc44;p=oam%2Ftr069-adapter.git diff --git a/mapper/src/test/java/org/commscope/tr069adapter/mapper/PnPPreProvisioningHandlerTest.java b/mapper/src/test/java/org/commscope/tr069adapter/mapper/PnPPreProvisioningHandlerTest.java index b84b5c6..c813ce6 100644 --- a/mapper/src/test/java/org/commscope/tr069adapter/mapper/PnPPreProvisioningHandlerTest.java +++ b/mapper/src/test/java/org/commscope/tr069adapter/mapper/PnPPreProvisioningHandlerTest.java @@ -1,101 +1,101 @@ -/* - * ============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 paramMap = new HashMap(); - 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 params = new ArrayList(); - 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 params = new ArrayList(); - 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; - } - -} +/* + * ============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 paramMap = new HashMap(); + 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 params = new ArrayList(); + 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 params = new ArrayList(); + 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; + } + +}