use of com.google.cloud.aiplatform.v1.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()));
}
use of com.google.cloud.aiplatform.v1.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()));
}
use of com.google.cloud.aiplatform.v1.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()));
}
use of com.google.cloud.aiplatform.v1.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()));
}
Aggregations