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);
}
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);
}
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");
}
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);
}
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);
}
Aggregations