Search in sources :

Example 1 with AggregatedListPagedResponse

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

the class SslCertificatesClientTest method aggregatedListTest.

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

Example 2 with AggregatedListPagedResponse

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

the class SubnetworksClientTest method aggregatedListTest.

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

Example 3 with AggregatedListPagedResponse

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

the class TargetHttpsProxiesClientTest method aggregatedListTest.

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

Example 4 with AggregatedListPagedResponse

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

the class TargetInstancesClientTest method aggregatedListTest.

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

Example 5 with AggregatedListPagedResponse

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

the class TargetPoolsClientTest method aggregatedListTest.

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