use of jakarta.nosql.document.DocumentDeleteQuery in project jnosql-diana by eclipse.
the class DefaultDocumentMapperDeleteBuilderTest method shouldQueryByEmbeddable.
@Test
public void shouldQueryByEmbeddable() {
DocumentDeleteQuery query = mapperBuilder.deleteFrom(Worker.class).where("job.city").eq("Salvador").build();
DocumentDeleteQuery queryExpected = delete().from("Worker").where("city").eq("Salvador").build();
assertEquals(queryExpected, query);
}
use of jakarta.nosql.document.DocumentDeleteQuery in project jnosql-diana by eclipse.
the class DefaultDocumentMapperDeleteBuilderTest method shouldSelectWhereNameGte.
@Test
public void shouldSelectWhereNameGte() {
DocumentDeleteQuery query = mapperBuilder.deleteFrom(Person.class).where("id").gte(10).build();
DocumentDeleteQuery queryExpected = delete().from("Person").where("_id").gte(10L).build();
assertEquals(queryExpected, query);
}
use of jakarta.nosql.document.DocumentDeleteQuery in project jnosql-diana by eclipse.
the class DefaultDocumentMapperDeleteBuilderTest method shouldReturnDeleteFrom.
@Test
public void shouldReturnDeleteFrom() {
DocumentMapperDeleteFrom documentFrom = mapperBuilder.deleteFrom(Person.class);
DocumentDeleteQuery query = documentFrom.build();
DocumentDeleteQuery queryExpected = delete().from("Person").build();
assertEquals(queryExpected, query);
}
use of jakarta.nosql.document.DocumentDeleteQuery in project jnosql-diana-driver by eclipse.
the class ArangoDBDocumentCollectionManagerTest method shouldRemoveEntity.
@Test
public void shouldRemoveEntity() {
DocumentEntity documentEntity = entityManager.insert(getEntity());
Document id = documentEntity.find("_key").get();
DocumentQuery select = select().from(COLLECTION_NAME).where(id.getName()).eq(id.get()).build();
DocumentDeleteQuery deleteQuery = delete().from(COLLECTION_NAME).where(id.getName()).eq(id.get()).build();
entityManager.delete(deleteQuery);
assertTrue(entityManager.select(select).collect(Collectors.toList()).isEmpty());
}
use of jakarta.nosql.document.DocumentDeleteQuery in project jnosql-diana-driver by eclipse.
the class ArangoDBDocumentCollectionManagerTest method shouldRemoveEntity2.
@Test
public void shouldRemoveEntity2() {
DocumentEntity documentEntity = entityManager.insert(getEntity());
Document id = documentEntity.find("name").get();
DocumentQuery select = select().from(COLLECTION_NAME).where(id.getName()).eq(id.get()).build();
DocumentDeleteQuery deleteQuery = delete().from(COLLECTION_NAME).where(id.getName()).eq(id.get()).build();
entityManager.delete(deleteQuery);
assertTrue(entityManager.select(select).collect(Collectors.toList()).isEmpty());
}
Aggregations