use of com.google.cloud.compute.v1.NodeGroupsClient.ListPagedResponse in project java-compute by googleapis.
the class TargetVpnGatewaysClientTest method listTest.
@Test
public void listTest() throws Exception {
TargetVpnGateway responsesElement = TargetVpnGateway.newBuilder().build();
TargetVpnGatewayList expectedResponse = TargetVpnGatewayList.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<TargetVpnGateway> 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.NodeGroupsClient.ListPagedResponse in project java-compute by googleapis.
the class VpnGatewaysClientTest method listTest.
@Test
public void listTest() throws Exception {
VpnGateway responsesElement = VpnGateway.newBuilder().build();
VpnGatewayList expectedResponse = VpnGatewayList.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<VpnGateway> 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.NodeGroupsClient.ListPagedResponse in project java-compute by googleapis.
the class VpnTunnelsClientTest method listTest.
@Test
public void listTest() throws Exception {
VpnTunnel responsesElement = VpnTunnel.newBuilder().build();
VpnTunnelList expectedResponse = VpnTunnelList.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<VpnTunnel> 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.NodeGroupsClient.ListPagedResponse in project java-compute by googleapis.
the class ZoneOperationsClientTest method listTest.
@Test
public void listTest() throws Exception {
Operation responsesElement = Operation.newBuilder().build();
OperationList expectedResponse = OperationList.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<Operation> 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.NodeGroupsClient.ListPagedResponse in project java-compute by googleapis.
the class InstanceGroupManagersClientTest method listTest.
@Test
public void listTest() throws Exception {
InstanceGroupManager responsesElement = InstanceGroupManager.newBuilder().build();
InstanceGroupManagerList expectedResponse = InstanceGroupManagerList.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<InstanceGroupManager> 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