gpt4 book ai didi

org.opendaylight.yangtools.yang.test.util.YangParserTestUtils类的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 10:47:31 31 4
gpt4 key购买 nike

本文整理了Java中org.opendaylight.yangtools.yang.test.util.YangParserTestUtils类的一些代码示例,展示了YangParserTestUtils类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YangParserTestUtils类的具体详情如下:
包路径:org.opendaylight.yangtools.yang.test.util.YangParserTestUtils
类名称:YangParserTestUtils

YangParserTestUtils介绍

[英]Utility class which provides convenience methods for producing effective schema context based on the supplied yang/yin sources or paths to these sources.
[中]实用类,它提供了基于提供的阳/阴源或这些源的路径生成有效模式上下文的方便方法。

代码示例

代码示例来源:origin: opendaylight/yangtools

/**
 * Creates a new effective schema context containing the specified YANG source. All YANG features are supported.
 *
 * @param resource relative path to the YANG file to be parsed
 * @param parserMode mode of statement parser
 * @return effective schema context
 */
public static SchemaContext parseYangResource(final String resource, final StatementParserMode parserMode) {
  return parseYangResource(resource, parserMode, null);
}

代码示例来源:origin: opendaylight/yangtools

/**
 * Creates a new effective schema context containing the specified YANG sources. Statement parser mode is set to
 * default mode and all YANG features are supported.
 *
 * @param files collection of YANG files to be parsed
 * @return effective schema context
 */
public static SchemaContext parseYangFiles(final Collection<File> files) {
  return parseYangFiles(StatementParserMode.DEFAULT_MODE, files);
}

代码示例来源:origin: opendaylight/yangtools

/**
 * Creates a new effective schema context containing the specified YANG sources. All YANG features are supported.
 *
 * @param yangResourceDirs relative paths to the directories containing YANG files to be parsed
 * @param yangResources relative paths to the YANG files to be parsed
 * @param statementParserMode mode of statement parser
 * @return effective schema context
 */
public static SchemaContext parseYangResources(final List<String> yangResourceDirs,
    final List<String> yangResources, final StatementParserMode statementParserMode) {
  return parseYangResources(yangResourceDirs, yangResources, null, statementParserMode);
}

代码示例来源:origin: opendaylight/yangtools

/**
 * Creates a new effective schema context containing the specified YANG sources.
 *
 * @param yangResourceDirs relative paths to the directories containing YANG files to be parsed
 * @param yangResources relative paths to the YANG files to be parsed
 * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
 *                          models are resolved
 * @param statementParserMode mode of statement parser
 * @return effective schema context
 */
public static SchemaContext parseYangResources(final List<String> yangResourceDirs,
    final List<String> yangResources, final Set<QName> supportedFeatures,
    final StatementParserMode statementParserMode) {
  final List<File> allYangFiles = new ArrayList<>();
  for (final String yangDir : yangResourceDirs) {
    allYangFiles.addAll(getYangFiles(yangDir));
  }
  for (final String yangFile : yangResources) {
    try {
      allYangFiles.add(new File(YangParserTestUtils.class.getResource(yangFile).toURI()));
    } catch (URISyntaxException e) {
      throw new IllegalArgumentException("Invalid resource " + yangFile, e);
    }
  }
  return parseYangFiles(supportedFeatures, statementParserMode, allYangFiles);
}

代码示例来源:origin: opendaylight/yangtools

public static SchemaContext parseYangSources(final StatementParserMode parserMode,
    final Set<QName> supportedFeatures, final YangTextSchemaSource... sources) {
  return parseSources(parserMode, supportedFeatures, Arrays.asList(sources));
}

代码示例来源:origin: opendaylight/yangtools

/**
 * Creates a new effective schema context containing the specified YANG sources. All YANG features are supported.
 *
 * @param resourcePath relative path to the directory with YANG files to be parsed
 * @param parserMode mode of statement parser
 * @return effective schema context
 */
public static SchemaContext parseYangResourceDirectory(final String resourcePath,
    final StatementParserMode parserMode) {
  return parseYangResourceDirectory(resourcePath, null, parserMode);
}

代码示例来源:origin: opendaylight/yangtools

/**
 * Creates a new effective schema context containing the specified YANG source.
 *
 * @param resource relative path to the YANG file to be parsed
 * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
 *                          model are resolved
 * @param parserMode mode of statement parser
 * @return effective schema context
 */
public static SchemaContext parseYangResource(final String resource, final StatementParserMode parserMode,
    final Set<QName> supportedFeatures) {
  final YangTextSchemaSource source = YangTextSchemaSource.forResource(YangParserTestUtils.class, resource);
  return parseYangSources(parserMode, supportedFeatures, source);
}

代码示例来源:origin: opendaylight/yangtools

/**
 * Creates a new effective schema context containing the specified YANG sources.
 *
 * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
 *                          models are resolved
 * @param parserMode mode of statement parser
 * @param files YANG files to be parsed
 * @return effective schema context
 */
public static SchemaContext parseYangFiles(final Set<QName> supportedFeatures,
    final StatementParserMode parserMode, final Collection<File> files) {
  return parseSources(parserMode, supportedFeatures,
    files.stream().map(YangTextSchemaSource::forFile).collect(Collectors.toList()));
}

