Search in sources :

Example 1 with ListHyperparameterTuningJobsPagedResponse

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

Example 2 with ListHyperparameterTuningJobsPagedResponse

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

Example 3 with ListHyperparameterTuningJobsPagedResponse

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

Example 4 with ListHyperparameterTuningJobsPagedResponse

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

Aggregations

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