use of jakarta.nosql.keyvalue.BucketManager in project jnosql-diana-driver by eclipse.
the class KeyValueEntityManagerFactoryTest method shouldCreateKeyValueEntityManager.
@Test
public void shouldCreateKeyValueEntityManager() {
BucketManager keyValueEntityManager = managerFactory.getBucketManager(BUCKET_NAME);
assertNotNull(keyValueEntityManager);
}
use of jakarta.nosql.keyvalue.BucketManager in project jnosql-diana by eclipse.
the class DelQueryParser method prepare.
public KeyValuePreparedStatement prepare(String query, BucketManager manager) {
DelQuery delQuery = provider.apply(query);
Params params = Params.newParams();
List<Value> values = delQuery.getKeys().stream().map(k -> Values.getValue(k, params)).collect(toList());
return DefaultKeyValuePreparedStatement.del(values, manager, params, query);
}
use of jakarta.nosql.keyvalue.BucketManager in project jnosql-diana by eclipse.
the class DelQueryParser method query.
Stream<Value> query(String query, BucketManager manager) {
DelQuery delQuery = provider.apply(query);
Params params = Params.newParams();
List<Value> values = delQuery.getKeys().stream().map(k -> Values.getValue(k, params)).collect(toList());
if (params.isNotEmpty()) {
throw new QueryException("To run a query with a parameter use a PrepareStatement instead.");
}
List<Object> keys = values.stream().map(Value::get).collect(toList());
manager.delete(keys);
return Stream.empty();
}
use of jakarta.nosql.keyvalue.BucketManager in project jnosql-diana by eclipse.
the class TemplateBean method create.
@Override
public KeyValueTemplate create(CreationalContext<KeyValueTemplate> creationalContext) {
KeyValueTemplateProducer producer = getInstance(KeyValueTemplateProducer.class);
BucketManager manager = getManager();
return producer.get(manager);
}
use of jakarta.nosql.keyvalue.BucketManager in project jnosql-diana by eclipse.
the class BucketManagerConverterTest method shouldReturnBucket.
@Test
public void shouldReturnBucket() {
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 BucketManager bucketManager = config.getValue(prefix, BucketManager.class);
final BucketManagerMock bucket = BucketManagerMock.class.cast(bucketManager);
Assertions.assertEquals("bucket", bucket.getBucketName());
System.clearProperty(prefix);
System.clearProperty(prefix + ".settings.key");
System.clearProperty(prefix + ".settings.key2");
System.clearProperty(prefix + ".provider");
System.clearProperty(prefix + ".database");
}
Aggregations