Search in sources :

Example 1 with ListAnnotationsPagedResponse

use of com.google.cloud.aiplatform.v1.DatasetServiceClient.ListAnnotationsPagedResponse in project java-aiplatform by googleapis.

the class DatasetServiceClientTest method listAnnotationsTest2.

@Test
public void listAnnotationsTest2() throws Exception {
    Annotation responsesElement = Annotation.newBuilder().build();
    ListAnnotationsResponse expectedResponse = ListAnnotationsResponse.newBuilder().setNextPageToken("").addAllAnnotations(Arrays.asList(responsesElement)).build();
    mockDatasetService.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListAnnotationsPagedResponse pagedListResponse = client.listAnnotations(parent);
    List<Annotation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getAnnotationsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockDatasetService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListAnnotationsRequest actualRequest = ((ListAnnotationsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListAnnotationsPagedResponse(com.google.cloud.aiplatform.v1.DatasetServiceClient.ListAnnotationsPagedResponse) Test(org.junit.Test)

Example 2 with ListAnnotationsPagedResponse

use of com.google.cloud.aiplatform.v1.DatasetServiceClient.ListAnnotationsPagedResponse in project java-aiplatform by googleapis.

the class DatasetServiceClientTest method listAnnotationsTest.

@Test
public void listAnnotationsTest() throws Exception {
    Annotation responsesElement = Annotation.newBuilder().build();
    ListAnnotationsResponse expectedResponse = ListAnnotationsResponse.newBuilder().setNextPageToken("").addAllAnnotations(Arrays.asList(responsesElement)).build();
    mockDatasetService.addResponse(expectedResponse);
    DataItemName parent = DataItemName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[DATA_ITEM]");
    ListAnnotationsPagedResponse pagedListResponse = client.listAnnotations(parent);
    List<Annotation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getAnnotationsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockDatasetService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListAnnotationsRequest actualRequest = ((ListAnnotationsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListAnnotationsPagedResponse(com.google.cloud.aiplatform.v1beta1.DatasetServiceClient.ListAnnotationsPagedResponse) Test(org.junit.Test)

Example 3 with ListAnnotationsPagedResponse

use of com.google.cloud.aiplatform.v1.DatasetServiceClient.ListAnnotationsPagedResponse in project java-aiplatform by googleapis.

the class DatasetServiceClientTest method listAnnotationsTest2.

@Test
public void listAnnotationsTest2() throws Exception {
    Annotation responsesElement = Annotation.newBuilder().build();
    ListAnnotationsResponse expectedResponse = ListAnnotationsResponse.newBuilder().setNextPageToken("").addAllAnnotations(Arrays.asList(responsesElement)).build();
    mockDatasetService.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListAnnotationsPagedResponse pagedListResponse = client.listAnnotations(parent);
    List<Annotation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getAnnotationsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockDatasetService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListAnnotationsRequest actualRequest = ((ListAnnotationsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListAnnotationsPagedResponse(com.google.cloud.aiplatform.v1beta1.DatasetServiceClient.ListAnnotationsPagedResponse) Test(org.junit.Test)

Example 4 with ListAnnotationsPagedResponse

use of com.google.cloud.aiplatform.v1.DatasetServiceClient.ListAnnotationsPagedResponse in project java-aiplatform by googleapis.

the class DatasetServiceClientTest method listAnnotationsTest.

@Test
public void listAnnotationsTest() throws Exception {
    Annotation responsesElement = Annotation.newBuilder().build();
    ListAnnotationsResponse expectedResponse = ListAnnotationsResponse.newBuilder().setNextPageToken("").addAllAnnotations(Arrays.asList(responsesElement)).build();
    mockDatasetService.addResponse(expectedResponse);
    DataItemName parent = DataItemName.of("[PROJECT]", "[LOCATION]", "[DATASET]", "[DATA_ITEM]");
    ListAnnotationsPagedResponse pagedListResponse = client.listAnnotations(parent);
    List<Annotation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getAnnotationsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockDatasetService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListAnnotationsRequest actualRequest = ((ListAnnotationsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListAnnotationsPagedResponse(com.google.cloud.aiplatform.v1.DatasetServiceClient.ListAnnotationsPagedResponse) Test(org.junit.Test)

Aggregations

AbstractMessage (com.google.protobuf.AbstractMessage)4 Test (org.junit.Test)4 ListAnnotationsPagedResponse (com.google.cloud.aiplatform.v1.DatasetServiceClient.ListAnnotationsPagedResponse)2 ListAnnotationsPagedResponse (com.google.cloud.aiplatform.v1beta1.DatasetServiceClient.ListAnnotationsPagedResponse)2