use of com.google.cloud.compute.v1.RegionInstanceGroupManagersClient.ListErrorsPagedResponse in project java-compute by googleapis.
the class InstanceGroupManagersClientTest method listErrorsTest.
@Test
public void listErrorsTest() throws Exception {
InstanceManagedByIgmError responsesElement = InstanceManagedByIgmError.newBuilder().build();
InstanceGroupManagersListErrorsResponse expectedResponse = InstanceGroupManagersListErrorsResponse.newBuilder().setNextPageToken("").addAllItems(Arrays.asList(responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
String zone = "zone-5246";
String instanceGroupManager = "instanceGroupManager-7543";
ListErrorsPagedResponse pagedListResponse = client.listErrors(project, zone, instanceGroupManager);
List<InstanceManagedByIgmError> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0));
List<String> actualRequests = mockService.getRequestPaths();
Assert.assertEquals(1, actualRequests.size());
String apiClientHeaderKey = mockService.getRequestHeaders().get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()).iterator().next();
Assert.assertTrue(GaxHttpJsonProperties.getDefaultApiClientHeaderPattern().matcher(apiClientHeaderKey).matches());
}
use of com.google.cloud.compute.v1.RegionInstanceGroupManagersClient.ListErrorsPagedResponse in project java-compute by googleapis.
the class RegionInstanceGroupManagersClientTest method listErrorsTest.
@Test
public void listErrorsTest() throws Exception {
InstanceManagedByIgmError responsesElement = InstanceManagedByIgmError.newBuilder().build();
RegionInstanceGroupManagersListErrorsResponse expectedResponse = RegionInstanceGroupManagersListErrorsResponse.newBuilder().setNextPageToken("").addAllItems(Arrays.asList(responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
String region = "region-9622";
String instanceGroupManager = "instanceGroupManager-7543";
ListErrorsPagedResponse pagedListResponse = client.listErrors(project, region, instanceGroupManager);
List<InstanceManagedByIgmError> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getItemsList().get(0), resources.get(0));
List<String> actualRequests = mockService.getRequestPaths();
Assert.assertEquals(1, actualRequests.size());
String apiClientHeaderKey = mockService.getRequestHeaders().get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()).iterator().next();
Assert.assertTrue(GaxHttpJsonProperties.getDefaultApiClientHeaderPattern().matcher(apiClientHeaderKey).matches());
}
Aggregations