1 /*******************************************************************************
2 * ============LICENSE_START======================================================= ONAP : ccsdk
3 * feature sdnr wt ================================================================================
4 * Copyright (C) 2019 highstreet technologies GmbH Intellectual Property. All rights reserved.
5 * ================================================================================ Licensed under
6 * the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance
7 * with the License. You may obtain a copy of the License at
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software distributed under the License
12 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
13 * or implied. See the License for the specific language governing permissions and limitations under
14 * the License. ============LICENSE_END=========================================================
15 ******************************************************************************/
16 package org.onap.ccsdk.features.sdnr.wt.devicemanager.test;
18 import java.util.Arrays;
19 import java.util.List;
20 import org.junit.Test;
21 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.HtMapper;
22 import org.onap.ccsdk.features.sdnr.wt.devicemanager.base.database.JsonMapperBase;
23 import org.onap.ccsdk.features.sdnr.wt.devicemanager.performancemanager.impl.database.types.EsHistoricalPerformance15Minutes;
24 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime;
25 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.LayerProtocolName;
26 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
27 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.Lp;
28 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.logical.termination.point.g.LpBuilder;
29 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.microwave.model.rev181010.air._interface.historical.performances.g.HistoricalPerformanceDataListBuilder;
31 public class TestMapper {
37 System.out.println(t++);
39 HtMapper<EsHistoricalPerformance15Minutes> mapper = new HtMapper<>(EsHistoricalPerformance15Minutes.class);
40 System.out.println(t++);
43 Lp layerProtocol = new LpBuilder().setUuid(new UniversalId("TestId"))
44 .setLayerProtocolName(new LayerProtocolName("LayprotcolTest")).build();
45 System.out.println(t++);
46 EsHistoricalPerformance15Minutes pmData = new EsHistoricalPerformance15Minutes("Testnode", layerProtocol);
47 System.out.println(t++);
49 // AirInterfaceHistoricalPerformancesBuilder builder1 = new
50 // AirInterfaceHistoricalPerformancesBuilder();
51 // System.out.println(t++);
54 HistoricalPerformanceDataListBuilder builder2 = new HistoricalPerformanceDataListBuilder();
55 System.out.println(t++);
56 builder2.setPeriodEndTime(new DateAndTime("2019-06-06T12:12:12.1Z"));
57 System.out.println(t++);
59 String json = mapper.objectToJson(pmData);
61 System.out.println("Result: " + pmData);
62 System.out.println("Result: " + json);
64 // fail("Not yet implemented");
70 for (int t = 0; t < 5; t++) {
71 JsonMapperBase baseMapper = new JsonMapperBase(0);
72 Integer o = new Integer(6);
73 List<Integer> oList = Arrays.asList(o);
74 String json = baseMapper.objectListToJson(oList);
75 System.out.println(json);