@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.logging.v2.GetLogMetricRequest)) { return super.equals(obj); } com.google.logging.v2.GetLogMetricRequest other = (com.google.logging.v2.GetLogMetricRequest) obj; boolean result = true; result = result && getMetricName().equals(other.getMetricName()); result = result && unknownFields.equals(other.unknownFields); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + METRIC_NAME_FIELD_NUMBER; hash = (53 * hash) + getMetricName().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * * * <pre> * The resource name of the desired metric: * "projects/[PROJECT_ID]/metrics/[METRIC_ID]" * </pre> * * <code>string metric_name = 1;</code> */ public Builder clearMetricName() { metricName_ = getDefaultInstance().getMetricName(); onChanged(); return this; } /**
public Builder mergeFrom(com.google.logging.v2.GetLogMetricRequest other) { if (other == com.google.logging.v2.GetLogMetricRequest.getDefaultInstance()) return this; if (!other.getMetricName().isEmpty()) { metricName_ = other.metricName_; onChanged(); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@Test @SuppressWarnings("all") public void getLogMetricTest() { MetricName name = ProjectMetricName.of("[PROJECT]", "[METRIC]"); String description = "description-1724546052"; String filter = "filter-1274492040"; String valueExtractor = "valueExtractor2047672534"; LogMetric expectedResponse = LogMetric.newBuilder() .setName(name.toString()) .setDescription(description) .setFilter(filter) .setValueExtractor(valueExtractor) .build(); mockMetricsServiceV2.addResponse(expectedResponse); MetricName metricName = ProjectMetricName.of("[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, MetricNames.parse(actualRequest.getMetricName())); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }