Search in sources :

Example 1 with GetMetricDescriptorRequest

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

the class MetricServiceClientTest method getMetricDescriptorTest.

@Test
@SuppressWarnings("all")
public void getMetricDescriptorTest() {
    String name2 = "name2-1052831874";
    String type = "type3575610";
    String unit = "unit3594628";
    String description = "description-1724546052";
    String displayName = "displayName1615086568";
    MetricDescriptor expectedResponse = MetricDescriptor.newBuilder().setName(name2).setType(type).setUnit(unit).setDescription(description).setDisplayName(displayName).build();
    mockMetricService.addResponse(expectedResponse);
    MetricDescriptorName name = MetricDescriptorName.create("[PROJECT]", "[METRIC_DESCRIPTOR]");
    MetricDescriptor actualResponse = client.getMetricDescriptor(name);
    Assert.assertEquals(expectedResponse, actualResponse);
    List<GeneratedMessageV3> actualRequests = mockMetricService.getRequests();
    Assert.assertEquals(1, actualRequests.size());
    GetMetricDescriptorRequest actualRequest = (GetMetricDescriptorRequest) actualRequests.get(0);
    Assert.assertEquals(name, actualRequest.getNameAsMetricDescriptorName());
}
Also used : GetMetricDescriptorRequest(com.google.monitoring.v3.GetMetricDescriptorRequest) MetricDescriptor(com.google.api.MetricDescriptor) MetricDescriptorName(com.google.monitoring.v3.MetricDescriptorName) GeneratedMessageV3(com.google.protobuf.GeneratedMessageV3) Test(org.junit.Test)

Aggregations

MetricDescriptor (com.google.api.MetricDescriptor)1 GetMetricDescriptorRequest (com.google.monitoring.v3.GetMetricDescriptorRequest)1 MetricDescriptorName (com.google.monitoring.v3.MetricDescriptorName)1 GeneratedMessageV3 (com.google.protobuf.GeneratedMessageV3)1 Test (org.junit.Test)1