use of org.apache.commons.configuration2.MapConfiguration in project janusgraph by JanusGraph.
the class ConfigurationManagementGraphTest method shouldReindexIfPropertyKeyExists.
@Test
public void shouldReindexIfPropertyKeyExists() {
final Map<String, Object> map = new HashMap<>();
map.put(STORAGE_BACKEND.toStringWithoutRoot(), "inmemory");
final MapConfiguration config = ConfigurationUtil.loadMapConfiguration(map);
final StandardJanusGraph graph = new StandardJanusGraph(new GraphDatabaseConfigurationBuilder().build(new CommonsConfiguration(config)));
final String propertyKeyName = "Created_Using_Template";
final Class dataType = Boolean.class;
JanusGraphManagement management = graph.openManagement();
management.makePropertyKey(propertyKeyName).dataType(dataType).make();
management.commit();
// Instantiate the ConfigurationManagementGraph Singleton
// This is purposefully done after a property key is created to ensure that a REDINDEX is initiated
new ConfigurationManagementGraph(graph);
management = graph.openManagement();
final JanusGraphIndex index = management.getGraphIndex("Created_Using_Template_Index");
final PropertyKey propertyKey = management.getPropertyKey("Created_Using_Template");
assertNotNull(index);
assertNotNull(propertyKey);
assertEquals(ENABLED, index.getIndexStatus(propertyKey));
management.commit();
}
use of org.apache.commons.configuration2.MapConfiguration in project bitflyer4j by after-the-sunrise.
the class Bitflyer4jFactoryTest method testGetRealtimeType.
@Test
public void testGetRealtimeType() {
Map<String, String> map = new HashMap<>();
MapConfiguration conf = new MapConfiguration(map);
// Default
assertSame(SocketServiceImpl.class, target.getRealtimeType(conf));
// Invalid
map.put(KeyType.REALTIME_TYPE.getKey(), "foo");
assertSame(SocketServiceImpl.class, target.getRealtimeType(conf));
}
use of org.apache.commons.configuration2.MapConfiguration in project bitflyer4j by after-the-sunrise.
the class KeyTypeTest method testFetch_Unconfigured.
@Test
public void testFetch_Unconfigured() throws ConfigurationException {
Configuration c = new MapConfiguration(new HashMap<>());
for (KeyType type : KeyType.values()) {
type.fetch(null);
type.fetch(c);
}
}
use of org.apache.commons.configuration2.MapConfiguration in project bitflyer4j by after-the-sunrise.
the class Bitflyer4jFactory method createConfiguration.
/**
* Create a {@link Configuration} instance,
* composed of multiple configurations which are enumerated in {@link ConfigurationType}.
*
* @return Composite configuration instance.
*/
@VisibleForTesting
AbstractConfiguration createConfiguration(Properties properties) {
CompositeConfiguration composite = new CompositeConfiguration();
ConfigurationType[] types = ConfigurationType.values();
Arrays.stream(types).forEach(s -> s.get().ifPresent(composite::addConfiguration));
Optional.ofNullable(properties).ifPresent(p -> composite.addConfiguration(new MapConfiguration(p)));
return composite;
}
Aggregations