コード例 #1
0
  @Bean
  @Primary
  public WireMockServer wireMockServer() {
    WireMockServer wireMockServer =
        new WireMockServer(
            wireMockConfig()
                .port(MOCK_SERVER_PORT)); // No-args constructor will start on port 8080, no HTTPS
    wireMockServer.start();
    WireMock.configureFor(MOCK_SERVER_PORT);

    return wireMockServer;
  }
コード例 #2
0
ファイル: ListCoursesSteps.java プロジェクト: tieSari/tmc-cli
 private void startWireMock() {
   wireMockServer = new WireMockServer();
   wireMockServer.start();
   wireMockServer.stubFor(
       get(urlEqualTo("/user"))
           .withHeader("Authorization", containing("Basic dGVzdDoxMjM0"))
           .willReturn(aResponse().withStatus(200)));
   wireMockServer.stubFor(
       get(urlEqualTo(coursesExtension.toString()))
           .withHeader("Authorization", containing("Basic dGVzdDoxMjM0"))
           .willReturn(
               aResponse()
                   .withStatus(200)
                   .withHeader("Content-Type", "application/json")
                   .withBody(ExampleJson.allCoursesExample)));
 }
コード例 #3
0
 @Override
 public void stop() {
   server.stop();
 }
コード例 #4
0
ファイル: ListCoursesSteps.java プロジェクト: tieSari/tmc-cli
 /** Shuts down the server and WireMock after scenario. */
 @After
 public void closeServer() throws IOException {
   tmcCli.stopServer();
   wireMockServer.stop();
   new File(new ConfigHandler().getConfigFilePath()).delete();
 }
コード例 #5
0
 @Override
 public void start() {
   configureFor("localhost", port);
   server.start();
 }