use of org.jnosql.diana.api.document.DocumentDeleteQuery in project jnosql-diana-driver by eclipse.
the class ArangoDBDocumentCollectionManagerAsyncTest method shouldRemoveEntityAsync.
@Test
public void shouldRemoveEntityAsync() {
DocumentEntity documentEntity = entityManager.insert(getEntity());
Document id = documentEntity.find(KEY_NAME).get();
DocumentDeleteQuery query = delete().from(COLLECTION_NAME).where(id.getName()).eq(id.get()).build();
entityManagerAsync.delete(query);
}
use of org.jnosql.diana.api.document.DocumentDeleteQuery in project jnosql-artemis by eclipse.
the class DefaultDocumentTemplateAsyncTest method shouldDeleteByEntity.
@Test
public void shouldDeleteByEntity() {
subject.delete(Person.class, 10L);
ArgumentCaptor<DocumentDeleteQuery> queryCaptor = ArgumentCaptor.forClass(DocumentDeleteQuery.class);
verify(managerMock).delete(queryCaptor.capture());
DocumentDeleteQuery query = queryCaptor.getValue();
assertEquals("Person", query.getDocumentCollection());
assertEquals(DocumentCondition.eq(Document.of("_id", 10L)), query.getCondition().get());
}
use of org.jnosql.diana.api.document.DocumentDeleteQuery in project jnosql-artemis by eclipse.
the class DefaultDocumentTemplateAsyncTest method shouldDelete.
@Test
public void shouldDelete() {
DocumentDeleteQuery query = delete().from("delete").build();
subject.delete(query);
verify(managerMock).delete(query);
}
use of org.jnosql.diana.api.document.DocumentDeleteQuery in project jnosql-artemis by eclipse.
the class DefaultDocumentTemplateTest method shouldDelete.
@Test
public void shouldDelete() {
DocumentDeleteQuery query = delete().from("delete").build();
subject.delete(query);
verify(managerMock).delete(query);
}
use of org.jnosql.diana.api.document.DocumentDeleteQuery in project jnosql-artemis by eclipse.
the class DefaultDocumentTemplateTest method shouldDeleteEntity.
@Test
public void shouldDeleteEntity() {
subject.delete(Person.class, "10");
ArgumentCaptor<DocumentDeleteQuery> queryCaptor = ArgumentCaptor.forClass(DocumentDeleteQuery.class);
verify(managerMock).delete(queryCaptor.capture());
DocumentDeleteQuery query = queryCaptor.getValue();
DocumentCondition condition = query.getCondition().get();
assertEquals("Person", query.getDocumentCollection());
assertEquals(DocumentCondition.eq(Document.of("_id", 10L)), condition);
}
Aggregations