@@ -139,7 +139,7 @@ void cleanUpGeneratedDatabases() throws DocumentClientException {
139139 new SqlParameterCollection (new SqlParameter ("@id" , id ))),
140140 null ).getQueryIterable ().iterator ().next ();
141141 if (database != null ) {
142- client .deleteDatabase (database .getSelfLink (), null ). close (); ;
142+ client .deleteDatabase (database .getSelfLink (), null );
143143 }
144144 }
145145 }
@@ -161,6 +161,7 @@ public void setUp() throws DocumentClientException {
161161 // Create the collection for test.
162162 DocumentCollection collectionDefinition = new DocumentCollection ();
163163 collectionDefinition .setId (GatewayTests .getUID ());
164+
164165 this .collectionForTest = client .createCollection (this .databaseForTest .getSelfLink (),
165166 collectionDefinition ,
166167 null ).getResource ();
@@ -338,11 +339,11 @@ public void testDatabaseCrud() throws DocumentClientException {
338339 Assert .assertTrue (databases .size () > 0 );
339340
340341 // Delete database.
341- client .deleteDatabase (createdDb .getSelfLink (), null ). close () ;
342+ client .deleteDatabase (createdDb .getSelfLink (), null );
342343
343344 // Read database after deletion.
344345 try {
345- client .readDatabase (createdDb .getSelfLink (), null ). close () ;
346+ client .readDatabase (createdDb .getSelfLink (), null );
346347 Assert .fail ("Exception didn't happen." );
347348 } catch (DocumentClientException e ) {
348349 Assert .assertEquals (404 , e .getStatusCode ());
@@ -378,11 +379,11 @@ public void testCollectionCrud() throws DocumentClientException {
378379 null ).getQueryIterable ().toList ();
379380 Assert .assertTrue (collections .size () > 0 );
380381 // Delete collection.
381- client .deleteCollection (createdCollection .getSelfLink (), null ). close () ;
382+ client .deleteCollection (createdCollection .getSelfLink (), null );
382383 // Read collection after deletion.
383384
384385 try {
385- client .readCollection (createdCollection .getSelfLink (), null ). close () ;
386+ client .readCollection (createdCollection .getSelfLink (), null );
386387 Assert .fail ("Exception didn't happen." );
387388 } catch (DocumentClientException e ) {
388389 Assert .assertEquals (404 , e .getStatusCode ());
@@ -403,7 +404,7 @@ public void testQueryIterableCrud() throws DocumentClientException {
403404 // Create 10 documents.
404405 for (int i = 0 ; i < numOfDocuments ; ++i ) {
405406 Document documentDefinition = new Document ("{ 'name': 'For paging test' }" );
406- client .createDocument (this .collectionForTest .getSelfLink (), documentDefinition , null , false ). close () ;
407+ client .createDocument (this .collectionForTest .getSelfLink (), documentDefinition , null , false );
407408 }
408409
409410 int numOfDocumentsPerPage = numOfDocuments / 5 ;
@@ -477,7 +478,7 @@ public void testCollectionIndexingPolicy() throws DocumentClientException {
477478 " 'indexingMode': 'Lazy'" +
478479 " }" +
479480 "}" );
480- client .deleteCollection (this .collectionForTest .getSelfLink (), null ). close () ;
481+ client .deleteCollection (this .collectionForTest .getSelfLink (), null );
481482 DocumentCollection lazyCollection = client .createCollection (this .databaseForTest .getSelfLink (),
482483 lazyCollectionDefinition ,
483484 null ).getResource ();
@@ -491,7 +492,7 @@ public void testCollectionIndexingPolicy() throws DocumentClientException {
491492 " 'indexingMode': 'Consistent'" +
492493 " }" +
493494 "}" );
494- client .deleteCollection (lazyCollection .getSelfLink (), null ). close () ;
495+ client .deleteCollection (lazyCollection .getSelfLink (), null );
495496 DocumentCollection consistentCollection = client .createCollection (this .databaseForTest .getSelfLink (),
496497 consistentCollectionDefinition ,
497498 null ).getResource ();
@@ -515,7 +516,7 @@ public void testCollectionIndexingPolicy() throws DocumentClientException {
515516 " ]" +
516517 " }" +
517518 "}" );
518- client .deleteCollection (consistentCollection .getSelfLink (), null ). close () ;
519+ client .deleteCollection (consistentCollection .getSelfLink (), null );
519520 DocumentCollection collectionWithSecondaryIndex = client .createCollection (this .databaseForTest .getSelfLink (),
520521 collectionDefinition ,
521522 null ).getResource ();
@@ -600,11 +601,11 @@ public void testDocumentCrud() throws DocumentClientException {
600601 Assert .assertEquals (rr .getStatusCode (), HttpStatus .SC_NOT_MODIFIED );
601602
602603 // delete document
603- client .deleteDocument (replacedDocument .getSelfLink (), null ). close () ;
604+ client .deleteDocument (replacedDocument .getSelfLink (), null );
604605
605606 // read documents after deletion
606607 try {
607- client .readDocument (replacedDocument .getSelfLink (), null ). close () ;
608+ client .readDocument (replacedDocument .getSelfLink (), null );
608609 Assert .fail ("Exception didn't happen." );
609610 } catch (DocumentClientException e ) {
610611 Assert .assertEquals (404 , e .getStatusCode ());
@@ -746,7 +747,7 @@ public int read() throws IOException {
746747 // Create attachment with invalid content type.
747748 ReadableStream mediaStream = new ReadableStream ("stream content." );
748749 try {
749- client .createAttachment (document .getSelfLink (), mediaStream , invalidMediaOptions ). close () ;
750+ client .createAttachment (document .getSelfLink (), mediaStream , invalidMediaOptions );
750751 Assert .assertTrue (false ); // This line shouldn't execute.
751752 } catch (DocumentClientException e ) {
752753 Assert .assertEquals (400 , e .getStatusCode ());
@@ -763,7 +764,7 @@ public int read() throws IOException {
763764 mediaStream = new ReadableStream ("stream content" );
764765 // Create colliding attachment.
765766 try {
766- client .createAttachment (document .getSelfLink (), mediaStream , validMediaOptions ). close () ;
767+ client .createAttachment (document .getSelfLink (), mediaStream , validMediaOptions );
767768 Assert .fail ("Exception didn't happen." );
768769 } catch (DocumentClientException e ) {
769770 Assert .assertEquals (409 , e .getStatusCode ());
@@ -794,7 +795,7 @@ public int read() throws IOException {
794795 attachment .set ("Author" , "new author" );
795796
796797 // Replace the attachment.
797- client .replaceAttachment (attachment , null ). close () ;
798+ client .replaceAttachment (attachment , null );
798799 Assert .assertEquals ("Book" , attachment .getString ("MediaType" ));
799800 Assert .assertEquals ("new author" , attachment .getString ("Author" ));
800801 // Read attachment media.
@@ -837,7 +838,7 @@ public int read() throws IOException {
837838 Assert .assertEquals (validAttachment .getMediaLink (), attachment .getMediaLink ());
838839 Assert .assertEquals (validAttachment .getContentType (), attachment .getContentType ());
839840 // Deleting attachment.
840- client .deleteAttachment (attachment .getSelfLink (), null ). close () ;
841+ client .deleteAttachment (attachment .getSelfLink (), null );
841842 // read attachments after deletion
842843 attachments = client .readAttachments (document .getSelfLink (), null ).getQueryIterable ().toList ();
843844 Assert .assertEquals (0 , attachments .size ());
@@ -869,7 +870,7 @@ public void testTriggerCrud() throws DocumentClientException {
869870
870871 Document document = new Document ();
871872 document .setId ("noname" );
872- client .createDocument (this .collectionForTest .getSelfLink (), document , options , false ). close () ;
873+ client .createDocument (this .collectionForTest .getSelfLink (), document , options , false );
873874
874875 // replace...
875876 String id = GatewayTests .getUID ();
@@ -900,7 +901,7 @@ public void testTriggerCrud() throws DocumentClientException {
900901 Assert .fail ("Query fail to find trigger" );
901902 }
902903
903- client .deleteTrigger (newTrigger .getSelfLink (), null ). close () ;
904+ client .deleteTrigger (newTrigger .getSelfLink (), null );
904905 }
905906
906907 @ Test
@@ -950,7 +951,7 @@ public void testStoredProcedureCrud() throws DocumentClientException {
950951 Assert .fail ("Query fail to find StoredProcedure" );
951952 }
952953
953- client .deleteStoredProcedure (newStoredProcedure .getSelfLink (), null ). close () ;
954+ client .deleteStoredProcedure (newStoredProcedure .getSelfLink (), null );
954955 }
955956
956957 @ Test
@@ -1096,7 +1097,7 @@ public void testUserDefinedFunctionCrud() throws DocumentClientException {
10961097 Assert .fail ("Query fail to find UserDefinedFunction" );
10971098 }
10981099 }
1099- client .deleteUserDefinedFunction (newUdf .getSelfLink (), null ). close () ;
1100+ client .deleteUserDefinedFunction (newUdf .getSelfLink (), null );
11001101 }
11011102
11021103 @ Test
@@ -1134,10 +1135,10 @@ public void testUserCrud() throws DocumentClientException {
11341135 user = client .readUser (replacedUser .getSelfLink (), null ).getResource ();
11351136 Assert .assertEquals (replacedUser .getId (), user .getId ());
11361137 // Delete user.
1137- client .deleteUser (user .getSelfLink (), null ). close () ;
1138+ client .deleteUser (user .getSelfLink (), null );
11381139 // Read user after deletion.
11391140 try {
1140- client .readUser (user .getSelfLink (), null ). close () ;
1141+ client .readUser (user .getSelfLink (), null );
11411142 Assert .fail ("Exception didn't happen." );
11421143 } catch (DocumentClientException e ) {
11431144 Assert .assertEquals (404 , e .getStatusCode ());
@@ -1191,10 +1192,10 @@ public void testPermissionCrud() throws DocumentClientException {
11911192 permission = client .readPermission (replacedPermission .getSelfLink (), null ).getResource ();
11921193 Assert .assertEquals (replacedPermission .getId (), permission .getId ());
11931194 // Delete permission.
1194- client .deletePermission (replacedPermission .getSelfLink (), null ). close () ;
1195+ client .deletePermission (replacedPermission .getSelfLink (), null );
11951196 // Read permission after deletion.
11961197 try {
1197- client .readPermission (permission .getSelfLink (), null ). close () ;
1198+ client .readPermission (permission .getSelfLink (), null );
11981199 Assert .fail ("Exception didn't happen." );
11991200 } catch (DocumentClientException e ) {
12001201 Assert .assertEquals (404 , e .getStatusCode ());
@@ -1263,7 +1264,7 @@ public void testOfferReadAndQuery() throws DocumentClientException {
12631264 Assert .assertEquals (400 , ex .getStatusCode ());
12641265 }
12651266
1266- client .deleteCollection (this .collectionForTest .getSelfLink (), null ). close () ;
1267+ client .deleteCollection (this .collectionForTest .getSelfLink (), null );
12671268
12681269 // Now try to get the read the offer after the collection is deleted
12691270 try {
@@ -1342,7 +1343,7 @@ public void testCreateCollectionWithOfferType() throws DocumentClientException {
13421343 collectionDefinition .setId (GatewayTests .getUID ());
13431344 RequestOptions requestOptions = new RequestOptions ();
13441345 requestOptions .setOfferType ("S2" );
1345- client .createCollection (this .databaseForTest .getSelfLink (), collectionDefinition , requestOptions ). close () ;
1346+ client .createCollection (this .databaseForTest .getSelfLink (), collectionDefinition , requestOptions );
13461347
13471348 // We should have an offer of type S2.
13481349 List <Offer > offerList = client .readOffers (null ).getQueryIterable ().toList ();
@@ -1457,7 +1458,7 @@ public void testAuthorization() throws DocumentClientException {
14571458 clientForCollection1 .readCollection (collectionForTest .getSelfLink (), null ).getResource ();
14581459 // 2. Failure-- Use Col1 Permission to delete
14591460 try {
1460- clientForCollection1 .deleteCollection (obtainedCollection1 .getSelfLink (), null ). close () ;
1461+ clientForCollection1 .deleteCollection (obtainedCollection1 .getSelfLink (), null );
14611462 Assert .fail ("Exception didn't happen." );
14621463 } catch (DocumentClientException e ) {
14631464 Assert .assertEquals (403 , e .getStatusCode ());
@@ -1565,7 +1566,6 @@ public void TestQuotaHeaders() {
15651566 Assert .assertTrue (response .getCollectionSizeUsage () > response .getDocumentUsage ());
15661567 Assert .assertTrue (response .getCollectionSizeUsage () == 4 * 1024 );
15671568 Assert .assertTrue (response .getDocumentUsage () == 2 * 1024 );
1568- response .close ();
15691569 } catch (DocumentClientException e ) {
15701570 e .printStackTrace ();
15711571 } catch (InterruptedException e ) {
0 commit comments