Search in sources :

Example 1 with ListPerInstanceConfigsPagedResponse

use of com.google.cloud.compute.v1.InstanceGroupManagersClient.ListPerInstanceConfigsPagedResponse in project java-compute by googleapis.

the class RegionInstanceGroupManagersClientTest method listPerInstanceConfigsTest.

@Test
public void listPerInstanceConfigsTest() throws Exception {
    PerInstanceConfig responsesElement = PerInstanceConfig.newBuilder().build();
    RegionInstanceGroupManagersListInstanceConfigsResp expectedResponse = RegionInstanceGroupManagersListInstanceConfigsResp.newBuilder().setNextPageToken("").addAllItems(Arrays.asList(responsesElement)).build();
    mockService.addResponse(expectedResponse);
    String project = "project-6911";
    String region = "region-9622";
    String instanceGroupManager = "instanceGroupManager-7543";
    ListPerInstanceConfigsPagedResponse pagedListResponse = client.listPerInstanceConfigs(project, region, instanceGroupManager);
    List<PerInstanceConfig> 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());
}
Also used : ListPerInstanceConfigsPagedResponse(com.google.cloud.compute.v1.RegionInstanceGroupManagersClient.ListPerInstanceConfigsPagedResponse) Test(org.junit.Test)

Example 2 with ListPerInstanceConfigsPagedResponse

use of com.google.cloud.compute.v1.InstanceGroupManagersClient.ListPerInstanceConfigsPagedResponse in project java-compute by googleapis.

the class InstanceGroupManagersClientTest method listPerInstanceConfigsTest.

@Test
public void listPerInstanceConfigsTest() throws Exception {
    PerInstanceConfig responsesElement = PerInstanceConfig.newBuilder().build();
    InstanceGroupManagersListPerInstanceConfigsResp expectedResponse = InstanceGroupManagersListPerInstanceConfigsResp.newBuilder().setNextPageToken("").addAllItems(Arrays.asList(responsesElement)).build();
    mockService.addResponse(expectedResponse);
    String project = "project-6911";
    String zone = "zone-5246";
    String instanceGroupManager = "instanceGroupManager-7543";
    ListPerInstanceConfigsPagedResponse pagedListResponse = client.listPerInstanceConfigs(project, zone, instanceGroupManager);
    List<PerInstanceConfig> 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());
}
Also used : ListPerInstanceConfigsPagedResponse(com.google.cloud.compute.v1.InstanceGroupManagersClient.ListPerInstanceConfigsPagedResponse) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 ListPerInstanceConfigsPagedResponse (com.google.cloud.compute.v1.InstanceGroupManagersClient.ListPerInstanceConfigsPagedResponse)1 ListPerInstanceConfigsPagedResponse (com.google.cloud.compute.v1.RegionInstanceGroupManagersClient.ListPerInstanceConfigsPagedResponse)1