5a5a621d930b68fc240140f76b086a0d57bc0a3c
[controller.git] / opendaylight / md-sal / sal-rest-connector / src / test / java / org / opendaylight / controller / sal / restconf / impl / xml / to / cnsn / test / XmlAugmentedElementToCnSnTest.java
1 /*
2  * Copyright (c) 2014 Cisco Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.sal.restconf.impl.xml.to.cnsn.test;
9
10 import static org.junit.Assert.assertNotNull;
11
12 import java.util.Set;
13 import org.junit.Test;
14 import org.opendaylight.controller.sal.rest.impl.XmlToCompositeNodeProvider;
15 import org.opendaylight.controller.sal.restconf.impl.test.TestUtils;
16 import org.opendaylight.yangtools.yang.data.api.CompositeNode;
17 import org.opendaylight.yangtools.yang.model.api.Module;
18
19 public class XmlAugmentedElementToCnSnTest {
20
21     @Test
22     public void loadDataAugmentedSchemaMoreEqualNamesTest() {
23         loadAndNormalizeData("/common/augment/xml/dataa.xml", "/common/augment/yang", "main", "cont");
24         loadAndNormalizeData("/common/augment/xml/datab.xml", "/common/augment/yang", "main", "cont");
25     }
26
27     private void loadAndNormalizeData(String xmlPath, String yangPath, String topLevelElementName, String moduleName) {
28         CompositeNode compNode = TestUtils.readInputToCnSn(xmlPath, false, XmlToCompositeNodeProvider.INSTANCE);
29         assertNotNull(compNode);
30         Set<Module> modules = TestUtils.loadModulesFrom(yangPath);
31
32         assertNotNull(modules);
33         TestUtils.normalizeCompositeNode(compNode, modules, topLevelElementName + ":" + moduleName);
34     }
35
36 }