Search in sources :

Example 1 with GetNotificationChannelRequest

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

the class NotificationChannelServiceClientTest method getNotificationChannelTest2.

@Test
public void getNotificationChannelTest2() throws Exception {
    NotificationChannel expectedResponse = NotificationChannel.newBuilder().setType("type3575610").setName(NotificationChannelName.ofProjectNotificationChannelName("[PROJECT]", "[NOTIFICATION_CHANNEL]").toString()).setDisplayName("displayName1714148973").setDescription("description-1724546052").putAllLabels(new HashMap<String, String>()).putAllUserLabels(new HashMap<String, String>()).setEnabled(BoolValue.newBuilder().build()).setCreationRecord(MutationRecord.newBuilder().build()).addAllMutationRecords(new ArrayList<MutationRecord>()).build();
    mockNotificationChannelService.addResponse(expectedResponse);
    String name = "name3373707";
    NotificationChannel actualResponse = client.getNotificationChannel(name);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockNotificationChannelService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetNotificationChannelRequest actualRequest = ((GetNotificationChannelRequest) actualRequests.get(0));
    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : NotificationChannel(com.google.monitoring.v3.NotificationChannel) AbstractMessage(com.google.protobuf.AbstractMessage) HashMap(java.util.HashMap) GetNotificationChannelRequest(com.google.monitoring.v3.GetNotificationChannelRequest) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 2 with GetNotificationChannelRequest

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

the class NotificationChannelServiceClientTest method getNotificationChannelTest.

@Test
public void getNotificationChannelTest() throws Exception {
    NotificationChannel expectedResponse = NotificationChannel.newBuilder().setType("type3575610").setName(NotificationChannelName.ofProjectNotificationChannelName("[PROJECT]", "[NOTIFICATION_CHANNEL]").toString()).setDisplayName("displayName1714148973").setDescription("description-1724546052").putAllLabels(new HashMap<String, String>()).putAllUserLabels(new HashMap<String, String>()).setEnabled(BoolValue.newBuilder().build()).setCreationRecord(MutationRecord.newBuilder().build()).addAllMutationRecords(new ArrayList<MutationRecord>()).build();
    mockNotificationChannelService.addResponse(expectedResponse);
    NotificationChannelName name = NotificationChannelName.ofProjectNotificationChannelName("[PROJECT]", "[NOTIFICATION_CHANNEL]");
    NotificationChannel actualResponse = client.getNotificationChannel(name);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockNotificationChannelService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetNotificationChannelRequest actualRequest = ((GetNotificationChannelRequest) actualRequests.get(0));
    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : NotificationChannel(com.google.monitoring.v3.NotificationChannel) AbstractMessage(com.google.protobuf.AbstractMessage) HashMap(java.util.HashMap) GetNotificationChannelRequest(com.google.monitoring.v3.GetNotificationChannelRequest) ArrayList(java.util.ArrayList) NotificationChannelName(com.google.monitoring.v3.NotificationChannelName) Test(org.junit.Test)

Aggregations

GetNotificationChannelRequest (com.google.monitoring.v3.GetNotificationChannelRequest)2 NotificationChannel (com.google.monitoring.v3.NotificationChannel)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 ArrayList (java.util.ArrayList)2 HashMap (java.util.HashMap)2 Test (org.junit.Test)2 NotificationChannelName (com.google.monitoring.v3.NotificationChannelName)1