2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
8 package org.opendaylight.controller.md.sal.dom.store.impl;
10 import java.io.InputStream;
11 import java.util.Collections;
12 import java.util.List;
13 import org.opendaylight.yangtools.yang.common.QName;
14 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
15 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
16 import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
17 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
19 public class TestModel {
21 public static final QName TEST_QNAME =
22 QName.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test", "2014-03-13", "test");
23 public static final QName OUTER_LIST_QNAME = QName.create(TEST_QNAME, "outer-list");
24 public static final QName INNER_LIST_QNAME = QName.create(TEST_QNAME, "inner-list");
25 public static final QName OUTER_CHOICE_QNAME = QName.create(TEST_QNAME, "outer-choice");
26 public static final QName ID_QNAME = QName.create(TEST_QNAME, "id");
27 public static final QName NAME_QNAME = QName.create(TEST_QNAME, "name");
28 public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
29 public static final QName TWO_QNAME = QName.create(TEST_QNAME, "two");
30 public static final QName THREE_QNAME = QName.create(TEST_QNAME, "three");
31 public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_QNAME);
32 public static final YangInstanceIdentifier OUTER_LIST_PATH =
33 YangInstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
34 private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
36 private static InputStream getInputStream() {
37 return TestModel.class.getResourceAsStream(DATASTORE_TEST_YANG);
40 public static SchemaContext createTestContext() {
41 final List<InputStream> streams = Collections.singletonList(getInputStream());
44 return YangParserTestUtils.parseYangStreams(streams);
45 } catch (ReactorException e) {
46 throw new RuntimeException("Unable to build schema context from " + streams, e);