980b1c589ca87de3b63fca6ae7563f29dd3b461b
[mdsal.git] / binding / mdsal-binding-dom-codec / src / test / java / org / opendaylight / mdsal / binding / dom / codec / impl / AbstractBindingRuntimeTest.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.mdsal.binding.dom.codec.impl;
9
10 import org.junit.AfterClass;
11 import org.junit.BeforeClass;
12 import org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext;
13 import org.opendaylight.mdsal.binding.generator.util.BindingRuntimeContext;
14 import org.opendaylight.mdsal.binding.spec.reflect.BindingReflections;
15 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
16
17 public abstract class AbstractBindingRuntimeTest {
18
19     private static SchemaContext schemaContext;
20     private static BindingRuntimeContext runtimeContext;
21
22     @BeforeClass
23     public static void beforeClass() {
24         ModuleInfoBackedContext ctx = ModuleInfoBackedContext.create();
25         ctx.addModuleInfos(BindingReflections.loadModuleInfos());
26         schemaContext = ctx.tryToCreateSchemaContext().get();
27         runtimeContext = BindingRuntimeContext.create(ctx, schemaContext);
28     }
29
30     @AfterClass
31     public static void afterClass() {
32         schemaContext = null;
33         runtimeContext = null;
34     }
35
36     public static final SchemaContext getSchemaContext() {
37         return schemaContext;
38     }
39
40     public static final BindingRuntimeContext getRuntimeContext() {
41         return runtimeContext;
42     }
43 }