Skip to content

Commit

Permalink
Cleanup warnings in GBPTreeTest
Browse files Browse the repository at this point in the history
  • Loading branch information
burqen committed Nov 29, 2018
1 parent baf3e1c commit 726f045
Showing 1 changed file with 8 additions and 11 deletions.
Expand Up @@ -63,7 +63,6 @@
import org.neo4j.io.pagecache.PageCursor;
import org.neo4j.io.pagecache.PagedFile;
import org.neo4j.io.pagecache.impl.FileIsNotMappedException;
import org.neo4j.kernel.lifecycle.LifecycleAdapter;
import org.neo4j.test.Barrier;
import org.neo4j.test.rule.PageCacheRule;
import org.neo4j.test.rule.RandomRule;
Expand Down Expand Up @@ -347,8 +346,7 @@ public void shouldRemapFileIfMappedWithPageSizeLargerThanCreationSize() throws E
public void shouldFailWhenTryingToOpenWithDifferentFormatIdentifier() throws Exception
{
// GIVEN
int pageSize = DEFAULT_PAGE_SIZE;
PageCache pageCache = createPageCache( pageSize );
PageCache pageCache = createPageCache( DEFAULT_PAGE_SIZE );
GBPTreeBuilder<MutableLong,MutableLong> builder = index( pageCache );
try ( GBPTree<MutableLong,MutableLong> ignored = builder.build() )
{ // Open/close is enough
Expand Down Expand Up @@ -710,7 +708,7 @@ private void openMustThrowMetadataMismatchExceptionIfSomeMetaPageIsMissing( Thro
{
// given an existing index with only the first page in it
PageCache pageCache = createPageCache( DEFAULT_PAGE_SIZE );
try ( GBPTree<MutableLong,MutableLong> tree = index( pageCache ).build() )
try ( GBPTree<MutableLong,MutableLong> ignored = index( pageCache ).build() )
{ // Just for creating it
}
fs.truncate( indexFile, DEFAULT_PAGE_SIZE /*truncate right after the first page*/ );
Expand Down Expand Up @@ -744,7 +742,7 @@ private void openMustThrowMetadataMismatchExceptionIfStatePagesAreAllZeros( Thro
{
// given an existing index with all-zero state pages
PageCache pageCache = createPageCache( DEFAULT_PAGE_SIZE );
try ( GBPTree<MutableLong,MutableLong> tree = index( pageCache ).build() )
try ( GBPTree<MutableLong,MutableLong> ignored = index( pageCache ).build() )
{ // Just for creating it
}
fs.truncate( indexFile, DEFAULT_PAGE_SIZE /*truncate right after the first page*/ );
Expand Down Expand Up @@ -1103,7 +1101,7 @@ public void cleanerShouldDieSilentlyOnClose() throws Throwable
collector.init();

Future<List<CleanupJob>> cleanJob;
try ( GBPTree<MutableLong, MutableLong> index = index( pageCache ).with( collector ).build() )
try ( GBPTree<MutableLong, MutableLong> ignored = index( pageCache ).with( collector ).build() )
{
blockOnNextIO.set( true );
cleanJob = executor.submit( startAndReturnStartedJobs( collector ) );
Expand Down Expand Up @@ -1133,7 +1131,7 @@ public void treeMustBeDirtyAfterCleanerDiedOnClose() throws Throwable
collector.init();

Future<List<CleanupJob>> cleanJob;
try ( GBPTree<MutableLong,MutableLong> index = index( pageCache ).with( collector ).build() )
try ( GBPTree<MutableLong,MutableLong> ignored = index( pageCache ).with( collector ).build() )
{
blockOnNextIO.set( true );
cleanJob = executor.submit( startAndReturnStartedJobs( collector ) );
Expand All @@ -1150,7 +1148,7 @@ public void treeMustBeDirtyAfterCleanerDiedOnClose() throws Throwable
assertFailedDueToUnmappedFile( cleanJob );

MonitorDirty monitor = new MonitorDirty();
try ( GBPTree<MutableLong,MutableLong> index = index().with( monitor ).build() )
try ( GBPTree<MutableLong,MutableLong> ignored = index().with( monitor ).build() )
{
assertFalse( monitor.cleanOnStart() );
}
Expand Down Expand Up @@ -1519,8 +1517,7 @@ public void cleanCrashPointersMustNotTriggerOnCleanStart() throws Exception
public void shouldThrowIfTreeStatePointToRootWithValidSuccessor() throws Exception
{
// GIVEN
int pageSize = DEFAULT_PAGE_SIZE;
try ( PageCache specificPageCache = createPageCache( pageSize ) )
try ( PageCache specificPageCache = createPageCache( DEFAULT_PAGE_SIZE ) )
{
try ( GBPTree<MutableLong,MutableLong> ignore = index( specificPageCache ).build() )
{
Expand Down Expand Up @@ -1565,7 +1562,7 @@ public void mustRetryCloseIfFailure() throws Exception
AtomicBoolean throwOnNext = new AtomicBoolean();
IOException exception = new IOException( "My failure" );
PageCache pageCache = pageCacheThatThrowExceptionWhenToldTo( exception, throwOnNext );
try ( GBPTree<MutableLong, MutableLong> index = index( pageCache ).build() )
try ( GBPTree<MutableLong, MutableLong> ignored = index( pageCache ).build() )
{
// WHEN
throwOnNext.set( true );
Expand Down

0 comments on commit 726f045

Please sign in to comment.