@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + PARENT_FIELD_NUMBER; hash = (53 * hash) + getParent().hashCode(); if (hasExclusion()) { hash = (37 * hash) + EXCLUSION_FIELD_NUMBER; hash = (53 * hash) + getExclusion().hashCode(); } hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.logging.v2.CreateExclusionRequest)) { return super.equals(obj); } com.google.logging.v2.CreateExclusionRequest other = (com.google.logging.v2.CreateExclusionRequest) obj; boolean result = true; result = result && getParent().equals(other.getParent()); result = result && (hasExclusion() == other.hasExclusion()); if (hasExclusion()) { result = result && getExclusion().equals(other.getExclusion()); } result = result && unknownFields.equals(other.unknownFields); return result; }
/** * * * <pre> * Required. The parent resource in which to create the exclusion: * "projects/[PROJECT_ID]" * "organizations/[ORGANIZATION_ID]" * "billingAccounts/[BILLING_ACCOUNT_ID]" * "folders/[FOLDER_ID]" * Examples: `"projects/my-logging-project"`, `"organizations/123456789"`. * </pre> * * <code>string parent = 1;</code> */ public Builder clearParent() { parent_ = getDefaultInstance().getParent(); onChanged(); return this; } /**
public Builder mergeFrom(com.google.logging.v2.CreateExclusionRequest other) { if (other == com.google.logging.v2.CreateExclusionRequest.getDefaultInstance()) return this; if (!other.getParent().isEmpty()) { parent_ = other.parent_; onChanged(); } if (other.hasExclusion()) { mergeExclusion(other.getExclusion()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@Test @SuppressWarnings("all") public void createExclusionTest() { String name = "name3373707"; String description = "description-1724546052"; String filter = "filter-1274492040"; boolean disabled = true; LogExclusion expectedResponse = LogExclusion.newBuilder() .setName(name) .setDescription(description) .setFilter(filter) .setDisabled(disabled) .build(); mockConfigServiceV2.addResponse(expectedResponse); ParentName parent = ProjectName.of("[PROJECT]"); LogExclusion exclusion = LogExclusion.newBuilder().build(); LogExclusion actualResponse = client.createExclusion(parent, exclusion); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockConfigServiceV2.getRequests(); Assert.assertEquals(1, actualRequests.size()); CreateExclusionRequest actualRequest = (CreateExclusionRequest) actualRequests.get(0); Assert.assertEquals(parent, ParentNames.parse(actualRequest.getParent())); Assert.assertEquals(exclusion, actualRequest.getExclusion()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }