Package com.github.tomakehurst.wiremock.global

Examples of com.github.tomakehurst.wiremock.global.RequestDelaySpec


public class SocketDelayTask implements AdminTask {

    @Override
    public ResponseDefinition execute(Admin admin, Request request) {
        RequestDelaySpec delaySpec = Json.read(request.getBodyAsString(), RequestDelaySpec.class);
        admin.addSocketAcceptDelay(delaySpec);
        return ResponseDefinition.ok();
    }
View Full Code Here


public class RequestDelaySpecTest {

    @Test
    public void canSerialiseToJson() {
        String json = Json.write(new RequestDelaySpec(500));
        assertJsonEquals("{ \"milliseconds\": 500 }", json);
    }
View Full Code Here

        assertJsonEquals("{ \"milliseconds\": 500 }", json);
    }

    @Test
    public void canDeserialiseFromJson() {
        RequestDelaySpec spec =
                Json.read("{ \"milliseconds\": 80 }", RequestDelaySpec.class);

        assertThat(spec.milliseconds(), is(80));
    }
View Full Code Here

    settings.setFixedDelay(milliseconds);
    admin.updateGlobalSettings(settings);
  }

    public void addDelayBeforeProcessingRequests(int milliseconds) {
        admin.addSocketAcceptDelay(new RequestDelaySpec(milliseconds));
    }
View Full Code Here

TOP

Related Classes of com.github.tomakehurst.wiremock.global.RequestDelaySpec

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.