Ejemplo n.º 1
0
  @Test
  public void testSetLatestConstraintTx() throws Exception {
    // given
    new GraphDatabaseFactory().newEmbeddedDatabase(testDir.absolutePath()).shutdown();
    StoreFactory sf =
        new StoreFactory(
            new Config(new HashMap<String, String>(), GraphDatabaseSettings.class),
            new DefaultIdGeneratorFactory(),
            new DefaultWindowPoolFactory(),
            new DefaultFileSystemAbstraction(),
            StringLogger.DEV_NULL,
            null);

    // when
    NeoStore neoStore = sf.newNeoStore(new File(testDir.absolutePath(), NeoStore.DEFAULT_NAME));

    // then the default is 0
    assertEquals(0l, neoStore.getLatestConstraintIntroducingTx());

    // when
    neoStore.setLatestConstraintIntroducingTx(10l);

    // then
    assertEquals(10l, neoStore.getLatestConstraintIntroducingTx());

    // when
    neoStore.flushAll();
    neoStore.close();
    neoStore = sf.newNeoStore(new File(testDir.absolutePath(), NeoStore.DEFAULT_NAME));

    // then the value should have been stored
    assertEquals(10l, neoStore.getLatestConstraintIntroducingTx());
    neoStore.close();
  }