Search in sources :

Example 1 with GetNotificationChannelDescriptorRequest

use of com.google.monitoring.v3.GetNotificationChannelDescriptorRequest in project java-monitoring by googleapis.

the class NotificationChannelServiceClientTest method getNotificationChannelDescriptorTest2.

@Test
public void getNotificationChannelDescriptorTest2() throws Exception {
    NotificationChannelDescriptor expectedResponse = NotificationChannelDescriptor.newBuilder().setName(NotificationChannelDescriptorName.ofProjectChannelDescriptorName("[PROJECT]", "[CHANNEL_DESCRIPTOR]").toString()).setType("type3575610").setDisplayName("displayName1714148973").setDescription("description-1724546052").addAllLabels(new ArrayList<LabelDescriptor>()).addAllSupportedTiers(new ArrayList<ServiceTier>()).setLaunchStage(LaunchStage.forNumber(0)).build();
    mockNotificationChannelService.addResponse(expectedResponse);
    String name = "name3373707";
    NotificationChannelDescriptor actualResponse = client.getNotificationChannelDescriptor(name);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockNotificationChannelService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetNotificationChannelDescriptorRequest actualRequest = ((GetNotificationChannelDescriptorRequest) actualRequests.get(0));
    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) NotificationChannelDescriptor(com.google.monitoring.v3.NotificationChannelDescriptor) ArrayList(java.util.ArrayList) GetNotificationChannelDescriptorRequest(com.google.monitoring.v3.GetNotificationChannelDescriptorRequest) ServiceTier(com.google.monitoring.v3.ServiceTier) Test(org.junit.Test)

Example 2 with GetNotificationChannelDescriptorRequest

use of com.google.monitoring.v3.GetNotificationChannelDescriptorRequest in project java-monitoring by googleapis.

the class NotificationChannelServiceClientTest method getNotificationChannelDescriptorTest.

@Test
public void getNotificationChannelDescriptorTest() throws Exception {
    NotificationChannelDescriptor expectedResponse = NotificationChannelDescriptor.newBuilder().setName(NotificationChannelDescriptorName.ofProjectChannelDescriptorName("[PROJECT]", "[CHANNEL_DESCRIPTOR]").toString()).setType("type3575610").setDisplayName("displayName1714148973").setDescription("description-1724546052").addAllLabels(new ArrayList<LabelDescriptor>()).addAllSupportedTiers(new ArrayList<ServiceTier>()).setLaunchStage(LaunchStage.forNumber(0)).build();
    mockNotificationChannelService.addResponse(expectedResponse);
    NotificationChannelDescriptorName name = NotificationChannelDescriptorName.ofProjectChannelDescriptorName("[PROJECT]", "[CHANNEL_DESCRIPTOR]");
    NotificationChannelDescriptor actualResponse = client.getNotificationChannelDescriptor(name);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockNotificationChannelService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetNotificationChannelDescriptorRequest actualRequest = ((GetNotificationChannelDescriptorRequest) actualRequests.get(0));
    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : NotificationChannelDescriptorName(com.google.monitoring.v3.NotificationChannelDescriptorName) AbstractMessage(com.google.protobuf.AbstractMessage) NotificationChannelDescriptor(com.google.monitoring.v3.NotificationChannelDescriptor) ArrayList(java.util.ArrayList) GetNotificationChannelDescriptorRequest(com.google.monitoring.v3.GetNotificationChannelDescriptorRequest) ServiceTier(com.google.monitoring.v3.ServiceTier) Test(org.junit.Test)

Aggregations

GetNotificationChannelDescriptorRequest (com.google.monitoring.v3.GetNotificationChannelDescriptorRequest)2 NotificationChannelDescriptor (com.google.monitoring.v3.NotificationChannelDescriptor)2 ServiceTier (com.google.monitoring.v3.ServiceTier)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 ArrayList (java.util.ArrayList)2 Test (org.junit.Test)2 NotificationChannelDescriptorName (com.google.monitoring.v3.NotificationChannelDescriptorName)1