Search in sources :

Example 1 with GetMonitoredResourceDescriptorRequest

use of com.google.monitoring.v3.GetMonitoredResourceDescriptorRequest in project google-cloud-java by GoogleCloudPlatform.

the class MetricServiceClientTest method getMonitoredResourceDescriptorTest.

@Test
@SuppressWarnings("all")
public void getMonitoredResourceDescriptorTest() {
    String name2 = "name2-1052831874";
    String type = "type3575610";
    String displayName = "displayName1615086568";
    String description = "description-1724546052";
    MonitoredResourceDescriptor expectedResponse = MonitoredResourceDescriptor.newBuilder().setName(name2).setType(type).setDisplayName(displayName).setDescription(description).build();
    mockMetricService.addResponse(expectedResponse);
    MonitoredResourceDescriptorName name = MonitoredResourceDescriptorName.create("[PROJECT]", "[MONITORED_RESOURCE_DESCRIPTOR]");
    MonitoredResourceDescriptor actualResponse = client.getMonitoredResourceDescriptor(name);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<GeneratedMessageV3> actualRequests = mockMetricService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetMonitoredResourceDescriptorRequest actualRequest = (GetMonitoredResourceDescriptorRequest) actualRequests.get(0);
    Assert.assertEquals(name, actualRequest.getNameAsMonitoredResourceDescriptorName());
}
Also used : MonitoredResourceDescriptorName(com.google.monitoring.v3.MonitoredResourceDescriptorName) MonitoredResourceDescriptor(com.google.api.MonitoredResourceDescriptor) GetMonitoredResourceDescriptorRequest(com.google.monitoring.v3.GetMonitoredResourceDescriptorRequest) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) Test(org.junit.Test)

Aggregations

MonitoredResourceDescriptor (com.google.api.MonitoredResourceDescriptor)1 GetMonitoredResourceDescriptorRequest (com.google.monitoring.v3.GetMonitoredResourceDescriptorRequest)1 MonitoredResourceDescriptorName (com.google.monitoring.v3.MonitoredResourceDescriptorName)1 GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)1 Test (org.junit.Test)1