use of org.eclipse.jnosql.mapping.column.reactive.ReactiveColumnTemplate in project jnosql-diana by eclipse.
the class DefaultReactiveColumnRepositoryProducer method get.
@Override
public <T, K, R extends ReactiveRepository<T, K>> R get(Class<R> repositoryClass, ColumnTemplate template) {
Objects.requireNonNull(template, "template is required");
Objects.requireNonNull(repositoryClass, "repositoryClass is required");
final ReactiveColumnTemplate reactiveTemplate = producerReactive.get(template);
ReactiveColumnRepositoryProxy<R> handler = new ReactiveColumnRepositoryProxy<>(reactiveTemplate, template, converters, classMappings, repositoryClass);
return (R) Proxy.newProxyInstance(repositoryClass.getClassLoader(), new Class[] { repositoryClass }, handler);
}
use of org.eclipse.jnosql.mapping.column.reactive.ReactiveColumnTemplate in project jnosql-diana by eclipse.
the class ReactiveColumnManagerConverter method success.
@Override
protected ReactiveColumnTemplate success(String value) {
Config config = BeanManagers.getInstance(Config.class);
final ColumnTemplate template = config.getValue(value, ColumnTemplate.class);
ReactiveColumnTemplateProducer producer = BeanManagers.getInstance(ReactiveColumnTemplateProducer.class);
return producer.get(template);
}
use of org.eclipse.jnosql.mapping.column.reactive.ReactiveColumnTemplate in project jnosql-diana by eclipse.
the class ColumnReactiveRepositoryProxyTest method setUp.
@BeforeEach
public void setUp() {
this.template = Mockito.mock(ColumnTemplate.class);
final ReactiveColumnTemplate reactiveTemplate = reactiveProducer.get(template);
ReactiveColumnRepositoryProxy<?> personHandler = new ReactiveColumnRepositoryProxy<>(reactiveTemplate, template, converters, classMappings, PersonRepository.class);
when(template.insert(any(Person.class))).thenReturn(Person.builder().build());
when(template.insert(any(Person.class), any(Duration.class))).thenReturn(Person.builder().build());
when(template.update(any(Person.class))).thenReturn(Person.builder().build());
personRepository = (PersonRepository) Proxy.newProxyInstance(PersonRepository.class.getClassLoader(), new Class[] { PersonRepository.class }, personHandler);
}
use of org.eclipse.jnosql.mapping.column.reactive.ReactiveColumnTemplate in project jnosql-diana by eclipse.
the class ReactiveRepositoryColumnBean method create.
@Override
public ReactiveRepository<?, ?> create(CreationalContext<ReactiveRepository<?, ?>> context) {
ClassMappings classMappings = getInstance(ClassMappings.class);
ColumnTemplate template = provider.isEmpty() ? getInstance(ColumnTemplate.class) : getInstance(ColumnTemplate.class, DatabaseQualifier.ofDocument(provider));
ReactiveColumnTemplateProducer reactiveProducer = getInstance(ReactiveColumnTemplateProducer.class);
final ReactiveColumnTemplate reactiveTemplate = reactiveProducer.get(template);
Converters converters = getInstance(Converters.class);
ReactiveColumnRepositoryProxy<?> handler = new ReactiveColumnRepositoryProxy<>(reactiveTemplate, template, converters, classMappings, type);
return (ReactiveRepository<?, ?>) Proxy.newProxyInstance(type.getClassLoader(), new Class[] { type }, handler);
}
use of org.eclipse.jnosql.mapping.column.reactive.ReactiveColumnTemplate in project jnosql-diana by eclipse.
the class ReactiveColumnManagerConverterTest 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", ColumnConfigurationMock.class.getName());
System.setProperty(prefix + ".database", "database");
final ReactiveColumnTemplate template = config.getValue(prefix, ReactiveColumnTemplate.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");
}
Aggregations