Skip to content

Commit 202dcb8

Browse files
committed
fix lint
1 parent 35da6cc commit 202dcb8

5 files changed

Lines changed: 53 additions & 43 deletions

File tree

java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/BigQueryImpl.java

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,7 @@ private static class ProjectPageFetcher implements NextPageFetcher<Project> {
7373
private final BigQueryOptions serviceOptions;
7474

7575
ProjectPageFetcher(
76-
BigQueryOptions serviceOptions,
77-
String cursor,
78-
Map<BigQueryRpc.Option, ?> optionMap) {
76+
BigQueryOptions serviceOptions, String cursor, Map<BigQueryRpc.Option, ?> optionMap) {
7977
this.requestOptions =
8078
PageImpl.nextRequestOptions(BigQueryRpc.Option.PAGE_TOKEN, cursor, optionMap);
8179
this.serviceOptions = serviceOptions;
@@ -351,25 +349,25 @@ && getOptions().getOpenTelemetryTracer() != null) {
351349
}
352350

353351
private static Page<Project> listProjects(
354-
final BigQueryOptions serviceOptions,
355-
final Map<BigQueryRpc.Option, ?> optionsMap) {
352+
final BigQueryOptions serviceOptions, final Map<BigQueryRpc.Option, ?> optionsMap) {
356353
Tuple<String, Iterable<ProjectList.Projects>> result =
357354
serviceOptions.getBigQueryRpcV2().listProjects(optionsMap);
358355
String nextPageToken = result.x();
359-
Iterable<Project> projects = Iterables.transform(
360-
result.y() != null ? result.y() : ImmutableList.<ProjectList.Projects>of(),
361-
projectPb -> new Project(
362-
projectPb.getId(),
363-
projectPb.getNumericId() != null ? String.valueOf(projectPb.getNumericId()) : null,
364-
projectPb.getProjectReference() != null ? projectPb.getProjectReference().getProjectId() : null,
365-
projectPb.getFriendlyName()
366-
)
367-
);
356+
Iterable<Project> projects =
357+
Iterables.transform(
358+
result.y() != null ? result.y() : ImmutableList.<ProjectList.Projects>of(),
359+
projectPb ->
360+
new Project(
361+
projectPb.getId(),
362+
projectPb.getNumericId() != null
363+
? String.valueOf(projectPb.getNumericId())
364+
: null,
365+
projectPb.getProjectReference() != null
366+
? projectPb.getProjectReference().getProjectId()
367+
: null,
368+
projectPb.getFriendlyName()));
368369
return new PageImpl<>(
369-
new ProjectPageFetcher(serviceOptions, nextPageToken, optionsMap),
370-
nextPageToken,
371-
projects
372-
);
370+
new ProjectPageFetcher(serviceOptions, nextPageToken, optionsMap), nextPageToken, projects);
373371
}
374372

375373
@Override

java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/Project.java

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@ public boolean equals(Object o) {
5757
if (this == o) return true;
5858
if (o == null || getClass() != o.getClass()) return false;
5959
Project project = (Project) o;
60-
return Objects.equals(id, project.id) &&
61-
Objects.equals(numericId, project.numericId) &&
62-
Objects.equals(projectId, project.projectId) &&
63-
Objects.equals(friendlyName, project.friendlyName);
60+
return Objects.equals(id, project.id)
61+
&& Objects.equals(numericId, project.numericId)
62+
&& Objects.equals(projectId, project.projectId)
63+
&& Objects.equals(friendlyName, project.friendlyName);
6464
}
6565

6666
@Override
@@ -70,11 +70,19 @@ public int hashCode() {
7070

7171
@Override
7272
public String toString() {
73-
return "Project{" +
74-
"id='" + id + '\'' +
75-
", numericId='" + numericId + '\'' +
76-
", projectId='" + projectId + '\'' +
77-
", friendlyName='" + friendlyName + '\'' +
78-
'}';
73+
return "Project{"
74+
+ "id='"
75+
+ id
76+
+ '\''
77+
+ ", numericId='"
78+
+ numericId
79+
+ '\''
80+
+ ", projectId='"
81+
+ projectId
82+
+ '\''
83+
+ ", friendlyName='"
84+
+ friendlyName
85+
+ '\''
86+
+ '}';
7987
}
8088
}

