aac64e8ed17eb7a991fce7ccaf29f79d9edfa9ec
[controller.git] / opendaylight / sal / yang-prototype / code-generator / binding-generator-impl / src / test / java / org / opendaylight / controller / sal / binding / generator / impl / AugmentRleativeXPathTest.java
1 /*
2  * Copyright (c) 2013 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.binding.generator.impl;
9
10 import org.junit.BeforeClass;
11 import org.junit.Test;
12 import org.opendaylight.controller.sal.binding.generator.api.BindingGenerator;
13 import org.opendaylight.controller.sal.binding.model.api.Type;
14 import org.opendaylight.controller.yang.model.api.Module;
15 import org.opendaylight.controller.yang.model.api.SchemaContext;
16 import org.opendaylight.controller.yang.model.parser.api.YangModelParser;
17 import org.opendaylight.controller.yang.parser.impl.YangParserImpl;
18
19 import java.io.File;
20 import java.util.ArrayList;
21 import java.util.List;
22 import java.util.Set;
23
24 import static org.junit.Assert.assertFalse;
25 import static org.junit.Assert.assertNotNull;
26
27 public class AugmentRleativeXPathTest {
28
29     private final static List<File> augmentModels = new ArrayList<>();
30     private final static String augmentFolderPath = AugmentedTypeTest.class
31             .getResource("/augment-relative-xpath-models").getPath();
32
33     @BeforeClass
34     public static void loadTestResources() {
35         final File augFolder = new File(augmentFolderPath);
36
37         for (final File fileEntry : augFolder.listFiles()) {
38             if (fileEntry.isFile()) {
39                 augmentModels.add(fileEntry);
40             }
41         }
42     }
43
44     @Test
45     public void AugmentationWithRelativeXPathTest() {
46         final YangModelParser parser = new YangParserImpl();
47         final Set<Module> modules = parser.parseYangModels(augmentModels);
48         final SchemaContext context = parser.resolveSchemaContext(modules);
49
50         assertNotNull("context is null", context);
51         final BindingGenerator bindingGen = new BindingGeneratorImpl();
52         final List<Type> genTypes = bindingGen.generateTypes(context);
53
54         assertNotNull("genTypes is null", genTypes);
55         assertFalse("genTypes is empty", genTypes.isEmpty());
56
57         //TODO: implement test
58     }
59 }