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.dataprovider.test;
21 import java.util.Arrays;
23 import org.junit.Test;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.Faultcurrent;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.FaultcurrentEntity;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.InventoryBuilder;
27 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.data.provider.rev190801.InventoryEntity;
29 public class TestYangCloning {
32 public void testEquipment() {
33 EquipmentBuilder equipmentBuilder = new EquipmentBuilder();
34 equipmentBuilder.setUuid( new UniversalId("EquipmentId"));
35 equipmentBuilder.setContainedHolder(Arrays.asList(new ContainedHolderBuilder()
36 .setUuid(new UniversalId("HolderId"))
37 .setAdministrativeState(AdministrativeState.Locked)
38 .setSupportedEquipment(Arrays.asList("eq1"))
40 Equipment equipment = equipmentBuilder.build();
41 InventoryEntity output = YangToolsCloner.instance().cloneToBuilder(equipment, new InventoryBuilder())
42 .setNodeId("node1").setUuid("a.a.a").setId("node1"+"/"+"a.a.a").build();
45 System.out.println("source:");
46 System.out.println(equipment);
47 System.out.println("result:");
48 System.out.println(output);
53 public void testFaultCurrent() {
54 ProblemNotificationXml source = new ProblemNotificationXml("node", "uuid", "problem", InternalSeverity.Critical,54,InternalDateAndTime.getTestpattern());
55 FaultcurrentEntity output = YangToolsCloner.instance().clone(source,Faultcurrent.class);
57 System.out.println("source:");
58 System.out.println(source);
59 System.out.println("result:");
60 System.out.println(output);