use of org.openclinica.ns.response.v31.Response in project buck by facebook.
the class HttpArtifactCacheTest method testFetchWrongKey.
@Test
public void testFetchWrongKey() throws Exception {
FakeProjectFilesystem filesystem = new FakeProjectFilesystem();
final RuleKey ruleKey = new RuleKey("00000000000000000000000000000000");
final RuleKey otherRuleKey = new RuleKey("11111111111111111111111111111111");
final String data = "data";
argsBuilder.setFetchClient(withMakeRequest(((path, requestBuilder) -> {
Request request = requestBuilder.url(SERVER + path).build();
Response response = new Response.Builder().request(request).protocol(Protocol.HTTP_1_1).code(HttpURLConnection.HTTP_OK).body(createResponseBody(ImmutableSet.of(otherRuleKey), ImmutableMap.of(), ByteSource.wrap(data.getBytes(Charsets.UTF_8)), data)).build();
return new OkHttpResponseWrapper(response);
})));
HttpArtifactCache cache = new HttpArtifactCache(argsBuilder.build());
Path output = Paths.get("output/file");
CacheResult result = cache.fetch(ruleKey, LazyPath.ofInstance(output));
assertEquals(CacheResultType.ERROR, result.getType());
assertEquals(Optional.empty(), filesystem.readFileIfItExists(output));
cache.close();
}
use of org.openclinica.ns.response.v31.Response in project Parse-SDK-Android by ParsePlatform.
the class ParseOkHttpClient method executeInternal.
@Override
/* package */
ParseHttpResponse executeInternal(ParseHttpRequest parseRequest) throws IOException {
Request okHttpRequest = getRequest(parseRequest);
Call okHttpCall = okHttpClient.newCall(okHttpRequest);
Response okHttpResponse = okHttpCall.execute();
return getResponse(okHttpResponse);
}
use of org.openclinica.ns.response.v31.Response in project BigImageViewer by Piasy.
the class GlideProgressSupport method createInterceptor.
private static Interceptor createInterceptor(final ResponseProgressListener listener) {
return new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
Response response = chain.proceed(request);
return response.newBuilder().body(new OkHttpProgressResponseBody(request.url(), response.body(), listener)).build();
}
};
}
use of org.openclinica.ns.response.v31.Response in project sonarqube by SonarSource.
the class HttpHeadersTest method verify_headers_of_js_provided_by_plugins.
@Test
public void verify_headers_of_js_provided_by_plugins() throws Exception {
Response response = call(orchestrator.getServer().getUrl() + "/static/uiextensionsplugin/extension.js");
verifySecurityHeaders(response);
verifyContentType(response, "application/javascript");
}
use of org.openclinica.ns.response.v31.Response in project sonarqube by SonarSource.
the class SsoAuthenticationTest method display_message_in_ui_but_not_in_log_when_unauthorized_exception.
@Test
public void display_message_in_ui_but_not_in_log_when_unauthorized_exception() throws Exception {
Response response = doCall("invalid login $", null, null, null);
assertThat(response.code()).isEqualTo(200);
assertThat(response.request().url().toString()).contains("sessions/unauthorized");
List<String> logsLines = FileUtils.readLines(orchestrator.getServer().getWebLogs(), UTF_8);
assertThat(logsLines).doesNotContain("org.sonar.server.exceptions.BadRequestException: Use only letters, numbers, and .-_@ please.");
USER_RULE.verifyUserDoesNotExist(USER_LOGIN);
}
Aggregations