Search in sources :

Example 31 with AggregatedListPagedResponse

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

the class ResourcePoliciesClientTest method aggregatedListTest.

@Test
public void aggregatedListTest() throws Exception {
    ResourcePoliciesScopedList responsesElement = ResourcePoliciesScopedList.newBuilder().build();
    ResourcePolicyAggregatedList expectedResponse = ResourcePolicyAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
    mockService.addResponse(expectedResponse);
    String project = "project-6911";
    AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
    List<Map.Entry<String, ResourcePoliciesScopedList>> 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.ResourcePoliciesClient.AggregatedListPagedResponse) Test(org.junit.Test)

Example 32 with AggregatedListPagedResponse

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

the class RoutersClientTest method aggregatedListTest.

@Test
public void aggregatedListTest() throws Exception {
    RoutersScopedList responsesElement = RoutersScopedList.newBuilder().build();
    RouterAggregatedList expectedResponse = RouterAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
    mockService.addResponse(expectedResponse);
    String project = "project-6911";
    AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
    List<Map.Entry<String, RoutersScopedList>> 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.RoutersClient.AggregatedListPagedResponse) Test(org.junit.Test)

Example 33 with AggregatedListPagedResponse

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

the class AcceleratorTypesClientTest method aggregatedListTest.

@Test
public void aggregatedListTest() throws Exception {
    AcceleratorTypesScopedList responsesElement = AcceleratorTypesScopedList.newBuilder().build();
    AcceleratorTypeAggregatedList expectedResponse = AcceleratorTypeAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
    mockService.addResponse(expectedResponse);
    String project = "project-6911";
    AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
    List<Map.Entry<String, AcceleratorTypesScopedList>> 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.AcceleratorTypesClient.AggregatedListPagedResponse) Test(org.junit.Test)

Example 34 with AggregatedListPagedResponse

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

the class TargetHttpProxiesClientTest method aggregatedListTest.

@Test
public void aggregatedListTest() throws Exception {
    TargetHttpProxiesScopedList responsesElement = TargetHttpProxiesScopedList.newBuilder().build();
    TargetHttpProxyAggregatedList expectedResponse = TargetHttpProxyAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
    mockService.addResponse(expectedResponse);
    String project = "project-6911";
    AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
    List<Map.Entry<String, TargetHttpProxiesScopedList>> 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.TargetHttpProxiesClient.AggregatedListPagedResponse) Test(org.junit.Test)

Example 35 with AggregatedListPagedResponse

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

the class VpnTunnelsClientTest method aggregatedListTest.

@Test
public void aggregatedListTest() throws Exception {
    VpnTunnelsScopedList responsesElement = VpnTunnelsScopedList.newBuilder().build();
    VpnTunnelAggregatedList expectedResponse = VpnTunnelAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
    mockService.addResponse(expectedResponse);
    String project = "project-6911";
    AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
    List<Map.Entry<String, VpnTunnelsScopedList>> 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.VpnTunnelsClient.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