Search in sources :

Example 66 with ListPagedResponse

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

the class GlobalPublicDelegatedPrefixesClientTest method listTest.

@Test
public void listTest() throws Exception {
    PublicDelegatedPrefix responsesElement = PublicDelegatedPrefix.newBuilder().build();
    PublicDelegatedPrefixList expectedResponse = PublicDelegatedPrefixList.newBuilder().setNextPageToken("").addAllItems(Arrays.asList(responsesElement)).build();
    mockService.addResponse(expectedResponse);
    String project = "project-6911";
    ListPagedResponse pagedListResponse = client.list(project);
    List<PublicDelegatedPrefix> 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.GlobalPublicDelegatedPrefixesClient.ListPagedResponse) Test(org.junit.Test)

Example 67 with ListPagedResponse

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

the class HealthChecksClientTest method listTest.

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

Example 68 with ListPagedResponse

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

the class ResourcePoliciesClientTest method listTest.

@Test
public void listTest() throws Exception {
    ResourcePolicy responsesElement = ResourcePolicy.newBuilder().build();
    ResourcePolicyList expectedResponse = ResourcePolicyList.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<ResourcePolicy> 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.ResourcePoliciesClient.ListPagedResponse) AggregatedListPagedResponse(com.google.cloud.compute.v1.ResourcePoliciesClient.AggregatedListPagedResponse) Test(org.junit.Test)

Example 69 with ListPagedResponse

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

the class RoutersClientTest method listTest.

@Test
public void listTest() throws Exception {
    Router responsesElement = Router.newBuilder().build();
    RouterList expectedResponse = RouterList.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<Router> 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.RoutersClient.ListPagedResponse) AggregatedListPagedResponse(com.google.cloud.compute.v1.RoutersClient.AggregatedListPagedResponse) Test(org.junit.Test)

Example 70 with ListPagedResponse

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

the class AddressesClientTest method listTest.

@Test
public void listTest() throws Exception {
    Address responsesElement = Address.newBuilder().build();
    AddressList expectedResponse = AddressList.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<Address> 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.AddressesClient.AggregatedListPagedResponse) ListPagedResponse(com.google.cloud.compute.v1.AddressesClient.ListPagedResponse) 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