Skip to content

Commit

Permalink
Fix codacy and spacing bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ajay Kannan committed Feb 10, 2016
1 parent 4d8d986 commit 9d201a0
Show file tree
Hide file tree
Showing 8 changed files with 91 additions and 91 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ public class InsertAllRequest implements Serializable {
* id used by BigQuery to detect duplicate insertion requests on a best-effort basis.
*
* <p>Example usage of creating a row to insert:
* <pre> {@code
* List<Long> repeatedFieldValue = Arrays.asList(1L, 2L);
* Map<String, Object> recordContent = new HashMap<String, Object>();
* recordContent.put("subfieldName1", "value");
* recordContent.put("subfieldName2", repeatedFieldValue);
* Map<String, Object> rowContent = new HashMap<String, Object>();
* rowContent.put("fieldName1", true);
* rowContent.put("fieldName2", recordContent);
* RowToInsert row = new RowToInsert("rowId", rowContent);
* <pre> {@code
* List<Long> repeatedFieldValue = Arrays.asList(1L, 2L);
* Map<String, Object> recordContent = new HashMap<String, Object>();
* recordContent.put("subfieldName1", "value");
* recordContent.put("subfieldName2", repeatedFieldValue);
* Map<String, Object> rowContent = new HashMap<String, Object>();
* rowContent.put("fieldName1", true);
* rowContent.put("fieldName2", recordContent);
* RowToInsert row = new RowToInsert("rowId", rowContent);
* }</pre>
*
* @see <a href ="https://cloud.google.com/bigquery/streaming-data-into-bigquery#dataconsistency">
Expand Down Expand Up @@ -177,16 +177,16 @@ public Builder addRow(RowToInsert rowToInsert) {
* Adds a row to be inserted with associated id.
*
* <p>Example usage of adding a row with associated id:
* <pre> {@code
* InsertAllRequest.Builder builder = InsertAllRequest.builder(tableId);
* List<Long> repeatedFieldValue = Arrays.asList(1L, 2L);
* Map<String, Object> recordContent = new HashMap<String, Object>();
* recordContent.put("subfieldName1", "value");
* recordContent.put("subfieldName2", repeatedFieldValue);
* Map<String, Object> rowContent = new HashMap<String, Object>();
* rowContent.put("fieldName1", true);
* rowContent.put("fieldName2", recordContent);
* builder.addRow("rowId", rowContent);
* <pre> {@code
* InsertAllRequest.Builder builder = InsertAllRequest.builder(tableId);
* List<Long> repeatedFieldValue = Arrays.asList(1L, 2L);
* Map<String, Object> recordContent = new HashMap<String, Object>();
* recordContent.put("subfieldName1", "value");
* recordContent.put("subfieldName2", repeatedFieldValue);
* Map<String, Object> rowContent = new HashMap<String, Object>();
* rowContent.put("fieldName1", true);
* rowContent.put("fieldName2", recordContent);
* builder.addRow("rowId", rowContent);
* }</pre>
*/
public Builder addRow(String id, Map<String, Object> content) {
Expand All @@ -198,16 +198,16 @@ public Builder addRow(String id, Map<String, Object> content) {
* Adds a row to be inserted without an associated id.
*
* <p>Example usage of adding a row without an associated id:
* <pre> {@code
* InsertAllRequest.Builder builder = InsertAllRequest.builder(tableId);
* List<Long> repeatedFieldValue = Arrays.asList(1L, 2L);
* Map<String, Object> recordContent = new HashMap<String, Object>();
* recordContent.put("subfieldName1", "value");
* recordContent.put("subfieldName2", repeatedFieldValue);
* Map<String, Object> rowContent = new HashMap<String, Object>();
* rowContent.put("fieldName1", true);
* rowContent.put("fieldName2", recordContent);
* builder.addRow(rowContent);
* <pre> {@code
* InsertAllRequest.Builder builder = InsertAllRequest.builder(tableId);
* List<Long> repeatedFieldValue = Arrays.asList(1L, 2L);
* Map<String, Object> recordContent = new HashMap<String, Object>();
* recordContent.put("subfieldName1", "value");
* recordContent.put("subfieldName2", repeatedFieldValue);
* Map<String, Object> rowContent = new HashMap<String, Object>();
* rowContent.put("fieldName1", true);
* rowContent.put("fieldName2", recordContent);
* builder.addRow(rowContent);
* }</pre>
*/
public Builder addRow(Map<String, Object> content) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,26 +35,26 @@
* {@link QueryResponse#jobCompleted()} returns {@code true}.
*
* <p>Example usage of a query request:
* <pre> {@code
* // Substitute "field", "table" and "dataset" with real field, table and dataset identifiers
* QueryRequest request = QueryRequest.builder("SELECT field FROM table")
* .defaultDataset(DatasetId.of("dataset"))
* .maxWaitTime(60000L)
* .maxResults(1000L)
* .build();
* QueryResponse response = bigquery.query(request);
* while (!response.jobCompleted()) {
* Thread.sleep(1000);
* response = bigquery.getQueryResults(response.jobId());
* }
* List<BigQueryError> executionErrors = response.executionErrors();
* // look for errors in executionErrors
* QueryResult result = response.result();
* Iterator<List<FieldValue>> rowIterator = result.iterateAll();
* while(rowIterator.hasNext()) {
* List<FieldValue> row = rowIterator.next();
* // do something with row
* }
* <pre> {@code
* // Substitute "field", "table" and "dataset" with real field, table and dataset identifiers
* QueryRequest request = QueryRequest.builder("SELECT field FROM table")
* .defaultDataset(DatasetId.of("dataset"))
* .maxWaitTime(60000L)
* .maxResults(1000L)
* .build();
* QueryResponse response = bigquery.query(request);
* while (!response.jobCompleted()) {
* Thread.sleep(1000);
* response = bigquery.getQueryResults(response.jobId());
* }
* List<BigQueryError> executionErrors = response.executionErrors();
* // look for errors in executionErrors
* QueryResult result = response.result();
* Iterator<List<FieldValue>> rowIterator = result.iterateAll();
* while(rowIterator.hasNext()) {
* List<FieldValue> row = rowIterator.next();
* // do something with row
* }
* }</pre>
*
* @see <a href="https://cloud.google.com/bigquery/docs/reference/v2/jobs/query">Query</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@
* Query Request ({@link BigQuery#query(QueryRequest)}).
*
* <p>Example usage of a query response:
* <pre> {@code
* QueryResponse response = bigquery.query(request);
* while (!response.jobCompleted()) {
* Thread.sleep(1000);
* response = bigquery.getQueryResults(response.jobId());
* }
* List<BigQueryError> executionErrors = response.executionErrors();
* // look for errors in executionErrors
* QueryResult result = response.result();
* Iterator<List<FieldValue>> rowIterator = result.iterateAll();
* while(rowIterator.hasNext()) {
* List<FieldValue> row = rowIterator.next();
* // do something with row
* }
* <pre> {@code
* QueryResponse response = bigquery.query(request);
* while (!response.jobCompleted()) {
* Thread.sleep(1000);
* response = bigquery.getQueryResults(response.jobId());
* }
* List<BigQueryError> executionErrors = response.executionErrors();
* // look for errors in executionErrors
* QueryResult result = response.result();
* Iterator<List<FieldValue>> rowIterator = result.iterateAll();
* while(rowIterator.hasNext()) {
* List<FieldValue> row = rowIterator.next();
* // do something with row
* }
* }</pre>
*
* @see <a href="https://cloud.google.com/bigquery/docs/reference/v2/jobs/getQueryResults">Get Query
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,10 +197,9 @@ public static void afterClass() throws ExecutionException, InterruptedException
if (bigquery != null) {
RemoteBigQueryHelper.forceDelete(bigquery, DATASET);
}
if (storage != null && !RemoteGcsHelper.forceDelete(storage, BUCKET, 10, TimeUnit.SECONDS)) {
if (LOG.isLoggable(Level.WARNING)) {
LOG.log(Level.WARNING, "Deletion of bucket {0} timed out, bucket is not empty", BUCKET);
}
if (storage != null && !RemoteGcsHelper.forceDelete(storage, BUCKET, 10, TimeUnit.SECONDS)
&& LOG.isLoggable(Level.WARNING)) {
LOG.log(Level.WARNING, "Deletion of bucket {0} timed out, bucket is not empty", BUCKET);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,8 +351,8 @@ public Blob reload(BlobSourceOption... options) {
* </p>
*
* <p>Example usage of replacing blob's metadata:
* <pre> {@code blob.toBuilder().metadata(null).build().update();}
* {@code blob.toBuilder().metadata(newMetadata).build().update();}
* <pre> {@code blob.toBuilder().metadata(null).build().update();}
* {@code blob.toBuilder().metadata(newMetadata).build().update();}
* </pre>
*
* @param options update options
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,10 @@ public class CopyWriter implements Restorable<CopyWriter> {
* is {@code false} will block until all pending chunks are copied.
*
* <p>This method has the same effect of doing:
* <pre> {@code while (!copyWriter.isDone()) {
* copyWriter.copyChunk();
* }}
* <pre> {@code
* while (!copyWriter.isDone()) {
* copyWriter.copyChunk();
* }}
* </pre>
*
* @throws StorageException upon failure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1300,8 +1300,8 @@ private static void checkContentType(BlobInfo blobInfo) throws IllegalArgumentEx
* can be done by setting the provided {@code blobInfo}'s metadata to {@code null}.
*
* <p>Example usage of replacing blob's metadata:
* <pre> {@code service.update(BlobInfo.builder("bucket", "name").metadata(null).build());}
* {@code service.update(BlobInfo.builder("bucket", "name").metadata(newMetadata).build());}
* <pre> {@code service.update(BlobInfo.builder("bucket", "name").metadata(null).build());}
* {@code service.update(BlobInfo.builder("bucket", "name").metadata(newMetadata).build());}
* </pre>
*
* @return the updated blob
Expand All @@ -1315,8 +1315,8 @@ private static void checkContentType(BlobInfo blobInfo) throws IllegalArgumentEx
* can be done by setting the provided {@code blobInfo}'s metadata to {@code null}.
*
* <p>Example usage of replacing blob's metadata:
* <pre> {@code service.update(BlobInfo.builder("bucket", "name").metadata(null).build());}
* {@code service.update(BlobInfo.builder("bucket", "name").metadata(newMetadata).build());}
* <pre> {@code service.update(BlobInfo.builder("bucket", "name").metadata(null).build());}
* {@code service.update(BlobInfo.builder("bucket", "name").metadata(newMetadata).build());}
* </pre>
*
* @return the updated blob
Expand Down Expand Up @@ -1373,14 +1373,15 @@ private static void checkContentType(BlobInfo blobInfo) throws IllegalArgumentEx
* might issue multiple RPC calls depending on blob's size.
*
* <p>Example usage of copy:
* <pre> {@code BlobInfo blob = service.copy(copyRequest).result();}
* <pre> {@code BlobInfo blob = service.copy(copyRequest).result();}
* </pre>
* To explicitly issue chunk copy requests use {@link CopyWriter#copyChunk()} instead:
* <pre> {@code CopyWriter copyWriter = service.copy(copyRequest);
* while (!copyWriter.isDone()) {
* copyWriter.copyChunk();
* }
* BlobInfo blob = copyWriter.result();
* <pre> {@code
* CopyWriter copyWriter = service.copy(copyRequest);
* while (!copyWriter.isDone()) {
* copyWriter.copyChunk();
* }
* BlobInfo blob = copyWriter.result();
* }
* </pre>
*
Expand Down Expand Up @@ -1462,8 +1463,8 @@ private static void checkContentType(BlobInfo blobInfo) throws IllegalArgumentEx
* accessible blobs, but don't want to require users to explicitly log in.
*
* <p>Example usage of creating a signed URL that is valid for 2 weeks:
* <pre> {@code
* service.signUrl(BlobInfo.builder("bucket", "name").build(), 14, TimeUnit.DAYS);
* <pre> {@code
* service.signUrl(BlobInfo.builder("bucket", "name").build(), 14, TimeUnit.DAYS);
* }</pre>
*
* @param blobInfo the blob associated with the signed URL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,9 @@ public static void beforeClass() {

@AfterClass
public static void afterClass() throws ExecutionException, InterruptedException {
if (storage != null && !RemoteGcsHelper.forceDelete(storage, BUCKET, 5, TimeUnit.SECONDS)) {
if (log.isLoggable(Level.WARNING)) {
log.log(Level.WARNING, "Deletion of bucket {0} timed out, bucket is not empty", BUCKET);
}
if (storage != null && !RemoteGcsHelper.forceDelete(storage, BUCKET, 5, TimeUnit.SECONDS)
&& log.isLoggable(Level.WARNING)) {
log.log(Level.WARNING, "Deletion of bucket {0} timed out, bucket is not empty", BUCKET);
}
}

Expand Down Expand Up @@ -442,15 +441,15 @@ public void testUpdateBlobFail() {
@Test
public void testDeleteNonExistingBlob() {
String blobName = "test-delete-non-existing-blob";
assertTrue(!storage.delete(BUCKET, blobName));
assertFalse(storage.delete(BUCKET, blobName));
}

@Test
public void testDeleteBlobNonExistingGeneration() {
String blobName = "test-delete-blob-non-existing-generation";
BlobInfo blob = BlobInfo.builder(BUCKET, blobName).build();
assertNotNull(storage.create(blob));
assertTrue(!storage.delete(BlobId.of(BUCKET, blobName, -1L)));
assertFalse(storage.delete(BlobId.of(BUCKET, blobName, -1L)));
}

@Test
Expand Down Expand Up @@ -966,7 +965,7 @@ public void testDeleteBlobsFail() {
assertNotNull(storage.create(sourceBlob1));
List<Boolean> deleteStatus = storage.delete(sourceBlob1.blobId(), sourceBlob2.blobId());
assertTrue(deleteStatus.get(0));
assertTrue(!deleteStatus.get(1));
assertFalse(deleteStatus.get(1));
}

@Test
Expand Down

0 comments on commit 9d201a0

Please sign in to comment.