use of com.sequenceiq.it.cloudbreak.testcase.mock.response.MockResponse in project cloudbreak by hortonworks.
the class DefaultResponseConfigure method thenReturn.
public T thenReturn(R retValue, String message, int statusCode, int times, String clss) {
if (!parameters.isEmpty()) {
throw new TestFailException("Mock thenReturn will not take into account url parameters.");
}
String crn = testDto.getCrn();
if (crn != null) {
pathVariable("mockUuid", crn);
}
String retType = clss;
if (retType == null && retValue != null) {
retType = retValue.getClass().getName();
}
MockResponse body = new MockResponse(retValue, message, getMethod().getHttpMethod().name(), getPath(), times, statusCode, retType);
executeQuery.executeConfigure(pathVariables(), body);
return testDto;
}
use of com.sequenceiq.it.cloudbreak.testcase.mock.response.MockResponse in project cloudbreak by hortonworks.
the class ExecuteQueryToMockInfrastructure method executeConfigure.
public void executeConfigure(Map<String, String> pathVariables, Function<WebTarget, WebTarget> decorateWebTarget, MockResponse body) {
String configuredPath = body.getPath();
for (Map.Entry<String, String> entry : pathVariables.entrySet()) {
configuredPath = configuredPath.replace("{" + entry.getKey() + "}", entry.getValue());
}
Invocation.Builder invocation = buildWebTarget("/configure", decorateWebTarget).request();
body.setPath(configuredPath);
try (Response ignore = invocation.post(Entity.json(body))) {
}
}
Aggregations