@@ -139,7 +139,7 @@ void cleanUpGeneratedDatabases() throws DocumentClientException {
139
139
new SqlParameterCollection (new SqlParameter ("@id" , id ))),
140
140
null ).getQueryIterable ().iterator ().next ();
141
141
if (database != null ) {
142
- client .deleteDatabase (database .getSelfLink (), null ). close (); ;
142
+ client .deleteDatabase (database .getSelfLink (), null );
143
143
}
144
144
}
145
145
}
@@ -161,6 +161,7 @@ public void setUp() throws DocumentClientException {
161
161
// Create the collection for test.
162
162
DocumentCollection collectionDefinition = new DocumentCollection ();
163
163
collectionDefinition .setId (GatewayTests .getUID ());
164
+
164
165
this .collectionForTest = client .createCollection (this .databaseForTest .getSelfLink (),
165
166
collectionDefinition ,
166
167
null ).getResource ();
@@ -338,11 +339,11 @@ public void testDatabaseCrud() throws DocumentClientException {
338
339
Assert .assertTrue (databases .size () > 0 );
339
340
340
341
// Delete database.
341
- client .deleteDatabase (createdDb .getSelfLink (), null ). close () ;
342
+ client .deleteDatabase (createdDb .getSelfLink (), null );
342
343
343
344
// Read database after deletion.
344
345
try {
345
- client .readDatabase (createdDb .getSelfLink (), null ). close () ;
346
+ client .readDatabase (createdDb .getSelfLink (), null );
346
347
Assert .fail ("Exception didn't happen." );
347
348
} catch (DocumentClientException e ) {
348
349
Assert .assertEquals (404 , e .getStatusCode ());
@@ -378,11 +379,11 @@ public void testCollectionCrud() throws DocumentClientException {
378
379
null ).getQueryIterable ().toList ();
379
380
Assert .assertTrue (collections .size () > 0 );
380
381
// Delete collection.
381
- client .deleteCollection (createdCollection .getSelfLink (), null ). close () ;
382
+ client .deleteCollection (createdCollection .getSelfLink (), null );
382
383
// Read collection after deletion.
383
384
384
385
try {
385
- client .readCollection (createdCollection .getSelfLink (), null ). close () ;
386
+ client .readCollection (createdCollection .getSelfLink (), null );
386
387
Assert .fail ("Exception didn't happen." );
387
388
} catch (DocumentClientException e ) {
388
389
Assert .assertEquals (404 , e .getStatusCode ());
@@ -403,7 +404,7 @@ public void testQueryIterableCrud() throws DocumentClientException {
403
404
// Create 10 documents.
404
405
for (int i = 0 ; i < numOfDocuments ; ++i ) {
405
406
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 );
407
408
}
408
409
409
410
int numOfDocumentsPerPage = numOfDocuments / 5 ;
@@ -477,7 +478,7 @@ public void testCollectionIndexingPolicy() throws DocumentClientException {
477
478
" 'indexingMode': 'Lazy'" +
478
479
" }" +
479
480
"}" );
480
- client .deleteCollection (this .collectionForTest .getSelfLink (), null ). close () ;
481
+ client .deleteCollection (this .collectionForTest .getSelfLink (), null );
481
482
DocumentCollection lazyCollection = client .createCollection (this .databaseForTest .getSelfLink (),
482
483
lazyCollectionDefinition ,
483
484
null ).getResource ();
@@ -491,7 +492,7 @@ public void testCollectionIndexingPolicy() throws DocumentClientException {
491
492
" 'indexingMode': 'Consistent'" +
492
493
" }" +
493
494
"}" );
494
- client .deleteCollection (lazyCollection .getSelfLink (), null ). close () ;
495
+ client .deleteCollection (lazyCollection .getSelfLink (), null );
495
496
DocumentCollection consistentCollection = client .createCollection (this .databaseForTest .getSelfLink (),
496
497
consistentCollectionDefinition ,
497
498
null ).getResource ();
@@ -515,7 +516,7 @@ public void testCollectionIndexingPolicy() throws DocumentClientException {
515
516
" ]" +
516
517
" }" +
517
518
"}" );
518
- client .deleteCollection (consistentCollection .getSelfLink (), null ). close () ;
519
+ client .deleteCollection (consistentCollection .getSelfLink (), null );
519
520
DocumentCollection collectionWithSecondaryIndex = client .createCollection (this .databaseForTest .getSelfLink (),
520
521
collectionDefinition ,
521
522
null ).getResource ();
@@ -600,11 +601,11 @@ public void testDocumentCrud() throws DocumentClientException {
600
601
Assert .assertEquals (rr .getStatusCode (), HttpStatus .SC_NOT_MODIFIED );
601
602
602
603
// delete document
603
- client .deleteDocument (replacedDocument .getSelfLink (), null ). close () ;
604
+ client .deleteDocument (replacedDocument .getSelfLink (), null );
604
605
605
606
// read documents after deletion
606
607
try {
607
- client .readDocument (replacedDocument .getSelfLink (), null ). close () ;
608
+ client .readDocument (replacedDocument .getSelfLink (), null );
608
609
Assert .fail ("Exception didn't happen." );
609
610
} catch (DocumentClientException e ) {
610
611
Assert .assertEquals (404 , e .getStatusCode ());
@@ -746,7 +747,7 @@ public int read() throws IOException {
746
747
// Create attachment with invalid content type.
747
748
ReadableStream mediaStream = new ReadableStream ("stream content." );
748
749
try {
749
- client .createAttachment (document .getSelfLink (), mediaStream , invalidMediaOptions ). close () ;
750
+ client .createAttachment (document .getSelfLink (), mediaStream , invalidMediaOptions );
750
751
Assert .assertTrue (false ); // This line shouldn't execute.
751
752
} catch (DocumentClientException e ) {
752
753
Assert .assertEquals (400 , e .getStatusCode ());
@@ -763,7 +764,7 @@ public int read() throws IOException {
763
764
mediaStream = new ReadableStream ("stream content" );
764
765
// Create colliding attachment.
765
766
try {
766
- client .createAttachment (document .getSelfLink (), mediaStream , validMediaOptions ). close () ;
767
+ client .createAttachment (document .getSelfLink (), mediaStream , validMediaOptions );
767
768
Assert .fail ("Exception didn't happen." );
768
769
} catch (DocumentClientException e ) {
769
770
Assert .assertEquals (409 , e .getStatusCode ());
@@ -794,7 +795,7 @@ public int read() throws IOException {
794
795
attachment .set ("Author" , "new author" );
795
796
796
797
// Replace the attachment.
797
- client .replaceAttachment (attachment , null ). close () ;
798
+ client .replaceAttachment (attachment , null );
798
799
Assert .assertEquals ("Book" , attachment .getString ("MediaType" ));
799
800
Assert .assertEquals ("new author" , attachment .getString ("Author" ));
800
801
// Read attachment media.
@@ -837,7 +838,7 @@ public int read() throws IOException {
837
838
Assert .assertEquals (validAttachment .getMediaLink (), attachment .getMediaLink ());
838
839
Assert .assertEquals (validAttachment .getContentType (), attachment .getContentType ());
839
840
// Deleting attachment.
840
- client .deleteAttachment (attachment .getSelfLink (), null ). close () ;
841
+ client .deleteAttachment (attachment .getSelfLink (), null );
841
842
// read attachments after deletion
842
843
attachments = client .readAttachments (document .getSelfLink (), null ).getQueryIterable ().toList ();
843
844
Assert .assertEquals (0 , attachments .size ());
@@ -869,7 +870,7 @@ public void testTriggerCrud() throws DocumentClientException {
869
870
870
871
Document document = new Document ();
871
872
document .setId ("noname" );
872
- client .createDocument (this .collectionForTest .getSelfLink (), document , options , false ). close () ;
873
+ client .createDocument (this .collectionForTest .getSelfLink (), document , options , false );
873
874
874
875
// replace...
875
876
String id = GatewayTests .getUID ();
@@ -900,7 +901,7 @@ public void testTriggerCrud() throws DocumentClientException {
900
901
Assert .fail ("Query fail to find trigger" );
901
902
}
902
903
903
- client .deleteTrigger (newTrigger .getSelfLink (), null ). close () ;
904
+ client .deleteTrigger (newTrigger .getSelfLink (), null );
904
905
}
905
906
906
907
@ Test
@@ -950,7 +951,7 @@ public void testStoredProcedureCrud() throws DocumentClientException {
950
951
Assert .fail ("Query fail to find StoredProcedure" );
951
952
}
952
953
953
- client .deleteStoredProcedure (newStoredProcedure .getSelfLink (), null ). close () ;
954
+ client .deleteStoredProcedure (newStoredProcedure .getSelfLink (), null );
954
955
}
955
956
956
957
@ Test
@@ -1096,7 +1097,7 @@ public void testUserDefinedFunctionCrud() throws DocumentClientException {
1096
1097
Assert .fail ("Query fail to find UserDefinedFunction" );
1097
1098
}
1098
1099
}
1099
- client .deleteUserDefinedFunction (newUdf .getSelfLink (), null ). close () ;
1100
+ client .deleteUserDefinedFunction (newUdf .getSelfLink (), null );
1100
1101
}
1101
1102
1102
1103
@ Test
@@ -1134,10 +1135,10 @@ public void testUserCrud() throws DocumentClientException {
1134
1135
user = client .readUser (replacedUser .getSelfLink (), null ).getResource ();
1135
1136
Assert .assertEquals (replacedUser .getId (), user .getId ());
1136
1137
// Delete user.
1137
- client .deleteUser (user .getSelfLink (), null ). close () ;
1138
+ client .deleteUser (user .getSelfLink (), null );
1138
1139
// Read user after deletion.
1139
1140
try {
1140
- client .readUser (user .getSelfLink (), null ). close () ;
1141
+ client .readUser (user .getSelfLink (), null );
1141
1142
Assert .fail ("Exception didn't happen." );
1142
1143
} catch (DocumentClientException e ) {
1143
1144
Assert .assertEquals (404 , e .getStatusCode ());
@@ -1191,10 +1192,10 @@ public void testPermissionCrud() throws DocumentClientException {
1191
1192
permission = client .readPermission (replacedPermission .getSelfLink (), null ).getResource ();
1192
1193
Assert .assertEquals (replacedPermission .getId (), permission .getId ());
1193
1194
// Delete permission.
1194
- client .deletePermission (replacedPermission .getSelfLink (), null ). close () ;
1195
+ client .deletePermission (replacedPermission .getSelfLink (), null );
1195
1196
// Read permission after deletion.
1196
1197
try {
1197
- client .readPermission (permission .getSelfLink (), null ). close () ;
1198
+ client .readPermission (permission .getSelfLink (), null );
1198
1199
Assert .fail ("Exception didn't happen." );
1199
1200
} catch (DocumentClientException e ) {
1200
1201
Assert .assertEquals (404 , e .getStatusCode ());
@@ -1263,7 +1264,7 @@ public void testOfferReadAndQuery() throws DocumentClientException {
1263
1264
Assert .assertEquals (400 , ex .getStatusCode ());
1264
1265
}
1265
1266
1266
- client .deleteCollection (this .collectionForTest .getSelfLink (), null ). close () ;
1267
+ client .deleteCollection (this .collectionForTest .getSelfLink (), null );
1267
1268
1268
1269
// Now try to get the read the offer after the collection is deleted
1269
1270
try {
@@ -1342,7 +1343,7 @@ public void testCreateCollectionWithOfferType() throws DocumentClientException {
1342
1343
collectionDefinition .setId (GatewayTests .getUID ());
1343
1344
RequestOptions requestOptions = new RequestOptions ();
1344
1345
requestOptions .setOfferType ("S2" );
1345
- client .createCollection (this .databaseForTest .getSelfLink (), collectionDefinition , requestOptions ). close () ;
1346
+ client .createCollection (this .databaseForTest .getSelfLink (), collectionDefinition , requestOptions );
1346
1347
1347
1348
// We should have an offer of type S2.
1348
1349
List <Offer > offerList = client .readOffers (null ).getQueryIterable ().toList ();
@@ -1457,7 +1458,7 @@ public void testAuthorization() throws DocumentClientException {
1457
1458
clientForCollection1 .readCollection (collectionForTest .getSelfLink (), null ).getResource ();
1458
1459
// 2. Failure-- Use Col1 Permission to delete
1459
1460
try {
1460
- clientForCollection1 .deleteCollection (obtainedCollection1 .getSelfLink (), null ). close () ;
1461
+ clientForCollection1 .deleteCollection (obtainedCollection1 .getSelfLink (), null );
1461
1462
Assert .fail ("Exception didn't happen." );
1462
1463
} catch (DocumentClientException e ) {
1463
1464
Assert .assertEquals (403 , e .getStatusCode ());
@@ -1565,7 +1566,6 @@ public void TestQuotaHeaders() {
1565
1566
Assert .assertTrue (response .getCollectionSizeUsage () > response .getDocumentUsage ());
1566
1567
Assert .assertTrue (response .getCollectionSizeUsage () == 4 * 1024 );
1567
1568
Assert .assertTrue (response .getDocumentUsage () == 2 * 1024 );
1568
- response .close ();
1569
1569
} catch (DocumentClientException e ) {
1570
1570
e .printStackTrace ();
1571
1571
} catch (InterruptedException e ) {
0 commit comments