File tree Expand file tree Collapse file tree 2 files changed +24
-0
lines changed
main/java/com/google/cloud/spanner
test/java/com/google/cloud/spanner Expand file tree Collapse file tree 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -1631,6 +1631,7 @@ public Builder usePlainText() {
16311631 this .experimentalHost = "http://" + this .experimentalHost ;
16321632 super .setHost (this .experimentalHost );
16331633 }
1634+ this .usePlainText = true ;
16341635 return this ;
16351636 }
16361637
Original file line number Diff line number Diff line change @@ -1199,4 +1199,27 @@ public void testExperimentalHostOptions() {
11991199 assertTrue (options .getSessionPoolOptions ().getUseMultiplexedSessionForRW ());
12001200 assertTrue (options .getSessionPoolOptions ().getUseMultiplexedSessionPartitionedOps ());
12011201 }
1202+
1203+ @ Test
1204+ public void testPlainTextOptions () {
1205+ SpannerOptions options =
1206+ SpannerOptions .newBuilder ().setExperimentalHost ("localhost:8080" ).usePlainText ().build ();
1207+ assertEquals ("http://localhost:8080" , options .getHost ());
1208+ assertEquals (NoCredentials .getInstance (), options .getCredentials ());
1209+ options =
1210+ SpannerOptions .newBuilder ()
1211+ .setExperimentalHost ("http://localhost:8080" )
1212+ .usePlainText ()
1213+ .build ();
1214+ assertEquals ("http://localhost:8080" , options .getHost ());
1215+ options =
1216+ SpannerOptions .newBuilder ().usePlainText ().setExperimentalHost ("localhost:8080" ).build ();
1217+ assertEquals ("http://localhost:8080" , options .getHost ());
1218+ options =
1219+ SpannerOptions .newBuilder ()
1220+ .usePlainText ()
1221+ .setExperimentalHost ("http://localhost:8080" )
1222+ .build ();
1223+ assertEquals ("http://localhost:8080" , options .getHost ());
1224+ }
12021225}
You can’t perform that action at this time.
0 commit comments