use of com.google.cloud.compute.v1.HealthChecksClient.AggregatedListPagedResponse in project java-compute by googleapis.
the class TargetVpnGatewaysClientTest method aggregatedListTest.
@Test
public void aggregatedListTest() throws Exception {
TargetVpnGatewaysScopedList responsesElement = TargetVpnGatewaysScopedList.newBuilder().build();
TargetVpnGatewayAggregatedList expectedResponse = TargetVpnGatewayAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
List<Map.Entry<String, TargetVpnGatewaysScopedList>> 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.HealthChecksClient.AggregatedListPagedResponse in project java-compute by googleapis.
the class VpnGatewaysClientTest method aggregatedListTest.
@Test
public void aggregatedListTest() throws Exception {
VpnGatewaysScopedList responsesElement = VpnGatewaysScopedList.newBuilder().build();
VpnGatewayAggregatedList expectedResponse = VpnGatewayAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
List<Map.Entry<String, VpnGatewaysScopedList>> 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.HealthChecksClient.AggregatedListPagedResponse in project java-compute by googleapis.
the class InstanceGroupManagersClientTest method aggregatedListTest.
@Test
public void aggregatedListTest() throws Exception {
InstanceGroupManagersScopedList responsesElement = InstanceGroupManagersScopedList.newBuilder().build();
InstanceGroupManagerAggregatedList expectedResponse = InstanceGroupManagerAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
List<Map.Entry<String, InstanceGroupManagersScopedList>> 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.HealthChecksClient.AggregatedListPagedResponse in project java-compute by googleapis.
the class InstanceGroupsClientTest method aggregatedListTest.
@Test
public void aggregatedListTest() throws Exception {
InstanceGroupsScopedList responsesElement = InstanceGroupsScopedList.newBuilder().build();
InstanceGroupAggregatedList expectedResponse = InstanceGroupAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
List<Map.Entry<String, InstanceGroupsScopedList>> 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.HealthChecksClient.AggregatedListPagedResponse in project java-compute by googleapis.
the class MachineTypesClientTest method aggregatedListTest.
@Test
public void aggregatedListTest() throws Exception {
MachineTypesScopedList responsesElement = MachineTypesScopedList.newBuilder().build();
MachineTypeAggregatedList expectedResponse = MachineTypeAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
List<Map.Entry<String, MachineTypesScopedList>> 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