use of com.google.cloud.compute.v1.RegionDiskTypesClient.ListPagedResponse in project java-compute by googleapis.
the class DiskTypesClientTest method listTest.
@Test
public void listTest() throws Exception {
DiskType responsesElement = DiskType.newBuilder().build();
DiskTypeList expectedResponse = DiskTypeList.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<DiskType> 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.RegionDiskTypesClient.ListPagedResponse in project java-compute by googleapis.
the class DisksClientTest method listTest.
@Test
public void listTest() throws Exception {
Disk responsesElement = Disk.newBuilder().build();
DiskList expectedResponse = DiskList.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<Disk> 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.RegionDiskTypesClient.ListPagedResponse in project java-compute by googleapis.
the class FirewallPoliciesClientTest method listTest.
@Test
public void listTest() throws Exception {
FirewallPolicy responsesElement = FirewallPolicy.newBuilder().build();
FirewallPolicyList expectedResponse = FirewallPolicyList.newBuilder().setNextPageToken("").addAllItems(Arrays.asList(responsesElement)).build();
mockService.addResponse(expectedResponse);
ListPagedResponse pagedListResponse = client.list();
List<FirewallPolicy> 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.RegionDiskTypesClient.ListPagedResponse in project java-compute by googleapis.
the class ForwardingRulesClientTest method listTest.
@Test
public void listTest() throws Exception {
ForwardingRule responsesElement = ForwardingRule.newBuilder().build();
ForwardingRuleList expectedResponse = ForwardingRuleList.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<ForwardingRule> 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.RegionDiskTypesClient.ListPagedResponse in project java-compute by googleapis.
the class RegionBackendServicesClientTest method listTest.
@Test
public void listTest() throws Exception {
BackendService responsesElement = BackendService.newBuilder().build();
BackendServiceList expectedResponse = BackendServiceList.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<BackendService> 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