@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.firestore.v1beta1.RollbackRequest)) { return super.equals(obj); } com.google.firestore.v1beta1.RollbackRequest other = (com.google.firestore.v1beta1.RollbackRequest) obj; boolean result = true; result = result && getDatabase().equals(other.getDatabase()); result = result && getTransaction().equals(other.getTransaction()); 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) + DATABASE_FIELD_NUMBER; hash = (53 * hash) + getDatabase().hashCode(); hash = (37 * hash) + TRANSACTION_FIELD_NUMBER; hash = (53 * hash) + getTransaction().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * * * <pre> * The transaction to roll back. * </pre> * * <code>bytes transaction = 2;</code> */ public Builder clearTransaction() { transaction_ = getDefaultInstance().getTransaction(); onChanged(); return this; }
public Builder mergeFrom(com.google.firestore.v1beta1.RollbackRequest other) { if (other == com.google.firestore.v1beta1.RollbackRequest.getDefaultInstance()) return this; if (!other.getDatabase().isEmpty()) { database_ = other.database_; onChanged(); } if (other.getTransaction() != com.google.protobuf.ByteString.EMPTY) { setTransaction(other.getTransaction()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@Test @SuppressWarnings("all") public void rollbackTest() { Empty expectedResponse = Empty.newBuilder().build(); mockFirestore.addResponse(expectedResponse); String formattedDatabase = FirestoreClient.formatDatabaseRootName("[PROJECT]", "[DATABASE]"); ByteString transaction = ByteString.copyFromUtf8("-34"); client.rollback(formattedDatabase, transaction); List<GeneratedMessageV3> actualRequests = mockFirestore.getRequests(); Assert.assertEquals(1, actualRequests.size()); RollbackRequest actualRequest = (RollbackRequest) actualRequests.get(0); Assert.assertEquals(formattedDatabase, actualRequest.getDatabase()); Assert.assertEquals(transaction, actualRequest.getTransaction()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }