Search in sources :

Example 46 with ListPagedResponse

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

the class InstanceGroupsClientTest method listTest.

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

Example 47 with ListPagedResponse

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

the class InterconnectLocationsClientTest method listTest.

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

Example 48 with ListPagedResponse

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

the class NodeTypesClientTest method listTest.

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

Example 49 with ListPagedResponse

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

the class PacketMirroringsClientTest method listTest.

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

Example 50 with ListPagedResponse

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

the class PublicDelegatedPrefixesClientTest 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";
    String region = "region-9622";
    ListPagedResponse pagedListResponse = client.list(project, region);
    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 : AggregatedListPagedResponse(com.google.cloud.compute.v1.PublicDelegatedPrefixesClient.AggregatedListPagedResponse) ListPagedResponse(com.google.cloud.compute.v1.PublicDelegatedPrefixesClient.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