From 25b3c923b03d735bdb3a5e2f66a3317339915d2b Mon Sep 17 00:00:00 2001 From: Noah Negrey Date: Tue, 18 Jun 2019 14:45:49 -0600 Subject: [PATCH] Pdt search updates (#1473) * Update to use shared data bucket for import test in Product Search * Include note for Similar Product Search * Fix test failures * Fix the tests and use a static indexed csv like the other languages --- .../com/example/vision/ImportProductSetsIT.java | 2 +- .../java/com/example/vision/ProductSearchIT.java | 13 +++++-------- 2 files changed, 6 insertions(+), 9 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 deea049c678..da946130afa 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 @@ -34,7 +34,7 @@ public class ImportProductSetsIT { 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"; + "gs://cloud-samples-data/vision/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"; 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 367c4965eef..e489ced53f8 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 @@ -26,20 +26,21 @@ import org.junit.runner.RunWith; import org.junit.runners.JUnit4; -/** Integration (system) tests for {@link ProductSearch}. */ +/** + * Integration (system) tests for {@link ProductSearch}.Tests rely on pre-created product set + * that has been indexed. + **/ @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"; + "gs://cloud-samples-data/vision/product_search/shoes_1.jpg"; private static final String FILE_PATH_1 = "./resources/shoes_1.jpg"; private static final String FILTER = "style=womens"; private ByteArrayOutputStream bout; @@ -51,15 +52,11 @@ 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); }