use of com.google.cloud.aiplatform.v1.PipelineServiceClient.ListTrainingPipelinesPagedResponse in project java-aiplatform by googleapis.
the class PipelineServiceClientTest method listTrainingPipelinesTest.
@Test
public void listTrainingPipelinesTest() throws Exception {
TrainingPipeline responsesElement = TrainingPipeline.newBuilder().build();
ListTrainingPipelinesResponse expectedResponse = ListTrainingPipelinesResponse.newBuilder().setNextPageToken("").addAllTrainingPipelines(Arrays.asList(responsesElement)).build();
mockPipelineService.addResponse(expectedResponse);
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
ListTrainingPipelinesPagedResponse pagedListResponse = client.listTrainingPipelines(parent);
List<TrainingPipeline> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getTrainingPipelinesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockPipelineService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListTrainingPipelinesRequest actualRequest = ((ListTrainingPipelinesRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.aiplatform.v1.PipelineServiceClient.ListTrainingPipelinesPagedResponse in project java-aiplatform by googleapis.
the class PipelineServiceClientTest method listTrainingPipelinesTest.
@Test
public void listTrainingPipelinesTest() throws Exception {
TrainingPipeline responsesElement = TrainingPipeline.newBuilder().build();
ListTrainingPipelinesResponse expectedResponse = ListTrainingPipelinesResponse.newBuilder().setNextPageToken("").addAllTrainingPipelines(Arrays.asList(responsesElement)).build();
mockPipelineService.addResponse(expectedResponse);
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
ListTrainingPipelinesPagedResponse pagedListResponse = client.listTrainingPipelines(parent);
List<TrainingPipeline> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getTrainingPipelinesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockPipelineService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListTrainingPipelinesRequest actualRequest = ((ListTrainingPipelinesRequest) actualRequests.get(0));
Assert.assertEquals(parent.toString(), actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.aiplatform.v1.PipelineServiceClient.ListTrainingPipelinesPagedResponse in project java-aiplatform by googleapis.
the class PipelineServiceClientTest method listTrainingPipelinesTest2.
@Test
public void listTrainingPipelinesTest2() throws Exception {
TrainingPipeline responsesElement = TrainingPipeline.newBuilder().build();
ListTrainingPipelinesResponse expectedResponse = ListTrainingPipelinesResponse.newBuilder().setNextPageToken("").addAllTrainingPipelines(Arrays.asList(responsesElement)).build();
mockPipelineService.addResponse(expectedResponse);
String parent = "parent-995424086";
ListTrainingPipelinesPagedResponse pagedListResponse = client.listTrainingPipelines(parent);
List<TrainingPipeline> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getTrainingPipelinesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockPipelineService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListTrainingPipelinesRequest actualRequest = ((ListTrainingPipelinesRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.aiplatform.v1.PipelineServiceClient.ListTrainingPipelinesPagedResponse in project java-aiplatform by googleapis.
the class PipelineServiceClientTest method listTrainingPipelinesTest2.
@Test
public void listTrainingPipelinesTest2() throws Exception {
TrainingPipeline responsesElement = TrainingPipeline.newBuilder().build();
ListTrainingPipelinesResponse expectedResponse = ListTrainingPipelinesResponse.newBuilder().setNextPageToken("").addAllTrainingPipelines(Arrays.asList(responsesElement)).build();
mockPipelineService.addResponse(expectedResponse);
String parent = "parent-995424086";
ListTrainingPipelinesPagedResponse pagedListResponse = client.listTrainingPipelines(parent);
List<TrainingPipeline> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getTrainingPipelinesList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockPipelineService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListTrainingPipelinesRequest actualRequest = ((ListTrainingPipelinesRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations