Search in sources :

Example 6 with BucketManager

use of jakarta.nosql.keyvalue.BucketManager in project jnosql-diana by eclipse.

the class DefaultKeyValueTemplateProducerTest method shouldReturn.

@Test
public void shouldReturn() {
    BucketManager manager = Mockito.mock(BucketManager.class);
    KeyValueTemplate repository = producer.get(manager);
    assertNotNull(repository);
}
Also used : BucketManager(jakarta.nosql.keyvalue.BucketManager) KeyValueTemplate(jakarta.nosql.mapping.keyvalue.KeyValueTemplate) Test(org.junit.jupiter.api.Test)

Example 7 with BucketManager

use of jakarta.nosql.keyvalue.BucketManager in project jnosql-diana by eclipse.

the class MockProducer method getBucketManager.

@Produces
public BucketManager getBucketManager() {
    BucketManager bucketManager = Mockito.mock(BucketManager.class);
    Person person = Person.builder().withName("Default").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("Default", "Default", 10))));
    return bucketManager;
}
Also used : User(jakarta.nosql.tck.entities.User) BucketManager(jakarta.nosql.keyvalue.BucketManager) Person(jakarta.nosql.tck.entities.Person) Produces(javax.enterprise.inject.Produces)

Example 8 with BucketManager

use of jakarta.nosql.keyvalue.BucketManager 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;
}
Also used : User(jakarta.nosql.tck.entities.User) BucketManager(jakarta.nosql.keyvalue.BucketManager) Person(jakarta.nosql.tck.entities.Person) Produces(javax.enterprise.inject.Produces) Database(jakarta.nosql.mapping.Database)

Example 9 with BucketManager

use of jakarta.nosql.keyvalue.BucketManager in project jnosql-diana-driver by eclipse.

the class CouchbaseMapTest method afterClass.

@AfterAll
public static void afterClass() {
    CouchbaseKeyValueConfiguration configuration = CouchbaseKeyValueTcConfiguration.getTcConfiguration();
    BucketManagerFactory keyValueEntityManagerFactory = configuration.get();
    BucketManager keyValueEntityManager = keyValueEntityManagerFactory.getBucketManager(CouchbaseUtil.BUCKET_NAME);
    keyValueEntityManager.delete("jnosql:map");
}
Also used : BucketManager(jakarta.nosql.keyvalue.BucketManager) BucketManagerFactory(jakarta.nosql.keyvalue.BucketManagerFactory) AfterAll(org.junit.jupiter.api.AfterAll)

Example 10 with BucketManager

use of jakarta.nosql.keyvalue.BucketManager in project jnosql-diana-driver by eclipse.

the class CouchbaseSetTest method afterClass.

@AfterAll
public static void afterClass() {
    CouchbaseKeyValueConfiguration configuration = CouchbaseKeyValueTcConfiguration.getTcConfiguration();
    BucketManagerFactory keyValueEntityManagerFactory = configuration.get();
    BucketManager keyValueEntityManager = keyValueEntityManagerFactory.getBucketManager(CouchbaseUtil.BUCKET_NAME);
    keyValueEntityManager.delete("jnosql:set");
}
Also used : BucketManager(jakarta.nosql.keyvalue.BucketManager) BucketManagerFactory(jakarta.nosql.keyvalue.BucketManagerFactory) AfterAll(org.junit.jupiter.api.AfterAll)

Aggregations

BucketManager (jakarta.nosql.keyvalue.BucketManager)25 BucketManagerFactory (jakarta.nosql.keyvalue.BucketManagerFactory)8 AfterAll (org.junit.jupiter.api.AfterAll)8 Test (org.junit.jupiter.api.Test)7 Params (jakarta.nosql.Params)4 QueryException (jakarta.nosql.QueryException)4 ServiceLoaderProvider (jakarta.nosql.ServiceLoaderProvider)4 Value (jakarta.nosql.Value)4 KeyValuePreparedStatement (jakarta.nosql.keyvalue.KeyValuePreparedStatement)4 Person (jakarta.nosql.tck.entities.Person)4 User (jakarta.nosql.tck.entities.User)4 List (java.util.List)4 Collectors.toList (java.util.stream.Collectors.toList)4 Stream (java.util.stream.Stream)4 Produces (javax.enterprise.inject.Produces)4 CouchbaseKeyValueConfiguration (org.eclipse.jnosql.communication.couchbase.keyvalue.CouchbaseKeyValueConfiguration)3 Database (jakarta.nosql.mapping.Database)2 KeyValueTemplateProducer (jakarta.nosql.mapping.keyvalue.KeyValueTemplateProducer)2 DelQuery (jakarta.nosql.query.DelQuery)2 DelQueryProvider (jakarta.nosql.query.DelQuery.DelQueryProvider)2