Search in sources :

Example 1 with GetNotificationChannelVerificationCodeResponse

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

the class NotificationChannelServiceClientTest method getNotificationChannelVerificationCodeTest.

@Test
public void getNotificationChannelVerificationCodeTest() throws Exception {
    GetNotificationChannelVerificationCodeResponse expectedResponse = GetNotificationChannelVerificationCodeResponse.newBuilder().setCode("code3059181").setExpireTime(Timestamp.newBuilder().build()).build();
    mockNotificationChannelService.addResponse(expectedResponse);
    NotificationChannelName name = NotificationChannelName.ofProjectNotificationChannelName("[PROJECT]", "[NOTIFICATION_CHANNEL]");
    GetNotificationChannelVerificationCodeResponse actualResponse = client.getNotificationChannelVerificationCode(name);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockNotificationChannelService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetNotificationChannelVerificationCodeRequest actualRequest = ((GetNotificationChannelVerificationCodeRequest) actualRequests.get(0));
    Assert.assertEquals(name.toString(), actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) GetNotificationChannelVerificationCodeRequest(com.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest) GetNotificationChannelVerificationCodeResponse(com.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse) NotificationChannelName(com.google.monitoring.v3.NotificationChannelName) Test(org.junit.Test)

Example 2 with GetNotificationChannelVerificationCodeResponse

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

the class NotificationChannelServiceClientTest method getNotificationChannelVerificationCodeTest2.

@Test
public void getNotificationChannelVerificationCodeTest2() throws Exception {
    GetNotificationChannelVerificationCodeResponse expectedResponse = GetNotificationChannelVerificationCodeResponse.newBuilder().setCode("code3059181").setExpireTime(Timestamp.newBuilder().build()).build();
    mockNotificationChannelService.addResponse(expectedResponse);
    String name = "name3373707";
    GetNotificationChannelVerificationCodeResponse actualResponse = client.getNotificationChannelVerificationCode(name);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<AbstractMessage> actualRequests = mockNotificationChannelService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetNotificationChannelVerificationCodeRequest actualRequest = ((GetNotificationChannelVerificationCodeRequest) actualRequests.get(0));
    Assert.assertEquals(name, actualRequest.getName());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : AbstractMessage(com.google.protobuf.AbstractMessage) GetNotificationChannelVerificationCodeRequest(com.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest) GetNotificationChannelVerificationCodeResponse(com.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse) Test(org.junit.Test)

Aggregations

GetNotificationChannelVerificationCodeRequest (com.google.monitoring.v3.GetNotificationChannelVerificationCodeRequest)2 GetNotificationChannelVerificationCodeResponse (com.google.monitoring.v3.GetNotificationChannelVerificationCodeResponse)2 AbstractMessage (com.google.protobuf.AbstractMessage)2 Test (org.junit.Test)2 NotificationChannelName (com.google.monitoring.v3.NotificationChannelName)1