use of com.google.protobuf.GeneratedMessageV3 in project google-cloud-java by GoogleCloudPlatform.
the class MetricsClientTest method updateLogMetricTest.
@Test
@SuppressWarnings("all")
public void updateLogMetricTest() {
String name = "name3373707";
String description = "description-1724546052";
String filter = "filter-1274492040";
LogMetric expectedResponse = LogMetric.newBuilder().setName(name).setDescription(description).setFilter(filter).build();
mockMetricsServiceV2.addResponse(expectedResponse);
MetricNameOneof metricName = MetricNameOneof.from(MetricName.create("[PROJECT]", "[METRIC]"));
LogMetric metric = LogMetric.newBuilder().build();
LogMetric actualResponse = client.updateLogMetric(metricName, metric);
Assert.assertEquals(expectedResponse, actualResponse);
List<GeneratedMessageV3> actualRequests = mockMetricsServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
UpdateLogMetricRequest actualRequest = (UpdateLogMetricRequest) actualRequests.get(0);
Assert.assertEquals(metricName, actualRequest.getMetricNameAsMetricNameOneof());
Assert.assertEquals(metric, actualRequest.getMetric());
}
use of com.google.protobuf.GeneratedMessageV3 in project google-cloud-java by GoogleCloudPlatform.
the class MetricsClientTest method getLogMetricTest.
@Test
@SuppressWarnings("all")
public void getLogMetricTest() {
String name = "name3373707";
String description = "description-1724546052";
String filter = "filter-1274492040";
LogMetric expectedResponse = LogMetric.newBuilder().setName(name).setDescription(description).setFilter(filter).build();
mockMetricsServiceV2.addResponse(expectedResponse);
MetricNameOneof metricName = MetricNameOneof.from(MetricName.create("[PROJECT]", "[METRIC]"));
LogMetric actualResponse = client.getLogMetric(metricName);
Assert.assertEquals(expectedResponse, actualResponse);
List<GeneratedMessageV3> actualRequests = mockMetricsServiceV2.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetLogMetricRequest actualRequest = (GetLogMetricRequest) actualRequests.get(0);
Assert.assertEquals(metricName, actualRequest.getMetricNameAsMetricNameOneof());
}
use of com.google.protobuf.GeneratedMessageV3 in project google-cloud-java by GoogleCloudPlatform.
the class TraceServiceClientTest method listTracesTest.
@Test
@SuppressWarnings("all")
public void listTracesTest() {
String nextPageToken = "";
Trace tracesElement = Trace.newBuilder().build();
List<Trace> traces = Arrays.asList(tracesElement);
ListTracesResponse expectedResponse = ListTracesResponse.newBuilder().setNextPageToken(nextPageToken).addAllTraces(traces).build();
mockTraceService.addResponse(expectedResponse);
String projectId = "projectId-1969970175";
ListTracesPagedResponse pagedListResponse = client.listTraces(projectId);
List<Trace> resources = Lists.newArrayList(pagedListResponse.iterateAll());
Assert.assertEquals(1, resources.size());
Assert.assertEquals(expectedResponse.getTracesList().get(0), resources.get(0));
List<GeneratedMessageV3> actualRequests = mockTraceService.getRequests();
Assert.assertEquals(1, actualRequests.size());
ListTracesRequest actualRequest = (ListTracesRequest) actualRequests.get(0);
Assert.assertEquals(projectId, actualRequest.getProjectId());
}
use of com.google.protobuf.GeneratedMessageV3 in project google-cloud-java by GoogleCloudPlatform.
the class TraceServiceClientTest method getTraceTest.
@Test
@SuppressWarnings("all")
public void getTraceTest() {
String projectId2 = "projectId2939242356";
String traceId2 = "traceId2987826376";
Trace expectedResponse = Trace.newBuilder().setProjectId(projectId2).setTraceId(traceId2).build();
mockTraceService.addResponse(expectedResponse);
String projectId = "projectId-1969970175";
String traceId = "traceId1270300245";
Trace actualResponse = client.getTrace(projectId, traceId);
Assert.assertEquals(expectedResponse, actualResponse);
List<GeneratedMessageV3> actualRequests = mockTraceService.getRequests();
Assert.assertEquals(1, actualRequests.size());
GetTraceRequest actualRequest = (GetTraceRequest) actualRequests.get(0);
Assert.assertEquals(projectId, actualRequest.getProjectId());
Assert.assertEquals(traceId, actualRequest.getTraceId());
}
use of com.google.protobuf.GeneratedMessageV3 in project google-cloud-java by GoogleCloudPlatform.
the class TraceServiceClientTest method patchTracesTest.
@Test
@SuppressWarnings("all")
public void patchTracesTest() {
Empty expectedResponse = Empty.newBuilder().build();
mockTraceService.addResponse(expectedResponse);
String projectId = "projectId-1969970175";
Traces traces = Traces.newBuilder().build();
client.patchTraces(projectId, traces);
List<GeneratedMessageV3> actualRequests = mockTraceService.getRequests();
Assert.assertEquals(1, actualRequests.size());
PatchTracesRequest actualRequest = (PatchTracesRequest) actualRequests.get(0);
Assert.assertEquals(projectId, actualRequest.getProjectId());
Assert.assertEquals(traces, actualRequest.getTraces());
}
Aggregations