gpt4 book ai didi

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

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

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

YangTextSchemaSource.read介绍

暂无

代码示例

代码示例来源: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

@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: 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());
}

代码示例来源: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());
}

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