Search in sources :

Example 71 with ListPagedResponse

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

the class AutoscalersClientTest method listTest.

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

Example 72 with ListPagedResponse

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

the class BackendBucketsClientTest method listTest.

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

Example 73 with ListPagedResponse

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

the class TargetGrpcProxiesClientTest method listTest.

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

Example 74 with ListPagedResponse

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

the class TargetHttpProxiesClientTest method listTest.

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

Example 75 with ListPagedResponse

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

the class TargetHttpsProxiesClientTest method listTest.

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