use of org.neo4j.kernel.EmbeddedGraphDatabase in project graphdb by neo4j-attic.
the class TestUpgradeStore method makeSureStoreCantBeUpgradedByBatchInserterEvenIfExplicitlyToldTo.
@Test
public void makeSureStoreCantBeUpgradedByBatchInserterEvenIfExplicitlyToldTo() throws Exception {
String path = path(14);
new EmbeddedGraphDatabase(path).shutdown();
setOlderNeoStoreVersion(path);
try {
new BatchInserterImpl(path, stringMap(ALLOW_STORE_UPGRADE, "true"));
fail("Shouldn't be able to upgrade with batch inserter");
} catch (IllegalArgumentException e) {
// Good
}
}
use of org.neo4j.kernel.EmbeddedGraphDatabase in project graphdb by neo4j-attic.
the class TestUpgradeStore method makeSureStoreCanBeUpgradedIfExplicitlyToldTo.
@Test
public void makeSureStoreCanBeUpgradedIfExplicitlyToldTo() throws Exception {
String path = path(13);
new EmbeddedGraphDatabase(path).shutdown();
setOlderNeoStoreVersion(path);
new EmbeddedGraphDatabase(path, stringMap(ALLOW_STORE_UPGRADE, "true")).shutdown();
}
use of org.neo4j.kernel.EmbeddedGraphDatabase in project neo4j-mobile-android by neo4j-contrib.
the class StoreMigrationTool method run.
private void run(String legacyStoreDirectory, String targetStoreDirectory) throws IOException {
LegacyStore legacyStore = new LegacyStore(new File(new File(legacyStoreDirectory), NeoStore.DEFAULT_NAME).getPath());
HashMap config = new HashMap();
config.put(IdGeneratorFactory.class, CommonFactories.defaultIdGeneratorFactory());
config.put(FileSystemAbstraction.class, CommonFactories.defaultFileSystemAbstraction());
File targetStoreDirectoryFile = new File(targetStoreDirectory);
if (targetStoreDirectoryFile.exists()) {
throw new IllegalStateException("Cannot migrate to a directory that already exists, please delete first and re-run");
}
boolean success = targetStoreDirectoryFile.mkdirs();
if (!success) {
throw new IllegalStateException("Failed to create directory");
}
File targetStoreFile = new File(targetStoreDirectory, NeoStore.DEFAULT_NAME);
config.put("neo_store", targetStoreFile.getPath());
NeoStore.createStore(targetStoreFile.getPath(), config);
NeoStore neoStore = new NeoStore(config);
long startTime = System.currentTimeMillis();
new StoreMigrator(new VisibleMigrationProgressMonitor(System.out)).migrate(legacyStore, neoStore);
long duration = System.currentTimeMillis() - startTime;
System.out.printf("Migration completed in %d s%n", duration / 1000);
neoStore.close();
EmbeddedGraphDatabase database = new EmbeddedGraphDatabase(null, targetStoreDirectoryFile.getPath());
database.shutdown();
}
use of org.neo4j.kernel.EmbeddedGraphDatabase in project qi4j-sdk by Qi4j.
the class NeoEntityStoreMixin method activateService.
@Override
public void activateService() throws Exception {
String path = config.get().path().get();
if (path == null) {
if (fileConfiguration != null)
path = new File(fileConfiguration.dataDirectory(), config.get().identity().get()).getAbsolutePath();
else
path = "build/neodb";
}
neo = new EmbeddedGraphDatabase(path);
indexService = new LuceneIndexService(neo);
uuid = UUID.randomUUID().toString() + "-";
}
Aggregations