Update test suite
[yangtools.git] / codec / yang-data-codec-gson / src / test / java / org / opendaylight / yangtools / yang / data / codec / gson / AbstractComplexJsonTest.java
1 /*
2  * Copyright (c) 2019 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.yangtools.yang.data.codec.gson;
9
10 import org.junit.AfterClass;
11 import org.junit.BeforeClass;
12 import org.opendaylight.yangtools.yang.common.Empty;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
15 import org.opendaylight.yangtools.yang.data.api.schema.ContainerNode;
16 import org.opendaylight.yangtools.yang.data.impl.schema.Builders;
17 import org.opendaylight.yangtools.yang.data.impl.schema.ImmutableNodes;
18 import org.opendaylight.yangtools.yang.model.api.EffectiveModelContext;
19 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
20
21 public abstract class AbstractComplexJsonTest {
22     static final QName CONT_1 = QName.create("ns:complex:json", "2014-08-11", "cont1");
23     static final NodeIdentifier CONT_1_NODEID = new NodeIdentifier(CONT_1);
24
25     private static final QName EMPTY_LEAF = QName.create(CONT_1, "empty");
26
27     static final ContainerNode CONT1_WITH_EMPTYLEAF = Builders.containerBuilder()
28             .withNodeIdentifier(CONT_1_NODEID)
29             .addChild(ImmutableNodes.leafNode(EMPTY_LEAF, Empty.value()))
30             .build();
31
32     static EffectiveModelContext schemaContext;
33     static JSONCodecFactory lhotkaCodecFactory;
34
35     @BeforeClass
36     public static void beforeClass() {
37         schemaContext = YangParserTestUtils.parseYangResourceDirectory("/complexjson/yang");
38         lhotkaCodecFactory = JSONCodecFactorySupplier.DRAFT_LHOTKA_NETMOD_YANG_JSON_02.getShared(schemaContext);
39     }
40
41     @AfterClass
42     public static void afterClass() {
43         lhotkaCodecFactory = null;
44         schemaContext = null;
45     }
46 }