use of com.google.cloud.logging.v2.ConfigClient.ListViewsPagedResponse in project java-logging by googleapis.
the class ConfigClientTest method listViewsTest.
@Test
public void listViewsTest() throws Exception {
LogView responsesElement = LogView.newBuilder().build();
ListViewsResponse expectedResponse = ListViewsResponse.newBuilder().setNextPageToken("").addAllViews(Arrays.asList(responsesElement)).build();
mockConfigServiceV2.addResponse(expectedResponse);
String parent = "parent-995424086";
ListViewsPagedResponse pagedListResponse = client.listViews(parent);
List<LogView> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getViewsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListViewsRequest actualRequest = ((ListViewsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.cloud.logging.v2.ConfigClient.ListViewsPagedResponse in project gapic-generator-java by googleapis.
the class ConfigClientTest method listViewsTest.
@Test
public void listViewsTest() throws Exception {
LogView responsesElement = LogView.newBuilder().build();
ListViewsResponse expectedResponse = ListViewsResponse.newBuilder().setNextPageToken("").addAllViews(Arrays.asList(responsesElement)).build();
mockConfigServiceV2.addResponse(expectedResponse);
String parent = "parent-995424086";
ListViewsPagedResponse pagedListResponse = client.listViews(parent);
List<LogView> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getViewsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockConfigServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListViewsRequest actualRequest = ((ListViewsRequest) actualRequests.get(0));
Assert.assertEquals(parent, actualRequest.getParent());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations