use of jakarta.nosql.mapping.Database in project jnosql-diana by eclipse.
the class MockProducer method getDocumentCollectionManagerMock.
@Produces
@Database(value = DatabaseType.DOCUMENT, provider = "documentRepositoryMock")
public DocumentCollectionManager getDocumentCollectionManagerMock() {
DocumentEntity entity = DocumentEntity.of("Person");
entity.add(Document.of("name", "documentRepositoryMock"));
entity.add(Document.of("age", 10));
DocumentCollectionManager manager = mock(DocumentCollectionManager.class);
when(manager.insert(Mockito.any(DocumentEntity.class))).thenReturn(entity);
when(manager.singleResult(Mockito.any(DocumentQuery.class))).thenReturn(Optional.empty());
return manager;
}
use of jakarta.nosql.mapping.Database in project jnosql-diana by eclipse.
the class MockProducer method getBucketManagerMock.
@Produces
@Database(value = DatabaseType.KEY_VALUE, provider = "keyvalueMock")
public BucketManager getBucketManagerMock() {
BucketManager bucketManager = Mockito.mock(BucketManager.class);
Person person = Person.builder().withName("keyvalueMock").build();
when(bucketManager.get("key")).thenReturn(Optional.ofNullable(Value.of(person)));
when(bucketManager.get(10L)).thenReturn(Optional.ofNullable(Value.of(person)));
when(bucketManager.get("user")).thenReturn(Optional.of(Value.of(new User("keyvalueMock", "keyvalueMock", 10))));
return bucketManager;
}
use of jakarta.nosql.mapping.Database in project jnosql-diana by eclipse.
the class MockProducer method getDocumentCollectionManagerMock.
@Produces
@Database(value = DatabaseType.DOCUMENT, provider = "documentRepositoryMock")
public DocumentCollectionManager getDocumentCollectionManagerMock() {
DocumentEntity entity = DocumentEntity.of("Person");
entity.add(Document.of("name", "documentRepositoryMock"));
entity.add(Document.of("age", 10));
DocumentCollectionManager manager = mock(DocumentCollectionManager.class);
when(manager.insert(Mockito.any(DocumentEntity.class))).thenReturn(entity);
when(manager.singleResult(Mockito.any(DocumentQuery.class))).thenReturn(Optional.empty());
return manager;
}
use of jakarta.nosql.mapping.Database in project jnosql-diana by eclipse.
the class MockProducer method getColumnFamilyManagerMock.
@Produces
@Database(value = DatabaseType.COLUMN, provider = "columnRepositoryMock")
public ColumnFamilyManager getColumnFamilyManagerMock() {
ColumnEntity entity = ColumnEntity.of("Person");
entity.add(Column.of("name", "columnRepositoryMock"));
entity.add(Column.of("age", 10));
ColumnFamilyManager manager = mock(ColumnFamilyManager.class);
when(manager.insert(Mockito.any(ColumnEntity.class))).thenReturn(entity);
return manager;
}
use of jakarta.nosql.mapping.Database in project jnosql-diana by eclipse.
the class MockProducer method getColumnFamilyManagerMock.
@Produces
@Database(value = DatabaseType.COLUMN, provider = "columnRepositoryMock")
public ColumnFamilyManager getColumnFamilyManagerMock() {
ColumnEntity entity = ColumnEntity.of("Person");
entity.add(Column.of("name", "columnRepositoryMock"));
entity.add(Column.of("age", 10));
ColumnFamilyManager manager = mock(ColumnFamilyManager.class);
when(manager.insert(Mockito.any(ColumnEntity.class))).thenReturn(entity);
return manager;
}
Aggregations