Skip to content

Commit 7564437

Browse files
committed
cleanup: fix lint errors
1 parent 8bf47af commit 7564437

26 files changed

+86
-77
lines changed

retail/interactive-tutorials/src/main/java/events/setup/EventsCreateBigQueryTable.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@
3232
public class EventsCreateBigQueryTable {
3333

3434
public static void main(String[] args) throws IOException {
35-
String dataset = "user_events";
36-
String validEventsTable = "events";
37-
String invalidEventsTable = "events_some_invalid";
38-
String eventsSchemaFilePath = "src/main/resources/events_schema.json";
35+
final String dataset = "user_events";
36+
final String validEventsTable = "events";
37+
final String invalidEventsTable = "events_some_invalid";
38+
final String eventsSchemaFilePath = "src/main/resources/events_schema.json";
3939
// user_events.json and user_events_some_invalid.json are located in the resources folder
40-
String validEventsSourceFile =
40+
final String validEventsSourceFile =
4141
ProductsCreateBigqueryTable.class.getResource("/user_events.json").getPath();
42-
String invalidEventsSourceFile =
42+
final String invalidEventsSourceFile =
4343
ProductsCreateBigqueryTable.class.getResource("/user_events_some_invalid.json").getPath();
4444

4545
BufferedReader bufferedReader = new BufferedReader(new FileReader(eventsSchemaFilePath));

retail/interactive-tutorials/src/main/java/events/setup/RemoveEventsResources.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,13 @@
2121

2222
import com.google.api.gax.rpc.PermissionDeniedException;
2323
import com.google.cloud.ServiceOptions;
24-
import com.google.cloud.retail.v2.*;
24+
import com.google.cloud.retail.v2.DeleteProductRequest;
25+
import com.google.cloud.retail.v2.ListProductsRequest;
26+
import com.google.cloud.retail.v2.Product;
27+
import com.google.cloud.retail.v2.ProductServiceClient;
2528
import com.google.cloud.retail.v2.ProductServiceClient.ListProductsPagedResponse;
29+
import com.google.cloud.retail.v2.PurgeUserEventsRequest;
30+
import com.google.cloud.retail.v2.UserEventServiceClient;
2631
import java.io.IOException;
2732

2833
public class RemoveEventsResources {

retail/interactive-tutorials/src/main/java/product/ImportProductsGcs.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ public static void main(String[] args) throws IOException, InterruptedException
5151
String gcsErrorBucket = String.format("%s/errors", gcsBucket);
5252

5353
// To check error handling, use an invalid catalog in request
54-
// branchName =
55-
// String.format("projects/%s/locations/global/catalogs/invalid_catalog/branches/default_branch", projectId);
54+
// branchName = String.format(
55+
// "projects/%s/locations/global/catalogs/invalid_catalog/branches/default_branch", projectId);
5656

5757
String gcsProductsObject = "products.json";
5858
// To check error handling, use an invalid product JSON.

retail/interactive-tutorials/src/main/java/product/SetInventory.java

+5-1
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,12 @@
2121
import static setup.SetupCleanup.getProduct;
2222

2323
import com.google.cloud.ServiceOptions;
24-
import com.google.cloud.retail.v2.*;
24+
import com.google.cloud.retail.v2.FulfillmentInfo;
25+
import com.google.cloud.retail.v2.PriceInfo;
26+
import com.google.cloud.retail.v2.Product;
2527
import com.google.cloud.retail.v2.Product.Availability;
28+
import com.google.cloud.retail.v2.ProductServiceClient;
29+
import com.google.cloud.retail.v2.SetInventoryRequest;
2630
import com.google.protobuf.FieldMask;
2731
import com.google.protobuf.Int32Value;
2832
import java.io.IOException;

retail/interactive-tutorials/src/main/java/product/setup/ProductsCreateBigqueryTable.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@
3131
public class ProductsCreateBigqueryTable {
3232

3333
public static void main(String[] args) throws IOException {
34-
String dataset = "products";
35-
String validProductsTable = "products";
36-
String invalidProductsTable = "products_some_invalid";
37-
String productSchemaFilePath = "src/main/resources/product_schema.json";
38-
String validProductsSourceFile =
34+
final String dataset = "products";
35+
final String validProductsTable = "products";
36+
final String invalidProductsTable = "products_some_invalid";
37+
final String productSchemaFilePath = "src/main/resources/product_schema.json";
38+
final String validProductsSourceFile =
3939
ProductsCreateBigqueryTable.class.getResource("/products.json").getPath();
40-
String invalidProductsSourceFile =
40+
final String invalidProductsSourceFile =
4141
ProductsCreateBigqueryTable.class.getResource("/products_some_invalid.json").getPath();
4242

4343
BufferedReader bufferedReader = new BufferedReader(new FileReader(productSchemaFilePath));

retail/interactive-tutorials/src/test/java/events/ImportUserEventsGcsTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,11 @@ public class ImportUserEventsGcsTest {
4040
public void setUp() throws IOException, InterruptedException {
4141
EventsCreateGcsBucket.main();
4242

43-
String projectId = ServiceOptions.getDefaultProjectId();
44-
String defaultCatalog =
43+
final String projectId = ServiceOptions.getDefaultProjectId();
44+
final String defaultCatalog =
4545
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
46-
String bucketName = EventsCreateGcsBucket.getBucketName();
47-
String gcsEventsObject = "user_events.json";
46+
final String bucketName = EventsCreateGcsBucket.getBucketName();
47+
final String gcsEventsObject = "user_events.json";
4848
bout = new ByteArrayOutputStream();
4949
PrintStream out = new PrintStream(bout);
5050
originalPrintStream = System.out;

retail/interactive-tutorials/src/test/java/events/ImportUserEventsInlineTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ public class ImportUserEventsInlineTest {
3737

3838
@Before
3939
public void setUp() throws IOException, ExecutionException, InterruptedException {
40-
String projectId = ServiceOptions.getDefaultProjectId();
41-
String defaultCatalog =
40+
final String projectId = ServiceOptions.getDefaultProjectId();
41+
final String defaultCatalog =
4242
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
4343
bout = new ByteArrayOutputStream();
4444
PrintStream out = new PrintStream(bout);

retail/interactive-tutorials/src/test/java/events/PurgeUserEventTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ public class PurgeUserEventTest {
3838

3939
@Before
4040
public void setUp() throws IOException, InterruptedException, ExecutionException {
41-
String projectId = ServiceOptions.getDefaultProjectId();
42-
String defaultCatalog =
41+
final String projectId = ServiceOptions.getDefaultProjectId();
42+
final String defaultCatalog =
4343
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
44-
String visitorId = UUID.randomUUID().toString();
44+
final String visitorId = UUID.randomUUID().toString();
4545
bout = new ByteArrayOutputStream();
4646
PrintStream out = new PrintStream(bout);
4747
originalPrintStream = System.out;

retail/interactive-tutorials/src/test/java/events/RejoinUserEventTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ public class RejoinUserEventTest {
3838

3939
@Before
4040
public void setUp() throws IOException, InterruptedException, ExecutionException {
41-
String projectId = ServiceOptions.getDefaultProjectId();
42-
String defaultCatalog =
41+
final String projectId = ServiceOptions.getDefaultProjectId();
42+
final String defaultCatalog =
4343
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
44-
String visitorId = UUID.randomUUID().toString();
44+
final String visitorId = UUID.randomUUID().toString();
4545
bout = new ByteArrayOutputStream();
4646
PrintStream out = new PrintStream(bout);
4747
originalPrintStream = System.out;

retail/interactive-tutorials/src/test/java/events/WriteUserEventTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ public class WriteUserEventTest {
3838

3939
@Before
4040
public void setUp() throws IOException, InterruptedException, ExecutionException {
41-
String projectId = ServiceOptions.getDefaultProjectId();
42-
String defaultCatalog =
41+
final String projectId = ServiceOptions.getDefaultProjectId();
42+
final String defaultCatalog =
4343
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
44-
String visitorId = UUID.randomUUID().toString();
44+
final String visitorId = UUID.randomUUID().toString();
4545
bout = new ByteArrayOutputStream();
4646
PrintStream out = new PrintStream(bout);
4747
originalPrintStream = System.out;

retail/interactive-tutorials/src/test/java/product/AddFulfillmentPlacesTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ public class AddFulfillmentPlacesTest {
4343
@Before
4444
public void setUp() throws IOException, InterruptedException, ExecutionException {
4545
// TODO(developer): Replace these variables before running the sample.
46-
String projectId = ServiceOptions.getDefaultProjectId();
47-
String generatedProductId = UUID.randomUUID().toString();
48-
String productName =
46+
final String projectId = ServiceOptions.getDefaultProjectId();
47+
final String generatedProductId = UUID.randomUUID().toString();
48+
final String productName =
4949
String.format(
5050
"projects/%s/locations/global/catalogs/default_catalog/branches/0/products/%s",
5151
projectId, generatedProductId);

retail/interactive-tutorials/src/test/java/product/CrudProductTest.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ public class CrudProductTest {
4343

4444
@Before
4545
public void setUp() throws IOException, InterruptedException, ExecutionException {
46-
String projectId = ServiceOptions.getDefaultProjectId();
47-
String generatedProductId = UUID.randomUUID().toString();
48-
String branchName =
46+
final String projectId = ServiceOptions.getDefaultProjectId();
47+
final String generatedProductId = UUID.randomUUID().toString();
48+
final String branchName =
4949
String.format(
5050
"projects/%s/locations/global/catalogs/default_catalog/branches/0", projectId);
51-
String productName = String.format("%s/products/%s", branchName, generatedProductId);
51+
final String productName = String.format("%s/products/%s", branchName, generatedProductId);
5252
bout = new ByteArrayOutputStream();
5353
PrintStream out = new PrintStream(bout);
5454
originalPrintStream = System.out;

retail/interactive-tutorials/src/test/java/product/DeleteProductTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public class DeleteProductTest {
3939

4040
@Before
4141
public void setUp() throws IOException, InterruptedException, ExecutionException {
42-
String generatedProductId = UUID.randomUUID().toString();
42+
final String generatedProductId = UUID.randomUUID().toString();
4343
bout = new ByteArrayOutputStream();
4444
PrintStream out = new PrintStream(bout);
4545
originalPrintStream = System.out;

retail/interactive-tutorials/src/test/java/product/GetProductTest.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public class GetProductTest {
4141

4242
@Before
4343
public void setUp() throws IOException, InterruptedException, ExecutionException {
44-
String generatedProductId = UUID.randomUUID().toString();
44+
final String generatedProductId = UUID.randomUUID().toString();
4545
bout = new ByteArrayOutputStream();
4646
PrintStream out = new PrintStream(bout);
4747
originalPrintStream = System.out;

retail/interactive-tutorials/src/test/java/product/ImportProductsGcsTest.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,13 @@ public class ImportProductsGcsTest {
4040
@Before
4141
public void setUp() throws IOException, InterruptedException, ExecutionException {
4242
ProductsCreateGcsBucket.main();
43-
String projectId = ServiceOptions.getDefaultProjectId();
44-
String branchName =
43+
final String projectId = ServiceOptions.getDefaultProjectId();
44+
final String branchName =
4545
String.format(
4646
"projects/%s/locations/global/catalogs/default_catalog/branches/0", projectId);
47-
String bucketName = ProductsCreateGcsBucket.getBucketName();
48-
String gcsBucket = String.format("gs://%s", bucketName);
49-
String gscProductsObject = "products.json";
47+
final String bucketName = ProductsCreateGcsBucket.getBucketName();
48+
final String gcsBucket = String.format("gs://%s", bucketName);
49+
final String gscProductsObject = "products.json";
5050
bout = new ByteArrayOutputStream();
5151
PrintStream out = new PrintStream(bout);
5252
originalPrintStream = System.out;

retail/interactive-tutorials/src/test/java/product/ImportProductsInlineSourceTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ public class ImportProductsInlineSourceTest {
3838

3939
@Before
4040
public void setUp() throws IOException, InterruptedException, ExecutionException {
41-
String projectId = ServiceOptions.getDefaultProjectId();
42-
String branchName =
41+
final String projectId = ServiceOptions.getDefaultProjectId();
42+
final String branchName =
4343
String.format(
4444
"projects/%s/locations/global/catalogs/default_catalog/branches/0", projectId);
4545
bout = new ByteArrayOutputStream();

retail/interactive-tutorials/src/test/java/product/RemoveFulfillmentPlacesTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ public class RemoveFulfillmentPlacesTest {
4242

4343
@Before
4444
public void setUp() throws IOException, InterruptedException, ExecutionException {
45-
String projectId = ServiceOptions.getDefaultProjectId();
46-
String generatedProductId = UUID.randomUUID().toString();
47-
String productName =
45+
final String projectId = ServiceOptions.getDefaultProjectId();
46+
final String generatedProductId = UUID.randomUUID().toString();
47+
final String productName =
4848
String.format(
4949
"projects/%s/locations/global/catalogs/default_catalog/branches/0/products/%s",
5050
projectId, generatedProductId);

retail/interactive-tutorials/src/test/java/product/SetInventoryTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ public class SetInventoryTest {
4242

4343
@Before
4444
public void setUp() throws IOException, InterruptedException, ExecutionException {
45-
String projectId = ServiceOptions.getDefaultProjectId();
46-
String generatedProductId = UUID.randomUUID().toString();
47-
String productName =
45+
final String projectId = ServiceOptions.getDefaultProjectId();
46+
final String generatedProductId = UUID.randomUUID().toString();
47+
final String productName =
4848
String.format(
4949
"projects/%s/locations/global/catalogs/default_catalog/branches/0/products/%s",
5050
projectId, generatedProductId);

retail/interactive-tutorials/src/test/java/product/UpdateProductTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ public class UpdateProductTest {
4242

4343
@Before
4444
public void setUp() throws IOException, InterruptedException, ExecutionException {
45-
String projectId = ServiceOptions.getDefaultProjectId();
46-
String branchName =
45+
final String projectId = ServiceOptions.getDefaultProjectId();
46+
final String branchName =
4747
String.format(
4848
"projects/%s/locations/global/catalogs/default_catalog/branches/0", projectId);
49-
String generatedProductId = UUID.randomUUID().toString();
49+
final String generatedProductId = UUID.randomUUID().toString();
5050
bout = new ByteArrayOutputStream();
5151
PrintStream out = new PrintStream(bout);
5252
originalPrintStream = System.out;

retail/interactive-tutorials/src/test/java/search/SearchSimpleQueryTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ public class SearchSimpleQueryTest {
3838

3939
@Before
4040
public void setUp() throws IOException, InterruptedException, ExecutionException {
41-
String projectId = ServiceOptions.getDefaultProjectId();
42-
String defaultCatalogName =
41+
final String projectId = ServiceOptions.getDefaultProjectId();
42+
final String defaultCatalogName =
4343
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
44-
String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
44+
final String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
4545
bout = new ByteArrayOutputStream();
4646
PrintStream out = new PrintStream(bout);
4747
originalPrintStream = System.out;

retail/interactive-tutorials/src/test/java/search/SearchWithBoostSpecTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ public class SearchWithBoostSpecTest {
3737

3838
@Before
3939
public void setUp() throws IOException, InterruptedException, ExecutionException {
40-
String projectId = ServiceOptions.getDefaultProjectId();
41-
String defaultCatalogName =
40+
final String projectId = ServiceOptions.getDefaultProjectId();
41+
final String defaultCatalogName =
4242
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
43-
String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
43+
final String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
4444
bout = new ByteArrayOutputStream();
4545
PrintStream out = new PrintStream(bout);
4646
originalPrintStream = System.out;

retail/interactive-tutorials/src/test/java/search/SearchWithFacetSpecTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ public class SearchWithFacetSpecTest {
3737

3838
@Before
3939
public void setUp() throws IOException, InterruptedException, ExecutionException {
40-
String projectId = ServiceOptions.getDefaultProjectId();
41-
String defaultCatalogName =
40+
final String projectId = ServiceOptions.getDefaultProjectId();
41+
final String defaultCatalogName =
4242
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
43-
String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
43+
final String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
4444
bout = new ByteArrayOutputStream();
4545
PrintStream out = new PrintStream(bout);
4646
originalPrintStream = System.out;

retail/interactive-tutorials/src/test/java/search/SearchWithFilteringTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ public class SearchWithFilteringTest {
3838

3939
@Before
4040
public void setUp() throws IOException, InterruptedException, ExecutionException {
41-
String projectId = ServiceOptions.getDefaultProjectId();
42-
String defaultCatalogName =
41+
final String projectId = ServiceOptions.getDefaultProjectId();
42+
final String defaultCatalogName =
4343
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
44-
String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
44+
final String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
4545
bout = new ByteArrayOutputStream();
4646
PrintStream out = new PrintStream(bout);
4747
originalPrintStream = System.out;

retail/interactive-tutorials/src/test/java/search/SearchWithOrderingTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ public class SearchWithOrderingTest {
3838

3939
@Before
4040
public void setUp() throws IOException, InterruptedException, ExecutionException {
41-
String projectId = ServiceOptions.getDefaultProjectId();
42-
String defaultCatalogName =
41+
final String projectId = ServiceOptions.getDefaultProjectId();
42+
final String defaultCatalogName =
4343
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
44-
String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
44+
final String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
4545
bout = new ByteArrayOutputStream();
4646
PrintStream out = new PrintStream(bout);
4747
originalPrintStream = System.out;

retail/interactive-tutorials/src/test/java/search/SearchWithPaginationTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ public class SearchWithPaginationTest {
3838

3939
@Before
4040
public void setUp() throws IOException, InterruptedException, ExecutionException {
41-
String projectId = ServiceOptions.getDefaultProjectId();
42-
String defaultCatalogName =
41+
final String projectId = ServiceOptions.getDefaultProjectId();
42+
final String defaultCatalogName =
4343
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
44-
String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
44+
final String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
4545
bout = new ByteArrayOutputStream();
4646
PrintStream out = new PrintStream(bout);
4747
originalPrintStream = System.out;

retail/interactive-tutorials/src/test/java/search/SearchWithQueryExpansionSpecTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ public class SearchWithQueryExpansionSpecTest {
3838

3939
@Before
4040
public void setUp() throws IOException, InterruptedException, ExecutionException {
41-
String projectId = ServiceOptions.getDefaultProjectId();
42-
String defaultCatalogName =
41+
final String projectId = ServiceOptions.getDefaultProjectId();
42+
final String defaultCatalogName =
4343
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
44-
String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
44+
final String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
4545
bout = new ByteArrayOutputStream();
4646
PrintStream out = new PrintStream(bout);
4747
originalPrintStream = System.out;

0 commit comments

Comments
 (0)