BUG-865: remove use of deprecated APIs
[mdsal.git] / dom / mdsal-dom-inmemory-datastore / src / test / java / org / opendaylight / controller / md / sal / dom / store / impl / TestModel.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.controller.md.sal.dom.store.impl;
9
10 import com.google.common.io.ByteSource;
11 import com.google.common.io.Resources;
12 import java.io.IOException;
13 import java.util.Collections;
14 import java.util.Set;
15 import org.opendaylight.yangtools.yang.common.QName;
16 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
17 import org.opendaylight.yangtools.yang.model.api.Module;
18 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
19 import org.opendaylight.yangtools.yang.model.parser.api.YangSyntaxErrorException;
20 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
21
22 public class TestModel {
23
24     public static final QName TEST_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test", "2014-03-13",
25         "test");
26     public static final QName OUTER_LIST_QNAME = QName.create(TEST_QNAME, "outer-list");
27     public static final QName INNER_LIST_QNAME = QName.create(TEST_QNAME, "inner-list");
28     public static final QName OUTER_CHOICE_QNAME = QName.create(TEST_QNAME, "outer-choice");
29     public static final QName ID_QNAME = QName.create(TEST_QNAME, "id");
30     public static final QName NAME_QNAME = QName.create(TEST_QNAME, "name");
31     public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
32     private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
33
34     public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_QNAME);
35     public static final YangInstanceIdentifier OUTER_LIST_PATH = YangInstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
36     public static final QName TWO_QNAME = QName.create(TEST_QNAME, "two");
37     public static final QName THREE_QNAME = QName.create(TEST_QNAME, "three");
38
39     private static ByteSource getInputStream() {
40         return Resources.asByteSource(TestModel.class.getResource(DATASTORE_TEST_YANG));
41     }
42
43     public static SchemaContext createTestContext() throws IOException, YangSyntaxErrorException {
44         YangParserImpl parser = new YangParserImpl();
45         return parser.parseSources(Collections.singletonList(getInputStream()));
46     }
47 }