use of org.janusgraph.diskstorage.configuration.Configuration in project janusgraph by JanusGraph.
the class ElasticSearchConfigTest method testExternalMappingsViaMapping.
@Test
public void testExternalMappingsViaMapping() throws Exception {
final Duration maxWrite = Duration.ofMillis(2000L);
final String storeName = "test_mapping";
final Configuration indexConfig = GraphDatabaseConfiguration.buildGraphConfiguration().set(USE_EXTERNAL_MAPPINGS, true, INDEX_NAME).restrictTo(INDEX_NAME);
final IndexProvider idx = open(indexConfig);
final ElasticMajorVersion version = ((ElasticSearchIndex) idx).getVersion();
// Test create index KO mapping is not push
final KeyInformation.IndexRetriever indexRetriever = IndexProviderTest.getIndexRetriever(IndexProviderTest.getMapping(idx.getFeatures(), ANALYZER_ENGLISH, ANALYZER_KEYWORD));
final BaseTransactionConfig txConfig = StandardBaseTransactionConfig.of(TimestampProviders.MILLI);
final IndexTransaction itx = new IndexTransaction(idx, indexRetriever, txConfig, maxWrite);
try {
idx.register(storeName, "date", IndexProviderTest.getMapping(idx.getFeatures(), ANALYZER_ENGLISH, ANALYZER_KEYWORD).get("date"), itx);
fail("should fail");
} catch (final PermanentBackendException ignored) {
}
final HttpPut newMapping = new HttpPut("janusgraph_" + storeName);
newMapping.setEntity(new StringEntity(objectMapper.writeValueAsString(readMapping(version, "/strict_mapping.json")), Charset.forName("UTF-8")));
executeRequest(newMapping);
// Test date property OK
idx.register(storeName, "date", IndexProviderTest.getMapping(idx.getFeatures(), ANALYZER_ENGLISH, ANALYZER_KEYWORD).get("date"), itx);
// Test weight property KO
try {
idx.register(storeName, "weight", IndexProviderTest.getMapping(idx.getFeatures(), ANALYZER_ENGLISH, ANALYZER_KEYWORD).get("weight"), itx);
fail("should fail");
} catch (final BackendException ignored) {
}
itx.rollback();
idx.close();
}
use of org.janusgraph.diskstorage.configuration.Configuration in project janusgraph by JanusGraph.
the class ElasticSearchConfigTest method testMultiTypeUpgrade.
@Test
public void testMultiTypeUpgrade() throws InterruptedException, BackendException, IOException {
// create multi-type index
final ModifiableConfiguration config = esr.setElasticsearchConfiguration(GraphDatabaseConfiguration.buildGraphConfiguration(), INDEX_NAME);
config.set(USE_DEPRECATED_MULTITYPE_INDEX, true, INDEX_NAME);
Configuration indexConfig = config.restrictTo(INDEX_NAME);
IndexProvider idx = open(indexConfig);
simpleWriteAndQuery(idx);
idx.close();
// should be able to open multi-type index if USE_DEPRECATED_MULTITYPE_INDEX is unset
config.remove(USE_DEPRECATED_MULTITYPE_INDEX, INDEX_NAME);
indexConfig = config.restrictTo(INDEX_NAME);
idx = open(indexConfig);
idx.close();
}
use of org.janusgraph.diskstorage.configuration.Configuration in project janusgraph by JanusGraph.
the class HBaseStoreManager method getFeatures.
@Override
public StoreFeatures getFeatures() {
Configuration c = GraphDatabaseConfiguration.buildGraphConfiguration();
StandardStoreFeatures.Builder fb = new StandardStoreFeatures.Builder().orderedScan(true).unorderedScan(true).batchMutation(true).multiQuery(true).distributed(true).keyOrdered(true).storeTTL(true).cellTTL(true).timestamps(true).preferredTimestamps(PREFERRED_TIMESTAMPS).optimisticLocking(true).keyConsistent(c);
try {
fb.localKeyPartition(getDeployment() == Deployment.LOCAL);
} catch (Exception e) {
logger.warn("Unexpected exception during getDeployment()", e);
}
return fb.build();
}
Aggregations