Package com.github.tomakehurst.wiremock.testsupport

Examples of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient


  }

    public static void setupServer(Options options) {
        wireMockServer = new WireMockServer(options);
        wireMockServer.start();
        testClient = new WireMockTestClient();
        WireMock.configure();
    }
View Full Code Here


    targetServiceAdmin = new WireMock("localhost", TARGET_SERVICE_PORT);

        proxyingService = new WireMockServer(proxyingServiceOptions);
        proxyingService.start();
        proxyingServiceAdmin = new WireMock();
        testClient = new WireMockTestClient();
        WireMock.configure();
  }
View Full Code Here

    @Test
    public void canRunOnAnotherPortThan8080() {
        WireMockServer wireMockServer = createServer(wireMockConfig().port(8090));
        wireMockServer.start();
        WireMockTestClient wireMockClient = new WireMockTestClient(8090);

        wireMockClient.addResponse(MappingJsonSamples.BASIC_MAPPING_REQUEST_WITH_RESPONSE_HEADER);
        WireMockResponse response = wireMockClient.get("/a/registered/resource");
        assertThat(response.statusCode(), is(401));
    }
View Full Code Here

    FILE_SOURCE_ROOT.mkdirs();
   
    mappingsDirectory = new File(FILE_SOURCE_ROOT, MAPPINGS);
   
    runner = new WireMockServerRunner();
    testClient = new WireMockTestClient();
   
    WireMock.configure();
  }
View Full Code Here

    private WireMockServer proxy;
    private WireMockTestClient testClient;

    @Before
    public void addAResourceToProxy() {
        testClient = new WireMockTestClient(wireMockRule.port());

        proxy = new WireMockServer(wireMockConfig()
                .port(0)
                .enableBrowserProxying(true));
        proxy.start();
View Full Code Here

    }

    public static void assertCanRegisterStubAndFetchOnCorrectPort() {
        givenThat(get(urlEqualTo("/rule/test")).willReturn(aResponse().withBody("Rule test body")));

        WireMockTestClient testClient = new WireMockTestClient(8089);

        assertThat(testClient.get("/rule/test").content(), is("Rule test body"));
    }
View Full Code Here

    altServer.stop();
  }

  @Test
  public void useStaticSyntaxOnAlternativeHostAndPort() throws Exception {
    WireMockTestClient defaultTestClient = new WireMockTestClient(defaultServer.port());
    WireMockTestClient altTestClient = new WireMockTestClient(altServer.port());
   
    String thisHostName = InetAddress.getLocalHost().getHostName();
        WireMock.configureFor(thisHostName, altServer.port());
   
    givenThat(get(urlEqualTo("/resource/on/other/address"))
        .willReturn(aResponse()
          .withStatus(206)));
   
    assertThat(altTestClient.get("/resource/on/other/address").statusCode(), is(206));
    assertThat(defaultTestClient.get("/resource/on/other/address").statusCode(), is(404));
  }
View Full Code Here

  private WireMockServer wireMockServer;
  private WireMockTestClient testClient;

  @Before
  public void init() {
    testClient = new WireMockTestClient();
  }
View Full Code Here

    WebAppContext context = new WebAppContext("sample-war/src/main/webapp", "/wiremock");
    jetty.addHandler(context);
    jetty.start();
   
    WireMock.configureFor("localhost", 8085, "/wiremock");
    testClient = new WireMockTestClient(8085);
  }
View Full Code Here

            wireMockServer.stop();
        }
    }

    private void executeGetIn(String address) {
        WireMockTestClient wireMockClient = new WireMockTestClient(port, address);
        wireMockClient.addResponse(MappingJsonSamples.BASIC_MAPPING_REQUEST_WITH_RESPONSE_HEADER);
        WireMockResponse response = wireMockClient.get("/a/registered/resource");
        assertThat(response.statusCode(), is(401));
    }
View Full Code Here

TOP

Related Classes of com.github.tomakehurst.wiremock.testsupport.WireMockTestClient

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.