package org.opendaylight.controller.md.sal.binding.test;
import org.junit.Before;
-import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
+import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
import org.opendaylight.yangtools.yang.binding.YangModuleInfo;
import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
public abstract class AbstractSchemaAwareTest {
- private Iterable<YangModuleInfo> moduleInfos;
- private SchemaContext schemaContext;
-
-
protected Iterable<YangModuleInfo> getModuleInfos() throws Exception {
return BindingReflections.loadModuleInfos();
}
+ protected SchemaContext getSchemaContext() throws Exception {
+ final Iterable<YangModuleInfo> moduleInfos = getModuleInfos();
+ final ModuleInfoBackedContext moduleContext = ModuleInfoBackedContext.create();
+ moduleContext.addModuleInfos(moduleInfos);
+ return moduleContext.tryToCreateSchemaContext().get();
+ }
@Before
public final void setup() throws Exception {
- moduleInfos = getModuleInfos();
- ModuleInfoBackedContext moduleContext = ModuleInfoBackedContext.create();
- moduleContext.addModuleInfos(moduleInfos);
- schemaContext = moduleContext.tryToCreateSchemaContext().get();
- setupWithSchema(schemaContext);
+ setupWithSchema(getSchemaContext());
}
/**
* Setups test with Schema context.
* This method is called before {@link #setupWithSchemaService(SchemaService)}
- *
- * @param context
*/
protected abstract void setupWithSchema(SchemaContext context);