use of com.google.cloud.compute.v1.MachineTypesClient.AggregatedListPagedResponse in project java-compute by googleapis.
the class DisksClientTest method aggregatedListTest.
@Test
public void aggregatedListTest() throws Exception {
DisksScopedList responsesElement = DisksScopedList.newBuilder().build();
DiskAggregatedList expectedResponse = DiskAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
List<Map.Entry<String, DisksScopedList>> 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());
}
use of com.google.cloud.compute.v1.MachineTypesClient.AggregatedListPagedResponse in project java-compute by googleapis.
the class ForwardingRulesClientTest method aggregatedListTest.
@Test
public void aggregatedListTest() throws Exception {
ForwardingRulesScopedList responsesElement = ForwardingRulesScopedList.newBuilder().build();
ForwardingRuleAggregatedList expectedResponse = ForwardingRuleAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
List<Map.Entry<String, ForwardingRulesScopedList>> 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());
}
use of com.google.cloud.compute.v1.MachineTypesClient.AggregatedListPagedResponse in project java-compute by googleapis.
the class NetworkEndpointGroupsClientTest method aggregatedListTest.
@Test
public void aggregatedListTest() throws Exception {
NetworkEndpointGroupsScopedList responsesElement = NetworkEndpointGroupsScopedList.newBuilder().build();
NetworkEndpointGroupAggregatedList expectedResponse = NetworkEndpointGroupAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
List<Map.Entry<String, NetworkEndpointGroupsScopedList>> 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());
}
use of com.google.cloud.compute.v1.MachineTypesClient.AggregatedListPagedResponse in project java-compute by googleapis.
the class NodeGroupsClientTest method aggregatedListTest.
@Test
public void aggregatedListTest() throws Exception {
NodeGroupsScopedList responsesElement = NodeGroupsScopedList.newBuilder().build();
NodeGroupAggregatedList expectedResponse = NodeGroupAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
List<Map.Entry<String, NodeGroupsScopedList>> 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());
}
use of com.google.cloud.compute.v1.MachineTypesClient.AggregatedListPagedResponse in project java-compute by googleapis.
the class HealthChecksClientTest method aggregatedListTest.
@Test
public void aggregatedListTest() throws Exception {
HealthChecksScopedList responsesElement = HealthChecksScopedList.newBuilder().build();
HealthChecksAggregatedList expectedResponse = HealthChecksAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
List<Map.Entry<String, HealthChecksScopedList>> 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());
}
Aggregations