@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.longrunning.GetOperationRequest)) { return super.equals(obj); } com.google.longrunning.GetOperationRequest other = (com.google.longrunning.GetOperationRequest) obj; boolean result = true; result = result && getName() .equals(other.getName()); return result; }
@java.lang.Override public boolean equals(final java.lang.Object obj) { if (obj == this) { return true; } if (!(obj instanceof com.google.longrunning.GetOperationRequest)) { return super.equals(obj); } com.google.longrunning.GetOperationRequest other = (com.google.longrunning.GetOperationRequest) obj; boolean result = true; result = result && getName() .equals(other.getName()); return result; }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
@Override public void getOperation(GetOperationRequest request, io.grpc.stub.StreamObserver<com.google.longrunning.Operation> responseObserver) { responseObserver.onNext(TaskRepository.getTask(request.getName()).getLRO()); responseObserver.onCompleted(); } }
@java.lang.Override public int hashCode() { if (memoizedHashCode != 0) { return memoizedHashCode; } int hash = 41; hash = (19 * hash) + getDescriptor().hashCode(); hash = (37 * hash) + NAME_FIELD_NUMBER; hash = (53 * hash) + getName().hashCode(); hash = (29 * hash) + unknownFields.hashCode(); memoizedHashCode = hash; return hash; }
/** * <pre> * The name of the operation resource. * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
/** * <pre> * The name of the operation resource. * </pre> * * <code>string name = 1;</code> */ public Builder clearName() { name_ = getDefaultInstance().getName(); onChanged(); return this; } /**
public Builder mergeFrom(com.google.longrunning.GetOperationRequest other) { if (other == com.google.longrunning.GetOperationRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } onChanged(); return this; }
public Builder mergeFrom(com.google.longrunning.GetOperationRequest other) { if (other == com.google.longrunning.GetOperationRequest.getDefaultInstance()) return this; if (!other.getName().isEmpty()) { name_ = other.name_; onChanged(); } onChanged(); return this; }
@Override public ApiFuture<Operation> futureCall( GetOperationRequest request, ApiCallContext context) { if (!request.getName().equals("poseidon")) { return ApiFutures.immediateFailedFuture( new IllegalStateException("Unexpected request: " + request)); } else { return ApiFutures.immediateFuture( Operation.newBuilder().setName("greece").build()); } } });
@Test @SuppressWarnings("all") public void getOperationTest() { String name2 = "name2-1052831874"; boolean done = true; Operation expectedResponse = Operation.newBuilder().setName(name2).setDone(done).build(); mockOperations.addResponse(expectedResponse); String name = "name3373707"; Operation actualResponse = client.getOperation(name); Assert.assertEquals(expectedResponse, actualResponse); List<GeneratedMessageV3> actualRequests = mockOperations.getRequests(); Assert.assertEquals(1, actualRequests.size()); GetOperationRequest actualRequest = (GetOperationRequest) actualRequests.get(0); Assert.assertEquals(name, actualRequest.getName()); }