Search in sources :

Example 6 with DocumentCollectionManager

use of org.jnosql.diana.api.document.DocumentCollectionManager in project jnosql-artemis by eclipse.

the class MockProducer method getDocumentCollectionManager.

@Produces
public DocumentCollectionManager getDocumentCollectionManager() {
    DocumentEntity entity = DocumentEntity.of("Person");
    entity.add(Document.of("name", "Default"));
    entity.add(Document.of("age", 10));
    DocumentCollectionManager manager = mock(DocumentCollectionManager.class);
    when(manager.insert(Mockito.any(DocumentEntity.class))).thenReturn(entity);
    return manager;
}
Also used : DocumentEntity(org.jnosql.diana.api.document.DocumentEntity) DocumentCollectionManager(org.jnosql.diana.api.document.DocumentCollectionManager) Produces(javax.enterprise.inject.Produces)

Example 7 with DocumentCollectionManager

use of org.jnosql.diana.api.document.DocumentCollectionManager in project jnosql-artemis by eclipse.

the class ManagerProducerProducer method getDocumentCollectionManager.

@Produces
public DocumentCollectionManager getDocumentCollectionManager() {
    DocumentCollectionManager collectionManager = Mockito.mock(DocumentCollectionManager.class);
    DocumentEntity entity = DocumentEntity.of("person");
    entity.add(Document.of("name", "Ada"));
    entity.add(Document.of("age", 10));
    entity.add(Document.of("salary", BigDecimal.TEN));
    entity.add(Document.of("phones", singletonList("22342342")));
    when(collectionManager.insert(Mockito.any(DocumentEntity.class))).thenReturn(entity);
    when(collectionManager.update(Mockito.any(DocumentEntity.class))).thenReturn(entity);
    return collectionManager;
}
Also used : DocumentEntity(org.jnosql.diana.api.document.DocumentEntity) DocumentCollectionManager(org.jnosql.diana.api.document.DocumentCollectionManager) Produces(javax.enterprise.inject.Produces)

Aggregations

DocumentCollectionManager (org.jnosql.diana.api.document.DocumentCollectionManager)7 Produces (javax.enterprise.inject.Produces)3 DocumentEntity (org.jnosql.diana.api.document.DocumentEntity)3 Test (org.junit.jupiter.api.Test)3 DocumentTemplateProducer (org.jnosql.artemis.document.DocumentTemplateProducer)1 DocumentQuery (org.jnosql.diana.api.document.DocumentQuery)1