use of org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration in project janusgraph by JanusGraph.
the class ThriftGraphSpeedTest method getGraph.
@Override
protected StandardJanusGraph getGraph() throws BackendException {
if (null == graph) {
GraphDatabaseConfiguration graphDatabaseConfiguration = new GraphDatabaseConfiguration(conf);
graphDatabaseConfiguration.getBackend().clearStorage();
log.debug("Cleared backend storage");
graph = (StandardJanusGraph) JanusGraphFactory.open(conf);
initializeGraph(graph);
}
return graph;
}
use of org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration in project janusgraph by JanusGraph.
the class CQLGraphSpeedTest method getGraph.
@Override
protected StandardJanusGraph getGraph() throws BackendException {
if (null == graph) {
GraphDatabaseConfiguration graphDatabaseConfiguration = new GraphDatabaseConfiguration(conf);
graphDatabaseConfiguration.getBackend().clearStorage();
log.debug("Cleared backend storage");
graph = (StandardJanusGraph) JanusGraphFactory.open(conf);
initializeGraph(graph);
}
return graph;
}
use of org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration in project janusgraph by JanusGraph.
the class HBaseStoreManagerConfigTest method testHBaseTimestampProvider.
@Test
public // Test HBase preferred timestamp provider MILLI is set by default
void testHBaseTimestampProvider() {
// Get an empty configuration
// GraphDatabaseConfiguration.buildGraphConfiguration() only build an empty one.
ModifiableConfiguration config = GraphDatabaseConfiguration.buildGraphConfiguration();
// Set backend to hbase
config.set(GraphDatabaseConfiguration.STORAGE_BACKEND, "hbase");
// Instantiate a GraphDatabaseConfiguration based on the above
GraphDatabaseConfiguration graphConfig = new GraphDatabaseConfigurationBuilder().build(config.getConfiguration());
// Check the TIMESTAMP_PROVIDER has been set to the hbase preferred MILLI
TimestampProviders provider = graphConfig.getConfiguration().get(GraphDatabaseConfiguration.TIMESTAMP_PROVIDER);
assertEquals(HBaseStoreManager.PREFERRED_TIMESTAMPS, provider);
}
use of org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration in project janusgraph by JanusGraph.
the class StandardLogProcessorFrameworkTest method createGraphWithMockedInternals.
private StandardJanusGraph createGraphWithMockedInternals() throws BackendException {
StandardJanusGraph mockGraph = mock(StandardJanusGraph.class);
Backend mockBackend = mock(Backend.class);
KCVSLog mockKCVSLog = mock(KCVSLog.class);
GraphDatabaseConfiguration gdbConfig = mock(GraphDatabaseConfiguration.class);
TimestampProvider tsProvider = mock(TimestampProvider.class);
Serializer mockSerializer = mock(Serializer.class);
when(mockGraph.getConfiguration()).thenReturn(gdbConfig);
when(mockGraph.isOpen()).thenReturn(true);
when(mockGraph.getDataSerializer()).thenReturn(mockSerializer);
when(mockGraph.getBackend()).thenReturn(mockBackend);
when(mockBackend.getUserLog(anyString())).thenReturn(mockKCVSLog);
when(gdbConfig.getTimestampProvider()).thenReturn(tsProvider);
mockKCVSLog.registerReaders(mock(ReadMarker.class), new LinkedList<>());
return mockGraph;
}
use of org.janusgraph.graphdb.configuration.GraphDatabaseConfiguration in project janusgraph by JanusGraph.
the class GraphDatabaseConfigurationBuilder method build.
public GraphDatabaseConfiguration build(ReadConfiguration localConfig) {
Preconditions.checkNotNull(localConfig);
BasicConfiguration localBasicConfiguration = new BasicConfiguration(ROOT_NS, localConfig, BasicConfiguration.Restriction.NONE);
ModifiableConfiguration overwrite = new ModifiableConfiguration(ROOT_NS, new CommonsConfiguration(), BasicConfiguration.Restriction.NONE);
final KeyColumnValueStoreManager storeManager = Backend.getStorageManager(localBasicConfiguration);
final StoreFeatures storeFeatures = storeManager.getFeatures();
final ReadConfiguration globalConfig = new ReadConfigurationBuilder().buildGlobalConfiguration(localConfig, localBasicConfiguration, overwrite, storeManager, new ModifiableConfigurationBuilder(), new KCVSConfigurationBuilder());
// Copy over local config options
ModifiableConfiguration localConfiguration = new ModifiableConfiguration(ROOT_NS, new CommonsConfiguration(), BasicConfiguration.Restriction.LOCAL);
localConfiguration.setAll(getLocalSubset(localBasicConfiguration.getAll()));
Configuration combinedConfig = new MixedConfiguration(ROOT_NS, globalConfig, localConfig);
// Compute unique instance id
String uniqueGraphId = UniqueInstanceIdRetriever.getInstance().getOrGenerateUniqueInstanceId(combinedConfig);
overwrite.set(UNIQUE_INSTANCE_ID, uniqueGraphId);
checkAndOverwriteTransactionLogConfiguration(combinedConfig, overwrite, storeFeatures);
checkAndOverwriteSystemManagementLogConfiguration(combinedConfig, overwrite);
MergedConfiguration configuration = new MergedConfiguration(overwrite, combinedConfig);
return new GraphDatabaseConfiguration(localConfig, localConfiguration, uniqueGraphId, configuration);
}
Aggregations