fix ServiceHandler SpotBugs false positives
[transportpce.git] / tests / honeynode / 1.2.1 / honeynode-plugin-impl / src / test / java / io / fd / honeycomb / transportpce / device / test / CreatePmListFromXMLFileTest.java
1 /*
2  * Copyright (c) 2018 Orange and/or its affiliates.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at:
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package io.fd.honeycomb.transportpce.device.test;
17
18 import io.fd.honeycomb.transportpce.device.tools.DefaultPmListFactory;
19 import io.fd.honeycomb.transportpce.test.common.DataStoreContext;
20 import io.fd.honeycomb.transportpce.test.common.DataStoreContextImpl;
21
22 import java.io.File;
23
24 import org.junit.Assert;
25 import org.junit.Test;
26 import org.opendaylight.yang.gen.v1.http.org.openroadm.pm.rev161014.CurrentPmlist;
27 import org.slf4j.Logger;
28 import org.slf4j.LoggerFactory;
29
30 /**
31  * Test to create {@link CurrentPmlist} object
32  * from xml file or String using Yangtools
33  *
34  * @author Martial COULIBALY ( martial.coulibaly@gfi.com ) on behalf of Orange
35  */
36 public class CreatePmListFromXMLFileTest {
37     private static final Logger LOG = LoggerFactory.getLogger(CreatePmListFromXMLFileTest.class);
38     private static final String PM_LIST_OPER_IN = "src/test/resources/oper-ROADMA-cpm.xml";
39
40     /**
41      * This test create Device from File
42      * located at {@link CreatePmListFromXMLFileTest#DEVICE_OPER_IN}.
43      *
44      * @throws NullPointerException
45      */
46     @Test
47     public void createPmListFromFile() throws NullPointerException{
48         LOG.info("test createPmListFromFile ...");
49         CurrentPmlist result = null;
50         File pm_list_data = new File(PM_LIST_OPER_IN);
51         DataStoreContext dataStoreContextUtil = new DataStoreContextImpl();
52         DefaultPmListFactory defaultPmListFactory = new DefaultPmListFactory();
53         result = defaultPmListFactory.createDefaultPmList(dataStoreContextUtil,pm_list_data);
54         if (result != null) {
55             LOG.info("result pm list size : {}", result.getCurrentPm());
56             Assert.assertEquals("result pm list size should be 4",4, result.getCurrentPm().size());
57         }
58         LOG.info("Test Succeed");
59     }
60 }