com.github.tomakehurst.wiremock.client.WireMock.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(3.8k)|赞(0)|评价(0)|浏览(149)

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

WireMock.<init>介绍

暂无

代码示例

代码示例来源:origin: com.github.tomakehurst/wiremock-jre8

public WireMock build() {
    return new WireMock(scheme, host, port, urlPathPrefix, hostHeader, proxyHost, proxyPort, authenticator);
  }
}

代码示例来源:origin: HotelsDotCom/styx

public void verify(RequestPatternBuilder builder) {
  WireMock wm = new WireMock("localhost", adminPort());
  wm.verifyThat(builder);
}

代码示例来源:origin: HotelsDotCom/styx

public MockOriginServer reset() {
  WireMock wm = new WireMock("localhost", adminPort());
  wm.resetMappings();
  return this;
}

代码示例来源:origin: HotelsDotCom/styx

public void verify(int count, RequestPatternBuilder builder) {
  WireMock wm = new WireMock("localhost", adminPort());
  wm.verifyThat(count, builder);
}

代码示例来源:origin: com.liveperson.ephemerals/ephemerals-module-wiremock

@Override
protected URL createObject(DeploymentEndpoints endpoints) {
  for(DeploymentEndpoints.Endpoint endpoint : endpoints.list()) {
    if(endpoint.getName().equals("wiremock-server")) {
      String host = endpoint.getHost();
      int port = endpoint.getPort();
      WireMock wireMock = new WireMock(host,port);
      wireMock.register(StubMapping.buildFrom(stubMapping));
      try {
        return new URL(String.format("http://%s:%s", host, port));
      } catch (MalformedURLException e) {
        return null;
      }
    }
  }
  return null;
}

代码示例来源:origin: allegro/hermes

public RemoteServiceEndpoint(WireMockServer service, final String path) {
  this.listener = new WireMock("localhost", service.port());
  this.path = path;
  this.url = URI.create(String.format("http://localhost:%d%s", service.port(), path));
  this.service = service;
  service.resetMappings();
  service.resetRequests();
  service.resetScenarios();
  service.addMockServiceRequestListener((request, response) -> {
    if (path.equals(request.getUrl())) {
      receivedRequests.add(LoggedRequest.createFrom(request));
    }
  });
}

代码示例来源:origin: pl.allegro.tech.hermes/hermes-test-helper

public RemoteServiceEndpoint(WireMockServer service, final String path) {
  this.listener = new WireMock("localhost", service.port());
  this.path = path;
  this.url = URI.create(String.format("http://localhost:%d%s", service.port(), path));
  this.service = service;
  service.resetMappings();
  service.resetRequests();
  service.resetScenarios();
  service.addMockServiceRequestListener((request, response) -> {
    if (path.equals(request.getUrl())) {
      receivedRequests.add(LoggedRequest.createFrom(request));
    }
  });
}

代码示例来源:origin: HotelsDotCom/styx

public MockOriginServer stub(UrlMatchingStrategy urlMatchingStrategy, ResponseDefinitionBuilder response) {
  WireMock wm = new WireMock("localhost", adminPort());
  wm.register(WireMock.get(urlMatchingStrategy).willReturn(response));
  return this;
}

代码示例来源:origin: org.springframework.cloud/spring-cloud-contract-stub-runner

private WireMock wireMock() {
  String scheme = this.https ? "https" : "http";
  String host = "localhost";
  int port = port();
  String urlPathPrefix = null;
  String hostHeader = null;
  String proxyHost = this.wireMockConfiguration.proxyHostHeader();
  int proxyPort = this.wireMockConfiguration.proxyVia().port();
  ClientAuthenticator authenticator = NoClientAuthenticator.noClientAuthenticator();
  return new WireMock(scheme, host, port, urlPathPrefix,
      hostHeader, proxyHost, proxyPort, authenticator);
}

代码示例来源:origin: com.github.tomakehurst/wiremock-jre8

public WireMockServer(Options options) {
  this.options = options;
  this.notifier = options.notifier();
  wireMockApp = new WireMockApp(options, this);
  this.stubRequestHandler = wireMockApp.buildStubRequestHandler();
  HttpServerFactory httpServerFactory = options.httpServerFactory();
  httpServer = httpServerFactory.buildHttpServer(
      options,
      wireMockApp.buildAdminRequestHandler(),
      stubRequestHandler
  );
  client = new WireMock(wireMockApp);
}

相关文章