From 8719cf96687cad1b5ce2517a861ce3ab40edc7cd Mon Sep 17 00:00:00 2001 From: nirupa-kumar Date: Fri, 24 Aug 2018 14:07:35 -0700 Subject: [PATCH 1/5] Adding the Product Search tests. --- .../vision/ProductInProductSetManagement.java | 4 +- .../com/example/vision/ProductManagement.java | 30 ++-- .../example/vision/ProductSetManagement.java | 4 +- .../example/vision/ImportProductSetsIT.java | 132 ++++++++++++++++++ .../ProductInProductSetManagementIT.java | 109 +++++++++++++++ .../example/vision/ProductManagementIT.java | 124 ++++++++++++++++ .../vision/ProductSetManagementIT.java | 85 +++++++++++ .../vision/ReferenceImageManagementIT.java | 91 ++++++++++++ 8 files changed, 554 insertions(+), 25 deletions(-) create mode 100644 vision/product-search/cloud-client/src/test/java/com/example/vision/ImportProductSetsIT.java create mode 100644 vision/product-search/cloud-client/src/test/java/com/example/vision/ProductInProductSetManagementIT.java create mode 100644 vision/product-search/cloud-client/src/test/java/com/example/vision/ProductManagementIT.java create mode 100644 vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSetManagementIT.java create mode 100644 vision/product-search/cloud-client/src/test/java/com/example/vision/ReferenceImageManagementIT.java diff --git a/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductInProductSetManagement.java b/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductInProductSetManagement.java index e040d33b26b..36eb1779a9a 100644 --- a/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductInProductSetManagement.java +++ b/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductInProductSetManagement.java @@ -53,7 +53,7 @@ public class ProductInProductSetManagement { * @param productSetId - Id of the product set. * @throws IOException - on I/O errors. */ - public static void addProductToSet( + public static void addProductToProductSet( String projectId, String computeRegion, String productId, String productSetId) throws IOException { ProductSearchClient client = ProductSearchClient.create(); @@ -162,7 +162,7 @@ public static void argsHelper(String[] args, PrintStream out) throws Exception { try { ns = parser.parseArgs(args); if (ns.get("command").equals("add_product_to_product_set")) { - addProductToSet( + addProductToProductSet( projectId, computeRegion, ns.getString("productId"), ns.getString("productSetId")); } if (ns.get("command").equals("list_products_in_product_set")) { diff --git a/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductManagement.java b/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductManagement.java index 0d6661913d1..f0a22f106e8 100644 --- a/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductManagement.java +++ b/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductManagement.java @@ -36,10 +36,9 @@ /** * This application demonstrates how to perform basic operations on Products. * - * For more information, see the tutorial page at + *

For more information, see the tutorial page at * https://cloud.google.com/vision/product-search/docs/ */ - public class ProductManagement { // [START vision_product_search_create_product] @@ -51,8 +50,6 @@ public class ProductManagement { * @param productId - Id of the product. * @param productDisplayName - Display name of the product. * @param productCategory - Category of the product. - * @param productDescription - Description of the product. - * @param productLabels - Labels of the product. * @throws IOException - on I/O errors. */ public static void createProduct( @@ -60,9 +57,7 @@ public static void createProduct( String computeRegion, String productId, String productDisplayName, - String productCategory, - String productDescription, - String productLabels) + String productCategory) throws IOException { ProductSearchClient client = ProductSearchClient.create(); @@ -76,12 +71,6 @@ public static void createProduct( .setName(productId) .setDisplayName(productDisplayName) .setProductCategory(productCategory) - .setDescription(productDescription) - .addProductLabels( - KeyValue.newBuilder() - .setKey(productLabels.split(",")[0].split("=")[0]) - .setValue(productLabels.split(",")[0].split("=")[1]) - .build()) .build(); Product product = client.createProduct(projectLocation.toString(), myProduct, productId); @@ -110,8 +99,8 @@ public static void listProducts(String projectId, String computeRegion) throws I System.out.println(String.format("\nProduct name: %s", product.getName())); System.out.println( String.format( - "Product id: %s", - product.getName().substring(product.getName().lastIndexOf('/') + 1))); + "Product id: %s", + product.getName().substring(product.getName().lastIndexOf('/') + 1))); System.out.println(String.format("Product display name: %s", product.getDisplayName())); System.out.println(String.format("Product category: %s", product.getProductCategory())); System.out.println("Product labels:"); @@ -192,9 +181,10 @@ public static void updateProductLabels( // Display the product information System.out.println(String.format("Product name: %s", updatedProduct.getName())); - System.out.println( - String.format( - "Updated product labels: %s", updatedProduct.getProductLabelsList().toString())); + System.out.println(String.format("Updated product labels: ")); + for (Product.KeyValue element : updatedProduct.getProductLabelsList()) { + System.out.println(String.format("%s: %s", element.getKey(), element.getValue())); + } } // [END vision_product_search_update_product_labels] @@ -261,9 +251,7 @@ public void argsHelper(String[] args, PrintStream out) throws Exception { computeRegion, ns.getString("productId"), ns.getString("productDisplayName"), - ns.getString("productCategory"), - ns.getString("productDescription"), - ns.getString("productLabels")); + ns.getString("productCategory")); } if (ns.get("command").equals("list_products")) { listProducts(projectId, computeRegion); diff --git a/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductSetManagement.java b/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductSetManagement.java index d5ed87955fb..1b3b9c29560 100644 --- a/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductSetManagement.java +++ b/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductSetManagement.java @@ -73,6 +73,7 @@ public static void createProductSet( // Display the product set information System.out.println(String.format("Product set name: %s", productSet.getName())); + } // [END vision_product_search_create_product_set] @@ -86,10 +87,8 @@ public static void createProductSet( */ public static void listProductSets(String projectId, String computeRegion) throws IOException { ProductSearchClient client = ProductSearchClient.create(); - // A resource that represents Google Cloud Platform location. LocationName projectLocation = LocationName.of(projectId, computeRegion); - // List all the product sets available in the region. for (ProductSet productSet : client.listProductSets(projectLocation).iterateAll()) { // Display the product set information @@ -104,6 +103,7 @@ public static void listProductSets(String projectId, String computeRegion) throw System.out.println(String.format("\tseconds: %s", productSet.getIndexTime().getSeconds())); System.out.println(String.format("\tnanos: %s", productSet.getIndexTime().getNanos())); } + } // [END vision_product_search_list_product_sets] diff --git a/vision/product-search/cloud-client/src/test/java/com/example/vision/ImportProductSetsIT.java b/vision/product-search/cloud-client/src/test/java/com/example/vision/ImportProductSetsIT.java new file mode 100644 index 00000000000..b00d8893c85 --- /dev/null +++ b/vision/product-search/cloud-client/src/test/java/com/example/vision/ImportProductSetsIT.java @@ -0,0 +1,132 @@ +/* + * Copyright 2018 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.vision; + +import static com.google.common.truth.Truth.assertThat; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +/** Integration (system) tests for {@link ImportProductSets}. */ +@RunWith(JUnit4.class) +@SuppressWarnings("checkstyle:abbreviationaswordinname") +public class ImportProductSetsIT { + private static final String PROJECT_ID = "java-docs-samples-testing"; + private static final String COMPUTE_REGION = "us-west1"; + private static final String GCS_URI = + "gs://java-docs-samples-testing/product-search/product_sets.csv"; + private static final String PRODUCT_SET_ID = "fake_product_set_id_for_testing"; + private static final String PRODUCT_ID_1 = "fake_product_id_for_testing_1"; + private static final String PRODUCT_ID_2 = "fake_product_id_for_testing_2"; + private static final String IMAGE_URI_1 = "shoes_1.jpg"; + private static final String IMAGE_URI_2 = "shoes_2.jpg"; + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() { + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + System.setOut(out); + } + + @After + public void tearDown() throws IOException { + ProductManagement.deleteProduct(PROJECT_ID,COMPUTE_REGION,PRODUCT_ID_1); + ProductManagement.deleteProduct(PROJECT_ID,COMPUTE_REGION,PRODUCT_ID_2); + ProductSetManagement.deleteProductSet(PROJECT_ID, COMPUTE_REGION, PRODUCT_SET_ID); + System.setOut(null); + } + + @Test + public void testImportProductSets() throws Exception { + // Act + ProductSetManagement.listProductSets(PROJECT_ID, COMPUTE_REGION); + + // Assert + String got = bout.toString(); + assertThat(got).doesNotContain(PRODUCT_SET_ID); + + // Act + ProductManagement.listProducts(PROJECT_ID, COMPUTE_REGION); + + // Assert + assertThat(got).doesNotContain(PRODUCT_ID_1); + assertThat(got).doesNotContain(PRODUCT_ID_2); + + // Act + ProductInProductSetManagement.listProductsInProductSet( + PROJECT_ID, COMPUTE_REGION, PRODUCT_SET_ID); + + // Assert + assertThat(got).doesNotContain(PRODUCT_ID_1); + assertThat(got).doesNotContain(PRODUCT_ID_2); + + // Act + ReferenceImageManagement.listReferenceImagesOfProduct(PROJECT_ID, COMPUTE_REGION, PRODUCT_ID_1); + + // Assert + assertThat(got).doesNotContain(IMAGE_URI_1); + + // Act + ReferenceImageManagement.listReferenceImagesOfProduct(PROJECT_ID, COMPUTE_REGION, PRODUCT_ID_2); + + // Assert + assertThat(got).doesNotContain(IMAGE_URI_2); + + // Act + ImportProductSets.importProductSets(PROJECT_ID, COMPUTE_REGION, GCS_URI); + ProductSetManagement.listProductSets(PROJECT_ID, COMPUTE_REGION); + + // Assert + got = bout.toString(); + assertThat(got).contains(PRODUCT_SET_ID); + + // Act + ProductManagement.listProducts(PROJECT_ID, COMPUTE_REGION); + + // Assert + assertThat(got).contains(PRODUCT_ID_1); + assertThat(got).contains(PRODUCT_ID_2); + + // Act + ProductInProductSetManagement.listProductsInProductSet( + PROJECT_ID, COMPUTE_REGION, PRODUCT_SET_ID); + + // Assert + assertThat(got).contains(PRODUCT_ID_1); + assertThat(got).contains(PRODUCT_ID_2); + + // Act + ReferenceImageManagement.listReferenceImagesOfProduct(PROJECT_ID, COMPUTE_REGION, PRODUCT_ID_1); + + // Assert + assertThat(got).contains(IMAGE_URI_1); + + // Act + ReferenceImageManagement.listReferenceImagesOfProduct(PROJECT_ID, COMPUTE_REGION, PRODUCT_ID_2); + + // Assert + assertThat(got).contains(IMAGE_URI_2); + } +} diff --git a/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductInProductSetManagementIT.java b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductInProductSetManagementIT.java new file mode 100644 index 00000000000..9ee0da69d8c --- /dev/null +++ b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductInProductSetManagementIT.java @@ -0,0 +1,109 @@ +/* + * Copyright 2018 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.vision; + +import static com.google.common.truth.Truth.assertThat; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +/** Integration (system) tests for {@link ProductInProductSetManagement}. */ +@RunWith(JUnit4.class) +@SuppressWarnings("checkstyle:abbreviationaswordinname") +public class ProductInProductSetManagementIT { + private static final String PROJECT_ID = "java-docs-samples-testing"; + private static final String COMPUTE_REGION = "us-west1"; + private static final String PRODUCT_SET_DISPLAY_NAME = + "fake_product_set_display_name_for_testing"; + private static final String PRODUCT_SET_ID = "fake_product_set_id_for_testing"; + private static final String PRODUCT_DISPLAY_NAME = "fake_product_display_name_for_testing"; + private static final String PRODUCT_CATEGORY = "apparel"; + private static final String PRODUCT_ID = "fake_product_id_for_testing"; + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() throws IOException { + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + System.setOut(out); + ProductSetManagement.createProductSet( + PROJECT_ID, COMPUTE_REGION, PRODUCT_SET_ID, PRODUCT_SET_DISPLAY_NAME); + ProductManagement.createProduct( + PROJECT_ID, COMPUTE_REGION, PRODUCT_ID, PRODUCT_DISPLAY_NAME, PRODUCT_CATEGORY); + bout.reset(); + } + + @After + public void tearDown() throws IOException { + ProductManagement.deleteProduct(PROJECT_ID, COMPUTE_REGION, PRODUCT_ID); + ProductSetManagement.deleteProductSet(PROJECT_ID, COMPUTE_REGION, PRODUCT_SET_ID); + System.setOut(null); + } + + @Test + public void testAddProductToProductSet() throws Exception { + // Act + ProductInProductSetManagement.listProductsInProductSet( + PROJECT_ID, COMPUTE_REGION, PRODUCT_SET_ID); + + // Assert + String got = bout.toString(); + assertThat(got).doesNotContain(PRODUCT_ID); + + bout.reset(); + + // Act + ProductInProductSetManagement.addProductToProductSet( + PROJECT_ID, COMPUTE_REGION, PRODUCT_ID, PRODUCT_SET_ID); + + // Assert + got = bout.toString(); + assertThat(got).contains("Product added to product set."); + } + + @Test + public void testRemoveProductFromProductSet() throws Exception { + // Act + ProductInProductSetManagement.addProductToProductSet( + PROJECT_ID, COMPUTE_REGION, PRODUCT_ID, PRODUCT_SET_ID); + ProductInProductSetManagement.listProductsInProductSet( + PROJECT_ID, COMPUTE_REGION, PRODUCT_SET_ID); + + // Assert + String got = bout.toString(); + assertThat(got).contains(PRODUCT_ID); + + bout.reset(); + + // Act + ProductInProductSetManagement.removeProductFromProductSet( + PROJECT_ID, COMPUTE_REGION, PRODUCT_ID, PRODUCT_SET_ID); + ProductInProductSetManagement.listProductsInProductSet( + PROJECT_ID, COMPUTE_REGION, PRODUCT_SET_ID); + + // Assert + got = bout.toString(); + assertThat(got).doesNotContain(PRODUCT_ID); + } +} diff --git a/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductManagementIT.java b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductManagementIT.java new file mode 100644 index 00000000000..724ed6cc295 --- /dev/null +++ b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductManagementIT.java @@ -0,0 +1,124 @@ +/* + * Copyright 2018 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.vision; + +import static com.google.common.truth.Truth.assertThat; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +/** Integration (system) tests for {@link ProductManagement}. */ +@RunWith(JUnit4.class) +@SuppressWarnings("checkstyle:abbreviationaswordinname") +public class ProductManagementIT { + private static final String PROJECT_ID = "java-docs-samples-testing"; + private static final String COMPUTE_REGION = "us-west1"; + private static final String PRODUCT_DISPLAY_NAME = "fake_product_display_name_for_testing"; + private static final String PRODUCT_CATEGORY = "homegoods"; + private static final String PRODUCT_ID = "fake_product_id_for_testing"; + private static final String KEY = "fake_key_for_testing"; + private static final String VALUE = "fake_value_for_testing"; + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() throws IOException { + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + System.setOut(out); + } + + @After + public void tearDown() throws IOException { + ProductManagement.deleteProduct(PROJECT_ID, COMPUTE_REGION, PRODUCT_ID); + System.setOut(null); + } + + @Test + public void testCreateProduct() throws Exception { + // Act + ProductManagement.listProducts(PROJECT_ID, COMPUTE_REGION); + + // Assert + String got = bout.toString(); + assertThat(got).doesNotContain(PRODUCT_ID); + + bout.reset(); + + // Act + ProductManagement.createProduct( + PROJECT_ID, COMPUTE_REGION, PRODUCT_ID, PRODUCT_DISPLAY_NAME, PRODUCT_CATEGORY); + ProductManagement.listProducts(PROJECT_ID, COMPUTE_REGION); + + // Assert + got = bout.toString(); + assertThat(got).contains(PRODUCT_ID); + } + + @Test + public void testDeleteProduct() throws Exception { + // Act + ProductManagement.createProduct( + PROJECT_ID, COMPUTE_REGION, PRODUCT_ID, PRODUCT_DISPLAY_NAME, PRODUCT_CATEGORY); + ProductManagement.listProducts(PROJECT_ID, COMPUTE_REGION); + + // Assert + String got = bout.toString(); + assertThat(got).contains(PRODUCT_ID); + + bout.reset(); + + // Act + ProductManagement.deleteProduct(PROJECT_ID, COMPUTE_REGION, PRODUCT_ID); + ProductManagement.listProducts(PROJECT_ID, COMPUTE_REGION); + + // Assert + got = bout.toString(); + assertThat(got).doesNotContain(PRODUCT_ID); + } + + @Test + public void testUpdateProductLabels() throws Exception { + // Act + ProductManagement.createProduct( + PROJECT_ID, COMPUTE_REGION, PRODUCT_ID, PRODUCT_DISPLAY_NAME, PRODUCT_CATEGORY); + ProductManagement.listProducts(PROJECT_ID, COMPUTE_REGION); + ProductManagement.getProduct(PROJECT_ID, COMPUTE_REGION, PRODUCT_ID); + + // Assert + String got = bout.toString(); + assertThat(got).doesNotContain(KEY); + assertThat(got).doesNotContain(VALUE); + + bout.reset(); + + // Act + ProductManagement.updateProductLabels( + PROJECT_ID, COMPUTE_REGION, PRODUCT_ID, KEY + "=" + VALUE); + + // Assert + got = bout.toString(); + assertThat(got).contains(KEY); + assertThat(got).contains(VALUE); + } +} diff --git a/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSetManagementIT.java b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSetManagementIT.java new file mode 100644 index 00000000000..6f37239ed37 --- /dev/null +++ b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSetManagementIT.java @@ -0,0 +1,85 @@ +/* + * Copyright 2018 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.vision; + +import static com.google.common.truth.Truth.assertThat; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +/** Integration (system) tests for {@link ProductSetManagement}. */ +@RunWith(JUnit4.class) +@SuppressWarnings("checkstyle:abbreviationaswordinname") +public class ProductSetManagementIT { + private static final String PROJECT_ID = "java-docs-samples-testing"; + private static final String COMPUTE_REGION = "us-west1"; + private static final String PRODUCT_SET_ID = "fake_product_set_id_for_testing"; + private static final String PRODUCT_SET_DISPLAY_NAME = + "fake_product_set_display_name_for_testing"; + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() throws IOException { + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + System.setOut(out); + } + + @After + public void tearDown() { + + System.setOut(null); + } + + @Test + public void testCreateDeleteProductSet() throws Exception { + // Act + ProductSetManagement.listProductSets(PROJECT_ID, COMPUTE_REGION); + + // Assert + String got = bout.toString(); + assertThat(got).doesNotContain(PRODUCT_SET_ID); + + bout.reset(); + + // Act + ProductSetManagement.createProductSet( + PROJECT_ID, COMPUTE_REGION, PRODUCT_SET_ID, PRODUCT_SET_DISPLAY_NAME); + ProductSetManagement.listProductSets(PROJECT_ID, COMPUTE_REGION); + + // Assert + got = bout.toString(); + assertThat(got).contains(PRODUCT_SET_ID); + + bout.reset(); + + // Act + ProductSetManagement.deleteProductSet(PROJECT_ID, COMPUTE_REGION, PRODUCT_SET_ID); + ProductSetManagement.listProductSets(PROJECT_ID, COMPUTE_REGION); + + // Assert + got = bout.toString(); + assertThat(got).doesNotContain(PRODUCT_SET_ID); + } +} diff --git a/vision/product-search/cloud-client/src/test/java/com/example/vision/ReferenceImageManagementIT.java b/vision/product-search/cloud-client/src/test/java/com/example/vision/ReferenceImageManagementIT.java new file mode 100644 index 00000000000..fa91673f4bf --- /dev/null +++ b/vision/product-search/cloud-client/src/test/java/com/example/vision/ReferenceImageManagementIT.java @@ -0,0 +1,91 @@ +/* + * Copyright 2018 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.vision; + +import static com.google.common.truth.Truth.assertThat; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +/** Integration (system) tests for {@link ReferenceImageManagement}. */ +@RunWith(JUnit4.class) +@SuppressWarnings("checkstyle:abbreviationaswordinname") +public class ReferenceImageManagementIT { + private static final String PROJECT_ID = "java-docs-samples-testing"; + private static final String COMPUTE_REGION = "us-west1"; + private static final String PRODUCT_DISPLAY_NAME = "fake_product_display_name_for_testing"; + private static final String PRODUCT_CATEGORY = "apparel"; + private static final String PRODUCT_ID = "fake_product_id_for_testing"; + private static final String REFERENCE_IMAGE_ID = "fake_reference_image_id_for_testing"; + private static final String GCS_URI = + "gs://java-docs-samples-testing/product-search/shoes_1.jpg"; + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() throws IOException { + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + System.setOut(out); + ProductManagement.createProduct( + PROJECT_ID, COMPUTE_REGION, PRODUCT_ID, PRODUCT_DISPLAY_NAME, PRODUCT_CATEGORY); + } + + @After + public void tearDown() throws IOException { + ProductManagement.deleteProduct(PROJECT_ID, COMPUTE_REGION, PRODUCT_ID); + System.setOut(null); + } + + @Test + public void testCreateReferenceImage() throws Exception { + // Act + ReferenceImageManagement.listReferenceImagesOfProduct(PROJECT_ID, COMPUTE_REGION, PRODUCT_ID); + + // Assert + String got = bout.toString(); + assertThat(got).doesNotContain(REFERENCE_IMAGE_ID); + + bout.reset(); + + // Act + ReferenceImageManagement.createReferenceImage( + PROJECT_ID, COMPUTE_REGION, PRODUCT_ID, REFERENCE_IMAGE_ID, GCS_URI); + ReferenceImageManagement.listReferenceImagesOfProduct(PROJECT_ID, COMPUTE_REGION, PRODUCT_ID); + + // Assert + got = bout.toString(); + assertThat(got).contains(REFERENCE_IMAGE_ID); + + bout.reset(); + + // Act + ReferenceImageManagement.deleteReferenceImage( + PROJECT_ID, COMPUTE_REGION, PRODUCT_ID, REFERENCE_IMAGE_ID); + ReferenceImageManagement.listReferenceImagesOfProduct(PROJECT_ID, COMPUTE_REGION, PRODUCT_ID); + + // Assert + got = bout.toString(); + assertThat(got).doesNotContain(REFERENCE_IMAGE_ID); + } +} From 6f83ab5a8b721273adb658bf9b69b00469897b67 Mon Sep 17 00:00:00 2001 From: nirupa-kumar Date: Mon, 27 Aug 2018 09:39:29 -0700 Subject: [PATCH 2/5] Fixing review issues. --- .../src/test/java/com/example/vision/ImportProductSetsIT.java | 2 +- .../com/example/vision/ProductInProductSetManagementIT.java | 2 +- .../src/test/java/com/example/vision/ProductManagementIT.java | 2 +- .../test/java/com/example/vision/ProductSetManagementIT.java | 2 +- .../java/com/example/vision/ReferenceImageManagementIT.java | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/vision/product-search/cloud-client/src/test/java/com/example/vision/ImportProductSetsIT.java b/vision/product-search/cloud-client/src/test/java/com/example/vision/ImportProductSetsIT.java index b00d8893c85..92377727211 100644 --- a/vision/product-search/cloud-client/src/test/java/com/example/vision/ImportProductSetsIT.java +++ b/vision/product-search/cloud-client/src/test/java/com/example/vision/ImportProductSetsIT.java @@ -31,7 +31,7 @@ @RunWith(JUnit4.class) @SuppressWarnings("checkstyle:abbreviationaswordinname") public class ImportProductSetsIT { - private static final String PROJECT_ID = "java-docs-samples-testing"; + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); private static final String COMPUTE_REGION = "us-west1"; private static final String GCS_URI = "gs://java-docs-samples-testing/product-search/product_sets.csv"; diff --git a/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductInProductSetManagementIT.java b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductInProductSetManagementIT.java index 9ee0da69d8c..0687d13e494 100644 --- a/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductInProductSetManagementIT.java +++ b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductInProductSetManagementIT.java @@ -31,7 +31,7 @@ @RunWith(JUnit4.class) @SuppressWarnings("checkstyle:abbreviationaswordinname") public class ProductInProductSetManagementIT { - private static final String PROJECT_ID = "java-docs-samples-testing"; + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); private static final String COMPUTE_REGION = "us-west1"; private static final String PRODUCT_SET_DISPLAY_NAME = "fake_product_set_display_name_for_testing"; diff --git a/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductManagementIT.java b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductManagementIT.java index 724ed6cc295..4a20a0d05b5 100644 --- a/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductManagementIT.java +++ b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductManagementIT.java @@ -31,7 +31,7 @@ @RunWith(JUnit4.class) @SuppressWarnings("checkstyle:abbreviationaswordinname") public class ProductManagementIT { - private static final String PROJECT_ID = "java-docs-samples-testing"; + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); private static final String COMPUTE_REGION = "us-west1"; private static final String PRODUCT_DISPLAY_NAME = "fake_product_display_name_for_testing"; private static final String PRODUCT_CATEGORY = "homegoods"; diff --git a/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSetManagementIT.java b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSetManagementIT.java index 6f37239ed37..424d6e21be7 100644 --- a/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSetManagementIT.java +++ b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSetManagementIT.java @@ -31,7 +31,7 @@ @RunWith(JUnit4.class) @SuppressWarnings("checkstyle:abbreviationaswordinname") public class ProductSetManagementIT { - private static final String PROJECT_ID = "java-docs-samples-testing"; + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); private static final String COMPUTE_REGION = "us-west1"; private static final String PRODUCT_SET_ID = "fake_product_set_id_for_testing"; private static final String PRODUCT_SET_DISPLAY_NAME = diff --git a/vision/product-search/cloud-client/src/test/java/com/example/vision/ReferenceImageManagementIT.java b/vision/product-search/cloud-client/src/test/java/com/example/vision/ReferenceImageManagementIT.java index fa91673f4bf..744a1d505d3 100644 --- a/vision/product-search/cloud-client/src/test/java/com/example/vision/ReferenceImageManagementIT.java +++ b/vision/product-search/cloud-client/src/test/java/com/example/vision/ReferenceImageManagementIT.java @@ -31,7 +31,7 @@ @RunWith(JUnit4.class) @SuppressWarnings("checkstyle:abbreviationaswordinname") public class ReferenceImageManagementIT { - private static final String PROJECT_ID = "java-docs-samples-testing"; + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); private static final String COMPUTE_REGION = "us-west1"; private static final String PRODUCT_DISPLAY_NAME = "fake_product_display_name_for_testing"; private static final String PRODUCT_CATEGORY = "apparel"; From f72841596cb57fec681c553f1d09d07909876409 Mon Sep 17 00:00:00 2001 From: nirupa-kumar Date: Mon, 27 Aug 2018 13:28:16 -0700 Subject: [PATCH 3/5] Product Search tests and src file updates to include GCS image file. --- .../com/example/vision/ProductSearch.java | 104 +++++++++++++-- .../com/example/vision/ProductSearchIT.java | 118 ++++++++++++++++++ 2 files changed, 209 insertions(+), 13 deletions(-) create mode 100644 vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSearchIT.java diff --git a/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductSearch.java b/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductSearch.java index d36fa6e24c4..6899761a1f8 100644 --- a/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductSearch.java +++ b/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductSearch.java @@ -23,6 +23,7 @@ import com.google.cloud.vision.v1p3beta1.Image; import com.google.cloud.vision.v1p3beta1.ImageAnnotatorClient; import com.google.cloud.vision.v1p3beta1.ImageContext; +import com.google.cloud.vision.v1p3beta1.ImageSource; import com.google.cloud.vision.v1p3beta1.ProductSearchParams; import com.google.cloud.vision.v1p3beta1.ProductSearchResults.Result; import com.google.cloud.vision.v1p3beta1.ProductSetName; @@ -54,7 +55,7 @@ public class ProductSearch { // [START vision_product_search_get_similar_products] /** - * Search similar products to image. + * Search similar products to image in local file. * * @param projectId - Id of the project. * @param computeRegion - Region name. @@ -66,7 +67,7 @@ public class ProductSearch { * color:red AND style:kids color:blue AND style:kids * @throws IOException - on I/O errors. */ - public static void getSimilarProducts( + public static void getSimilarProductsFile( String projectId, String computeRegion, String productSetId, @@ -85,11 +86,8 @@ public static void getSimilarProducts( // Create annotate image request along with product search feature. Feature featuresElement = Feature.newBuilder().setType(Type.PRODUCT_SEARCH).build(); - // The input image can be a GCS link or HTTPS link or Raw image bytes. + // The input image can be a HTTPS link or Raw image bytes. // Example: - // To use GCS link replace with below code - // ImageSource source = ImageSource.newBuilder().setGcsImageUri(gcsUri).build(); - // Image image = Image.newBuilder().setSource(source).build(); // To use HTTP link replace with below code // ImageSource source = ImageSource.newBuilder().setImageUri(imageUri).build(); // Image image = Image.newBuilder().setSource(source).build(); @@ -130,6 +128,72 @@ public static void getSimilarProducts( } // [END vision_product_search_get_similar_products] + // [START vision_product_search_get_similar_products_gcs] + /** + * Search similar products to image in Google Cloud Storage. + * + * @param projectId - Id of the project. + * @param computeRegion - Region name. + * @param productSetId - Id of the product set. + * @param productCategory - Category of the product. + * @param gcsUri - GCS file path of the image to be searched + * @param filter - Condition to be applied on the labels. Example for filter: (color = red OR + * color = blue) AND style = kids It will search on all products with the following labels: + * color:red AND style:kids color:blue AND style:kids + * @throws Exception - on errors. + */ + public static void getSimilarProductsGcs(String projectId, + String computeRegion, + String productSetId, + String productCategory, + String gcsUri, + String filter) throws Exception { + ImageAnnotatorClient queryImageClient = ImageAnnotatorClient.create(); + + // Get the full path of the product set. + String productSetPath = ProductSetName.of(projectId, computeRegion, productSetId).toString(); + + // Get the image from Google Cloud Storage + ImageSource source = ImageSource.newBuilder().setGcsImageUri(gcsUri).build(); + + // Create annotate image request along with product search feature. + Feature featuresElement = Feature.newBuilder().setType(Type.PRODUCT_SEARCH).build(); + Image image = Image.newBuilder().setSource(source).build(); + ImageContext imageContext = + ImageContext.newBuilder() + .setProductSearchParams( + ProductSearchParams.newBuilder() + .setProductSet(productSetPath) + .addProductCategories(productCategory) + .setFilter(filter)) + .build(); + + AnnotateImageRequest annotateImageRequest = + AnnotateImageRequest.newBuilder() + .addFeatures(featuresElement) + .setImage(image) + .setImageContext(imageContext) + .build(); + List requests = Arrays.asList(annotateImageRequest); + + // Search products similar to the image. + BatchAnnotateImagesResponse response = queryImageClient.batchAnnotateImages(requests); + + List similarProducts = + response.getResponses(0).getProductSearchResults().getResultsList(); + + System.out.println("Similar Products: "); + for (Result product : similarProducts) { + System.out.println(String.format("\nProduct name: %s", product.getProduct().getName())); + System.out.println( + String.format("Product display name: %s", product.getProduct().getDisplayName())); + System.out.println( + String.format("Product description: %s", product.getProduct().getDescription())); + System.out.println(String.format("Score(Confidence): %s", product.getScore())); + System.out.println(String.format("Image name: %s", product.getImage())); + } + } + public static void main(String[] args) throws Exception { ProductSearch productSearch = new ProductSearch(); productSearch.argsHelper(args, System.out); @@ -139,11 +203,17 @@ public static void argsHelper(String[] args, PrintStream out) throws Exception { ArgumentParser parser = ArgumentParsers.newFor("Product Search").build(); Subparsers subparsers = parser.addSubparsers().dest("command"); - Subparser getSimilarProductsParser = subparsers.addParser("get_similar_products"); - getSimilarProductsParser.addArgument("productSetId"); - getSimilarProductsParser.addArgument("productCategory"); - getSimilarProductsParser.addArgument("filePath"); - getSimilarProductsParser.addArgument("filter").nargs("?").setDefault(""); + Subparser getSimilarProductsFileParser = subparsers.addParser("get_similar_products_file"); + getSimilarProductsFileParser.addArgument("productSetId"); + getSimilarProductsFileParser.addArgument("productCategory"); + getSimilarProductsFileParser.addArgument("filePath"); + getSimilarProductsFileParser.addArgument("filter").nargs("?").setDefault(""); + + Subparser getSimilarProductsGcsParser = subparsers.addParser("get_similar_products_gcs"); + getSimilarProductsGcsParser.addArgument("productSetId"); + getSimilarProductsGcsParser.addArgument("productCategory"); + getSimilarProductsGcsParser.addArgument("gcsUri"); + getSimilarProductsGcsParser.addArgument("filter").nargs("?").setDefault(""); String projectId = System.getenv("PROJECT_ID"); String computeRegion = System.getenv("REGION_NAME"); @@ -151,14 +221,22 @@ public static void argsHelper(String[] args, PrintStream out) throws Exception { Namespace ns = null; try { ns = parser.parseArgs(args); - if (ns.get("command").equals("get_similar_products")) { - getSimilarProducts( + if (ns.get("command").equals("get_similar_products_file")) { + getSimilarProductsFile( projectId, computeRegion, ns.getString("productSetId"), ns.getString("productCategory"), ns.getString("filePath"), ns.getString("filter")); + } else if (ns.get("command").equals("get_similar_products_gcs")) { + getSimilarProductsGcs( + projectId, + computeRegion, + ns.getString("productSetId"), + ns.getString("productCategory"), + ns.getString("gcsUri"), + ns.getString("filter")); } } catch (ArgumentParserException e) { diff --git a/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSearchIT.java b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSearchIT.java new file mode 100644 index 00000000000..8b8f35a17e2 --- /dev/null +++ b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSearchIT.java @@ -0,0 +1,118 @@ +/* + * Copyright 2018 Google Inc. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.vision; + +import static com.google.common.truth.Truth.assertThat; + +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.PrintStream; +import java.util.List; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; + +/** Integration (system) tests for {@link ProductSearch}. */ +@RunWith(JUnit4.class) +@SuppressWarnings("checkstyle:abbreviationaswordinname") +public class ProductSearchIT { + private static final String PROJECT_ID = System.getenv("GOOGLE_CLOUD_PROJECT"); + private static final String COMPUTE_REGION = "us-west1"; + private static final String GCS_URI = + "gs://java-docs-samples-testing/product-search/indexed_product_sets.csv"; + private static final String PRODUCT_SET_ID = "indexed_product_set_id_for_testing"; + private static final String PRODUCT_CATEGORY = "apparel"; + private static final String PRODUCT_ID_1 = "indexed_product_id_for_testing_1"; + private static final String PRODUCT_ID_2 = "indexed_product_id_for_testing_2"; + private static final String IMAGE_URI_1 = + "gs://java-docs-samples-testing/product-search/shoes_1.jpg"; + private static final String FILE_PATH_1 = "./resources/shoes_1.jpg"; + private static final String FILTER = "style=womens"; + private static final String BUCKET = "java-docs-samples-testing"; + private ByteArrayOutputStream bout; + private PrintStream out; + + @Before + public void setUp() throws Exception { + + bout = new ByteArrayOutputStream(); + out = new PrintStream(bout); + System.setOut(out); + ImportProductSets.importProductSets(PROJECT_ID, COMPUTE_REGION, GCS_URI); + bout.reset(); + } + + @After + public void tearDown() throws Exception { + ProductManagement.deleteProduct(PROJECT_ID,COMPUTE_REGION,PRODUCT_ID_1); + ProductManagement.deleteProduct(PROJECT_ID,COMPUTE_REGION,PRODUCT_ID_2); + ProductSetManagement.deleteProductSet(PROJECT_ID, COMPUTE_REGION, PRODUCT_SET_ID); + System.setOut(null); + } + + @Test + public void testGetSimilarProductsFile() throws Exception { + // Act + ProductSearch.getSimilarProductsFile( + PROJECT_ID, COMPUTE_REGION, PRODUCT_SET_ID, PRODUCT_CATEGORY, FILE_PATH_1, ""); + + // Assert + String got = bout.toString(); + assertThat(got).contains(PRODUCT_ID_1); + assertThat(got).contains(PRODUCT_ID_2); + } + + @Test + public void testGetSimilarProductsGcs() throws Exception { + // Act + ProductSearch.getSimilarProductsGcs( + PROJECT_ID, COMPUTE_REGION, PRODUCT_SET_ID, PRODUCT_CATEGORY, IMAGE_URI_1, ""); + + // Assert + String got = bout.toString(); + assertThat(got).contains(PRODUCT_ID_1); + assertThat(got).contains(PRODUCT_ID_2); + } + + @Test + public void testGetSimilarProductsFileWithFilter() throws Exception { + // Act + ProductSearch.getSimilarProductsFile( + PROJECT_ID, COMPUTE_REGION, PRODUCT_SET_ID, PRODUCT_CATEGORY, FILE_PATH_1, FILTER); + + // Assert + String got = bout.toString(); + assertThat(got).contains(PRODUCT_ID_1); + assertThat(got).doesNotContain(PRODUCT_ID_2); + } + + @Test + public void testGetSimilarProductsGcsWithFilter() throws Exception { + // Act + //ImportProductSets.importProductSets(PROJECT_ID, COMPUTE_REGION, GCS_URI); + //bout.reset(); + ProductSearch.getSimilarProductsGcs( + PROJECT_ID, COMPUTE_REGION, PRODUCT_SET_ID, PRODUCT_CATEGORY, IMAGE_URI_1, FILTER); + + // Assert + String got = bout.toString(); + assertThat(got).contains(PRODUCT_ID_1); + assertThat(got).doesNotContain(PRODUCT_ID_2); + } +} From 3372088b1daf6e9478ef6873c3a804f5c0112853 Mon Sep 17 00:00:00 2001 From: nirupa-kumar Date: Mon, 27 Aug 2018 15:04:31 -0700 Subject: [PATCH 4/5] Fixing issues after review. --- .../src/main/java/com/example/vision/ProductSearch.java | 1 + .../src/test/java/com/example/vision/ProductSearchIT.java | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductSearch.java b/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductSearch.java index 6899761a1f8..0d396581b80 100644 --- a/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductSearch.java +++ b/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductSearch.java @@ -193,6 +193,7 @@ public static void getSimilarProductsGcs(String projectId, System.out.println(String.format("Image name: %s", product.getImage())); } } + // [END vision_product_search_get_similar_products_gcs] public static void main(String[] args) throws Exception { ProductSearch productSearch = new ProductSearch(); diff --git a/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSearchIT.java b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSearchIT.java index 8b8f35a17e2..f51c761eaa9 100644 --- a/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSearchIT.java +++ b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSearchIT.java @@ -105,8 +105,6 @@ public void testGetSimilarProductsFileWithFilter() throws Exception { @Test public void testGetSimilarProductsGcsWithFilter() throws Exception { // Act - //ImportProductSets.importProductSets(PROJECT_ID, COMPUTE_REGION, GCS_URI); - //bout.reset(); ProductSearch.getSimilarProductsGcs( PROJECT_ID, COMPUTE_REGION, PRODUCT_SET_ID, PRODUCT_CATEGORY, IMAGE_URI_1, FILTER); From ab2ef41d02214a2f37621c7aed1b3e2897bb3eac Mon Sep 17 00:00:00 2001 From: nirupa-kumar Date: Mon, 27 Aug 2018 15:53:18 -0700 Subject: [PATCH 5/5] Inc. to LLC --- vision/product-search/cloud-client/pom.xml | 2 +- .../src/main/java/com/example/vision/ImportProductSets.java | 2 +- .../java/com/example/vision/ProductInProductSetManagement.java | 2 +- .../src/main/java/com/example/vision/ProductManagement.java | 2 +- .../src/main/java/com/example/vision/ProductSearch.java | 2 +- .../main/java/com/example/vision/ReferenceImageManagement.java | 2 +- .../src/test/java/com/example/vision/ImportProductSetsIT.java | 2 +- .../com/example/vision/ProductInProductSetManagementIT.java | 2 +- .../src/test/java/com/example/vision/ProductManagementIT.java | 2 +- .../src/test/java/com/example/vision/ProductSearchIT.java | 2 +- .../test/java/com/example/vision/ProductSetManagementIT.java | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/vision/product-search/cloud-client/pom.xml b/vision/product-search/cloud-client/pom.xml index 6c7a5762e50..0eae429c2ea 100644 --- a/vision/product-search/cloud-client/pom.xml +++ b/vision/product-search/cloud-client/pom.xml @@ -26,7 +26,7 @@ com.google.cloud.samples shared-configuration - 1.0.9 + 1.0.10 diff --git a/vision/product-search/cloud-client/src/main/java/com/example/vision/ImportProductSets.java b/vision/product-search/cloud-client/src/main/java/com/example/vision/ImportProductSets.java index 6071e33d0ed..ae8f08b2c9c 100644 --- a/vision/product-search/cloud-client/src/main/java/com/example/vision/ImportProductSets.java +++ b/vision/product-search/cloud-client/src/main/java/com/example/vision/ImportProductSets.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 Google Inc. + * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductInProductSetManagement.java b/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductInProductSetManagement.java index 36eb1779a9a..06f686ec998 100644 --- a/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductInProductSetManagement.java +++ b/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductInProductSetManagement.java @@ -1,5 +1,5 @@ /* - * Copyright 2017 Google Inc. + * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductManagement.java b/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductManagement.java index f0a22f106e8..4f5fc7dbb07 100644 --- a/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductManagement.java +++ b/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductManagement.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 Google Inc. + * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductSearch.java b/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductSearch.java index 0d396581b80..2e18e806226 100644 --- a/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductSearch.java +++ b/vision/product-search/cloud-client/src/main/java/com/example/vision/ProductSearch.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 Google Inc. + * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vision/product-search/cloud-client/src/main/java/com/example/vision/ReferenceImageManagement.java b/vision/product-search/cloud-client/src/main/java/com/example/vision/ReferenceImageManagement.java index 7618b3d796c..c9413259d5b 100644 --- a/vision/product-search/cloud-client/src/main/java/com/example/vision/ReferenceImageManagement.java +++ b/vision/product-search/cloud-client/src/main/java/com/example/vision/ReferenceImageManagement.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 Google Inc. + * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vision/product-search/cloud-client/src/test/java/com/example/vision/ImportProductSetsIT.java b/vision/product-search/cloud-client/src/test/java/com/example/vision/ImportProductSetsIT.java index 92377727211..a398dfd0037 100644 --- a/vision/product-search/cloud-client/src/test/java/com/example/vision/ImportProductSetsIT.java +++ b/vision/product-search/cloud-client/src/test/java/com/example/vision/ImportProductSetsIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 Google Inc. + * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductInProductSetManagementIT.java b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductInProductSetManagementIT.java index 0687d13e494..67bc1713148 100644 --- a/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductInProductSetManagementIT.java +++ b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductInProductSetManagementIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 Google Inc. + * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductManagementIT.java b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductManagementIT.java index 4a20a0d05b5..27db617513a 100644 --- a/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductManagementIT.java +++ b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductManagementIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 Google Inc. + * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSearchIT.java b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSearchIT.java index f51c761eaa9..812ab556c24 100644 --- a/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSearchIT.java +++ b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSearchIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 Google Inc. + * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. diff --git a/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSetManagementIT.java b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSetManagementIT.java index 424d6e21be7..9d92d606bf2 100644 --- a/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSetManagementIT.java +++ b/vision/product-search/cloud-client/src/test/java/com/example/vision/ProductSetManagementIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2018 Google Inc. + * Copyright 2018 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License.