Search in sources :

Example 16 with BucketManager

use of org.jnosql.diana.api.key.BucketManager in project jnosql-artemis 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("user")).thenReturn(Optional.of(Value.of(new User("keyvalueMock", "keyvalueMock", 10))));
    return bucketManager;
}
Also used : User(org.jnosql.artemis.model.User) BucketManager(org.jnosql.diana.api.key.BucketManager) Person(org.jnosql.artemis.model.Person) Produces(javax.enterprise.inject.Produces)

Aggregations

BucketManager (org.jnosql.diana.api.key.BucketManager)16 BucketManagerFactory (org.jnosql.diana.api.key.BucketManagerFactory)8 AfterAll (org.junit.jupiter.api.AfterAll)8 Test (org.junit.jupiter.api.Test)5 CouchbaseKeyValueConfiguration (org.jnosql.diana.couchbase.key.CouchbaseKeyValueConfiguration)3 Produces (javax.enterprise.inject.Produces)2 Person (org.jnosql.artemis.model.Person)2 User (org.jnosql.artemis.model.User)2 KeyValueTemplateProducer (org.jnosql.artemis.key.KeyValueTemplateProducer)1