This repository was archived by the owner on Apr 7, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
main/java/com/google/cloud/spanner
test/java/com/google/cloud/spanner Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1625,6 +1625,7 @@ public Builder usePlainText() {
16251625 this .experimentalHost = "http://" + this .experimentalHost ;
16261626 super .setHost (this .experimentalHost );
16271627 }
1628+ this .usePlainText = true ;
16281629 return this ;
16291630 }
16301631
Original file line number Diff line number Diff line change @@ -1201,4 +1201,27 @@ public void testExperimentalHostOptions() {
12011201 assertTrue (options .getSessionPoolOptions ().getUseMultiplexedSessionForRW ());
12021202 assertTrue (options .getSessionPoolOptions ().getUseMultiplexedSessionPartitionedOps ());
12031203 }
1204+
1205+ @ Test
1206+ public void testPlainTextOptions () {
1207+ SpannerOptions options =
1208+ SpannerOptions .newBuilder ().setExperimentalHost ("localhost:8080" ).usePlainText ().build ();
1209+ assertEquals ("http://localhost:8080" , options .getHost ());
1210+ assertEquals (NoCredentials .getInstance (), options .getCredentials ());
1211+ options =
1212+ SpannerOptions .newBuilder ()
1213+ .setExperimentalHost ("http://localhost:8080" )
1214+ .usePlainText ()
1215+ .build ();
1216+ assertEquals ("http://localhost:8080" , options .getHost ());
1217+ options =
1218+ SpannerOptions .newBuilder ().usePlainText ().setExperimentalHost ("localhost:8080" ).build ();
1219+ assertEquals ("http://localhost:8080" , options .getHost ());
1220+ options =
1221+ SpannerOptions .newBuilder ()
1222+ .usePlainText ()
1223+ .setExperimentalHost ("http://localhost:8080" )
1224+ .build ();
1225+ assertEquals ("http://localhost:8080" , options .getHost ());
1226+ }
12041227}
You can’t perform that action at this time.
0 commit comments