Search in sources :

Example 51 with LifeSupport

use of org.neo4j.kernel.lifecycle.LifeSupport in project neo4j by neo4j.

the class PhysicalLogicalTransactionStoreTest method shouldThrowNoSuchTransactionExceptionIfMetadataNotFound.

@Test
public void shouldThrowNoSuchTransactionExceptionIfMetadataNotFound() throws Exception {
    // GIVEN
    LogFile logFile = mock(LogFile.class);
    TransactionMetadataCache cache = new TransactionMetadataCache(10);
    LifeSupport life = new LifeSupport();
    final LogicalTransactionStore txStore = new PhysicalLogicalTransactionStore(logFile, cache, new VersionAwareLogEntryReader<>());
    try {
        life.start();
        // WHEN
        try {
            txStore.getMetadataFor(10);
            fail("Should have thrown");
        } catch (NoSuchTransactionException e) {
        // THEN Good
        }
    } finally {
        life.shutdown();
    }
}
Also used : LifeSupport(org.neo4j.kernel.lifecycle.LifeSupport) Test(org.junit.Test)

Aggregations

LifeSupport (org.neo4j.kernel.lifecycle.LifeSupport)51 Test (org.junit.Test)22 IOException (java.io.IOException)14 File (java.io.File)12 Monitors (org.neo4j.kernel.monitoring.Monitors)12 FileSystemAbstraction (org.neo4j.io.fs.FileSystemAbstraction)8 ReadableClosablePositionAwareChannel (org.neo4j.kernel.impl.transaction.log.ReadableClosablePositionAwareChannel)8 VersionAwareLogEntryReader (org.neo4j.kernel.impl.transaction.log.entry.VersionAwareLogEntryReader)8 CommittedTransactionRepresentation (org.neo4j.kernel.impl.transaction.CommittedTransactionRepresentation)6 JobScheduler (org.neo4j.kernel.impl.util.JobScheduler)6 LogHeaderCache (org.neo4j.kernel.impl.transaction.log.LogHeaderCache)5 PhysicalLogFile (org.neo4j.kernel.impl.transaction.log.PhysicalLogFile)5 Monitor (org.neo4j.kernel.impl.transaction.log.PhysicalLogFile.Monitor)5 Dependencies (org.neo4j.kernel.impl.util.Dependencies)5 StorageEngine (org.neo4j.storageengine.api.StorageEngine)5 URI (java.net.URI)4 Matchers.anyString (org.mockito.Matchers.anyString)4 Config (org.neo4j.kernel.configuration.Config)4 UnableToCopyStoreFromOldMasterException (org.neo4j.kernel.ha.store.UnableToCopyStoreFromOldMasterException)4 KernelContext (org.neo4j.kernel.impl.spi.KernelContext)4