1cda8716d9a9d7a6be342f9f1441c6a0c4419f7b
[ccsdk/features.git] /
1 /*
2  * ============LICENSE_START========================================================================
3  * ONAP : ccsdk feature sdnr wt
4  * =================================================================================================
5  * Copyright (C) 2020 highstreet technologies GmbH Intellectual Property. All rights reserved.
6  * =================================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
8  * in compliance with the License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software distributed under the License
13  * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
14  * or implied. See the License for the specific language governing permissions and limitations under
15  * the License.
16  * ============LICENSE_END==========================================================================
17  */
18 package org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.test;
19
20 import static org.junit.Assert.assertEquals;
21 import static org.junit.Assert.assertThrows;
22 import org.junit.Test;
23 import org.onap.ccsdk.features.sdnr.wt.devicemanager.onf.ifpac.microwave.pm.PerformanceDataAirInterface170324Builder;
24 import org.onap.ccsdk.features.sdnr.wt.devicemanager.util.InconsistentPMDataException;
25 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
26 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
27 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.LpBuilder;
28 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataList;
29 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performances.g.HistoricalPerformanceDataListBuilder;
30 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performance.type.g.PerformanceData;
31 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.air._interface.historical.performance.type.g.PerformanceDataBuilder;
32 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceConfiguration;
33 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev170324.mw.air._interface.pac.AirInterfaceConfigurationBuilder;
34 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId;
35
36 public class TestWrapperNoPmData {
37
38     @Test
39     public void test() {
40         NodeId nodeId = new NodeId("TestNode");
41         Lp lp = new LpBuilder().setUuid(new UniversalId("NodeUUID")).build();
42         //Build empty, without PerformanceData
43         HistoricalPerformanceDataList pmRecord =
44                 new HistoricalPerformanceDataListBuilder().setHistoryDataId("1").build();
45         AirInterfaceConfiguration airConfiguration = new AirInterfaceConfigurationBuilder().build();
46
47         @SuppressWarnings("unused")
48         Exception exception = assertThrows(InconsistentPMDataException.class, () -> {
49             PerformanceDataAirInterface170324Builder pmdata =
50                     new PerformanceDataAirInterface170324Builder(nodeId, lp, pmRecord, airConfiguration);
51         });
52         String expectedMessage = "Ignore record without PerformanceData. Node/Lp: NodeUUID/default";
53         String actualMessage = exception.getMessage();
54         assertEquals(actualMessage,expectedMessage);
55     }
56 }