gpt4 book ai didi

org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource.getIdentifier()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-16 08:32:40 28 4
gpt4 key购买 nike

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

YangTextSchemaSource.getIdentifier介绍

暂无

代码示例

代码示例来源:origin: org.opendaylight.yangtools/yang-model-util

@Override
@SuppressFBWarnings(value = "RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE",
  justification = "https://github.com/spotbugs/spotbugs/issues/600")
protected void storeAsType(final File file, final YangTextSchemaSource cast) {
  try (InputStream castStream = cast.openStream()) {
    Files.copy(castStream, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
  } catch (final IOException e) {
    throw new IllegalStateException("Cannot store schema source " + cast.getIdentifier() + " to " + file,
        e);
  }
}

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

@Override
@SuppressFBWarnings(value = "RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE",
  justification = "https://github.com/spotbugs/spotbugs/issues/600")
protected void storeAsType(final File file, final YangTextSchemaSource cast) {
  try (InputStream castStream = cast.openStream()) {
    Files.copy(castStream, file.toPath(), StandardCopyOption.REPLACE_EXISTING);
  } catch (final IOException e) {
    throw new IllegalStateException("Cannot store schema source " + cast.getIdentifier() + " to " + file,
        e);
  }
}

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

public YangTextSchemaSourceSerializationProxy(final YangTextSchemaSource source) throws IOException {
  this.revision = source.getIdentifier().getRevision().orElse(null);
  this.name = source.getIdentifier().getName();
  this.schemaSource = source.read();
}

代码示例来源:origin: org.opendaylight.controller/sal-clustering-commons

public YangTextSchemaSourceSerializationProxy(final YangTextSchemaSource source) throws IOException {
  this.revision = source.getIdentifier().getRevision();
  this.name = source.getIdentifier().getName();
  this.schemaSource = source.read();
}

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

@Override
public void onSuccess(@Nonnull final YangTextSchemaSource result) {
  try {
    promise.success(new YangTextSchemaSourceSerializationProxy(result));
  } catch (IOException e) {
    LOG.warn("Unable to read schema source for {}", result.getIdentifier(), e);
    promise.failure(e);
  }
}

代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950

/**
 * Create a {@link YangStatementStreamSource} for a {@link YangTextSchemaSource}.
 *
 * @param source YangTextSchemaSource, must not be null
 * @return A new {@link YangStatementStreamSource}
 * @throws IOException When we fail to read the source
 * @throws YangSyntaxErrorException If the source fails basic parsing
 */
public static YangStatementStreamSource create(final YangTextSchemaSource source) throws IOException,
    YangSyntaxErrorException {
  final StatementContext context;
  try (InputStream stream = source.openStream()) {
    context = parseYangSource(source.getIdentifier(), stream);
  }
  return new YangStatementStreamSource(source.getIdentifier(), context, source.getSymbolicName().orElse(null));
}

代码示例来源:origin: org.opendaylight.controller/sal-clustering-commons

@Override
public void onSuccess(YangTextSchemaSource result) {
  try {
    promise.success(new YangTextSchemaSourceSerializationProxy(result));
  } catch (IOException e) {
    LOG.warn("Unable to read schema source for {}", result.getIdentifier(), e);
    promise.failure(e);
  }
}

代码示例来源:origin: org.opendaylight.yangtools/yang-parser-rfc7950

public static ASTSchemaSource transformText(final YangTextSchemaSource text) throws SchemaSourceException,
      IOException, YangSyntaxErrorException {
    final YangStatementStreamSource src = YangStatementStreamSource.create(text);
    final ParserRuleContext ctx = src.getYangAST();
    LOG.debug("Model {} parsed successfully", text);

    // TODO: missing validation (YangModelBasicValidationListener should be re-implemented to new parser)

    return ASTSchemaSource.create(text.getIdentifier(), text.getSymbolicName().orElse(null), ctx);
  }
}

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

