Search in sources :

Example 1 with ListBatchPredictionJobsPagedResponse

use of com.google.cloud.aiplatform.v1beta1.JobServiceClient.ListBatchPredictionJobsPagedResponse in project java-aiplatform by googleapis.

the class JobServiceClientTest method listBatchPredictionJobsTest2.

@Test
public void listBatchPredictionJobsTest2() throws Exception {
    BatchPredictionJob responsesElement = BatchPredictionJob.newBuilder().build();
    ListBatchPredictionJobsResponse expectedResponse = ListBatchPredictionJobsResponse.newBuilder().setNextPageToken("").addAllBatchPredictionJobs(Arrays.asList(responsesElement)).build();
    mockJobService.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListBatchPredictionJobsPagedResponse pagedListResponse = client.listBatchPredictionJobs(parent);
    List<BatchPredictionJob> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getBatchPredictionJobsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockJobService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListBatchPredictionJobsRequest actualRequest = ((ListBatchPredictionJobsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListBatchPredictionJobsPagedResponse(com.google.cloud.aiplatform.v1.JobServiceClient.ListBatchPredictionJobsPagedResponse) Test(org.junit.Test)

Example 2 with ListBatchPredictionJobsPagedResponse

use of com.google.cloud.aiplatform.v1beta1.JobServiceClient.ListBatchPredictionJobsPagedResponse in project java-aiplatform by googleapis.

the class JobServiceClientTest method listBatchPredictionJobsTest.

@Test
public void listBatchPredictionJobsTest() throws Exception {
    BatchPredictionJob responsesElement = BatchPredictionJob.newBuilder().build();
    ListBatchPredictionJobsResponse expectedResponse = ListBatchPredictionJobsResponse.newBuilder().setNextPageToken("").addAllBatchPredictionJobs(Arrays.asList(responsesElement)).build();
    mockJobService.addResponse(expectedResponse);
    LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    ListBatchPredictionJobsPagedResponse pagedListResponse = client.listBatchPredictionJobs(parent);
    List<BatchPredictionJob> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getBatchPredictionJobsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockJobService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListBatchPredictionJobsRequest actualRequest = ((ListBatchPredictionJobsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListBatchPredictionJobsPagedResponse(com.google.cloud.aiplatform.v1.JobServiceClient.ListBatchPredictionJobsPagedResponse) Test(org.junit.Test)

Example 3 with ListBatchPredictionJobsPagedResponse

use of com.google.cloud.aiplatform.v1beta1.JobServiceClient.ListBatchPredictionJobsPagedResponse in project java-aiplatform by googleapis.

the class JobServiceClientTest method listBatchPredictionJobsTest.

@Test
public void listBatchPredictionJobsTest() throws Exception {
    BatchPredictionJob responsesElement = BatchPredictionJob.newBuilder().build();
    ListBatchPredictionJobsResponse expectedResponse = ListBatchPredictionJobsResponse.newBuilder().setNextPageToken("").addAllBatchPredictionJobs(Arrays.asList(responsesElement)).build();
    mockJobService.addResponse(expectedResponse);
    LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
    ListBatchPredictionJobsPagedResponse pagedListResponse = client.listBatchPredictionJobs(parent);
    List<BatchPredictionJob> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getBatchPredictionJobsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockJobService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListBatchPredictionJobsRequest actualRequest = ((ListBatchPredictionJobsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListBatchPredictionJobsPagedResponse(com.google.cloud.aiplatform.v1beta1.JobServiceClient.ListBatchPredictionJobsPagedResponse) Test(org.junit.Test)

Example 4 with ListBatchPredictionJobsPagedResponse

use of com.google.cloud.aiplatform.v1beta1.JobServiceClient.ListBatchPredictionJobsPagedResponse in project java-aiplatform by googleapis.

the class JobServiceClientTest method listBatchPredictionJobsTest2.

@Test
public void listBatchPredictionJobsTest2() throws Exception {
    BatchPredictionJob responsesElement = BatchPredictionJob.newBuilder().build();
    ListBatchPredictionJobsResponse expectedResponse = ListBatchPredictionJobsResponse.newBuilder().setNextPageToken("").addAllBatchPredictionJobs(Arrays.asList(responsesElement)).build();
    mockJobService.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListBatchPredictionJobsPagedResponse pagedListResponse = client.listBatchPredictionJobs(parent);
    List<BatchPredictionJob> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getBatchPredictionJobsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockJobService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListBatchPredictionJobsRequest actualRequest = ((ListBatchPredictionJobsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListBatchPredictionJobsPagedResponse(com.google.cloud.aiplatform.v1beta1.JobServiceClient.ListBatchPredictionJobsPagedResponse) Test(org.junit.Test)

Aggregations

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