File tree Expand file tree Collapse file tree 1 file changed +10
-13
lines changed
gcloud-java-datastore/src/main/java/com/google/cloud/datastore/testing Expand file tree Collapse file tree 1 file changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -556,31 +556,28 @@ private static int findAvailablePort() {
556556 }
557557 }
558558
559+ private DatastoreOptions .Builder optionsBuilder () {
560+ return DatastoreOptions .builder ()
561+ .projectId (projectId )
562+ .host ("localhost:" + Integer .toString (port ))
563+ .authCredentials (AuthCredentials .noAuth ())
564+ .retryParams (RetryParams .noRetries ());
565+ }
566+
559567 /**
560568 * Returns a {@link DatastoreOptions} instance that sets the host to use the Datastore emulator on
561569 * localhost.
562570 */
563571 public DatastoreOptions options () {
564- return DatastoreOptions .builder ()
565- .projectId (projectId )
566- .host ("localhost:" + Integer .toString (port ))
567- .authCredentials (AuthCredentials .noAuth ())
568- .retryParams (RetryParams .noRetries ())
569- .build ();
572+ return optionsBuilder ().build ();
570573 }
571574
572575 /**
573576 * Returns a {@link DatastoreOptions} instance that sets the host to use the Datastore emulator on
574577 * localhost. The default namespace is set to {@code namespace}.
575578 */
576579 public DatastoreOptions options (String namespace ) {
577- return DatastoreOptions .builder ()
578- .projectId (projectId )
579- .host ("localhost:" + Integer .toString (port ))
580- .authCredentials (AuthCredentials .noAuth ())
581- .retryParams (RetryParams .noRetries ())
582- .namespace (namespace )
583- .build ();
580+ return optionsBuilder ().namespace (namespace ).build ();
584581 }
585582
586583 /**
You can’t perform that action at this time.
0 commit comments