use of com.google.cloud.compute.v1.VpnGatewaysClient.ListPagedResponse in project java-compute by googleapis.
the class RegionNotificationEndpointsClientTest method listTest.
@Test
public void listTest() throws Exception {
NotificationEndpoint responsesElement = NotificationEndpoint.newBuilder().build();
NotificationEndpointList expectedResponse = NotificationEndpointList.newBuilder().setNextPageToken("").addAllItems(Arrays.asList(responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
String region = "region-9622";
ListPagedResponse pagedListResponse = client.list(project, region);
List<NotificationEndpoint> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getItemsList().get(0), 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.VpnGatewaysClient.ListPagedResponse in project java-compute by googleapis.
the class RegionTargetHttpProxiesClientTest method listTest.
@Test
public void listTest() throws Exception {
TargetHttpProxy responsesElement = TargetHttpProxy.newBuilder().build();
TargetHttpProxyList expectedResponse = TargetHttpProxyList.newBuilder().setNextPageToken("").addAllItems(Arrays.asList(responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
String region = "region-9622";
ListPagedResponse pagedListResponse = client.list(project, region);
List<TargetHttpProxy> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getItemsList().get(0), 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.VpnGatewaysClient.ListPagedResponse in project java-compute by googleapis.
the class RegionTargetHttpsProxiesClientTest method listTest.
@Test
public void listTest() throws Exception {
TargetHttpsProxy responsesElement = TargetHttpsProxy.newBuilder().build();
TargetHttpsProxyList expectedResponse = TargetHttpsProxyList.newBuilder().setNextPageToken("").addAllItems(Arrays.asList(responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
String region = "region-9622";
ListPagedResponse pagedListResponse = client.list(project, region);
List<TargetHttpsProxy> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getItemsList().get(0), 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.VpnGatewaysClient.ListPagedResponse in project java-compute by googleapis.
the class RegionsClientTest method listTest.
@Test
public void listTest() throws Exception {
Region responsesElement = Region.newBuilder().build();
RegionList expectedResponse = RegionList.newBuilder().setNextPageToken("").addAllItems(Arrays.asList(responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
ListPagedResponse pagedListResponse = client.list(project);
List<Region> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getItemsList().get(0), 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.VpnGatewaysClient.ListPagedResponse in project java-compute by googleapis.
the class ReservationsClientTest method listTest.
@Test
public void listTest() throws Exception {
Reservation responsesElement = Reservation.newBuilder().build();
ReservationList expectedResponse = ReservationList.newBuilder().setNextPageToken("").addAllItems(Arrays.asList(responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
String zone = "zone-5246";
ListPagedResponse pagedListResponse = client.list(project, zone);
List<Reservation> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getItemsList().get(0), 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