@Test public void throwsOnUnknownVersion() throws Exception { prepareNeoStoreFile( "v9.9.9" ); expected.expect( new RootCauseMatcher( IllegalArgumentException.class ) ); expected.expectMessage( "Unknown store version 'v9.9.9'" ); execute( databaseDirectory.toString() ); }
@Test public void failToRecoverFirstCorruptedTransactionSingleFileNoCheckpointIfFailOnCorruption() throws IOException { addCorruptedCommandsToLastLogFile(); expectedException.expectCause( new RootCauseMatcher<>( NegativeArraySizeException.class ) ); GraphDatabaseService recoveredDatabase = databaseFactory.newEmbeddedDatabase( storeDir ); recoveredDatabase.shutdown(); }
@Test public void commitTimeNotAccessibleBeforeCommit() { db.registerTransactionEventHandler( getBeforeCommitHandler( TransactionData::getCommitTime ) ); String message = "Transaction commit time is not assigned yet. It will be assigned during transaction commit."; expectedException.expectCause( new RootCauseMatcher<>( IllegalStateException.class, message ) ); runTransaction(); }
@Test public void transactionIdNotAccessibleBeforeCommit() { db.registerTransactionEventHandler( getBeforeCommitHandler( TransactionData::getTransactionId ) ); String message = "Transaction id is not assigned yet. It will be assigned during transaction commit."; expectedException.expectCause( new RootCauseMatcher<>( IllegalStateException.class, message ) ); runTransaction(); }
@Test public void doNotTruncateNewerTransactionLogFileWhenFailOnError() throws IOException { GraphDatabaseAPI database = (GraphDatabaseAPI) databaseFactory.newEmbeddedDatabase( storeDir ); for ( int i = 0; i < 10; i++ ) { generateTransaction( database ); } database.shutdown(); removeLastCheckpointRecordFromLastLogFile(); addRandomBytesToLastLogFile( this::randomPositiveBytes ); expectedException.expectCause( new RootCauseMatcher<>( UnsupportedLogVersionException.class ) ); database = (GraphDatabaseAPI) databaseFactory.newEmbeddedDatabase( storeDir ); database.shutdown(); }
@Test( timeout = TEST_TIMEOUT ) public void timeoutOnAcquiringExclusiveLock() throws Exception expectedException.expect( new RootCauseMatcher<>( LockAcquisitionTimeoutException.class, "The transaction has been terminated. " + "Retry your operation in a new transaction, and you should see a successful result. " +
@Test( timeout = TEST_TIMEOUT ) public void timeoutOnAcquiringSharedLock() throws Exception expectedException.expect( new RootCauseMatcher<>( LockAcquisitionTimeoutException.class, "The transaction has been terminated. " + "Retry your operation in a new transaction, and you should see a successful result. " +