gpt4 book ai didi

okreplay.YamlRecordedInteraction类的使用及代码示例

转载 作者:知者 更新时间:2024-03-18 17:15:31 26 4
gpt4 key购买 nike

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

YamlRecordedInteraction介绍

暂无

代码示例

代码示例来源:origin: airbnb/okreplay

RecordedInteraction toImmutable() {
 if (immutableInteraction == null) {
  immutableInteraction = createImmutable();
 }
 return immutableInteraction;
}

代码示例来源:origin: com.airbnb.okreplay/okreplay

@Override public boolean apply(YamlRecordedInteraction input) {
  return matchRule.isMatch(request, input.toImmutable().request());
 }
});

代码示例来源:origin: airbnb/okreplay

YamlRecordedInteraction toYaml() {
  return new YamlRecordedInteraction(recorded,
    (YamlRecordedRequest) request.toYaml(), (YamlRecordedResponse) response.toYaml());
 }
}

代码示例来源:origin: airbnb/okreplay

@Override public boolean apply(YamlRecordedInteraction input) {
  return matchRule.isMatch(request, input.toImmutable().request());
 }
});

代码示例来源:origin: com.airbnb.okreplay/okreplay

YamlRecordedInteraction toYaml() {
  return new YamlRecordedInteraction(recorded,
    (YamlRecordedRequest) request.toYaml(), (YamlRecordedResponse) response.toYaml());
 }
}

代码示例来源:origin: airbnb/okreplay

@Override public Response play(final Request request) {
 if (!mode.isReadable()) {
  throw new IllegalStateException("the tape is not readable");
 }
 if (mode.isSequential()) {
  Integer nextIndex = orderedIndex.getAndIncrement();
  RecordedInteraction nextInteraction = interactions.get(nextIndex).toImmutable();
  if (nextInteraction == null) {
   throw new IllegalStateException(String.format("No recording found at position %s",
     nextIndex));
  }
  if (!matchRule.isMatch(request, nextInteraction.request())) {
   throw new IllegalStateException(String.format("Request %s does not match recorded " +
     "request" + " %s", stringify(request), stringify(nextInteraction.request())));
  }
  return nextInteraction.response();
 } else {
  int position = findMatch(request);
  if (position < 0) {
   throw new IllegalStateException("no matching recording found");
  } else {
   return interactions.get(position).toImmutable().response();
  }
 }
}

代码示例来源:origin: com.airbnb.okreplay/okreplay

@Override public Response play(final Request request) {
 if (!mode.isReadable()) {
  throw new IllegalStateException("the tape is not readable");
 }
 if (mode.isSequential()) {
  Integer nextIndex = orderedIndex.getAndIncrement();
  RecordedInteraction nextInteraction = interactions.get(nextIndex).toImmutable();
  if (nextInteraction == null) {
   throw new IllegalStateException(String.format("No recording found at position %s",
     nextIndex));
  }
  if (!matchRule.isMatch(request, nextInteraction.request())) {
   throw new IllegalStateException(String.format("Request %s does not match recorded " +
     "request" + " %s", stringify(request), stringify(nextInteraction.request())));
  }
  return nextInteraction.response();
 } else {
  int position = findMatch(request);
  if (position < 0) {
   throw new IllegalStateException("no matching recording found");
  } else {
   return interactions.get(position).toImmutable().response();
  }
 }
}

代码示例来源:origin: airbnb/okreplay

@Override public boolean seek(Request request) {
 if (isSequential()) {
  try {
   // TODO: it's a complete waste of time using an AtomicInteger when this method is called
   // before play in a non-transactional way
   Integer index = orderedIndex.get();
   RecordedInteraction interaction = interactions.get(index).toImmutable();
   Request nextRequest = interaction == null ? null : interaction.request();
   return nextRequest != null && matchRule.isMatch(request, nextRequest);
  } catch (IndexOutOfBoundsException e) {
   throw new NonWritableTapeException();
  }
 } else {
  return findMatch(request) >= 0;
 }
}

代码示例来源:origin: com.airbnb.okreplay/okreplay

@Override public boolean seek(Request request) {
 if (isSequential()) {
  try {
   // TODO: it's a complete waste of time using an AtomicInteger when this method is called
   // before play in a non-transactional way
   Integer index = orderedIndex.get();
   RecordedInteraction interaction = interactions.get(index).toImmutable();
   Request nextRequest = interaction == null ? null : interaction.request();
   return nextRequest != null && matchRule.isMatch(request, nextRequest);
  } catch (IndexOutOfBoundsException e) {
   throw new NonWritableTapeException();
  }
 } else {
  return findMatch(request) >= 0;
 }
}

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