Search in sources :

Example 6 with ListPagedResponse

use of com.google.cloud.compute.v1.MachineImagesClient.ListPagedResponse in project java-compute by googleapis.

the class TargetVpnGatewaysClientTest method listTest.

@Test
public void listTest() throws Exception {
    TargetVpnGateway responsesElement = TargetVpnGateway.newBuilder().build();
    TargetVpnGatewayList expectedResponse = TargetVpnGatewayList.newBuilder().setNextPageToken("").addAllItems(Arrays.asList(responsesElement)).build();
    mockService.addResponse(expectedResponse);
    String project = "project-6911";
    String region = "region-9622";
    ListPagedResponse pagedListResponse = client.list(project, region);
    List<TargetVpnGateway> 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 : ListPagedResponse(com.google.cloud.compute.v1.TargetVpnGatewaysClient.ListPagedResponse) AggregatedListPagedResponse(com.google.cloud.compute.v1.TargetVpnGatewaysClient.AggregatedListPagedResponse) Test(org.junit.Test)

Example 7 with ListPagedResponse

use of com.google.cloud.compute.v1.MachineImagesClient.ListPagedResponse in project java-compute by googleapis.

the class VpnGatewaysClientTest method listTest.

@Test
public void listTest() throws Exception {
    VpnGateway responsesElement = VpnGateway.newBuilder().build();
    VpnGatewayList expectedResponse = VpnGatewayList.newBuilder().setNextPageToken("").addAllItems(Arrays.asList(responsesElement)).build();
    mockService.addResponse(expectedResponse);
    String project = "project-6911";
    String region = "region-9622";
    ListPagedResponse pagedListResponse = client.list(project, region);
    List<VpnGateway> 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 : AggregatedListPagedResponse(com.google.cloud.compute.v1.VpnGatewaysClient.AggregatedListPagedResponse) ListPagedResponse(com.google.cloud.compute.v1.VpnGatewaysClient.ListPagedResponse) Test(org.junit.Test)

Example 8 with ListPagedResponse

use of com.google.cloud.compute.v1.MachineImagesClient.ListPagedResponse in project java-compute by googleapis.

the class VpnTunnelsClientTest method listTest.

@Test
public void listTest() throws Exception {
    VpnTunnel responsesElement = VpnTunnel.newBuilder().build();
    VpnTunnelList expectedResponse = VpnTunnelList.newBuilder().setNextPageToken("").addAllItems(Arrays.asList(responsesElement)).build();
    mockService.addResponse(expectedResponse);
    String project = "project-6911";
    String region = "region-9622";
    ListPagedResponse pagedListResponse = client.list(project, region);
    List<VpnTunnel> 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 : ListPagedResponse(com.google.cloud.compute.v1.VpnTunnelsClient.ListPagedResponse) AggregatedListPagedResponse(com.google.cloud.compute.v1.VpnTunnelsClient.AggregatedListPagedResponse) Test(org.junit.Test)

Example 9 with ListPagedResponse

use of com.google.cloud.compute.v1.MachineImagesClient.ListPagedResponse in project java-compute by googleapis.

the class ZoneOperationsClientTest method listTest.

@Test
public void listTest() throws Exception {
    Operation responsesElement = Operation.newBuilder().build();
    OperationList expectedResponse = OperationList.newBuilder().setNextPageToken("").addAllItems(Arrays.asList(responsesElement)).build();
    mockService.addResponse(expectedResponse);
    String project = "project-6911";
    String zone = "zone-5246";
    ListPagedResponse pagedListResponse = client.list(project, zone);
    List<Operation> 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 : ListPagedResponse(com.google.cloud.compute.v1.ZoneOperationsClient.ListPagedResponse) Test(org.junit.Test)

Example 10 with ListPagedResponse

use of com.google.cloud.compute.v1.MachineImagesClient.ListPagedResponse in project java-compute by googleapis.

the class InstanceGroupManagersClientTest method listTest.

@Test
public void listTest() throws Exception {
    InstanceGroupManager responsesElement = InstanceGroupManager.newBuilder().build();
    InstanceGroupManagerList expectedResponse = InstanceGroupManagerList.newBuilder().setNextPageToken("").addAllItems(Arrays.asList(responsesElement)).build();
    mockService.addResponse(expectedResponse);
    String project = "project-6911";
    String zone = "zone-5246";
    ListPagedResponse pagedListResponse = client.list(project, zone);
    List<InstanceGroupManager> 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 : ListPagedResponse(com.google.cloud.compute.v1.InstanceGroupManagersClient.ListPagedResponse) AggregatedListPagedResponse(com.google.cloud.compute.v1.InstanceGroupManagersClient.AggregatedListPagedResponse) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)77 ListPagedResponse (com.google.cloud.compute.v1.InstanceTemplatesClient.ListPagedResponse)2 ListPagedResponse (com.google.cloud.compute.v1.ZoneOperationsClient.ListPagedResponse)2 AggregatedListPagedResponse (com.google.cloud.compute.v1.AcceleratorTypesClient.AggregatedListPagedResponse)1 ListPagedResponse (com.google.cloud.compute.v1.AcceleratorTypesClient.ListPagedResponse)1 AggregatedListPagedResponse (com.google.cloud.compute.v1.AddressesClient.AggregatedListPagedResponse)1 ListPagedResponse (com.google.cloud.compute.v1.AddressesClient.ListPagedResponse)1 AggregatedListPagedResponse (com.google.cloud.compute.v1.AutoscalersClient.AggregatedListPagedResponse)1 ListPagedResponse (com.google.cloud.compute.v1.AutoscalersClient.ListPagedResponse)1 ListPagedResponse (com.google.cloud.compute.v1.BackendBucketsClient.ListPagedResponse)1 AggregatedListPagedResponse (com.google.cloud.compute.v1.BackendServicesClient.AggregatedListPagedResponse)1 ListPagedResponse (com.google.cloud.compute.v1.BackendServicesClient.ListPagedResponse)1 AggregatedListPagedResponse (com.google.cloud.compute.v1.DiskTypesClient.AggregatedListPagedResponse)1 ListPagedResponse (com.google.cloud.compute.v1.DiskTypesClient.ListPagedResponse)1 AggregatedListPagedResponse (com.google.cloud.compute.v1.DisksClient.AggregatedListPagedResponse)1 ListPagedResponse (com.google.cloud.compute.v1.DisksClient.ListPagedResponse)1 ListPagedResponse (com.google.cloud.compute.v1.ExternalVpnGatewaysClient.ListPagedResponse)1 ListPagedResponse (com.google.cloud.compute.v1.FirewallPoliciesClient.ListPagedResponse)1 ListPagedResponse (com.google.cloud.compute.v1.FirewallsClient.ListPagedResponse)1 AggregatedListPagedResponse (com.google.cloud.compute.v1.ForwardingRulesClient.AggregatedListPagedResponse)1