@@ -33,54 +33,54 @@ public abstract class CloudantClientHelper {
3333 //some tests need access to the URI with user info (e.g. replication)
3434 public static final String SERVER_URI_WITH_USER_INFO ;
3535 //some tests need access to the credentials (e.g. auth interceptors, vcap)
36- static final String COUCH_USERNAME ;
37- static final String COUCH_PASSWORD ;
38- static final String COUCH_HOST ;
36+ static final String SERVER_USER ;
37+ static final String SERVER_PASSWORD ;
38+ static final String SERVER_HOST ;
3939
4040 private static final CloudantClient CLIENT_INSTANCE ;
4141
42- private static final String COUCH_PORT ;
43- private static final String HTTP_PROTOCOL ;
42+ private static final String SERVER_PORT ;
43+ private static final String SERVER_PROTOCOL ;
4444 private static final URL SERVER_URL ;
4545
4646 static {
4747
4848 try {
4949 //a URL might be supplied, otherwise use the separate properties
50- String URL = System .getProperty ("test.couch .url" );
50+ String URL = System .getProperty ("test.server .url" );
5151 if (URL != null ) {
5252 URL couch = new URL (URL );
53- HTTP_PROTOCOL = couch .getProtocol ();
54- COUCH_HOST = couch .getHost ();
55- COUCH_PORT = (couch .getPort () < 0 ) ? null : Integer .toString (couch .getPort ());
53+ SERVER_PROTOCOL = couch .getProtocol ();
54+ SERVER_HOST = couch .getHost ();
55+ SERVER_PORT = (couch .getPort () < 0 ) ? null : Integer .toString (couch .getPort ());
5656 String userInfo = couch .getUserInfo ();
5757 if (userInfo != null ) {
58- COUCH_USERNAME = userInfo .substring (0 , userInfo .indexOf (":" ));
59- COUCH_PASSWORD = userInfo .substring (userInfo .indexOf (":" ) + 1 );
58+ SERVER_USER = userInfo .substring (0 , userInfo .indexOf (":" ));
59+ SERVER_PASSWORD = userInfo .substring (userInfo .indexOf (":" ) + 1 );
6060 } else {
61- COUCH_USERNAME = System .getProperty ("test.couch.username " );
62- COUCH_PASSWORD = System .getProperty ("test.couch .password" );
61+ SERVER_USER = System .getProperty ("test.server.user " );
62+ SERVER_PASSWORD = System .getProperty ("test.server .password" );
6363 }
6464 } else {
65- COUCH_USERNAME = System .getProperty ("test.couch.username " );
66- COUCH_PASSWORD = System .getProperty ("test.couch .password" );
67- COUCH_HOST = System .getProperty ("test.couch .host" , "localhost" );
68- COUCH_PORT = System .getProperty ("test.couch .port" , "5984" );
69- HTTP_PROTOCOL = System .getProperty ("test.couch.http " , "http" ); //should either be
65+ SERVER_USER = System .getProperty ("test.server.user " );
66+ SERVER_PASSWORD = System .getProperty ("test.server .password" );
67+ SERVER_HOST = System .getProperty ("test.server .host" , "localhost" );
68+ SERVER_PORT = System .getProperty ("test.server .port" , "5984" );
69+ SERVER_PROTOCOL = System .getProperty ("test.server.protocol " , "http" ); //should either be
7070 // http or https
7171 }
7272
7373 //now build the URLs
74- SERVER_URL = new URL (HTTP_PROTOCOL + "://"
75- + COUCH_HOST
76- + ((COUCH_PORT != null ) ? ":" + COUCH_PORT : "" )); //port if supplied
74+ SERVER_URL = new URL (SERVER_PROTOCOL + "://"
75+ + SERVER_HOST
76+ + ((SERVER_PORT != null ) ? ":" + SERVER_PORT : "" )); //port if supplied
7777
7878 // Ensure username and password are correctly URL encoded when included in the URI
79- SERVER_URI_WITH_USER_INFO = HTTP_PROTOCOL + "://"
80- + ((!IamAuthCondition .IS_IAM_ENABLED && COUCH_USERNAME != null ) ?
81- URLEncoder .encode (COUCH_USERNAME , "UTF-8" ) +
82- ":" + URLEncoder .encode (COUCH_PASSWORD , "UTF-8" ) + "@" : "" ) + COUCH_HOST + (
83- (COUCH_PORT != null ) ? ":" + COUCH_PORT : "" ); //port if supplied
79+ SERVER_URI_WITH_USER_INFO = SERVER_PROTOCOL + "://"
80+ + ((!IamAuthCondition .IS_IAM_ENABLED && SERVER_USER != null ) ?
81+ URLEncoder .encode (SERVER_USER , "UTF-8" ) +
82+ ":" + URLEncoder .encode (SERVER_PASSWORD , "UTF-8" ) + "@" : "" ) + SERVER_HOST + (
83+ (SERVER_PORT != null ) ? ":" + SERVER_PORT : "" ); //port if supplied
8484 } catch (Throwable t ) {
8585 throw new RuntimeException (t );
8686 }
@@ -122,8 +122,8 @@ public static ClientBuilder getClientBuilder() {
122122 if (IamAuthCondition .IS_IAM_ENABLED ) {
123123 builder .iamApiKey (IamAuthCondition .IAM_API_KEY );
124124 } else {
125- builder .username (COUCH_USERNAME )
126- .password (COUCH_PASSWORD );
125+ builder .username (SERVER_USER )
126+ .password (SERVER_PASSWORD );
127127 }
128128 return builder ;
129129 }
0 commit comments