/*
- * Copyright (c) 2013 Cisco Systems, Inc. and others. All rights reserved.
+ * Copyright (c) 2013, 2017 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
*/
package org.opendaylight.controller.md.sal.dom.store.benchmark;
-import java.io.InputStream;
-import java.util.Collections;
-import java.util.List;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.model.api.SchemaContext;
-import org.opendaylight.yangtools.yang.parser.spi.meta.ReactorException;
import org.opendaylight.yangtools.yang.test.util.YangParserTestUtils;
/**
public static final QName ID_QNAME = QName.create(TEST_QNAME, "id");
public static final QName NAME_QNAME = QName.create(TEST_QNAME, "name");
private static final String DATASTORE_TEST_YANG = "/odl-datastore-test.yang";
-
public static final YangInstanceIdentifier TEST_PATH = YangInstanceIdentifier.of(TEST_QNAME);
public static final YangInstanceIdentifier OUTER_LIST_PATH =
YangInstanceIdentifier.builder(TEST_PATH).node(OUTER_LIST_QNAME).build();
- private static InputStream getInputStream() {
- return BenchmarkModel.class.getResourceAsStream(DATASTORE_TEST_YANG);
+ private BenchmarkModel() {
}
public static SchemaContext createTestContext() {
- final SchemaContext schemaContext;
- final List<InputStream> streams = Collections.singletonList(getInputStream());
-
- try {
- schemaContext = YangParserTestUtils.parseYangStreams(streams);
- } catch (ReactorException e) {
- throw new RuntimeException("Unable to build schema context from " + streams, e);
- }
- return schemaContext;
+ return YangParserTestUtils.parseYangResources(BenchmarkModel.class, DATASTORE_TEST_YANG);
}
}