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.yangtools.yang.data.impl.tree;
10 import java.io.InputStream;
11 import java.util.Collections;
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.Module;
16 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
17 import org.opendaylight.yangtools.yang.parser.impl.YangParserImpl;
20 * @author Lukas Sedlak <lsedlak@cisco.com>
22 public class BenchmarkModel {
24 public static final QName TEST_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test", "2014-03-13",
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";
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();
37 public static final InputStream getDatastoreBenchmarkInputStream() {
38 return getInputStream(DATASTORE_TEST_YANG);
41 private static InputStream getInputStream(final String resourceName) {
42 return BenchmarkModel.class.getResourceAsStream(resourceName);
45 public static SchemaContext createTestContext() {
46 YangParserImpl parser = new YangParserImpl();
47 Set<Module> modules = parser.parseYangModelsFromStreams(Collections.singletonList(
48 getDatastoreBenchmarkInputStream()));
49 return parser.resolveSchemaContext(modules);