Search in sources :

Example 1 with KeyValueTemplate

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

the class ReactiveRepositoryKeyValueBean method create.

@Override
public ReactiveRepository<?, ?> create(CreationalContext<ReactiveRepository<?, ?>> creationalContext) {
    KeyValueTemplate template = provider.isEmpty() ? getInstance(KeyValueTemplate.class) : getInstance(KeyValueTemplate.class, DatabaseQualifier.ofKeyValue(provider));
    ReactiveKeyValueTemplate reactiveTemplate = provider.isEmpty() ? getInstance(ReactiveKeyValueTemplate.class) : getInstance(ReactiveKeyValueTemplate.class, DatabaseQualifier.ofKeyValue(provider));
    ReactiveKeyValueRepositoryProxy<?> handler = new ReactiveKeyValueRepositoryProxy<>(template, reactiveTemplate, type);
    return (ReactiveRepository<?, ?>) Proxy.newProxyInstance(type.getClassLoader(), new Class[] { type }, handler);
}
Also used : ReactiveKeyValueTemplate(org.eclipse.jnosql.mapping.keyvalue.reactive.ReactiveKeyValueTemplate) ReactiveRepository(org.eclipse.jnosql.mapping.reactive.ReactiveRepository) ReactiveKeyValueTemplate(org.eclipse.jnosql.mapping.keyvalue.reactive.ReactiveKeyValueTemplate) KeyValueTemplate(jakarta.nosql.mapping.keyvalue.KeyValueTemplate)

Example 2 with KeyValueTemplate

use of jakarta.nosql.mapping.keyvalue.KeyValueTemplate 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 3 with KeyValueTemplate

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

the class KeyValueTemplateConverterTest method shouldReturnTemplate.

@Test
public void shouldReturnTemplate() {
    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", KeyValueConfigurationMock.class.getName());
    System.setProperty(prefix + ".database", "bucket");
    final KeyValueTemplate template = config.getValue(prefix, KeyValueTemplate.class);
    Assertions.assertNotNull(template);
    System.clearProperty(prefix);
    System.clearProperty(prefix + ".settings.key");
    System.clearProperty(prefix + ".settings.key2");
    System.clearProperty(prefix + ".provider");
    System.clearProperty(prefix + ".database");
}
Also used : KeyValueTemplate(jakarta.nosql.mapping.keyvalue.KeyValueTemplate) Test(org.junit.jupiter.api.Test)

Example 4 with KeyValueTemplate

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

the class RepositoryKeyValueBean method create.

@Override
public Repository create(CreationalContext<Repository> creationalContext) {
    KeyValueTemplate repository = provider.isEmpty() ? getInstance(KeyValueTemplate.class) : getInstance(KeyValueTemplate.class, DatabaseQualifier.ofKeyValue(provider));
    KeyValueRepositoryProxy handler = new KeyValueRepositoryProxy(type, repository);
    return (Repository) Proxy.newProxyInstance(type.getClassLoader(), new Class[] { type }, handler);
}
Also used : Repository(jakarta.nosql.mapping.Repository) KeyValueTemplate(jakarta.nosql.mapping.keyvalue.KeyValueTemplate)

Example 5 with KeyValueTemplate

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

the class ReactiveKeyValueTemplateProducerTest method shouldReturnTemplate.

@Test
public void shouldReturnTemplate() {
    final KeyValueTemplate template = Mockito.mock(KeyValueTemplate.class);
    final ReactiveKeyValueTemplate reactiveTemplate = producer.get(template);
    Assertions.assertNotNull(reactiveTemplate);
}
Also used : KeyValueTemplate(jakarta.nosql.mapping.keyvalue.KeyValueTemplate) Test(org.junit.jupiter.api.Test)

Aggregations

KeyValueTemplate (jakarta.nosql.mapping.keyvalue.KeyValueTemplate)10 Test (org.junit.jupiter.api.Test)5 ReactiveKeyValueTemplate (org.eclipse.jnosql.mapping.keyvalue.reactive.ReactiveKeyValueTemplate)3 ReactiveKeyValueTemplateProducer (org.eclipse.jnosql.mapping.keyvalue.reactive.ReactiveKeyValueTemplateProducer)2 BucketManager (jakarta.nosql.keyvalue.BucketManager)1 Repository (jakarta.nosql.mapping.Repository)1 PersonRepository (jakarta.nosql.tck.entities.PersonRepository)1 ReactiveRepository (org.eclipse.jnosql.mapping.reactive.ReactiveRepository)1 Config (org.eclipse.microprofile.config.Config)1