代码示例来源:origin: opendaylight/yangtools

/**
 * Creates a new effective schema context containing the specified YANG sources. Statement parser mode is set to
 * default mode and all YANG features are supported.
 *
 * @param resourcePath relative path to the directory with YANG files to be parsed
 * @return effective schema context
 */
public static SchemaContext parseYangResourceDirectory(final String resourcePath) {
  return parseYangResourceDirectory(resourcePath, StatementParserMode.DEFAULT_MODE);
}

代码示例来源:origin: opendaylight/yangtools

/**
 * Creates a new effective schema context containing the specified YANG source. Statement parser mode is set to
 * default mode and all YANG features are supported.
 *
 * @param resource relative path to the YANG file to be parsed
 *
 * @return effective schema context
 */
public static SchemaContext parseYangResource(final String resource) {
  return parseYangResource(resource, StatementParserMode.DEFAULT_MODE);
}

代码示例来源:origin: opendaylight/yangtools

/**
 * Creates a new effective schema context containing the specified YANG sources. All YANG features are supported.
 *
 * @param parserMode mode of statement parser
 * @param files collection of YANG files to be parsed
 * @return effective schema context
 */
public static SchemaContext parseYangFiles(final StatementParserMode parserMode, final Collection<File> files) {
  return parseYangFiles(null, parserMode, files);
}

代码示例来源:origin: opendaylight/yangtools

/**
 * Creates a new effective schema context containing the specified YANG sources. Statement parser mode is set to
 * default mode.
 *
 * @param yangDirs relative paths to the directories containing YANG files to be parsed
 * @param yangFiles relative paths to the YANG files to be parsed
 * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
 *                          models are resolved
 * @return effective schema context
 */
public static SchemaContext parseYangResources(final List<String> yangDirs, final List<String> yangFiles,
    final Set<QName> supportedFeatures) {
  return parseYangResources(yangDirs, yangFiles, supportedFeatures, StatementParserMode.DEFAULT_MODE);
}

代码示例来源:origin: opendaylight/yangtools

public static SchemaContext parseYangResources(final Class<?> clazz, final Collection<String> resources) {
  final List<YangTextSchemaSource> sources = new ArrayList<>(resources.size());
  for (final String r : resources) {
    sources.add(YangTextSchemaSource.forResource(clazz, r));
  }
  return parseSources(StatementParserMode.DEFAULT_MODE, null, sources);
}

代码示例来源:origin: opendaylight/yangtools

/**
 * Creates a new effective schema context containing the specified YANG sources. Statement parser mode is set to
 * default mode.
 *
 * @param resourcePath relative path to the directory with YANG files to be parsed
 * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
 *                          models are resolved
 * @return effective schema context
 */
public static SchemaContext parseYangResourceDirectory(final String resourcePath,
    final Set<QName> supportedFeatures) {
  return parseYangResourceDirectory(resourcePath, supportedFeatures, StatementParserMode.DEFAULT_MODE);
}

代码示例来源:origin: opendaylight/yangtools

/**
 * Creates a new effective schema context containing the specified YANG source. Statement parser mode is set to
 * default mode.
 *
 * @param resource relative path to the YANG file to be parsed
 * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
 *                          model are resolved
 * @return effective schema context
 */
public static SchemaContext parseYangResource(final String resource, final Set<QName> supportedFeatures) {
  return parseYangResource(resource, StatementParserMode.DEFAULT_MODE, supportedFeatures);
}

代码示例来源:origin: opendaylight/yangtools

public static SchemaContext parseYangFiles(final Set<QName> supportedFeatures, final Collection<File> files) {
  return parseYangFiles(supportedFeatures, StatementParserMode.DEFAULT_MODE, files);
}

代码示例来源:origin: opendaylight/yangtools

/**
 * Creates a new effective schema context containing the specified YANG sources. Statement parser mode is set to
 * default mode and all YANG features are supported.
 *
 * @param clazz Resource lookup base
 * @param resources Resource names to be looked up
 * @return effective schema context
 */
public static SchemaContext parseYangResources(final Class<?> clazz, final String... resources) {
  return parseYangResources(clazz, Arrays.asList(resources));
}

代码示例来源:origin: opendaylight/yangtools

static SchemaContext createTestContext() {
    return YangParserTestUtils.parseYangResource("/odl-datastore-test.yang");
  }
}

代码示例来源:origin: opendaylight/yangtools

/**
 * Creates a new effective schema context containing the specified YANG sources. Statement parser mode is set to
 * default mode.
 *
 * @param supportedFeatures set of supported features based on which all if-feature statements in the parsed YANG
 *                          models are resolved
 * @param files YANG files to be parsed
 * @return effective schema context
 */
public static SchemaContext parseYangFiles(final Set<QName> supportedFeatures, final File... files) {
  return parseYangFiles(supportedFeatures, Arrays.asList(files));
}

代码示例来源:origin: opendaylight/controller

public static SchemaContext createTestContext() {
  return YangParserTestUtils.parseYangResources(TestModel.class, DATASTORE_TEST_YANG, DATASTORE_AUG_YANG,
    DATASTORE_TEST_NOTIFICATION_YANG);
}

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com