@@ -37,36 +37,41 @@ private static DatabaseClient makeAdminTestClient() {
3737 );
3838 }
3939 private static DatabaseClient makeRestClientImpl (DatabaseClientFactory .DigestAuthContext auth ) {
40- return makeClientImpl (auth , "8012" );
40+ return makeClientImpl (auth , "8012" , false );
4141 }
4242 private static DatabaseClient makeTestClientImpl (DatabaseClientFactory .DigestAuthContext auth ) {
43- return makeClientImpl (auth , "8016" );
43+ return makeClientImpl (auth , "8016" , true );
4444 }
45- private static DatabaseClient makeClientImpl (DatabaseClientFactory .DigestAuthContext auth , String defaultPort ) {
45+ private static DatabaseClient makeClientImpl (
46+ DatabaseClientFactory .DigestAuthContext auth , String defaultPort , boolean withCheck
47+ ) {
4648 String host = System .getProperty ("TEST_HOST" , "localhost" );
4749 int port = Integer .parseInt (System .getProperty ("TEST_PORT" , defaultPort ));
4850
4951 DatabaseClient db = DatabaseClientFactory .newClient (host , port , auth );
5052
51- try {
52- OkHttpClient client = (OkHttpClient ) db .getClientImplementation ();
53+ if (withCheck ) {
54+ try {
55+ OkHttpClient client = (OkHttpClient ) db .getClientImplementation ();
5356// TODO: better alternative to ping for non-REST server
54- Response response = client .newCall (new Request .Builder ().url (
55- new HttpUrl .Builder ()
56- .scheme ("http" )
57- .host (host )
58- .port (port )
59- .encodedPath ("/" )
60- .build ()
61- ).build ()
57+ Response response = client .newCall (new Request .Builder ().url (
58+ new HttpUrl .Builder ()
59+ .scheme ("http" )
60+ .host (host )
61+ .port (port )
62+ .encodedPath ("/" )
63+ .build ()
64+ ).build ()
6265 ).execute ();
63- int statusCode = response .code ();
64- if (statusCode >= 300 && statusCode != 404 ) {
65- throw new RuntimeException (statusCode +" " +response .message ());
66+ int statusCode = response .code ();
67+ if (statusCode >= 300 && statusCode != 404 ) {
68+ throw new RuntimeException (statusCode +" " +response .message ());
69+ }
70+ } catch (IOException e ) {
71+ throw new RuntimeException (e );
6672 }
67- } catch (IOException e ) {
68- throw new RuntimeException (e );
6973 }
74+
7075 return db ;
7176 }
7277 public static URL getResource (String name ) {
0 commit comments