Esempio n. 1
0
 @Override
 public SingleServedStubResult getServedStub(UUID id) {
   return executeRequest(
       adminRoutes.requestSpecForTask(GetServedStubTask.class),
       PathParams.single("id", id),
       SingleServedStubResult.class);
 }
Esempio n. 2
0
 @Override
 @SuppressWarnings("unchecked")
 public SingleStubMappingResult getStubMapping(UUID id) {
   return executeRequest(
       adminRoutes.requestSpecForTask(GetStubMappingTask.class),
       PathParams.single("id", id),
       SingleStubMappingResult.class);
 }
Esempio 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);
  }
Esempio n. 4
0
 private <B, R> R executeRequest(RequestSpec requestSpec, Class<R> responseType) {
   return executeRequest(requestSpec, PathParams.empty(), null, responseType, 200);
 }
Esempio n. 5
0
 private void executeRequest(RequestSpec requestSpec) {
   executeRequest(requestSpec, PathParams.empty(), null, Void.class, 200);
 }