gpt4 book ai didi

org.opendaylight.controller.cluster.schema.provider.impl.YangTextSchemaSourceSerializationProxy类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 13:25:07 26 4
gpt4 key购买 nike

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

YangTextSchemaSourceSerializationProxy介绍

[英]org.opendaylight.yangtools.yang.model.repo.api.YangTextSchemaSource serialization proxy.
[中]

代码示例

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

@Override
public void onComplete(Throwable throwable,
    YangTextSchemaSourceSerializationProxy yangTextSchemaSourceSerializationProxy) {
  if (yangTextSchemaSourceSerializationProxy != null) {
    res.set(yangTextSchemaSourceSerializationProxy.getRepresentation());
  }
  if (throwable != null) {
    res.setException(throwable);
  }
}

代码示例来源: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 testProxyEqualsBackingYangTextSource() throws IOException {
    YangTextSchemaSourceSerializationProxy serializationProxy =
        new YangTextSchemaSourceSerializationProxy(schemaSource);

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

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

@Override
public void onComplete(Throwable throwable, YangTextSchemaSourceSerializationProxy yangTextSchemaSourceSerializationProxy) {
  if(yangTextSchemaSourceSerializationProxy != null) {
    res.set(yangTextSchemaSourceSerializationProxy.getRepresentation());
  }
  if(throwable != null) {
    res.setException(throwable);
  }
}

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

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