|  | 
| 25 | 25 | import com.google.cloud.testing.BaseEmulatorHelper; | 
| 26 | 26 | import com.google.common.collect.ImmutableList; | 
| 27 | 27 | import java.io.IOException; | 
| 28 |  | -import java.io.InputStream; | 
| 29 |  | -import java.io.InputStreamReader; | 
| 30 |  | -import java.io.OutputStream; | 
| 31 |  | -import java.net.HttpURLConnection; | 
| 32 | 28 | import java.net.MalformedURLException; | 
| 33 | 29 | import java.net.URL; | 
| 34 | 30 | import java.nio.file.FileVisitResult; | 
|  | 
| 42 | 38 | import java.util.UUID; | 
| 43 | 39 | import java.util.concurrent.TimeoutException; | 
| 44 | 40 | import java.util.logging.Logger; | 
| 45 |  | - | 
| 46 |  | -import com.google.common.io.CharStreams; | 
| 47 | 41 | import org.threeten.bp.Duration; | 
| 48 | 42 | 
 | 
| 49 | 43 | /** | 
| @@ -101,24 +95,6 @@ public class LocalDatastoreHelper extends BaseEmulatorHelper<DatastoreOptions> { | 
| 101 | 95 |           .setCredentials(NoCredentials.getInstance()) | 
| 102 | 96 |           .setRetrySettings(ServiceOptions.getNoRetrySettings()); | 
| 103 | 97 | 
 | 
| 104 |  | -  String sendGetRequest(String request) throws IOException { | 
| 105 |  | -    URL url = new URL("http", DEFAULT_HOST, this.getPort(), request); | 
| 106 |  | -    HttpURLConnection con = (HttpURLConnection) url.openConnection(); | 
| 107 |  | -    con.setRequestMethod("GET"); | 
| 108 |  | - | 
| 109 |  | -    InputStream in = con.getInputStream(); | 
| 110 |  | -    String response = CharStreams.toString(new InputStreamReader(con.getInputStream())); | 
| 111 |  | -    in.close(); | 
| 112 |  | -    return response; | 
| 113 |  | -  } | 
| 114 |  | -  public String checkHealth() { | 
| 115 |  | -    try { | 
| 116 |  | -      return sendGetRequest("/"); | 
| 117 |  | -    } catch (IOException e) { | 
| 118 |  | -      throw new RuntimeException(e); | 
| 119 |  | -    } | 
| 120 |  | -  } | 
| 121 |  | - | 
| 122 | 98 |   /** A builder for {@code LocalDatastoreHelper} objects. */ | 
| 123 | 99 |   public static class Builder { | 
| 124 | 100 |     private double consistency; | 
|  | 
0 commit comments