Search in sources :

Example 1 with OnDiskLastTxIdGetter

use of org.neo4j.kernel.ha.transaction.OnDiskLastTxIdGetter in project neo4j by neo4j.

the class OnDiskLastTxIdGetterTest method lastTransactionIdIsBaseTxIdWhileNeoStoresAreStopped.

@Test
public void lastTransactionIdIsBaseTxIdWhileNeoStoresAreStopped() {
    final StoreFactory storeFactory = new StoreFactory(new File("store"), pageCacheRule.getPageCache(fs.get()), fs.get(), NullLogProvider.getInstance());
    final NeoStores neoStores = storeFactory.openAllNeoStores(true);
    neoStores.close();
    LongSupplier supplier = () -> neoStores.getMetaDataStore().getLastCommittedTransactionId();
    OnDiskLastTxIdGetter diskLastTxIdGetter = new OnDiskLastTxIdGetter(supplier);
    assertEquals(TransactionIdStore.BASE_TX_ID, diskLastTxIdGetter.getLastTxId());
}
Also used : OnDiskLastTxIdGetter(org.neo4j.kernel.ha.transaction.OnDiskLastTxIdGetter) NeoStores(org.neo4j.kernel.impl.store.NeoStores) StoreFactory(org.neo4j.kernel.impl.store.StoreFactory) LongSupplier(java.util.function.LongSupplier) File(java.io.File) Test(org.junit.Test)

Example 2 with OnDiskLastTxIdGetter

use of org.neo4j.kernel.ha.transaction.OnDiskLastTxIdGetter in project neo4j by neo4j.

the class OnDiskLastTxIdGetterTest method testGetLastTxIdNoFilePresent.

@Test
public void testGetLastTxIdNoFilePresent() throws Exception {
    // This is a sign that we have some bad coupling on our hands.
    // We currently have to do this because of our lifecycle and construction ordering.
    OnDiskLastTxIdGetter getter = new OnDiskLastTxIdGetter(() -> 13L);
    assertEquals(13L, getter.getLastTxId());
}
Also used : OnDiskLastTxIdGetter(org.neo4j.kernel.ha.transaction.OnDiskLastTxIdGetter) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 OnDiskLastTxIdGetter (org.neo4j.kernel.ha.transaction.OnDiskLastTxIdGetter)2 File (java.io.File)1 LongSupplier (java.util.function.LongSupplier)1 NeoStores (org.neo4j.kernel.impl.store.NeoStores)1 StoreFactory (org.neo4j.kernel.impl.store.StoreFactory)1