1 /*******************************************************************************
2 * ============LICENSE_START========================================================================
3 * ONAP : ccsdk feature sdnr wt
4 * =================================================================================================
5 * Copyright (C) 2019 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
10 * http://www.apache.org/licenses/LICENSE-2.0
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
16 * ============LICENSE_END==========================================================================
17 ******************************************************************************/
19 package org.onap.ccsdk.features.sdnr.wt.devicemanager.test;
21 import java.util.Arrays;
23 import org.junit.Test;
24 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalDateAndTime;
25 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.util.InternalSeverity;
26 import org.onap.ccsdk.features.sdnr.wt.devicemanager.impl.xml.ProblemNotificationXml;
27 import org.onap.ccsdk.features.sdnr.wt.yangtools.YangToolsCloner;
28 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.AdministrativeState;
29 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.Equipment;
30 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.EquipmentBuilder;
31 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.UniversalId;
32 import org.opendaylight.yang.gen.v1.urn.onf.params.xml.ns.yang.core.model.rev170320.equipment.g.ContainedHolderBuilder;
33 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.Faultcurrent;
34 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.FaultcurrentEntity;
35 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.InventoryBuilder;
36 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.InventoryEntity;
38 public class TestYangCloning {
41 public void testEquipment() {
42 EquipmentBuilder equipmentBuilder = new EquipmentBuilder();
43 equipmentBuilder.setUuid( new UniversalId("EquipmentId"));
44 equipmentBuilder.setContainedHolder(Arrays.asList(new ContainedHolderBuilder()
45 .setUuid(new UniversalId("HolderId"))
46 .setAdministrativeState(AdministrativeState.Locked)
47 .setSupportedEquipment(Arrays.asList("eq1"))
49 Equipment equipment = equipmentBuilder.build();
50 InventoryEntity output = YangToolsCloner.instance().cloneToBuilder(equipment, new InventoryBuilder())
51 .setNodeId("node1").setUuid("a.a.a").setId("node1"+"/"+"a.a.a").build();
54 System.out.println("source:");
55 System.out.println(equipment);
56 System.out.println("result:");
57 System.out.println(output);
62 public void testFaultCurrent() {
63 ProblemNotificationXml source = new ProblemNotificationXml("node", "uuid", "problem", InternalSeverity.Critical,54,InternalDateAndTime.getTestpattern());
64 FaultcurrentEntity output = YangToolsCloner.instance().clone(source,Faultcurrent.class);
66 System.out.println("source:");
67 System.out.println(source);
68 System.out.println("result:");
69 System.out.println(output);