Exemplo n.º 1
0
 @Override
 public SingleServedStubResult getServedStub(UUID id) {
   return executeRequest(
       adminRoutes.requestSpecForTask(GetServedStubTask.class),
       PathParams.single("id", id),
       SingleServedStubResult.class);
 }
Exemplo n.º 2
0
 @Override
 @SuppressWarnings("unchecked")
 public SingleStubMappingResult getStubMapping(UUID id) {
   return executeRequest(
       adminRoutes.requestSpecForTask(GetStubMappingTask.class),
       PathParams.single("id", id),
       SingleStubMappingResult.class);
 }
Exemplo n.º 3
0
  @Override
  public void addStubMapping(StubMapping stubMapping) {
    if (stubMapping.getRequest().hasCustomMatcher()) {
      throw new AdminException(
          "Custom matchers can't be used when administering a remote WireMock server. "
              + "Use WireMockRule.stubFor() or WireMockServer.stubFor() to administer the local instance.");
    }

    executeRequest(
        adminRoutes.requestSpecForTask(CreateStubMappingTask.class),
        PathParams.empty(),
        stubMapping,
        Void.class,
        201);
  }
Exemplo n.º 4
0
 private <B, R> R executeRequest(RequestSpec requestSpec, Class<R> responseType) {
   return executeRequest(requestSpec, PathParams.empty(), null, responseType, 200);
 }
Exemplo n.º 5
0
 private void executeRequest(RequestSpec requestSpec) {
   executeRequest(requestSpec, PathParams.empty(), null, Void.class, 200);
 }