@Test public void makeRequestShouldHandleAPresentPayload() throws MalformedURLException { URL url = new URL("https: byte[] payload = "hello".getBytes(UTF_8); HTTPRequest expected = new HTTPRequest(url, PUT, FETCH_OPTIONS); expected.addHeader(new HTTPHeader("Content-Length", "5")); expected.addHeader(new HTTPHeader("Content-MD5", "XUFAKrxLKna5cZ2REBfFkg==")); expected.addHeader(new HTTPHeader("User-Agent", OauthRawGcsService.USER_AGENT_PRODUCT)); expected.setPayload(payload); assertHttpRequestEquals(expected, service.makeRequest(GCS_FILENAME, null, PUT, 30000, payload)); }
@VisibleForTesting HTTPRequest makeRequest(GcsFilename filename, @Nullable Map<String, String> queryStrings, HTTPMethod method, long timeoutMillis) { return makeRequest(filename, queryStrings, method, timeoutMillis, EMPTY_PAYLOAD); }
OauthRawGcsService implements RawGcsService { @VisibleForTesting HTTPRequest makeRequest(GcsFilename filename, @Nullable Map<String, String> queryStrings, HTTPMethod method, long timeoutMillis) { return makeRequest(filename, queryStrings, method, timeoutMillis, EMPTY_PAYLOAD); } }
OauthRawGcsService implements RawGcsService { @VisibleForTesting HTTPRequest makeRequest(GcsFilename filename, @Nullable Map<String, String> queryStrings, HTTPMethod method, long timeoutMillis) { return makeRequest(filename, queryStrings, method, timeoutMillis, EMPTY_PAYLOAD); } OauthRawGcsService(OAuthURLFetchService urlfetch, ImmutableSet<HTTPHeader> headers); }
OauthRawGcsService implements RawGcsService { @VisibleForTesting HTTPRequest makeRequest(GcsFilename filename, @Nullable Map<String, String> queryStrings, HTTPMethod method, long timeoutMillis) { return makeRequest(filename, queryStrings, method, timeoutMillis, EMPTY_PAYLOAD); } OauthRawGcsService(OAuthURLFetchService urlfetch, ImmutableSet<HTTPHeader> headers); @Override String toString(); @Override int getMaxWriteSizeByte(); @Override RawGcsCreationToken beginObjectCreation(
      GcsFilename filename, GcsFileOptions options, long timeoutMillis); @Override Future<RawGcsCreationToken> continueObjectCreationAsync(
      RawGcsCreationToken token, ByteBuffer chunk, long timeoutMillis); @Override void finishObjectCreation(RawGcsCreationToken token, ByteBuffer chunk, long timeoutMillis); @Override void putObject(GcsFilename filename, GcsFileOptions options, ByteBuffer content,
      long timeoutMillis); @Override boolean deleteObject(GcsFilename filename, long timeoutMillis); @Override Future<GcsFileMetadata> readObjectAsync(final ByteBuffer dst, final GcsFilename filename,
      long startOffsetBytes, long timeoutMillis); @Override GcsFileMetadata getObjectMetadata(GcsFilename filename, long timeoutMillis); @Override int getChunkSizeBytes(); @Override void composeObject(Iterable<String> source, GcsFilename dest, long timeoutMillis); @Override void copyObject(GcsFilename source, GcsFilename dest, GcsFileOptions fileOptions,
      long timeoutMillis); @Override ListItemBatch list(String bucket, String prefix, String delimiter, String marker,
      int maxResults,
      long timeoutMillis); }
OauthRawGcsService implements RawGcsService { @VisibleForTesting HTTPRequest makeRequest(GcsFilename filename, @Nullable Map<String, String> queryStrings, HTTPMethod method, long timeoutMillis) { return makeRequest(filename, queryStrings, method, timeoutMillis, EMPTY_PAYLOAD); } OauthRawGcsService(OAuthURLFetchService urlfetch, ImmutableSet<HTTPHeader> headers); @Override String toString(); @Override int getMaxWriteSizeByte(); @Override RawGcsCreationToken beginObjectCreation(
      GcsFilename filename, GcsFileOptions options, long timeoutMillis); @Override Future<RawGcsCreationToken> continueObjectCreationAsync(
      RawGcsCreationToken token, ByteBuffer chunk, long timeoutMillis); @Override void finishObjectCreation(RawGcsCreationToken token, ByteBuffer chunk, long timeoutMillis); @Override void putObject(GcsFilename filename, GcsFileOptions options, ByteBuffer content,
      long timeoutMillis); @Override boolean deleteObject(GcsFilename filename, long timeoutMillis); @Override Future<GcsFileMetadata> readObjectAsync(final ByteBuffer dst, final GcsFilename filename,
      long startOffsetBytes, long timeoutMillis); @Override GcsFileMetadata getObjectMetadata(GcsFilename filename, long timeoutMillis); @Override int getChunkSizeBytes(); @Override void composeObject(Iterable<String> source, GcsFilename dest, long timeoutMillis); @Override void copyObject(GcsFilename source, GcsFilename dest, GcsFileOptions fileOptions,
      long timeoutMillis); @Override ListItemBatch list(String bucket, String prefix, String delimiter, String marker,
      int maxResults,
      long timeoutMillis); static final String USER_AGENT_PRODUCT; static final List<String> OAUTH_SCOPES; static final int WRITE_LIMIT_BYTES; }