use of com.mercedesbenz.sechub.integrationtest.internal.TestRestHelper in project sechub by mercedes-benz.
the class AsPDSUser method markJobAsReadyToStart.
public void markJobAsReadyToStart(UUID jobUUID) {
TestRestHelper restHelper = getRestHelper();
TestURLBuilder urlBuilder = getUrlBuilder();
markJobAsReadyToStart(jobUUID, restHelper, urlBuilder);
}
use of com.mercedesbenz.sechub.integrationtest.internal.TestRestHelper in project sechub by mercedes-benz.
the class AsPDSUser method createJobFor.
private String createJobFor(UUID sechubJobUUID, String productId, Map<String, String> params) {
TestRestHelper restHelper = getRestHelper();
TestURLBuilder urlBuilder = getUrlBuilder();
return createJobFor(sechubJobUUID, params, productId, restHelper, urlBuilder);
}
use of com.mercedesbenz.sechub.integrationtest.internal.TestRestHelper in project sechub by mercedes-benz.
the class DeveloperAdministration method createTestRestHelperWithErrorHandling.
private TestRestHelper createTestRestHelperWithErrorHandling(ErrorHandler provider, UserContext user, RestHelperTarget restHelperTarget) {
return new TestRestHelper(user, restHelperTarget) {
@Override
protected ResponseErrorHandler createErrorHandler() {
return new DefaultResponseErrorHandler() {
@Override
public void handleError(ClientHttpResponse response) throws IOException {
StringBuilder httpResponseProblem = new StringBuilder();
String statusText = response.getStatusText();
httpResponseProblem.append("status code::");
httpResponseProblem.append(response.getStatusCode());
if (statusText != null) {
httpResponseProblem.append(", text:");
httpResponseProblem.append(statusText);
}
try (BufferedReader br = new BufferedReader(new InputStreamReader(response.getBody(), "UTF-8"))) {
String line = null;
httpResponseProblem.append(",body:");
while ((line = br.readLine()) != null) {
httpResponseProblem.append("\n");
httpResponseProblem.append(line);
}
} catch (IOException e) {
provider.handleError("failed to read response body:" + e.getMessage());
}
StringBuilder errorOutput = new StringBuilder();
errorOutput.append("******************************************************************\n");
errorOutput.append("*** SENT ***\n");
errorOutput.append("******************************************************************\n");
errorOutput.append("Last URL call:").append(TestRestHelper.getLastUrl());
if (TestRestHelper.getLastData() != null) {
errorOutput.append("\nWith data:").append(TestRestHelper.getLastData());
}
errorOutput.append("\n");
errorOutput.append("******************************************************************\n");
errorOutput.append("*** RECEIVED ***\n");
errorOutput.append("******************************************************************\n");
errorOutput.append(httpResponseProblem).append("\n");
provider.handleError(errorOutput.toString());
}
};
}
};
}
Aggregations