a56364cad16a56884e7a2b1350482f0841a520df
[mdsal.git] / code-generator / binding-data-codec / src / test / java / org / opendaylight / yangtools / binding / data / codec / test / 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.yangtools.binding.data.codec.test;
9
10 import org.junit.Before;
11 import org.opendaylight.yangtools.sal.binding.generator.impl.ModuleInfoBackedContext;
12 import org.opendaylight.yangtools.sal.binding.generator.util.BindingRuntimeContext;
13 import org.opendaylight.yangtools.yang.binding.util.BindingReflections;
14 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
15
16 public abstract class AbstractBindingRuntimeTest {
17
18     private SchemaContext schemaContext;
19     private BindingRuntimeContext runtimeContext;
20
21     @Before
22     public void setup() {
23         ModuleInfoBackedContext ctx = ModuleInfoBackedContext.create();
24         ctx.addModuleInfos(BindingReflections.loadModuleInfos());
25         schemaContext = ctx.tryToCreateSchemaContext().get();
26         runtimeContext = BindingRuntimeContext.create(ctx, schemaContext);
27
28     }
29
30     public SchemaContext getSchemaContext() {
31         return schemaContext;
32     }
33
34     public BindingRuntimeContext getRuntimeContext() {
35         return runtimeContext;
36     }
37 }