use of jakarta.nosql.Settings in project jnosql-diana-driver by eclipse.
the class CassandraColumnFamilyManagerFactoryTest method setUp.
@BeforeEach
public void setUp() {
Settings settings = ManagerFactorySupplier.INSTANCE.getSettings();
SettingsBuilder builder = Settings.builder();
builder.put("cassandra.host.1", settings.get("cassandra.host-1").get().toString());
builder.put("cassandra.port", settings.get("cassandra.port").get().toString());
builder.put("cassandra.query.1", " CREATE KEYSPACE IF NOT EXISTS newKeySpace WITH replication = {'class': 'SimpleStrategy', 'replication_factor' : 3};");
CassandraConfiguration cassandraConfiguration = new CassandraConfiguration();
subject = cassandraConfiguration.get(builder.build());
}
use of jakarta.nosql.Settings in project jnosql-diana-driver by eclipse.
the class CassandraConfigurationTest method shouldCreateDocumentEntityManagerFactoryFromFile.
@Test
public void shouldCreateDocumentEntityManagerFactoryFromFile() {
Settings settings = ManagerFactorySupplier.INSTANCE.getSettings();
CassandraConfiguration cassandraConfiguration = new CassandraConfiguration();
ColumnFamilyManagerFactory entityManagerFactory = cassandraConfiguration.get(settings);
assertNotNull(entityManagerFactory);
}
use of jakarta.nosql.Settings in project jnosql-diana by eclipse.
the class BucketManagerFactoryConverter method success.
@Override
public BucketManagerFactory success(String value) {
final SettingsConverter settingsConverter = BeanManagers.getInstance(SettingsConverter.class);
Config config = BeanManagers.getInstance(Config.class);
final Settings settings = settingsConverter.convert(value);
String provider = value + ".provider";
final Class<?> configurationClass = config.getValue(provider, Class.class);
if (KeyValueConfiguration.class.isAssignableFrom(configurationClass)) {
final Reflections reflections = BeanManagers.getInstance(Reflections.class);
final KeyValueConfiguration configuration = (KeyValueConfiguration) reflections.newInstance(configurationClass);
return configuration.get(settings);
}
throw new ConfigurationException("The class " + configurationClass + " is not valid to " + KeyValueConfiguration.class);
}
use of jakarta.nosql.Settings in project jnosql-diana by eclipse.
the class GraphConverterTest method shouldReturnManagerFactory.
@Test
public void shouldReturnManagerFactory() {
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", GraphConfigurationMock.class.getName());
final Graph graph = config.getValue(prefix, Graph.class);
final GraphMock factoryMock = GraphMock.class.cast(graph);
final Settings settings = factoryMock.getSettings();
assertEquals(2, settings.size());
assertEquals(settings.get("key").get(), "value");
assertEquals(settings.get("key2").get(), "value2");
assertNotNull(graph);
System.clearProperty(prefix);
System.clearProperty(prefix + ".settings.key");
System.clearProperty(prefix + ".settings.key2");
System.clearProperty(prefix + ".provider");
}
use of jakarta.nosql.Settings in project jnosql-diana by eclipse.
the class DefaultSettingsTest method shouldFindPrefixWithOrder.
@Test
public void shouldFindPrefixWithOrder() {
Settings settings = Settings.builder().put("host", "host").put("host-3", "host-3").put("host-2", "host-2").put("host-1", "host-1").build();
List<Object> hosts = settings.prefix("host");
Assertions.assertEquals(4, hosts.size());
assertThat(hosts, contains("host", "host-1", "host-2", "host-3"));
}
Aggregations