@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.spanner.v1.RollbackRequest)) { return super.equals(obj); } com.google.spanner.v1.RollbackRequest other = (com.google.spanner.v1.RollbackRequest) obj; boolean result = true; result = result && getSession().equals(other.getSession()); result = result && getTransactionId().equals(other.getTransactionId()); 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) + SESSION_FIELD_NUMBER; hash = (53 * hash) + getSession().hashCode(); hash = (37 * hash) + TRANSACTION_ID_FIELD_NUMBER; hash = (53 * hash) + getTransactionId().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * * * <pre> * Required. The session in which the transaction to roll back is running. * </pre> * * <code>string session = 1;</code> */ public Builder clearSession() { session_ = getDefaultInstance().getSession(); onChanged(); return this; } /**
@Override public void rollback(RollbackRequest request, @Nullable Map<Option, ?> options) throws SpannerException { GrpcCallContext context = newCallContext(options, request.getSession()); get(spannerStub.rollbackCallable().futureCall(request, context)); }
public Builder mergeFrom(com.google.spanner.v1.RollbackRequest other) { if (other == com.google.spanner.v1.RollbackRequest.getDefaultInstance()) return this; if (!other.getSession().isEmpty()) { session_ = other.session_; onChanged(); } if (other.getTransactionId() != com.google.protobuf.ByteString.EMPTY) { setTransactionId(other.getTransactionId()); } this.mergeUnknownFields(other.unknownFields); onChanged(); return this; }
@Test @SuppressWarnings("all") public void rollbackTest() { Empty expectedResponse = Empty.newBuilder().build(); mockSpanner.addResponse(expectedResponse); SessionName session = SessionName.of("[PROJECT]", "[INSTANCE]", "[DATABASE]", "[SESSION]"); ByteString transactionId = ByteString.copyFromUtf8("28"); client.rollback(session, transactionId); List<GeneratedMessageV3> actualRequests = mockSpanner.getRequests(); Assert.assertEquals(1, actualRequests.size()); RollbackRequest actualRequest = (RollbackRequest) actualRequests.get(0); Assert.assertEquals(session, SessionName.parse(actualRequest.getSession())); Assert.assertEquals(transactionId, actualRequest.getTransactionId()); Assert.assertTrue( channelProvider.isHeaderSent( ApiClientHeaderProvider.getDefaultApiClientHeaderKey(), GaxGrpcProperties.getDefaultApiClientHeaderPattern())); }
@Override public void rollback(RollbackRequest request, @Nullable Map<Option, ?> options) throws SpannerException { GrpcCallContext context = newCallContext(options, request.getSession()); get(spannerStub.rollbackCallable().futureCall(request, context)); }