Search in sources :

Example 1 with NotificationChannelDescriptor

use of com.google.monitoring.v3.NotificationChannelDescriptor 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()));
}
Also used : ListNotificationChannelDescriptorsResponse(com.google.monitoring.v3.ListNotificationChannelDescriptorsResponse) AbstractMessage(com.google.protobuf.AbstractMessage) NotificationChannelDescriptor(com.google.monitoring.v3.NotificationChannelDescriptor) ListNotificationChannelDescriptorsRequest(com.google.monitoring.v3.ListNotificationChannelDescriptorsRequest) ListNotificationChannelDescriptorsPagedResponse(com.google.cloud.monitoring.v3.NotificationChannelServiceClient.ListNotificationChannelDescriptorsPagedResponse) Test(org.junit.Test)

Example 2 with NotificationChannelDescriptor

use of com.google.monitoring.v3.NotificationChannelDescriptor 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 3 with NotificationChannelDescriptor

use of com.google.monitoring.v3.NotificationChannelDescriptor 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()));
}
Also used : OrganizationName(com.google.monitoring.v3.OrganizationName) ListNotificationChannelDescriptorsResponse(com.google.monitoring.v3.ListNotificationChannelDescriptorsResponse) AbstractMessage(com.google.protobuf.AbstractMessage) NotificationChannelDescriptor(com.google.monitoring.v3.NotificationChannelDescriptor) ListNotificationChannelDescriptorsRequest(com.google.monitoring.v3.ListNotificationChannelDescriptorsRequest) ListNotificationChannelDescriptorsPagedResponse(com.google.cloud.monitoring.v3.NotificationChannelServiceClient.ListNotificationChannelDescriptorsPagedResponse) Test(org.junit.Test)

Example 4 with NotificationChannelDescriptor

use of com.google.monitoring.v3.NotificationChannelDescriptor 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()));
}
Also used : ListNotificationChannelDescriptorsResponse(com.google.monitoring.v3.ListNotificationChannelDescriptorsResponse) AbstractMessage(com.google.protobuf.AbstractMessage) NotificationChannelDescriptor(com.google.monitoring.v3.NotificationChannelDescriptor) ListNotificationChannelDescriptorsRequest(com.google.monitoring.v3.ListNotificationChannelDescriptorsRequest) ListNotificationChannelDescriptorsPagedResponse(com.google.cloud.monitoring.v3.NotificationChannelServiceClient.ListNotificationChannelDescriptorsPagedResponse) FolderName(com.google.monitoring.v3.FolderName) Test(org.junit.Test)

Example 5 with NotificationChannelDescriptor

use of com.google.monitoring.v3.NotificationChannelDescriptor 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

NotificationChannelDescriptor (com.google.monitoring.v3.NotificationChannelDescriptor)6 AbstractMessage (com.google.protobuf.AbstractMessage)6 Test (org.junit.Test)6 ListNotificationChannelDescriptorsPagedResponse (com.google.cloud.monitoring.v3.NotificationChannelServiceClient.ListNotificationChannelDescriptorsPagedResponse)4 ListNotificationChannelDescriptorsRequest (com.google.monitoring.v3.ListNotificationChannelDescriptorsRequest)4 ListNotificationChannelDescriptorsResponse (com.google.monitoring.v3.ListNotificationChannelDescriptorsResponse)4 GetNotificationChannelDescriptorRequest (com.google.monitoring.v3.GetNotificationChannelDescriptorRequest)2 ServiceTier (com.google.monitoring.v3.ServiceTier)2 ArrayList (java.util.ArrayList)2 FolderName (com.google.monitoring.v3.FolderName)1 NotificationChannelDescriptorName (com.google.monitoring.v3.NotificationChannelDescriptorName)1 OrganizationName (com.google.monitoring.v3.OrganizationName)1 ProjectName (com.google.monitoring.v3.ProjectName)1