Search in sources :

Example 1 with ListTrainingPipelinesPagedResponse

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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListTrainingPipelinesPagedResponse(com.google.cloud.aiplatform.v1.PipelineServiceClient.ListTrainingPipelinesPagedResponse) Test(org.junit.Test)

Example 2 with ListTrainingPipelinesPagedResponse

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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListTrainingPipelinesPagedResponse(com.google.cloud.aiplatform.v1beta1.PipelineServiceClient.ListTrainingPipelinesPagedResponse) Test(org.junit.Test)

Example 3 with ListTrainingPipelinesPagedResponse

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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListTrainingPipelinesPagedResponse(com.google.cloud.aiplatform.v1beta1.PipelineServiceClient.ListTrainingPipelinesPagedResponse) Test(org.junit.Test)

Example 4 with ListTrainingPipelinesPagedResponse

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()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) ListTrainingPipelinesPagedResponse(com.google.cloud.aiplatform.v1.PipelineServiceClient.ListTrainingPipelinesPagedResponse) Test(org.junit.Test)

Aggregations

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