2 * Copyright (c) 2016 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.mdsal.binding.yang.types;
11 import java.util.ArrayList;
12 import java.util.List;
13 import org.opendaylight.yangtools.yang.model.api.SchemaContext;
14 import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
17 * Test Model Provider designated to load test resources and provide Schema Context
18 * for testing of TypeProviderImpl
20 public final class TypeProviderModel {
22 public static final String TEST_TYPE_PROVIDER_MODULE_NAME = "test-type-provider";
24 private static final String BASE_YANG_TYPES_PATH = "/base-yang-types.yang";
25 private static final String TEST_TYPE_PROVIDER_PATH = "/"+TEST_TYPE_PROVIDER_MODULE_NAME+".yang";
26 private static final String TEST_TYPE_PROVIDER_B_PATH = "/test-type-provider-b.yang";
28 private static File getFile(final String resourceName) throws Exception {
29 return new File(TypeProviderModel.class.getResource(resourceName).toURI());
32 private static List<File> provideTestModelStreams() throws Exception {
33 final List<File> arrayList = new ArrayList<>();
35 arrayList.add(getFile(BASE_YANG_TYPES_PATH));
36 arrayList.add(getFile(TEST_TYPE_PROVIDER_PATH));
37 arrayList.add(getFile(TEST_TYPE_PROVIDER_B_PATH));
41 public static SchemaContext createTestContext() throws Exception {
42 return YangParserTestUtils.parseYangFiles(provideTestModelStreams());