Search in sources :

Example 1 with ListUptimeCheckConfigsResponse

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

the class UptimeCheckServiceClientTest method listUptimeCheckConfigsTest2.

@Test
public void listUptimeCheckConfigsTest2() throws Exception {
    UptimeCheckConfig responsesElement = UptimeCheckConfig.newBuilder().build();
    ListUptimeCheckConfigsResponse expectedResponse = ListUptimeCheckConfigsResponse.newBuilder().setNextPageToken("").addAllUptimeCheckConfigs(Arrays.asList(responsesElement)).build();
    mockUptimeCheckService.addResponse(expectedResponse);
    OrganizationName parent = OrganizationName.of("[ORGANIZATION]");
    ListUptimeCheckConfigsPagedResponse pagedListResponse = client.listUptimeCheckConfigs(parent);
    List<UptimeCheckConfig> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getUptimeCheckConfigsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockUptimeCheckService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListUptimeCheckConfigsRequest actualRequest = ((ListUptimeCheckConfigsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : OrganizationName(com.google.monitoring.v3.OrganizationName) ListUptimeCheckConfigsRequest(com.google.monitoring.v3.ListUptimeCheckConfigsRequest) AbstractMessage(com.google.protobuf.AbstractMessage) ListUptimeCheckConfigsResponse(com.google.monitoring.v3.ListUptimeCheckConfigsResponse) ListUptimeCheckConfigsPagedResponse(com.google.cloud.monitoring.v3.UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse) UptimeCheckConfig(com.google.monitoring.v3.UptimeCheckConfig) Test(org.junit.Test)

Example 2 with ListUptimeCheckConfigsResponse

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

the class UptimeCheckServiceClientTest method listUptimeCheckConfigsTest.

@Test
public void listUptimeCheckConfigsTest() throws Exception {
    UptimeCheckConfig responsesElement = UptimeCheckConfig.newBuilder().build();
    ListUptimeCheckConfigsResponse expectedResponse = ListUptimeCheckConfigsResponse.newBuilder().setNextPageToken("").addAllUptimeCheckConfigs(Arrays.asList(responsesElement)).build();
    mockUptimeCheckService.addResponse(expectedResponse);
    FolderName parent = FolderName.of("[FOLDER]");
    ListUptimeCheckConfigsPagedResponse pagedListResponse = client.listUptimeCheckConfigs(parent);
    List<UptimeCheckConfig> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getUptimeCheckConfigsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockUptimeCheckService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListUptimeCheckConfigsRequest actualRequest = ((ListUptimeCheckConfigsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListUptimeCheckConfigsRequest(com.google.monitoring.v3.ListUptimeCheckConfigsRequest) AbstractMessage(com.google.protobuf.AbstractMessage) ListUptimeCheckConfigsResponse(com.google.monitoring.v3.ListUptimeCheckConfigsResponse) ListUptimeCheckConfigsPagedResponse(com.google.cloud.monitoring.v3.UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse) UptimeCheckConfig(com.google.monitoring.v3.UptimeCheckConfig) FolderName(com.google.monitoring.v3.FolderName) Test(org.junit.Test)

Example 3 with ListUptimeCheckConfigsResponse

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

the class UptimeCheckServiceClientTest method listUptimeCheckConfigsTest3.

@Test
public void listUptimeCheckConfigsTest3() throws Exception {
    UptimeCheckConfig responsesElement = UptimeCheckConfig.newBuilder().build();
    ListUptimeCheckConfigsResponse expectedResponse = ListUptimeCheckConfigsResponse.newBuilder().setNextPageToken("").addAllUptimeCheckConfigs(Arrays.asList(responsesElement)).build();
    mockUptimeCheckService.addResponse(expectedResponse);
    ProjectName parent = ProjectName.of("[PROJECT]");
    ListUptimeCheckConfigsPagedResponse pagedListResponse = client.listUptimeCheckConfigs(parent);
    List<UptimeCheckConfig> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getUptimeCheckConfigsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockUptimeCheckService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListUptimeCheckConfigsRequest actualRequest = ((ListUptimeCheckConfigsRequest) actualRequests.get(0));
    Assert.assertEquals(parent.toString(), actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListUptimeCheckConfigsRequest(com.google.monitoring.v3.ListUptimeCheckConfigsRequest) AbstractMessage(com.google.protobuf.AbstractMessage) ProjectName(com.google.monitoring.v3.ProjectName) ListUptimeCheckConfigsResponse(com.google.monitoring.v3.ListUptimeCheckConfigsResponse) ListUptimeCheckConfigsPagedResponse(com.google.cloud.monitoring.v3.UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse) UptimeCheckConfig(com.google.monitoring.v3.UptimeCheckConfig) Test(org.junit.Test)

Example 4 with ListUptimeCheckConfigsResponse

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

the class UptimeCheckServiceClientTest method listUptimeCheckConfigsTest4.

@Test
public void listUptimeCheckConfigsTest4() throws Exception {
    UptimeCheckConfig responsesElement = UptimeCheckConfig.newBuilder().build();
    ListUptimeCheckConfigsResponse expectedResponse = ListUptimeCheckConfigsResponse.newBuilder().setNextPageToken("").addAllUptimeCheckConfigs(Arrays.asList(responsesElement)).build();
    mockUptimeCheckService.addResponse(expectedResponse);
    String parent = "parent-995424086";
    ListUptimeCheckConfigsPagedResponse pagedListResponse = client.listUptimeCheckConfigs(parent);
    List<UptimeCheckConfig> resources = Lists.newArrayList(pagedListResponse.iterateAll());
    Assert.assertEquals(1, resources.size());
    Assert.assertEquals(expectedResponse.getUptimeCheckConfigsList().get(0), resources.get(0));
    List<AbstractMessage> actualRequests = mockUptimeCheckService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    ListUptimeCheckConfigsRequest actualRequest = ((ListUptimeCheckConfigsRequest) actualRequests.get(0));
    Assert.assertEquals(parent, actualRequest.getParent());
    Assert.assertTrue(channelProvider.isHeaderSent(ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern()));
}
Also used : ListUptimeCheckConfigsRequest(com.google.monitoring.v3.ListUptimeCheckConfigsRequest) AbstractMessage(com.google.protobuf.AbstractMessage) ListUptimeCheckConfigsResponse(com.google.monitoring.v3.ListUptimeCheckConfigsResponse) ListUptimeCheckConfigsPagedResponse(com.google.cloud.monitoring.v3.UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse) UptimeCheckConfig(com.google.monitoring.v3.UptimeCheckConfig) Test(org.junit.Test)

Aggregations

ListUptimeCheckConfigsPagedResponse (com.google.cloud.monitoring.v3.UptimeCheckServiceClient.ListUptimeCheckConfigsPagedResponse)4 ListUptimeCheckConfigsRequest (com.google.monitoring.v3.ListUptimeCheckConfigsRequest)4 ListUptimeCheckConfigsResponse (com.google.monitoring.v3.ListUptimeCheckConfigsResponse)4 UptimeCheckConfig (com.google.monitoring.v3.UptimeCheckConfig)4 AbstractMessage (com.google.protobuf.AbstractMessage)4 Test (org.junit.Test)4 FolderName (com.google.monitoring.v3.FolderName)1 OrganizationName (com.google.monitoring.v3.OrganizationName)1 ProjectName (com.google.monitoring.v3.ProjectName)1