コード例 #1
0
  @Override
  @SuppressWarnings("unchecked")
  public ResponseHandler apply(final MocoConfig config) {
    if (config.isFor(MocoConfig.URI_ID)) {
      String newLocalBase = (String) config.apply(proxyConfig.localBase());
      return new ProxyBatchResponseHandler(
          from(newLocalBase).to(proxyConfig.remoteBase()), failover());
    }

    return this;
  }
コード例 #2
0
ファイル: HttpSetting.java プロジェクト: xiongrl/moco
  @Override
  @SuppressWarnings("unchecked")
  public Setting<HttpResponseSetting> apply(final MocoConfig config) {
    RequestMatcher appliedMatcher = configItem(this.matcher, config);
    if (config.isFor(MocoConfig.URI_ID) && this.matcher == appliedMatcher) {
      appliedMatcher =
          new AndRequestMatcher(
              of(appliedMatcher, InternalApis.context((String) config.apply(""))));
    }

    HttpSetting setting = new HttpSetting(appliedMatcher);
    setting.handler = configItem(this.handler, config);
    setting.eventTriggers = configItems(eventTriggers, config);
    return setting;
  }
コード例 #3
0
    @Override
    public Resource apply(MocoConfig config, Resource resource) {
      if (config.isFor(id())) {
        return newResource(config);
      }

      return resource;
    }
コード例 #4
0
  @Override
  public RequestMatcher apply(final MocoConfig config) {
    if (config.isFor(resource.id())) {
      return new XmlRequestMatcher(this.extractor, resource.apply(config));
    }

    return this;
  }