Adjust to yangtools-2.0.0 changes
[controller.git] / opendaylight / md-sal / sal-distributed-datastore / src / test / java / org / opendaylight / controller / md / cluster / datastore / model / SchemaContextHelper.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
9 package org.opendaylight.controller.md.cluster.datastore.model;
10
11 import java.io.File;
12 import java.io.InputStream;
13 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
14 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
15
16 public final class SchemaContextHelper {
17
18     public static final String ODL_DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
19     public static final String PEOPLE_YANG = "/people.yang";
20     public static final String CARS_YANG = "/cars.yang";
21
22     private SchemaContextHelper() {
23
24     }
25
26     public static InputStream getInputStream(final String yangFileName) {
27         return SchemaContextHelper.class.getResourceAsStream(yangFileName);
28     }
29
30     public static SchemaContext full() {
31         return select(ODL_DATASTORE_TEST_YANG, PEOPLE_YANG, CARS_YANG);
32     }
33
34     public static SchemaContext select(final String... schemaFiles) {
35         return YangParserTestUtils.parseYangResources(SchemaContextHelper.class, schemaFiles);
36     }
37
38     public static SchemaContext distributedShardedDOMDataTreeSchemaContext() {
39         // we need prefix-shard-configuration and odl-datastore-test models
40         // for DistributedShardedDOMDataTree tests
41         return YangParserTestUtils.parseYangResources(SchemaContextHelper.class, ODL_DATASTORE_TEST_YANG,
42             "/META-INF/yang/prefix-shard-configuration@2017-01-10.yang");
43     }
44
45     public static SchemaContext entityOwners() {
46         return YangParserTestUtils.parseYangFiles(new File("src/main/yang/entity-owners.yang"));
47     }
48 }