SpannerImpl(SpannerOptions options) { this(options.getSpannerRpcV1(), options.getPrefetchChunks(), options); }
BatchReadOnlyTransactionImpl(SpannerImpl spanner, SessionImpl session, TimestampBound bound) { super( checkNotNull(session), checkNotNull(bound), checkNotNull(spanner).getOptions().getSpannerRpcV1(), spanner.getOptions().getPrefetchChunks()); this.sessionName = session.getName(); this.options = session.getOptions(); initTransaction(); }
BatchReadOnlyTransactionImpl( SpannerImpl spanner, SessionImpl session, BatchTransactionId batchTransactionId) { super( checkNotNull(session), checkNotNull(batchTransactionId).getTransactionId(), batchTransactionId.getTimestamp(), checkNotNull(spanner).getOptions().getSpannerRpcV1(), spanner.getOptions().getPrefetchChunks()); this.sessionName = session.getName(); this.options = session.getOptions(); }
@Test public void defaultBuilder() { // We need to set the project id since in test environment we cannot obtain a default project // id. SpannerOptions options = SpannerOptions.newBuilder().setProjectId("test-project").build(); assertThat(options.getHost()).isEqualTo("https://spanner.googleapis.com"); assertThat(options.getPrefetchChunks()).isEqualTo(4); assertThat(options.getSessionLabels()).isNull(); }
@Test public void builder() { String host = "http://localhost:8000/"; String projectId = "test-project"; Map<String, String> labels = new HashMap<>(); labels.put("env", "dev"); SpannerOptions options = SpannerOptions.newBuilder() .setHost(host) .setProjectId(projectId) .setPrefetchChunks(2) .setSessionLabels(labels) .build(); assertThat(options.getHost()).isEqualTo(host); assertThat(options.getProjectId()).isEqualTo(projectId); assertThat(options.getPrefetchChunks()).isEqualTo(2); assertThat(options.getSessionLabels()).containsExactlyEntriesIn(labels); }
SpannerImpl(SpannerOptions options) { this(options.getSpannerRpcV1(), options.getPrefetchChunks(), options); }
BatchReadOnlyTransactionImpl(SpannerImpl spanner, SessionImpl session, TimestampBound bound) { super( checkNotNull(session), checkNotNull(bound), checkNotNull(spanner).getOptions().getSpannerRpcV1(), spanner.getOptions().getPrefetchChunks()); this.sessionName = session.getName(); this.options = session.getOptions(); initTransaction(); }
BatchReadOnlyTransactionImpl( SpannerImpl spanner, SessionImpl session, BatchTransactionId batchTransactionId) { super( checkNotNull(session), checkNotNull(batchTransactionId).getTransactionId(), batchTransactionId.getTimestamp(), checkNotNull(spanner).getOptions().getSpannerRpcV1(), spanner.getOptions().getPrefetchChunks()); this.sessionName = session.getName(); this.options = session.getOptions(); }