Search in sources :

Example 1 with BucketManagerFactoryMock

use of org.eclipse.jnosql.mapping.keyvalue.configuration.KeyValueConfigurationMock.BucketManagerFactoryMock in project jnosql-diana by eclipse.

the class BucketManagerFactoryConverterTest 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", KeyValueConfigurationMock.class.getName());
    final BucketManagerFactory managerFactory = config.getValue(prefix, BucketManagerFactory.class);
    final BucketManagerFactoryMock factoryMock = BucketManagerFactoryMock.class.cast(managerFactory);
    final Settings settings = factoryMock.getSettings();
    assertEquals(2, settings.size());
    assertEquals(settings.get("key").get(), "value");
    assertEquals(settings.get("key2").get(), "value2");
    assertNotNull(managerFactory);
    System.clearProperty(prefix);
    System.clearProperty(prefix + ".settings.key");
    System.clearProperty(prefix + ".settings.key2");
    System.clearProperty(prefix + ".provider");
}
Also used : BucketManagerFactoryMock(org.eclipse.jnosql.mapping.keyvalue.configuration.KeyValueConfigurationMock.BucketManagerFactoryMock) Settings(jakarta.nosql.Settings) BucketManagerFactory(jakarta.nosql.keyvalue.BucketManagerFactory) Test(org.junit.jupiter.api.Test)

Aggregations

Settings (jakarta.nosql.Settings)1 BucketManagerFactory (jakarta.nosql.keyvalue.BucketManagerFactory)1 BucketManagerFactoryMock (org.eclipse.jnosql.mapping.keyvalue.configuration.KeyValueConfigurationMock.BucketManagerFactoryMock)1 Test (org.junit.jupiter.api.Test)1