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 org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
11 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
13 import org.opendaylight.yangtools.yang.parser.stmt.reactor.CrossSourceStatementReactor;
14 import org.opendaylight.yangtools.yang.parser.stmt.rfc6020.YangInferencePipeline;
15 import java.io.InputStream;
16 import java.util.Collections;
17 import org.opendaylight.yangtools.yang.common.QName;
18 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
19 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
22 * @author Lukas Sedlak <lsedlak@cisco.com>
24 public class BenchmarkModel {
26 public static final QName TEST_QNAME = QName.create("urn:opendaylight:params:xml:ns:yang:controller:md:sal:dom:store:test", "2014-03-13",
28 public static final QName OUTER_LIST_QNAME = QName.create(TEST_QNAME, "outer-list");
29 public static final QName INNER_LIST_QNAME = QName.create(TEST_QNAME, "inner-list");
30 public static final QName OUTER_CHOICE_QNAME = QName.create(TEST_QNAME, "outer-choice");
31 public static final QName ID_QNAME = QName.create(TEST_QNAME, "id");
32 public static final QName NAME_QNAME = QName.create(TEST_QNAME, "name");
33 public static final QName VALUE_QNAME = QName.create(TEST_QNAME, "value");
34 private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
36 public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_QNAME);
37 public static final YangInstanceIdentifier OUTER_LIST_PATH = YangInstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
39 public static final InputStream getDatastoreBenchmarkInputStream() {
40 return getInputStream(DATASTORE_TEST_YANG);
43 private static InputStream getInputStream(final String resourceName) {
44 return BenchmarkModel.class.getResourceAsStream(resourceName);
47 public static SchemaContext createTestContext() throws SourceException, ReactorException {
48 CrossSourceStatementReactor.BuildAction reactor = YangInferencePipeline.RFC6020_REACTOR.newBuild();
49 SchemaContext schemaContext = reactor.buildEffective(Collections.singletonList(
50 getDatastoreBenchmarkInputStream()));