Search in sources :

Example 21 with AggregatedListPagedResponse

use of com.google.cloud.compute.v1.HealthChecksClient.AggregatedListPagedResponse in project java-compute by googleapis.

the class NodeTemplatesClientTest method aggregatedListTest.

@Test
public void aggregatedListTest() throws Exception {
    NodeTemplatesScopedList responsesElement = NodeTemplatesScopedList.newBuilder().build();
    NodeTemplateAggregatedList expectedResponse = NodeTemplateAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
    mockService.addResponse(expectedResponse);
    String project = "project-6911";
    AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
    List<Map.Entry<String, NodeTemplatesScopedList>> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getItemsMap().entrySet().iterator().next(), 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.NodeTemplatesClient.AggregatedListPagedResponse) Test(org.junit.Test)

Example 22 with AggregatedListPagedResponse

use of com.google.cloud.compute.v1.HealthChecksClient.AggregatedListPagedResponse in project java-compute by googleapis.

the class PacketMirroringsClientTest method aggregatedListTest.

@Test
public void aggregatedListTest() throws Exception {
    PacketMirroringsScopedList responsesElement = PacketMirroringsScopedList.newBuilder().build();
    PacketMirroringAggregatedList expectedResponse = PacketMirroringAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
    mockService.addResponse(expectedResponse);
    String project = "project-6911";
    AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
    List<Map.Entry<String, PacketMirroringsScopedList>> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getItemsMap().entrySet().iterator().next(), 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.PacketMirroringsClient.AggregatedListPagedResponse) Test(org.junit.Test)

Example 23 with AggregatedListPagedResponse

use of com.google.cloud.compute.v1.HealthChecksClient.AggregatedListPagedResponse in project java-compute by googleapis.

the class PublicDelegatedPrefixesClientTest method aggregatedListTest.

@Test
public void aggregatedListTest() throws Exception {
    PublicDelegatedPrefixesScopedList responsesElement = PublicDelegatedPrefixesScopedList.newBuilder().build();
    PublicDelegatedPrefixAggregatedList expectedResponse = PublicDelegatedPrefixAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
    mockService.addResponse(expectedResponse);
    String project = "project-6911";
    AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
    List<Map.Entry<String, PublicDelegatedPrefixesScopedList>> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getItemsMap().entrySet().iterator().next(), 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) Test(org.junit.Test)

Example 24 with AggregatedListPagedResponse

use of com.google.cloud.compute.v1.HealthChecksClient.AggregatedListPagedResponse in project java-compute by googleapis.

the class RegionCommitmentsClientTest method aggregatedListTest.

@Test
public void aggregatedListTest() throws Exception {
    CommitmentsScopedList responsesElement = CommitmentsScopedList.newBuilder().build();
    CommitmentAggregatedList expectedResponse = CommitmentAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
    mockService.addResponse(expectedResponse);
    String project = "project-6911";
    AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
    List<Map.Entry<String, CommitmentsScopedList>> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getItemsMap().entrySet().iterator().next(), 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.RegionCommitmentsClient.AggregatedListPagedResponse) Test(org.junit.Test)

Example 25 with AggregatedListPagedResponse

use of com.google.cloud.compute.v1.HealthChecksClient.AggregatedListPagedResponse in project java-compute by googleapis.

the class DiskTypesClientTest method aggregatedListTest.

@Test
public void aggregatedListTest() throws Exception {
    DiskTypesScopedList responsesElement = DiskTypesScopedList.newBuilder().build();
    DiskTypeAggregatedList expectedResponse = DiskTypeAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
    mockService.addResponse(expectedResponse);
    String project = "project-6911";
    AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
    List<Map.Entry<String, DiskTypesScopedList>> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getItemsMap().entrySet().iterator().next(), 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.DiskTypesClient.AggregatedListPagedResponse) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)35 AggregatedListPagedResponse (com.google.cloud.compute.v1.InstancesClient.AggregatedListPagedResponse)2 AggregatedListPagedResponse (com.google.cloud.compute.v1.AcceleratorTypesClient.AggregatedListPagedResponse)1 AggregatedListPagedResponse (com.google.cloud.compute.v1.AddressesClient.AggregatedListPagedResponse)1 AggregatedListInstancesRequest (com.google.cloud.compute.v1.AggregatedListInstancesRequest)1 AggregatedListPagedResponse (com.google.cloud.compute.v1.AutoscalersClient.AggregatedListPagedResponse)1 AggregatedListPagedResponse (com.google.cloud.compute.v1.BackendServicesClient.AggregatedListPagedResponse)1 AggregatedListPagedResponse (com.google.cloud.compute.v1.DiskTypesClient.AggregatedListPagedResponse)1 AggregatedListPagedResponse (com.google.cloud.compute.v1.DisksClient.AggregatedListPagedResponse)1 AggregatedListPagedResponse (com.google.cloud.compute.v1.ForwardingRulesClient.AggregatedListPagedResponse)1 AggregatedListPagedResponse (com.google.cloud.compute.v1.GlobalOperationsClient.AggregatedListPagedResponse)1 AggregatedListPagedResponse (com.google.cloud.compute.v1.HealthChecksClient.AggregatedListPagedResponse)1 Instance (com.google.cloud.compute.v1.Instance)1 AggregatedListPagedResponse (com.google.cloud.compute.v1.InstanceGroupManagersClient.AggregatedListPagedResponse)1 AggregatedListPagedResponse (com.google.cloud.compute.v1.InstanceGroupsClient.AggregatedListPagedResponse)1 InstancesClient (com.google.cloud.compute.v1.InstancesClient)1 InstancesScopedList (com.google.cloud.compute.v1.InstancesScopedList)1 AggregatedListPagedResponse (com.google.cloud.compute.v1.InterconnectAttachmentsClient.AggregatedListPagedResponse)1 AggregatedListPagedResponse (com.google.cloud.compute.v1.MachineTypesClient.AggregatedListPagedResponse)1 AggregatedListPagedResponse (com.google.cloud.compute.v1.NetworkEndpointGroupsClient.AggregatedListPagedResponse)1