@Test public void remoteValidateCallsServerHealthcheck() { when(this.mockClient.healthcheck(any())).thenReturn(Mono.just(true)); SpannerConnection connection = new SpannerConnection(this.mockClient, TEST_SESSION, null); StepVerifier.create(connection.validate(ValidationDepth.REMOTE)) .expectNext(true) .verifyComplete(); verify(this.mockClient).healthcheck(connection); }
@Override public Publisher<Boolean> validate(ValidationDepth validationDepth) { if (validationDepth == ValidationDepth.LOCAL) { return Mono.fromSupplier(() -> this.getSessionName() != null); } return this.client.healthcheck(this); }
SpannerConnection implements Connection, StatementExecutionContext { @Override public Publisher<Boolean> validate(ValidationDepth validationDepth) { if (validationDepth == ValidationDepth.LOCAL) { return Mono.fromSupplier(() -> this.getSessionName() != null); } return this.client.healthcheck(this); } }
SpannerConnection implements Connection, StatementExecutionContext { @Override public Publisher<Boolean> validate(ValidationDepth validationDepth) { if (validationDepth == ValidationDepth.LOCAL) { return Mono.fromSupplier(() -> this.getSessionName() != null); } return this.client.healthcheck(this); } SpannerConnection(Client client, Session session, SpannerConnectionConfiguration config); }
SpannerConnection implements Connection, StatementExecutionContext { @Override public Publisher<Boolean> validate(ValidationDepth validationDepth) { if (validationDepth == ValidationDepth.LOCAL) { return Mono.fromSupplier(() -> this.getSessionName() != null); } return this.client.healthcheck(this); } SpannerConnection(Client client, Session session, SpannerConnectionConfiguration config); @Override Mono<Void> beginTransaction(); Mono<Void> beginTransaction(TransactionOptions transactionOptions); @Override Mono<Void> commitTransaction(); @Override Mono<Void> rollbackTransaction(); @Override Mono<Void> close(); @Override Batch createBatch(); @Override Publisher<Void> createSavepoint(String s); @Override SpannerStatement createStatement(String sql); @Override Publisher<Void> releaseSavepoint(String s); @Override Publisher<Void> rollbackTransactionToSavepoint(String s); @Override Publisher<Void> setTransactionIsolationLevel(IsolationLevel isolationLevel); @Override IsolationLevel getTransactionIsolationLevel(); @Override ByteString getTransactionId(); @Override String getSessionName(); @Override long nextSeqNum(); boolean isTransactionReadWrite(); boolean isTransactionPartitionedDml(); @Override Publisher<Boolean> validate(ValidationDepth validationDepth); @Override Publisher<Void> setAutoCommit(boolean newAutoCommit); @Override boolean isAutoCommit(); @Override SpannerConnectionMetadata getMetadata(); }
SpannerConnection implements Connection, StatementExecutionContext { @Override public Publisher<Boolean> validate(ValidationDepth validationDepth) { if (validationDepth == ValidationDepth.LOCAL) { return Mono.fromSupplier(() -> this.getSessionName() != null); } return this.client.healthcheck(this); } SpannerConnection(Client client, Session session, SpannerConnectionConfiguration config); @Override Mono<Void> beginTransaction(); Mono<Void> beginTransaction(TransactionOptions transactionOptions); @Override Mono<Void> commitTransaction(); @Override Mono<Void> rollbackTransaction(); @Override Mono<Void> close(); @Override Batch createBatch(); @Override Publisher<Void> createSavepoint(String s); @Override SpannerStatement createStatement(String sql); @Override Publisher<Void> releaseSavepoint(String s); @Override Publisher<Void> rollbackTransactionToSavepoint(String s); @Override Publisher<Void> setTransactionIsolationLevel(IsolationLevel isolationLevel); @Override IsolationLevel getTransactionIsolationLevel(); @Override ByteString getTransactionId(); @Override String getSessionName(); @Override long nextSeqNum(); boolean isTransactionReadWrite(); boolean isTransactionPartitionedDml(); @Override Publisher<Boolean> validate(ValidationDepth validationDepth); @Override Publisher<Void> setAutoCommit(boolean newAutoCommit); @Override boolean isAutoCommit(); @Override SpannerConnectionMetadata getMetadata();  }