Skip to content

Commit

Permalink
cleanup: fix lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Shabirmean committed Nov 10, 2022
1 parent 8bf47af commit 7564437
Show file tree
Hide file tree
Showing 26 changed files with 86 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,14 @@
public class EventsCreateBigQueryTable {

public static void main(String[] args) throws IOException {
String dataset = "user_events";
String validEventsTable = "events";
String invalidEventsTable = "events_some_invalid";
String eventsSchemaFilePath = "src/main/resources/events_schema.json";
final String dataset = "user_events";
final String validEventsTable = "events";
final String invalidEventsTable = "events_some_invalid";
final String eventsSchemaFilePath = "src/main/resources/events_schema.json";
// user_events.json and user_events_some_invalid.json are located in the resources folder
String validEventsSourceFile =
final String validEventsSourceFile =
ProductsCreateBigqueryTable.class.getResource("/user_events.json").getPath();
String invalidEventsSourceFile =
final String invalidEventsSourceFile =
ProductsCreateBigqueryTable.class.getResource("/user_events_some_invalid.json").getPath();

BufferedReader bufferedReader = new BufferedReader(new FileReader(eventsSchemaFilePath));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,13 @@

import com.google.api.gax.rpc.PermissionDeniedException;
import com.google.cloud.ServiceOptions;
import com.google.cloud.retail.v2.*;
import com.google.cloud.retail.v2.DeleteProductRequest;
import com.google.cloud.retail.v2.ListProductsRequest;
import com.google.cloud.retail.v2.Product;
import com.google.cloud.retail.v2.ProductServiceClient;
import com.google.cloud.retail.v2.ProductServiceClient.ListProductsPagedResponse;
import com.google.cloud.retail.v2.PurgeUserEventsRequest;
import com.google.cloud.retail.v2.UserEventServiceClient;
import java.io.IOException;

public class RemoveEventsResources {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ public static void main(String[] args) throws IOException, InterruptedException
String gcsErrorBucket = String.format("%s/errors", gcsBucket);

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

String gcsProductsObject = "products.json";
// To check error handling, use an invalid product JSON.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,12 @@
import static setup.SetupCleanup.getProduct;

import com.google.cloud.ServiceOptions;
import com.google.cloud.retail.v2.*;
import com.google.cloud.retail.v2.FulfillmentInfo;
import com.google.cloud.retail.v2.PriceInfo;
import com.google.cloud.retail.v2.Product;
import com.google.cloud.retail.v2.Product.Availability;
import com.google.cloud.retail.v2.ProductServiceClient;
import com.google.cloud.retail.v2.SetInventoryRequest;
import com.google.protobuf.FieldMask;
import com.google.protobuf.Int32Value;
import java.io.IOException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
public class ProductsCreateBigqueryTable {

public static void main(String[] args) throws IOException {
String dataset = "products";
String validProductsTable = "products";
String invalidProductsTable = "products_some_invalid";
String productSchemaFilePath = "src/main/resources/product_schema.json";
String validProductsSourceFile =
final String dataset = "products";
final String validProductsTable = "products";
final String invalidProductsTable = "products_some_invalid";
final String productSchemaFilePath = "src/main/resources/product_schema.json";
final String validProductsSourceFile =
ProductsCreateBigqueryTable.class.getResource("/products.json").getPath();
String invalidProductsSourceFile =
final String invalidProductsSourceFile =
ProductsCreateBigqueryTable.class.getResource("/products_some_invalid.json").getPath();

BufferedReader bufferedReader = new BufferedReader(new FileReader(productSchemaFilePath));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public class ImportUserEventsGcsTest {
public void setUp() throws IOException, InterruptedException {
EventsCreateGcsBucket.main();

String projectId = ServiceOptions.getDefaultProjectId();
String defaultCatalog =
final String projectId = ServiceOptions.getDefaultProjectId();
final String defaultCatalog =
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
String bucketName = EventsCreateGcsBucket.getBucketName();
String gcsEventsObject = "user_events.json";
final String bucketName = EventsCreateGcsBucket.getBucketName();
final String gcsEventsObject = "user_events.json";
bout = new ByteArrayOutputStream();
PrintStream out = new PrintStream(bout);
originalPrintStream = System.out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ public class ImportUserEventsInlineTest {

@Before
public void setUp() throws IOException, ExecutionException, InterruptedException {
String projectId = ServiceOptions.getDefaultProjectId();
String defaultCatalog =
final String projectId = ServiceOptions.getDefaultProjectId();
final String defaultCatalog =
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
bout = new ByteArrayOutputStream();
PrintStream out = new PrintStream(bout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public class PurgeUserEventTest {

@Before
public void setUp() throws IOException, InterruptedException, ExecutionException {
String projectId = ServiceOptions.getDefaultProjectId();
String defaultCatalog =
final String projectId = ServiceOptions.getDefaultProjectId();
final String defaultCatalog =
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
String visitorId = UUID.randomUUID().toString();
final String visitorId = UUID.randomUUID().toString();
bout = new ByteArrayOutputStream();
PrintStream out = new PrintStream(bout);
originalPrintStream = System.out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public class RejoinUserEventTest {

@Before
public void setUp() throws IOException, InterruptedException, ExecutionException {
String projectId = ServiceOptions.getDefaultProjectId();
String defaultCatalog =
final String projectId = ServiceOptions.getDefaultProjectId();
final String defaultCatalog =
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
String visitorId = UUID.randomUUID().toString();
final String visitorId = UUID.randomUUID().toString();
bout = new ByteArrayOutputStream();
PrintStream out = new PrintStream(bout);
originalPrintStream = System.out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public class WriteUserEventTest {

@Before
public void setUp() throws IOException, InterruptedException, ExecutionException {
String projectId = ServiceOptions.getDefaultProjectId();
String defaultCatalog =
final String projectId = ServiceOptions.getDefaultProjectId();
final String defaultCatalog =
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
String visitorId = UUID.randomUUID().toString();
final String visitorId = UUID.randomUUID().toString();
bout = new ByteArrayOutputStream();
PrintStream out = new PrintStream(bout);
originalPrintStream = System.out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public class AddFulfillmentPlacesTest {
@Before
public void setUp() throws IOException, InterruptedException, ExecutionException {
// TODO(developer): Replace these variables before running the sample.
String projectId = ServiceOptions.getDefaultProjectId();
String generatedProductId = UUID.randomUUID().toString();
String productName =
final String projectId = ServiceOptions.getDefaultProjectId();
final String generatedProductId = UUID.randomUUID().toString();
final String productName =
String.format(
"projects/%s/locations/global/catalogs/default_catalog/branches/0/products/%s",
projectId, generatedProductId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ public class CrudProductTest {

@Before
public void setUp() throws IOException, InterruptedException, ExecutionException {
String projectId = ServiceOptions.getDefaultProjectId();
String generatedProductId = UUID.randomUUID().toString();
String branchName =
final String projectId = ServiceOptions.getDefaultProjectId();
final String generatedProductId = UUID.randomUUID().toString();
final String branchName =
String.format(
"projects/%s/locations/global/catalogs/default_catalog/branches/0", projectId);
String productName = String.format("%s/products/%s", branchName, generatedProductId);
final String productName = String.format("%s/products/%s", branchName, generatedProductId);
bout = new ByteArrayOutputStream();
PrintStream out = new PrintStream(bout);
originalPrintStream = System.out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class DeleteProductTest {

@Before
public void setUp() throws IOException, InterruptedException, ExecutionException {
String generatedProductId = UUID.randomUUID().toString();
final String generatedProductId = UUID.randomUUID().toString();
bout = new ByteArrayOutputStream();
PrintStream out = new PrintStream(bout);
originalPrintStream = System.out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class GetProductTest {

@Before
public void setUp() throws IOException, InterruptedException, ExecutionException {
String generatedProductId = UUID.randomUUID().toString();
final String generatedProductId = UUID.randomUUID().toString();
bout = new ByteArrayOutputStream();
PrintStream out = new PrintStream(bout);
originalPrintStream = System.out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ public class ImportProductsGcsTest {
@Before
public void setUp() throws IOException, InterruptedException, ExecutionException {
ProductsCreateGcsBucket.main();
String projectId = ServiceOptions.getDefaultProjectId();
String branchName =
final String projectId = ServiceOptions.getDefaultProjectId();
final String branchName =
String.format(
"projects/%s/locations/global/catalogs/default_catalog/branches/0", projectId);
String bucketName = ProductsCreateGcsBucket.getBucketName();
String gcsBucket = String.format("gs://%s", bucketName);
String gscProductsObject = "products.json";
final String bucketName = ProductsCreateGcsBucket.getBucketName();
final String gcsBucket = String.format("gs://%s", bucketName);
final String gscProductsObject = "products.json";
bout = new ByteArrayOutputStream();
PrintStream out = new PrintStream(bout);
originalPrintStream = System.out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public class ImportProductsInlineSourceTest {

@Before
public void setUp() throws IOException, InterruptedException, ExecutionException {
String projectId = ServiceOptions.getDefaultProjectId();
String branchName =
final String projectId = ServiceOptions.getDefaultProjectId();
final String branchName =
String.format(
"projects/%s/locations/global/catalogs/default_catalog/branches/0", projectId);
bout = new ByteArrayOutputStream();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public class RemoveFulfillmentPlacesTest {

@Before
public void setUp() throws IOException, InterruptedException, ExecutionException {
String projectId = ServiceOptions.getDefaultProjectId();
String generatedProductId = UUID.randomUUID().toString();
String productName =
final String projectId = ServiceOptions.getDefaultProjectId();
final String generatedProductId = UUID.randomUUID().toString();
final String productName =
String.format(
"projects/%s/locations/global/catalogs/default_catalog/branches/0/products/%s",
projectId, generatedProductId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@ public class SetInventoryTest {

@Before
public void setUp() throws IOException, InterruptedException, ExecutionException {
String projectId = ServiceOptions.getDefaultProjectId();
String generatedProductId = UUID.randomUUID().toString();
String productName =
final String projectId = ServiceOptions.getDefaultProjectId();
final String generatedProductId = UUID.randomUUID().toString();
final String productName =
String.format(
"projects/%s/locations/global/catalogs/default_catalog/branches/0/products/%s",
projectId, generatedProductId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@ public class UpdateProductTest {

@Before
public void setUp() throws IOException, InterruptedException, ExecutionException {
String projectId = ServiceOptions.getDefaultProjectId();
String branchName =
final String projectId = ServiceOptions.getDefaultProjectId();
final String branchName =
String.format(
"projects/%s/locations/global/catalogs/default_catalog/branches/0", projectId);
String generatedProductId = UUID.randomUUID().toString();
final String generatedProductId = UUID.randomUUID().toString();
bout = new ByteArrayOutputStream();
PrintStream out = new PrintStream(bout);
originalPrintStream = System.out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public class SearchSimpleQueryTest {

@Before
public void setUp() throws IOException, InterruptedException, ExecutionException {
String projectId = ServiceOptions.getDefaultProjectId();
String defaultCatalogName =
final String projectId = ServiceOptions.getDefaultProjectId();
final String defaultCatalogName =
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
final String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
bout = new ByteArrayOutputStream();
PrintStream out = new PrintStream(bout);
originalPrintStream = System.out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ public class SearchWithBoostSpecTest {

@Before
public void setUp() throws IOException, InterruptedException, ExecutionException {
String projectId = ServiceOptions.getDefaultProjectId();
String defaultCatalogName =
final String projectId = ServiceOptions.getDefaultProjectId();
final String defaultCatalogName =
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
final String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
bout = new ByteArrayOutputStream();
PrintStream out = new PrintStream(bout);
originalPrintStream = System.out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ public class SearchWithFacetSpecTest {

@Before
public void setUp() throws IOException, InterruptedException, ExecutionException {
String projectId = ServiceOptions.getDefaultProjectId();
String defaultCatalogName =
final String projectId = ServiceOptions.getDefaultProjectId();
final String defaultCatalogName =
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
final String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
bout = new ByteArrayOutputStream();
PrintStream out = new PrintStream(bout);
originalPrintStream = System.out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public class SearchWithFilteringTest {

@Before
public void setUp() throws IOException, InterruptedException, ExecutionException {
String projectId = ServiceOptions.getDefaultProjectId();
String defaultCatalogName =
final String projectId = ServiceOptions.getDefaultProjectId();
final String defaultCatalogName =
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
final String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
bout = new ByteArrayOutputStream();
PrintStream out = new PrintStream(bout);
originalPrintStream = System.out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public class SearchWithOrderingTest {

@Before
public void setUp() throws IOException, InterruptedException, ExecutionException {
String projectId = ServiceOptions.getDefaultProjectId();
String defaultCatalogName =
final String projectId = ServiceOptions.getDefaultProjectId();
final String defaultCatalogName =
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
final String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
bout = new ByteArrayOutputStream();
PrintStream out = new PrintStream(bout);
originalPrintStream = System.out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public class SearchWithPaginationTest {

@Before
public void setUp() throws IOException, InterruptedException, ExecutionException {
String projectId = ServiceOptions.getDefaultProjectId();
String defaultCatalogName =
final String projectId = ServiceOptions.getDefaultProjectId();
final String defaultCatalogName =
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
final String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
bout = new ByteArrayOutputStream();
PrintStream out = new PrintStream(bout);
originalPrintStream = System.out;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ public class SearchWithQueryExpansionSpecTest {

@Before
public void setUp() throws IOException, InterruptedException, ExecutionException {
String projectId = ServiceOptions.getDefaultProjectId();
String defaultCatalogName =
final String projectId = ServiceOptions.getDefaultProjectId();
final String defaultCatalogName =
String.format("projects/%s/locations/global/catalogs/default_catalog", projectId);
String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
final String defaultSearchPlacementName = defaultCatalogName + "/placements/default_search";
bout = new ByteArrayOutputStream();
PrintStream out = new PrintStream(bout);
originalPrintStream = System.out;
Expand Down

0 comments on commit 7564437

Please sign in to comment.