use of jakarta.nosql.document.DocumentCollectionManager in project jnosql-diana by eclipse.
the class DocumentCollectionManagerConverterTest method shouldReturnManager.
@Test
public void shouldReturnManager() {
final String prefix = UUID.randomUUID().toString();
System.setProperty(prefix, prefix);
System.setProperty(prefix + ".settings.key", "value");
System.setProperty(prefix + ".settings.key2", "value2");
System.setProperty(prefix + ".provider", DocumentConfigurationMock.class.getName());
System.setProperty(prefix + ".database", "database");
final DocumentCollectionManager manager = config.getValue(prefix, DocumentCollectionManager.class);
final DocumentCollectionManagerMock managerMock = DocumentCollectionManagerMock.class.cast(manager);
Assertions.assertEquals("database", managerMock.getDatabase());
System.clearProperty(prefix);
System.clearProperty(prefix + ".settings.key");
System.clearProperty(prefix + ".settings.key2");
System.clearProperty(prefix + ".provider");
System.clearProperty(prefix + ".database");
}
use of jakarta.nosql.document.DocumentCollectionManager 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.document.DocumentCollectionManager in project jnosql-diana 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;
}
use of jakarta.nosql.document.DocumentCollectionManager in project jnosql-diana-driver by eclipse.
the class OrientDBDocumentCollectionManagerFactoryTest method shouldCreateEntityManager.
@Test
public void shouldCreateEntityManager() {
DocumentCollectionManager database = managerFactory.get("database");
assertNotNull(database);
}
use of jakarta.nosql.document.DocumentCollectionManager in project jnosql-diana-driver by eclipse.
the class ArangoDBDocumentCollectionManagerFactoryTest method shouldCreateEntityManager.
@Test
public void shouldCreateEntityManager() {
DocumentCollectionManager database = managerFactory.get("database");
assertNotNull(database);
}
Aggregations