use of com.google.cloud.compute.v1.HealthChecksClient.AggregatedListPagedResponse in project java-compute by googleapis.
the class BackendServicesClientTest method aggregatedListTest.
@Test
public void aggregatedListTest() throws Exception {
BackendServicesScopedList responsesElement = BackendServicesScopedList.newBuilder().build();
BackendServiceAggregatedList expectedResponse = BackendServiceAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
List<Map.Entry<String, BackendServicesScopedList>> 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 GlobalOperationsClientTest method aggregatedListTest.
@Test
public void aggregatedListTest() throws Exception {
OperationsScopedList responsesElement = OperationsScopedList.newBuilder().build();
OperationAggregatedList expectedResponse = OperationAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
List<Map.Entry<String, OperationsScopedList>> 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 ReservationsClientTest method aggregatedListTest.
@Test
public void aggregatedListTest() throws Exception {
ReservationsScopedList responsesElement = ReservationsScopedList.newBuilder().build();
ReservationAggregatedList expectedResponse = ReservationAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
List<Map.Entry<String, ReservationsScopedList>> 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 NodeTypesClientTest method aggregatedListTest.
@Test
public void aggregatedListTest() throws Exception {
NodeTypesScopedList responsesElement = NodeTypesScopedList.newBuilder().build();
NodeTypeAggregatedList expectedResponse = NodeTypeAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
List<Map.Entry<String, NodeTypesScopedList>> 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 ServiceAttachmentsClientTest method aggregatedListTest.
@Test
public void aggregatedListTest() throws Exception {
ServiceAttachmentsScopedList responsesElement = ServiceAttachmentsScopedList.newBuilder().build();
ServiceAttachmentAggregatedList expectedResponse = ServiceAttachmentAggregatedList.newBuilder().setNextPageToken("").putAllItems(Collections.singletonMap("items", responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
AggregatedListPagedResponse pagedListResponse = client.aggregatedList(project);
List<Map.Entry<String, ServiceAttachmentsScopedList>> 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