use of com.google.cloud.compute.v1.GlobalPublicDelegatedPrefixesClient.ListPagedResponse in project java-compute by googleapis.
the class ZonesClientTest method listTest.
@Test
public void listTest() throws Exception {
Zone responsesElement = Zone.newBuilder().build();
ZoneList expectedResponse = ZoneList.newBuilder().setNextPageToken("").addAllItems(Arrays.asList(responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
ListPagedResponse pagedListResponse = client.list(project);
List<Zone> 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.GlobalPublicDelegatedPrefixesClient.ListPagedResponse in project java-compute by googleapis.
the class TargetSslProxiesClientTest method listTest.
@Test
public void listTest() throws Exception {
TargetSslProxy responsesElement = TargetSslProxy.newBuilder().build();
TargetSslProxyList expectedResponse = TargetSslProxyList.newBuilder().setNextPageToken("").addAllItems(Arrays.asList(responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
ListPagedResponse pagedListResponse = client.list(project);
List<TargetSslProxy> 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.GlobalPublicDelegatedPrefixesClient.ListPagedResponse in project java-compute by googleapis.
the class TargetTcpProxiesClientTest method listTest.
@Test
public void listTest() throws Exception {
TargetTcpProxy responsesElement = TargetTcpProxy.newBuilder().build();
TargetTcpProxyList expectedResponse = TargetTcpProxyList.newBuilder().setNextPageToken("").addAllItems(Arrays.asList(responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
ListPagedResponse pagedListResponse = client.list(project);
List<TargetTcpProxy> 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.GlobalPublicDelegatedPrefixesClient.ListPagedResponse in project java-compute by googleapis.
the class UrlMapsClientTest method listTest.
@Test
public void listTest() throws Exception {
UrlMap responsesElement = UrlMap.newBuilder().build();
UrlMapList expectedResponse = UrlMapList.newBuilder().setNextPageToken("").addAllItems(Arrays.asList(responsesElement)).build();
mockService.addResponse(expectedResponse);
String project = "project-6911";
ListPagedResponse pagedListResponse = client.list(project);
List<UrlMap> 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