@@ -146,7 +146,7 @@ public static void cleanupClass() throws Exception {
146146 public void setup () throws Exception {
147147 super .setUp ();
148148 String apiKey = getProperty ("discovery.apikey" );
149- String url = "https://api.us-south. discovery.watson.cloud.ibm.com" ;
149+ String url = getProperty ( " discovery.url" ) ;
150150 Authenticator authenticator = new IamAuthenticator (apiKey );
151151 discovery = new Discovery ("2019-04-30" , authenticator );
152152 discovery .setServiceUrl (url );
@@ -2137,21 +2137,7 @@ private Configuration createTestConfig() {
21372137 }
21382138
21392139 private Collection createCollection (CreateCollectionOptions createOptions ) {
2140-
2141- Collection createResponse = null ;
2142- try {
2143- // In a successful case, you can grab the ID with the following code.
2144- Response <Collection > collectionResponse = discovery .createCollection (createOptions ).execute ();
2145- createResponse = collectionResponse .getResult ();
2146-
2147- String transactionId = collectionResponse .getHeaders ().values ("x-global-transaction-id" ).get (0 );
2148- System .out .println ("x-global-transcation-id: " +transactionId );
2149- } catch (ServiceResponseException e ) {
2150- // This is how you get the ID from a failed request.
2151- // Make sure to use the ServiceResponseException class or one of its subclasses!
2152- String transactionId = e .getHeaders ().values ("x-global-transaction-id" ).get (0 );
2153- System .out .println ("x-global-transcation-id: " +transactionId );
2154- }
2140+ Collection createResponse = discovery .createCollection (createOptions ).execute ().getResult ();
21552141 collectionIds .add (createResponse .getCollectionId ());
21562142 return createResponse ;
21572143 }
@@ -2196,7 +2182,7 @@ private DocumentAccepted createTestDocument(String json, String filename, String
21962182 DocumentAccepted createResponse = discovery .addDocument (builder .build ()).execute ().getResult ();
21972183 WaitFor .Condition documentAccepted =
21982184 new WaitForDocumentAccepted (environmentId , collectionId , createResponse .getDocumentId ());
2199- WaitFor .waitFor (documentAccepted , 10 , TimeUnit .SECONDS , 500 );
2185+ WaitFor .waitFor (documentAccepted , 5 , TimeUnit .SECONDS , 500 );
22002186 return createResponse ;
22012187 }
22022188
@@ -2222,7 +2208,7 @@ private synchronized String setupTestDocuments() {
22222208
22232209 WaitFor .Condition collectionAvailable =
22242210 new WaitForCollectionAvailable (environmentId , collectionId );
2225- WaitFor .waitFor (collectionAvailable , 10 , TimeUnit .SECONDS , 500 );
2211+ WaitFor .waitFor (collectionAvailable , 5 , TimeUnit .SECONDS , 500 );
22262212
22272213 return collectionId ;
22282214 }
0 commit comments