Ejemplo n.º 1
0
  @Test
  public void setVersion() throws Exception {
    String storeDir = "target/test-data/set-version";
    new TestGraphDatabaseFactory()
        .setFileSystem(fs.get())
        .newImpermanentDatabase(storeDir)
        .shutdown();
    assertEquals(1, NeoStore.setVersion(fs.get(), new File(storeDir, NeoStore.DEFAULT_NAME), 10));
    assertEquals(10, NeoStore.setVersion(fs.get(), new File(storeDir, NeoStore.DEFAULT_NAME), 12));

    StoreFactory sf =
        new StoreFactory(
            new Config(new HashMap<String, String>(), GraphDatabaseSettings.class),
            new DefaultIdGeneratorFactory(),
            new DefaultWindowPoolFactory(),
            fs.get(),
            StringLogger.DEV_NULL,
            null);

    NeoStore neoStore = sf.newNeoStore(new File(storeDir, NeoStore.DEFAULT_NAME));
    assertEquals(12, neoStore.getVersion());
    neoStore.close();
  }