use of com.google.cloud.aiplatform.v1.JobServiceClient.ListHyperparameterTuningJobsPagedResponse in project java-aiplatform by googleapis.
the class JobServiceClientTest method listHyperparameterTuningJobsTest.
@Test
public void listHyperparameterTuningJobsTest() throws Exception {
HyperparameterTuningJob responsesElement = HyperparameterTuningJob.newBuilder().build();
ListHyperparameterTuningJobsResponse expectedResponse = ListHyperparameterTuningJobsResponse.newBuilder().setNextPageToken("").addAllHyperparameterTuningJobs(Arrays.asList(responsesElement)).build();
mockJobService.addResponse(expectedResponse);
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
ListHyperparameterTuningJobsPagedResponse pagedListResponse = client.listHyperparameterTuningJobs(parent);
List<HyperparameterTuningJob> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getHyperparameterTuningJobsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockJobService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListHyperparameterTuningJobsRequest actualRequest = ((ListHyperparameterTuningJobsRequest) 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.ListHyperparameterTuningJobsPagedResponse in project java-aiplatform by googleapis.
the class JobServiceClientTest method listHyperparameterTuningJobsTest2.
@Test
public void listHyperparameterTuningJobsTest2() throws Exception {
HyperparameterTuningJob responsesElement = HyperparameterTuningJob.newBuilder().build();
ListHyperparameterTuningJobsResponse expectedResponse = ListHyperparameterTuningJobsResponse.newBuilder().setNextPageToken("").addAllHyperparameterTuningJobs(Arrays.asList(responsesElement)).build();
mockJobService.addResponse(expectedResponse);
String parent = "parent-995424086";
ListHyperparameterTuningJobsPagedResponse pagedListResponse = client.listHyperparameterTuningJobs(parent);
List<HyperparameterTuningJob> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getHyperparameterTuningJobsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockJobService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListHyperparameterTuningJobsRequest actualRequest = ((ListHyperparameterTuningJobsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.aiplatform.v1.JobServiceClient.ListHyperparameterTuningJobsPagedResponse in project java-aiplatform by googleapis.
the class JobServiceClientTest method listHyperparameterTuningJobsTest.
@Test
public void listHyperparameterTuningJobsTest() throws Exception {
HyperparameterTuningJob responsesElement = HyperparameterTuningJob.newBuilder().build();
ListHyperparameterTuningJobsResponse expectedResponse = ListHyperparameterTuningJobsResponse.newBuilder().setNextPageToken("").addAllHyperparameterTuningJobs(Arrays.asList(responsesElement)).build();
mockJobService.addResponse(expectedResponse);
LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]");
ListHyperparameterTuningJobsPagedResponse pagedListResponse = client.listHyperparameterTuningJobs(parent);
List<HyperparameterTuningJob> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getHyperparameterTuningJobsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockJobService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListHyperparameterTuningJobsRequest actualRequest = ((ListHyperparameterTuningJobsRequest) 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.ListHyperparameterTuningJobsPagedResponse in project java-aiplatform by googleapis.
the class JobServiceClientTest method listHyperparameterTuningJobsTest2.
@Test
public void listHyperparameterTuningJobsTest2() throws Exception {
HyperparameterTuningJob responsesElement = HyperparameterTuningJob.newBuilder().build();
ListHyperparameterTuningJobsResponse expectedResponse = ListHyperparameterTuningJobsResponse.newBuilder().setNextPageToken("").addAllHyperparameterTuningJobs(Arrays.asList(responsesElement)).build();
mockJobService.addResponse(expectedResponse);
String parent = "parent-995424086";
ListHyperparameterTuningJobsPagedResponse pagedListResponse = client.listHyperparameterTuningJobs(parent);
List<HyperparameterTuningJob> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getHyperparameterTuningJobsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockJobService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListHyperparameterTuningJobsRequest actualRequest = ((ListHyperparameterTuningJobsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations