Search in sources :

Example 1 with ListProductSetsPagedResponse

use of com.google.cloud.vision.v1p3beta1.ProductSearchClient.ListProductSetsPagedResponse in project java-vision by googleapis.

the class ProductSearchClientTest method listProductSetsTest2.

@Test
public void listProductSetsTest2() throws Exception {
    ProductSet responsesElement = ProductSet.newBuilder().build();
    ListProductSetsResponse expectedResponse = ListProductSetsResponse.newBuilder().setNextPageToken("").addAllProductSets(Arrays.asList(responsesElement)).build();
    mockProductSearch.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListProductSetsPagedResponse pagedListResponse = client.listProductSets(parent);
    List<ProductSet> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getProductSetsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockProductSearch.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListProductSetsRequest actualRequest = ((ListProductSetsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListProductSetsPagedResponse(com.google.cloud.vision.v1p4beta1.ProductSearchClient.ListProductSetsPagedResponse) Test(org.junit.Test)

Example 2 with ListProductSetsPagedResponse

use of com.google.cloud.vision.v1p3beta1.ProductSearchClient.ListProductSetsPagedResponse in project java-vision by googleapis.

the class ProductSearchClientTest method listProductSetsTest2.

@Test
public void listProductSetsTest2() throws Exception {
    ProductSet responsesElement = ProductSet.newBuilder().build();
    ListProductSetsResponse expectedResponse = ListProductSetsResponse.newBuilder().setNextPageToken("").addAllProductSets(Arrays.asList(responsesElement)).build();
    mockProductSearch.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListProductSetsPagedResponse pagedListResponse = client.listProductSets(parent);
    List<ProductSet> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getProductSetsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockProductSearch.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListProductSetsRequest actualRequest = ((ListProductSetsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListProductSetsPagedResponse(com.google.cloud.vision.v1.ProductSearchClient.ListProductSetsPagedResponse) Test(org.junit.Test)

Example 3 with ListProductSetsPagedResponse

use of com.google.cloud.vision.v1p3beta1.ProductSearchClient.ListProductSetsPagedResponse in project java-vision by googleapis.

the class ProductSearchClientTest method listProductSetsTest.

@Test
public void listProductSetsTest() throws Exception {
    ProductSet responsesElement = ProductSet.newBuilder().build();
    ListProductSetsResponse expectedResponse = ListProductSetsResponse.newBuilder().setNextPageToken("").addAllProductSets(Arrays.asList(responsesElement)).build();
    mockProductSearch.addResponse(expectedResponse);
    LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    ListProductSetsPagedResponse pagedListResponse = client.listProductSets(parent);
    List<ProductSet> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getProductSetsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockProductSearch.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListProductSetsRequest actualRequest = ((ListProductSetsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListProductSetsPagedResponse(com.google.cloud.vision.v1.ProductSearchClient.ListProductSetsPagedResponse) Test(org.junit.Test)

Example 4 with ListProductSetsPagedResponse

use of com.google.cloud.vision.v1p3beta1.ProductSearchClient.ListProductSetsPagedResponse in project java-vision by googleapis.

the class ProductSearchClientTest method listProductSetsTest.

@Test
public void listProductSetsTest() throws Exception {
    ProductSet responsesElement = ProductSet.newBuilder().build();
    ListProductSetsResponse expectedResponse = ListProductSetsResponse.newBuilder().setNextPageToken("").addAllProductSets(Arrays.asList(responsesElement)).build();
    mockProductSearch.addResponse(expectedResponse);
    LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    ListProductSetsPagedResponse pagedListResponse = client.listProductSets(parent);
    List<ProductSet> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getProductSetsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockProductSearch.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListProductSetsRequest actualRequest = ((ListProductSetsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListProductSetsPagedResponse(com.google.cloud.vision.v1p3beta1.ProductSearchClient.ListProductSetsPagedResponse) Test(org.junit.Test)

Example 5 with ListProductSetsPagedResponse

use of com.google.cloud.vision.v1p3beta1.ProductSearchClient.ListProductSetsPagedResponse in project java-vision by googleapis.

the class ProductSearchClientTest method listProductSetsTest.

@Test
public void listProductSetsTest() throws Exception {
    ProductSet responsesElement = ProductSet.newBuilder().build();
    ListProductSetsResponse expectedResponse = ListProductSetsResponse.newBuilder().setNextPageToken("").addAllProductSets(Arrays.asList(responsesElement)).build();
    mockProductSearch.addResponse(expectedResponse);
    LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    ListProductSetsPagedResponse pagedListResponse = client.listProductSets(parent);
    List<ProductSet> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getProductSetsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockProductSearch.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListProductSetsRequest actualRequest = ((ListProductSetsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListProductSetsPagedResponse(com.google.cloud.vision.v1p4beta1.ProductSearchClient.ListProductSetsPagedResponse) Test(org.junit.Test)

Aggregations

AbstractMessage (com.google.protobuf.AbstractMessage)6 Test (org.junit.Test)6 ListProductSetsPagedResponse (com.google.cloud.vision.v1.ProductSearchClient.ListProductSetsPagedResponse)2 ListProductSetsPagedResponse (com.google.cloud.vision.v1p3beta1.ProductSearchClient.ListProductSetsPagedResponse)2 ListProductSetsPagedResponse (com.google.cloud.vision.v1p4beta1.ProductSearchClient.ListProductSetsPagedResponse)2