@When("^the client performs (.+) request on \"(.+)\"$") public void perform_Http_Request(String httpMethod, String url) throws Throwable { facade.setResponsePrefix(""); facade.doRequest(httpMethod, url); } }
@When("^the query is executed$") public void execute_Query() throws Throwable { String contentType = ContentType.JSON.toString(); requestFacade.accept(contentType); requestFacade.contentType(contentType); responseFacade.setResponsePrefix("data."); responseFacade.doRequest("POST", ""); } }
public void doRequest(String httpMethod, final String url) throws Exception { final HttpMethod method = HttpMethod.parse(httpMethod); // TODO: Should be refactored into CukesHttpPlugin boolean filterEnabled = world.getBoolean(CukesOptions.LOADRUNNER_FILTER_BLOCKS_REQUESTS); AwaitCondition awaitCondition = specification.awaitCondition(); try { if (awaitCondition != null && !filterEnabled) { int intervalTime = awaitCondition.getInterval().getValue(); TimeUnit intervalUnit = awaitCondition.getInterval().getUnitDict().getTimeUnit(); int waitTime = awaitCondition.getWaitTime().getValue(); TimeUnit unit = awaitCondition.getWaitTime().getUnitDict().getTimeUnit(); // TODO Fix Awaitility.with().pollInterval(intervalTime, intervalUnit) .await() .atMost(waitTime, unit) .until(doRequest(url, method), new AwaitConditionMatcher(awaitCondition)); } else { doRequest(url, method).call(); } } catch (RuntimeException e) { if (!expectException) { throw e; } exception = e; } specification.initNewSpecification(); }
public void doRequest(String httpMethod, final String url) throws Exception { final HttpMethod method = HttpMethod.parse(httpMethod); // TODO: Should be refactored into CukesHttpPlugin boolean filterEnabled = world.getBoolean(CukesOptions.LOADRUNNER_FILTER_BLOCKS_REQUESTS); AwaitCondition awaitCondition = specification.awaitCondition(); try { if (awaitCondition != null && !filterEnabled) { int intervalTime = awaitCondition.getInterval().getValue(); TimeUnit intervalUnit = awaitCondition.getInterval().getUnitDict().getTimeUnit(); int waitTime = awaitCondition.getWaitTime().getValue(); TimeUnit unit = awaitCondition.getWaitTime().getUnitDict().getTimeUnit(); // TODO Fix Awaitility.with().pollInterval(intervalTime, intervalUnit) .await() .atMost(waitTime, unit) .until(doRequest(url, method), new AwaitConditionMatcher(awaitCondition)); } else { doRequest(url, method).call(); } } catch (RuntimeException e) { if (!expectException) { throw e; } exception = e; } specification.initNewSpecification(); }