26c932b3198500d11bdd2bb408c85edd4a379bd6
[mdsal.git] / yanglib / mdsal-yanglib-rfc8525 / src / test / java / org / opendaylight / mdsal / yanglib / rfc8525 / AbstractYangLibraryTest.java
1 /*
2  * Copyright (c) 2022 PANTHEON.tech, s.r.o. 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.yanglib.rfc8525;
9
10 import org.junit.Before;
11 import org.junit.BeforeClass;
12 import org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTree;
13 import org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTreeFactory;
14 import org.opendaylight.mdsal.binding.dom.codec.impl.DefaultBindingCodecTreeFactory;
15 import org.opendaylight.mdsal.binding.generator.impl.DefaultBindingRuntimeGenerator;
16 import org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeContext;
17 import org.opendaylight.mdsal.binding.runtime.api.BindingRuntimeGenerator;
18 import org.opendaylight.mdsal.binding.runtime.spi.BindingRuntimeHelpers;
19 import org.opendaylight.yangtools.yang.parser.api.YangParserException;
20 import org.opendaylight.yangtools.yang.parser.api.YangParserFactory;
21 import org.opendaylight.yangtools.yang.parser.impl.DefaultYangParserFactory;
22
23 abstract class AbstractYangLibraryTest {
24     private static final BindingRuntimeGenerator BINDING_RUNTIME_GENERATOR = new DefaultBindingRuntimeGenerator();
25     private static final YangParserFactory YANG_PARSER_FACTORY = new DefaultYangParserFactory();
26     private static final BindingCodecTreeFactory CODEC_FACTORY = new DefaultBindingCodecTreeFactory();
27
28     static BindingRuntimeContext runtimeContext;
29     static BindingCodecTree codecTree;
30
31     YangLibrarySupport yangLib;
32
33     @BeforeClass
34     public static void beforeClass() {
35         runtimeContext = BindingRuntimeHelpers.createRuntimeContext();
36         codecTree = CODEC_FACTORY.create(runtimeContext);
37     }
38
39     @Before
40     public void before() throws YangParserException {
41         yangLib = new YangLibrarySupport(YANG_PARSER_FACTORY, BINDING_RUNTIME_GENERATOR, CODEC_FACTORY);
42     }
43 }