use of org.janusgraph.diskstorage.configuration.Configuration in project janusgraph by JanusGraph.
the class KeyColumnValueStoreTest method scanTestWithSimpleJob.
@Test
public void scanTestWithSimpleJob() throws Exception {
int keys = 1000, columns = 40;
String[][] values = KeyValueStoreUtil.generateData(keys, columns);
// Make it only half the number of columns for every 2nd key
for (int i = 0; i < values.length; i++) {
if (i % 2 == 0)
values[i] = Arrays.copyOf(values[i], columns / 2);
}
log.debug("Loading values: " + keys + "x" + columns);
loadValues(values);
clopen();
StandardScanner scanner = new StandardScanner(manager);
SimpleScanJobRunner runner = (ScanJob job, Configuration jobConf, String rootNSName) -> runSimpleJob(scanner, job, jobConf);
SimpleScanJob.runBasicTests(keys, columns, runner);
}
use of org.janusgraph.diskstorage.configuration.Configuration in project janusgraph by JanusGraph.
the class RidGenerationTest method testThreadBasedRidGeneration.
@Test
public void testThreadBasedRidGeneration() throws InterruptedException {
Configuration c = Configuration.EMPTY;
// n <= 1 is useless
final int n = 8;
Collection<byte[]> rids = Collections.synchronizedSet(new HashSet<byte[]>());
RidThread[] threads = new RidThread[n];
for (int i = 0; i < n; i++) {
threads[i] = new RidThread(rids, c);
}
for (int i = 0; i < n; i++) {
threads[i].start();
}
for (int i = 0; i < n; i++) {
threads[i].join();
}
// TODO: rewrite test case in terms of GraphDatabaseConfiguration
// assertEquals(n, rids.size());
}
use of org.janusgraph.diskstorage.configuration.Configuration in project janusgraph by JanusGraph.
the class HadoopScanMapper method setup.
@Override
protected void setup(Context context) throws IOException, InterruptedException {
super.setup(context);
org.apache.hadoop.conf.Configuration hadoopConf = DEFAULT_COMPAT.getContextConfiguration(context);
ModifiableHadoopConfiguration scanConf = ModifiableHadoopConfiguration.of(JanusGraphHadoopConfiguration.MAPRED_NS, hadoopConf);
job = getJob(scanConf);
metrics = new HadoopContextScanMetrics(context);
Configuration graphConf = getJanusGraphConfiguration(context);
finishSetup(scanConf, graphConf);
}
use of org.janusgraph.diskstorage.configuration.Configuration in project janusgraph by JanusGraph.
the class CQLStoreManager method initializeSession.
Session initializeSession(final String keyspaceName) {
final Configuration configuration = getStorageConfig();
final Map<String, Object> replication = Match(configuration.get(REPLICATION_STRATEGY)).of(Case($("SimpleStrategy"), strategy -> HashMap.<String, Object>of("class", strategy, "replication_factor", configuration.get(REPLICATION_FACTOR))), Case($("NetworkTopologyStrategy"), strategy -> HashMap.<String, Object>of("class", strategy).merge(Array.of(configuration.get(REPLICATION_OPTIONS)).grouped(2).toMap(array -> Tuple.of(array.get(0), Integer.parseInt(array.get(1))))))).toJavaMap();
final Session s = this.cluster.connect();
s.execute(createKeyspace(keyspaceName).ifNotExists().with().replication(replication));
return s;
}
use of org.janusgraph.diskstorage.configuration.Configuration in project janusgraph by JanusGraph.
the class ElasticSearchConfigTest method testIndexCreationOptions.
@Test
public void testIndexCreationOptions() throws InterruptedException, BackendException, IOException {
final int shards = 7;
final CommonsConfiguration cc = new CommonsConfiguration(new BaseConfiguration());
cc.set("index." + INDEX_NAME + ".elasticsearch.create.ext.number_of_shards", String.valueOf(shards));
final ModifiableConfiguration config = new ModifiableConfiguration(GraphDatabaseConfiguration.ROOT_NS, cc, BasicConfiguration.Restriction.NONE);
esr.setElasticsearchConfiguration(config, INDEX_NAME);
final Configuration indexConfig = config.restrictTo(INDEX_NAME);
final IndexProvider idx = open(indexConfig);
simpleWriteAndQuery(idx);
idx.close();
final ElasticSearchClient client = ElasticSearchSetup.REST_CLIENT.connect(indexConfig).getClient();
assertEquals(String.valueOf(shards), client.getIndexSettings("janusgraph_jvmlocal_test_store").get("number_of_shards"));
client.close();
}
Aggregations