61eb42648f6372181e9f67591c7081834433ce2e
[controller.git] / opendaylight / md-sal / sal-binding-broker / src / test / java / org / opendaylight / controller / md / sal / binding / impl / test / AbstractSchemaAwareTest.java
1 package org.opendaylight.controller.md.sal.binding.impl.test;
2
3 import org.junit.Before;
4 import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
5 import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
6 import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
7 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
8
9 public abstract class AbstractSchemaAwareTest  {
10
11     private Iterable<YangModuleInfo> moduleInfos;
12     private SchemaContext schemaContext;
13
14
15     protected Iterable<YangModuleInfo> getModuleInfos() {
16         return BindingReflections.loadModuleInfos();
17     }
18
19
20     @Before
21     public final void setup() {
22         moduleInfos = getModuleInfos();
23         ModuleInfoBackedContext moduleContext = ModuleInfoBackedContext.create();
24         moduleContext.addModuleInfos(moduleInfos);
25         schemaContext = moduleContext.tryToCreateSchemaContext().get();
26         setupWithSchema(schemaContext);
27     }
28
29
30     protected abstract void setupWithSchema(SchemaContext context);
31
32 }

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.