@Override
  void addYangsToMetaInf(final MavenProject project, final Collection<YangTextSchemaSource> modelsInProject)
      throws IOException {
    final File generatedYangDir = new GeneratedDirectories(project).getYangDir();
    LOG.debug("Generated dir {}", generatedYangDir);
    // copy project's src/main/yang/*.yang to ${project.builddir}/generated-sources/yang/META-INF/yang/
    // This honors setups like a Eclipse-profile derived one
    final File withMetaInf = new File(generatedYangDir, YangToSourcesProcessor.META_INF_YANG_STRING);
    for (YangTextSchemaSource source : modelsInProject) {
      final String fileName = source.getIdentifier().toYangFilename();
      final File file = new File(withMetaInf, fileName);
      Files.createParentDirs(file);
      source.copyTo(Files.asByteSink(file));
      LOG.debug("Created file {} for {}", file, source.getIdentifier());
    }
    setResource(generatedYangDir, project);
    LOG.debug("{} YANG files marked as resources: {}", YangToSourcesProcessor.LOG_PREFIX, generatedYangDir);
  }
}

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

if (!astSource.getIdentifier().equals(textSource.getIdentifier())) {

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

@Test
public void serializeAndDesrializeProxy() throws ClassNotFoundException, IOException {
  YangTextSchemaSourceSerializationProxy proxy = new YangTextSchemaSourceSerializationProxy(schemaSource);
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  ObjectOutputStream oos = new ObjectOutputStream(bos);
  oos.writeObject(proxy);
  ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bos.toByteArray()));
  YangTextSchemaSourceSerializationProxy deserializedProxy =
      (YangTextSchemaSourceSerializationProxy) ois.readObject();
  assertEquals(deserializedProxy.getRepresentation().getIdentifier(), proxy.getRepresentation().getIdentifier());
  assertArrayEquals(deserializedProxy.getRepresentation().read(), proxy.getRepresentation().read());
}

代码示例来源:origin: org.opendaylight.yangtools/yang-parser-impl

final SourceIdentifier providedId = source.getIdentifier();
final SourceIdentifier parsedId = ast.getIdentifier();
final YangTextSchemaSource text;

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

final SourceIdentifier providedId = source.getIdentifier();
final SourceIdentifier parsedId = ast.getIdentifier();
final YangTextSchemaSource text;

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

@Test
  public void testProxyEqualsBackingYangTextSource() throws IOException {
    YangTextSchemaSourceSerializationProxy serializationProxy =
        new YangTextSchemaSourceSerializationProxy(schemaSource);

    assertEquals(serializationProxy.getRepresentation().getIdentifier(), schemaSource.getIdentifier());
    assertArrayEquals(serializationProxy.getRepresentation().read(), schemaSource.read());
  }
}

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

@Test
public void testGetExistingYangTextSchemaSource() throws Exception {
  String source = "Test source.";
  YangTextSchemaSource schemaSource = YangTextSchemaSource.delegateForByteSource(
      ID, ByteSource.wrap(source.getBytes()));
  Mockito.when(mockedLocalRepository.getSchemaSource(ID, YangTextSchemaSource.class)).thenReturn(
      Futures.immediateCheckedFuture(schemaSource));
  Future<YangTextSchemaSourceSerializationProxy> retrievedSourceFuture =
      remoteRepository.getYangTextSchemaSource(ID);
  assertTrue(retrievedSourceFuture.isCompleted());
  YangTextSchemaSource resultSchemaSource = Await.result(retrievedSourceFuture,
      FiniteDuration.Zero()).getRepresentation();
  assertEquals(resultSchemaSource.getIdentifier(), schemaSource.getIdentifier());
  assertArrayEquals(resultSchemaSource.read(), schemaSource.read());
}

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

@Test
public void getExistingYangTextSchemaSource() throws IOException, SchemaSourceException {
  String source = "Test";
  YangTextSchemaSource schemaSource = YangTextSchemaSource.delegateForByteSource(
      ID, ByteSource.wrap(source.getBytes()));
  YangTextSchemaSourceSerializationProxy sourceProxy = new YangTextSchemaSourceSerializationProxy(schemaSource);
  Mockito.when(mockedRemoteSchemaRepository.getYangTextSchemaSource(ID))
    .thenReturn(Futures.successful(sourceProxy));
  YangTextSchemaSource providedSource = remoteSchemaProvider.getSource(ID).checkedGet();
  assertEquals(providedSource.getIdentifier(), ID);
  assertArrayEquals(providedSource.read(), schemaSource.read());
}

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