use of jakarta.nosql.document.DocumentQuery in project jnosql-diana-driver by eclipse.
the class MangoQueryConverterTest method shouldSelectFromLteAge.
@ParameterizedTest
@JsonSource("select_from_lte_order.json")
public void shouldSelectFromLteAge(JsonObject expected) {
DocumentQuery query = select().from("person").where("age").lte(10).build();
JsonObject jsonObject = converter.apply(query);
assertEquals(expected, jsonObject);
}
use of jakarta.nosql.document.DocumentQuery in project jnosql-diana-driver by eclipse.
the class MangoQueryConverterTest method shouldSelectFromOrAge.
@ParameterizedTest
@JsonSource("select_from_or_order.json")
public void shouldSelectFromOrAge(JsonObject expected) {
DocumentQuery query = select().from("person").where("name").eq("Poliana").or("name").eq("Ada").build();
JsonObject jsonObject = converter.apply(query);
assertEquals(expected, jsonObject);
}
use of jakarta.nosql.document.DocumentQuery in project jnosql-diana-driver by eclipse.
the class ElasticsearchDocumentCollectionManagerTest method shouldFindAll.
@Test
public void shouldFindAll() throws InterruptedException {
entityManager.insert(DocumentEntityGerator.getEntity());
DocumentQuery query = select().from(DocumentEntityGerator.COLLECTION_NAME).build();
SECONDS.sleep(1L);
List<DocumentEntity> entities = entityManager.select(query).collect(Collectors.toList());
assertFalse(entities.isEmpty());
}
use of jakarta.nosql.document.DocumentQuery in project jnosql-diana-driver by eclipse.
the class ElasticsearchDocumentCollectionManagerTest method shouldRemoveEntityById.
@Test
public void shouldRemoveEntityById() {
DocumentEntity documentEntity = entityManager.insert(DocumentEntityGerator.getEntity());
Document id = documentEntity.find("_id").get();
DocumentQuery query = select().from(DocumentEntityGerator.COLLECTION_NAME).where(id.getName()).eq(id.get()).build();
DocumentDeleteQuery deleteQuery = delete().from(DocumentEntityGerator.COLLECTION_NAME).where(id.getName()).eq(id.get()).build();
entityManager.delete(deleteQuery);
assertTrue(entityManager.select(query).collect(Collectors.toList()).isEmpty());
}
use of jakarta.nosql.document.DocumentQuery in project jnosql-diana-driver by eclipse.
the class ElasticsearchDocumentCollectionManagerTest method shouldRemoveEntityByName.
@Test
public void shouldRemoveEntityByName() throws InterruptedException {
DocumentEntity documentEntity = entityManager.insert(DocumentEntityGerator.getEntity());
Document name = documentEntity.find("name").get();
DocumentQuery query = select().from(DocumentEntityGerator.COLLECTION_NAME).where(name.getName()).eq(name.get()).build();
DocumentDeleteQuery deleteQuery = delete().from(DocumentEntityGerator.COLLECTION_NAME).where(name.getName()).eq(name.get()).build();
SECONDS.sleep(1L);
entityManager.delete(deleteQuery);
SECONDS.sleep(1L);
List<DocumentEntity> entities = entityManager.select(query).collect(Collectors.toList());
System.out.println(entities);
assertTrue(entities.isEmpty());
}
Aggregations