Search in sources :

Example 1 with UpdateNotificationChannelRequest

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

the class NotificationChannelServiceClientTest method updateNotificationChannelTest.

@Test
public void updateNotificationChannelTest() 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);
    FieldMask updateMask = FieldMask.newBuilder().build();
    NotificationChannel notificationChannel = NotificationChannel.newBuilder().build();
    NotificationChannel actualResponse = client.updateNotificationChannel(updateMask, notificationChannel);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockNotificationChannelService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    UpdateNotificationChannelRequest actualRequest = ((UpdateNotificationChannelRequest) actualRequests.get(0));
    Assert.assertEquals(updateMask, actualRequest.getUpdateMask());
    Assert.assertEquals(notificationChannel, actualRequest.getNotificationChannel());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : NotificationChannel(com.google.monitoring.v3.NotificationChannel) AbstractMessage(com.google.protobuf.AbstractMessage) UpdateNotificationChannelRequest(com.google.monitoring.v3.UpdateNotificationChannelRequest) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) FieldMask(com.google.protobuf.FieldMask) Test(org.junit.Test)

Aggregations

NotificationChannel (com.google.monitoring.v3.NotificationChannel)1 UpdateNotificationChannelRequest (com.google.monitoring.v3.UpdateNotificationChannelRequest)1 AbstractMessage (com.google.protobuf.AbstractMessage)1 FieldMask (com.google.protobuf.FieldMask)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Test (org.junit.Test)1