2 * Copyright (c) 2018 Orange and/or its affiliates.
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:
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
16 package io.fd.honeycomb.transportpce.device.test;
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;
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;
31 * Test to create {@link CurrentPmlist} object
32 * from xml file or String using Yangtools
34 * @author Martial COULIBALY ( martial.coulibaly@gfi.com ) on behalf of Orange
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";
41 * This test create Device from File
42 * located at {@link CreatePmListFromXMLFileTest#DEVICE_OPER_IN}.
44 * @throws NullPointerException
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);
55 LOG.info("result pm list size : {}", result.getCurrentPm());
56 Assert.assertEquals("result pm list size should be 4",4, result.getCurrentPm().size());
58 LOG.info("Test Succeed");