java-bigquery/google-cloud-bigquery/src/main/java/com/google/cloud/bigquery/spi/v2/HttpBigQueryRpc.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
import com.google.api.services.bigquery.model.Model;
5151
import com.google.api.services.bigquery.model.ModelReference;
5252
import com.google.api.services.bigquery.model.Policy;
53+
import com.google.api.services.bigquery.model.ProjectList;
5354
import com.google.api.services.bigquery.model.QueryRequest;
5455
import com.google.api.services.bigquery.model.QueryResponse;
55-
import com.google.api.services.bigquery.model.ProjectList;
5656
import com.google.api.services.bigquery.model.Routine;
5757
import com.google.api.services.bigquery.model.RoutineReference;
5858
import com.google.api.services.bigquery.model.SetIamPolicyRequest;
@@ -275,7 +275,9 @@ public Tuple<String, Iterable<ProjectList.Projects>> listProjects(Map<Option, ?>
275275
if (pageToken != null) {
276276
request.setPageToken(pageToken);
277277
}
278-
request.getRequestHeaders().set("x-goog-otel-enabled", this.options.isOpenTelemetryTracingEnabled());
278+
request
279+
.getRequestHeaders()
280+
.set("x-goog-otel-enabled", this.options.isOpenTelemetryTracingEnabled());
279281

280282
String gcpResourceDestinationId = RESOURCE_PROJECT_PREFIX + this.options.getProjectId();
281283

java-bigquery/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/BigQueryImplTest.java

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import static org.mockito.Mockito.times;
3636
import static org.mockito.Mockito.verify;
3737
import static org.mockito.Mockito.when;
38-
import java.math.BigInteger;
3938

4039
import com.google.api.gax.paging.Page;
4140
import com.google.api.services.bigquery.model.ErrorProto;
@@ -783,16 +782,18 @@ void testListDatasetsWithOptions() throws IOException {
783782
@Test
784783
void testListProjects() {
785784
bigquery = options.getService();
786-
ProjectList.Projects p1 = new ProjectList.Projects()
787-
.setId("id1")
788-
.setNumericId(BigInteger.valueOf(111L))
789-
.setProjectReference(new ProjectReference().setProjectId("p-1"))
790-
.setFriendlyName("fn1");
791-
ProjectList.Projects p2 = new ProjectList.Projects()
792-
.setId("id2")
793-
.setNumericId(BigInteger.valueOf(222L))
794-
.setProjectReference(new ProjectReference().setProjectId("p-2"))
795-
.setFriendlyName("fn2");
785+
ProjectList.Projects p1 =
786+
new ProjectList.Projects()
787+
.setId("id1")
788+
.setNumericId(BigInteger.valueOf(111L))
789+
.setProjectReference(new ProjectReference().setProjectId("p-1"))
790+
.setFriendlyName("fn1");
791+
ProjectList.Projects p2 =
792+
new ProjectList.Projects()
793+
.setId("id2")
794+
.setNumericId(BigInteger.valueOf(222L))
795+
.setProjectReference(new ProjectReference().setProjectId("p-2"))
796+
.setFriendlyName("fn2");
796797
ImmutableList<ProjectList.Projects> projectsPb = ImmutableList.of(p1, p2);
797798
Tuple<String, Iterable<ProjectList.Projects>> result = Tuple.of(CURSOR, projectsPb);
798799

@@ -804,7 +805,7 @@ void testListProjects() {
804805
Project expected1 = new Project("id1", "111", "p-1", "fn1");
805806
Project expected2 = new Project("id2", "222", "p-2", "fn2");
806807
assertArrayEquals(
807-
new Project[]{expected1, expected2}, Iterables.toArray(page.getValues(), Project.class));
808+
new Project[] {expected1, expected2}, Iterables.toArray(page.getValues(), Project.class));
808809
verify(bigqueryRpcMock).listProjects(EMPTY_RPC_OPTIONS);
809810
}
810811

java-bigquery/google-cloud-bigquery/src/test/java/com/google/cloud/bigquery/spi/v2/HttpBigQueryRpcTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ public void testListProjects() throws Exception {
289289
options.put(BigQueryRpc.Option.MAX_RESULTS, 10L);
290290
options.put(BigQueryRpc.Option.PAGE_TOKEN, "token1");
291291

292-
com.google.cloud.Tuple<String, Iterable<ProjectList.Projects>> result = rpc.listProjects(options);
292+
com.google.cloud.Tuple<String, Iterable<ProjectList.Projects>> result =
293+
rpc.listProjects(options);
293294

294295
verifyRequest("GET", "/projects?maxResults=10&pageToken=token1");
295296
assertEquals("token2", result.x());

0 commit comments

Comments
 (0)