|
21 | 21 | package com.arangodb;
|
22 | 22 |
|
23 | 23 | import com.arangodb.entity.*;
|
24 |
| -import com.arangodb.internal.RequestContextHolder; |
25 | 24 | import com.arangodb.internal.serde.SerdeUtils;
|
26 | 25 | import com.arangodb.model.*;
|
27 | 26 | import com.arangodb.model.DocumentImportOptions.OnDuplicate;
|
|
35 | 34 | import com.fasterxml.jackson.core.JsonProcessingException;
|
36 | 35 | import com.fasterxml.jackson.databind.JsonNode;
|
37 | 36 | import com.fasterxml.jackson.databind.ObjectMapper;
|
| 37 | +import com.fasterxml.jackson.databind.node.JsonNodeFactory; |
38 | 38 | import org.junit.jupiter.api.BeforeAll;
|
39 | 39 | import org.junit.jupiter.params.ParameterizedTest;
|
40 | 40 | import org.junit.jupiter.params.provider.Arguments;
|
@@ -557,8 +557,7 @@ void insertDocumentAsBytes(ArangoCollectionAsync collection) throws ExecutionExc
|
557 | 557 | assertThat(createEntity.getKey()).isEqualTo(key);
|
558 | 558 | assertThat(createEntity.getRev()).isNotNull();
|
559 | 559 | assertThat(createEntity.getNew()).isNotNull().isInstanceOf(RawBytes.class);
|
560 |
| - Map<String, Object> newDoc = RequestContextHolder.INSTANCE.runWithCtx(RequestContext.EMPTY, () -> |
561 |
| - collection.getSerde().deserializeUserData(createEntity.getNew().get(), Map.class)); |
| 560 | + Map<String, Object> newDoc = collection.getSerde().getUserSerde().deserialize(createEntity.getNew().get(), Map.class); |
562 | 561 | assertThat(newDoc).containsAllEntriesOf(doc);
|
563 | 562 | }
|
564 | 563 |
|
@@ -1597,6 +1596,38 @@ void deleteDocumentIfMatchFail(ArangoCollectionAsync collection) throws Executio
|
1597 | 1596 | assertThat(thrown).isInstanceOf(ArangoDBException.class);
|
1598 | 1597 | }
|
1599 | 1598 |
|
| 1599 | + @ParameterizedTest |
| 1600 | + @MethodSource("asyncCols") |
| 1601 | + void deleteDocuments(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { |
| 1602 | + DocumentCreateEntity<?> a = collection.insertDocument(new BaseDocument()).get(); |
| 1603 | + DocumentCreateEntity<?> b = collection.insertDocument(new BaseDocument()).get(); |
| 1604 | + MultiDocumentEntity<DocumentDeleteEntity<Void>> info = collection.deleteDocuments( |
| 1605 | + Arrays.asList(a.getKey(), b.getKey())).get(); |
| 1606 | + assertThat(info).isNotNull(); |
| 1607 | + assertThat(info.getDocuments()).hasSize(2); |
| 1608 | + assertThat(info.getErrors()).isEmpty(); |
| 1609 | + } |
| 1610 | + |
| 1611 | + @ParameterizedTest |
| 1612 | + @MethodSource("asyncCols") |
| 1613 | + void deleteDocumentsWithRevs(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException { |
| 1614 | + DocumentCreateEntity<?> a = collection.insertDocument(new BaseDocument()).get(); |
| 1615 | + DocumentCreateEntity<?> b = collection.insertDocument(new BaseDocument()).get(); |
| 1616 | + MultiDocumentEntity<DocumentDeleteEntity<Void>> info = collection.deleteDocuments( |
| 1617 | + Arrays.asList( |
| 1618 | + JsonNodeFactory.instance.objectNode() |
| 1619 | + .put("_key", a.getKey()) |
| 1620 | + .put("_rev", a.getRev()), |
| 1621 | + JsonNodeFactory.instance.objectNode() |
| 1622 | + .put("_key", b.getKey()) |
| 1623 | + .put("_rev", "wrong") |
| 1624 | + ), new DocumentDeleteOptions().ignoreRevs(false)).get(); |
| 1625 | + assertThat(info).isNotNull(); |
| 1626 | + assertThat(info.getDocuments()).hasSize(1); |
| 1627 | + assertThat(info.getDocuments().get(0).getKey()).isEqualTo(a.getKey()); |
| 1628 | + assertThat(info.getErrors()).hasSize(1); |
| 1629 | + } |
| 1630 | + |
1600 | 1631 | @ParameterizedTest
|
1601 | 1632 | @MethodSource("asyncCols")
|
1602 | 1633 | void deleteDocumentSilent(ArangoCollectionAsync collection) throws ExecutionException, InterruptedException {
|
|
0 commit comments