use of com.google.monitoring.v3.ListNotificationChannelDescriptorsResponse in project java-monitoring by googleapis.
the class NotificationChannelServiceClientTest method listNotificationChannelDescriptorsTest4.
@Test
public void listNotificationChannelDescriptorsTest4() throws Exception {
NotificationChannelDescriptor responsesElement = NotificationChannelDescriptor.newBuilder().build();
ListNotificationChannelDescriptorsResponse expectedResponse = ListNotificationChannelDescriptorsResponse.newBuilder().setNextPageToken("").addAllChannelDescriptors(Arrays.asList(responsesElement)).build();
mockNotificationChannelService.addResponse(expectedResponse);
String name = "name3373707";
ListNotificationChannelDescriptorsPagedResponse pagedListResponse = client.listNotificationChannelDescriptors(name);
List<NotificationChannelDescriptor> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getChannelDescriptorsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockNotificationChannelService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListNotificationChannelDescriptorsRequest actualRequest = ((ListNotificationChannelDescriptorsRequest) actualRequests.get(0));
Assert.assertEquals(name, actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.monitoring.v3.ListNotificationChannelDescriptorsResponse in project java-monitoring by googleapis.
the class NotificationChannelServiceClientTest method listNotificationChannelDescriptorsTest2.
@Test
public void listNotificationChannelDescriptorsTest2() throws Exception {
NotificationChannelDescriptor responsesElement = NotificationChannelDescriptor.newBuilder().build();
ListNotificationChannelDescriptorsResponse expectedResponse = ListNotificationChannelDescriptorsResponse.newBuilder().setNextPageToken("").addAllChannelDescriptors(Arrays.asList(responsesElement)).build();
mockNotificationChannelService.addResponse(expectedResponse);
OrganizationName name = OrganizationName.of("[ORGANIZATION]");
ListNotificationChannelDescriptorsPagedResponse pagedListResponse = client.listNotificationChannelDescriptors(name);
List<NotificationChannelDescriptor> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getChannelDescriptorsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockNotificationChannelService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListNotificationChannelDescriptorsRequest actualRequest = ((ListNotificationChannelDescriptorsRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.monitoring.v3.ListNotificationChannelDescriptorsResponse in project java-monitoring by googleapis.
the class NotificationChannelServiceClientTest method listNotificationChannelDescriptorsTest.
@Test
public void listNotificationChannelDescriptorsTest() throws Exception {
NotificationChannelDescriptor responsesElement = NotificationChannelDescriptor.newBuilder().build();
ListNotificationChannelDescriptorsResponse expectedResponse = ListNotificationChannelDescriptorsResponse.newBuilder().setNextPageToken("").addAllChannelDescriptors(Arrays.asList(responsesElement)).build();
mockNotificationChannelService.addResponse(expectedResponse);
FolderName name = FolderName.of("[FOLDER]");
ListNotificationChannelDescriptorsPagedResponse pagedListResponse = client.listNotificationChannelDescriptors(name);
List<NotificationChannelDescriptor> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getChannelDescriptorsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockNotificationChannelService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListNotificationChannelDescriptorsRequest actualRequest = ((ListNotificationChannelDescriptorsRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
use of com.google.monitoring.v3.ListNotificationChannelDescriptorsResponse in project java-monitoring by googleapis.
the class NotificationChannelServiceClientTest method listNotificationChannelDescriptorsTest3.
@Test
public void listNotificationChannelDescriptorsTest3() throws Exception {
NotificationChannelDescriptor responsesElement = NotificationChannelDescriptor.newBuilder().build();
ListNotificationChannelDescriptorsResponse expectedResponse = ListNotificationChannelDescriptorsResponse.newBuilder().setNextPageToken("").addAllChannelDescriptors(Arrays.asList(responsesElement)).build();
mockNotificationChannelService.addResponse(expectedResponse);
ProjectName name = ProjectName.of("[PROJECT]");
ListNotificationChannelDescriptorsPagedResponse pagedListResponse = client.listNotificationChannelDescriptors(name);
List<NotificationChannelDescriptor> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getChannelDescriptorsList().get(0), resources.get(0));
List<AbstractMessage> actualRequests = mockNotificationChannelService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListNotificationChannelDescriptorsRequest actualRequest = ((ListNotificationChannelDescriptorsRequest) actualRequests.get(0));
Assert.assertEquals(name.toString(), actualRequest.getName());
Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Aggregations