Skip to content

Commit

Permalink
Cleanup after messy rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
burqen authored and chrisvest committed Sep 16, 2016
1 parent 5f00d4e commit 77c967c
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
Expand Up @@ -22,10 +22,10 @@
import java.io.File;
import java.io.IOException;

public class CannotMoveMappedFileException extends IOException
public class CannotRenameMappedFileException extends IOException
{
public CannotMoveMappedFileException( File file )
public CannotRenameMappedFileException( File file )
{
super( "Cannot move mapped file: " + file );
super( "Cannot rename mapped file: " + file );
}
}
Expand Up @@ -38,7 +38,7 @@
import org.neo4j.io.pagecache.PageCacheOpenOptions;
import org.neo4j.io.pagecache.PageSwapperFactory;
import org.neo4j.io.pagecache.PagedFile;
import org.neo4j.io.pagecache.impl.CannotMoveMappedFileException;
import org.neo4j.io.pagecache.impl.CannotRenameMappedFileException;
import org.neo4j.io.pagecache.tracing.EvictionEvent;
import org.neo4j.io.pagecache.tracing.EvictionRunEvent;
import org.neo4j.io.pagecache.tracing.FlushEventOpportunity;
Expand Down Expand Up @@ -414,7 +414,7 @@ private void throwIfMapped( File file ) throws IOException
{
if ( tryGetMappingOrNull( file ) != null )
{
throw new CannotMoveMappedFileException( file );
throw new CannotRenameMappedFileException( file );
}
}

Expand Down
Expand Up @@ -35,7 +35,7 @@
import org.neo4j.io.pagecache.IOLimiter;
import org.neo4j.io.pagecache.PageCache;
import org.neo4j.io.pagecache.PagedFile;
import org.neo4j.io.pagecache.impl.CannotMoveMappedFileException;
import org.neo4j.io.pagecache.impl.CannotRenameMappedFileException;

/**
* A {@linkplain PageCache page cache} that wraps another page cache and an {@linkplain Adversary adversary} to provide
Expand Down Expand Up @@ -120,7 +120,7 @@ public int maxCachedPages()
public void renameFile( File sourceFile, File targetFile, CopyOption... copyOptions )
throws IOException
{
adversary.injectFailure( CannotMoveMappedFileException.class, FileAlreadyExistsException.class,
adversary.injectFailure( CannotRenameMappedFileException.class, FileAlreadyExistsException.class,
IOException.class, SecurityException.class );
delegate.renameFile( sourceFile, targetFile, copyOptions );
}
Expand Down
Expand Up @@ -58,7 +58,7 @@
import org.neo4j.graphdb.mockfs.EphemeralFileSystemAbstraction;
import org.neo4j.io.fs.FileSystemAbstraction;
import org.neo4j.io.fs.StoreChannel;
import org.neo4j.io.pagecache.impl.CannotMoveMappedFileException;
import org.neo4j.io.pagecache.impl.CannotRenameMappedFileException;
import org.neo4j.io.pagecache.impl.SingleFilePageSwapperFactory;
import org.neo4j.io.pagecache.randomharness.Record;
import org.neo4j.io.pagecache.randomharness.StandardRecordFormat;
Expand Down Expand Up @@ -4694,8 +4694,8 @@ public void writingToClosedWritableByteChannelMustThrow() throws Exception
}
}

@Test( expected = CannotMoveMappedFileException.class )
public void moveFileMustThrowIfSourceFileIsMapped() throws Exception
@Test( expected = CannotRenameMappedFileException.class )
public void renameFileMustThrowIfSourceFileIsMapped() throws Exception
{
File a = file( "a" );
File b = file( "b" );
Expand All @@ -4706,8 +4706,8 @@ public void moveFileMustThrowIfSourceFileIsMapped() throws Exception
}
}

@Test( expected = CannotMoveMappedFileException.class )
public void moveFileMustThrowIfTargetFileIsMapped() throws Exception
@Test( expected = CannotRenameMappedFileException.class )
public void renameFileMustThrowIfTargetFileIsMapped() throws Exception
{
File a = file( "a" );
File b = existingFile( "b" );
Expand All @@ -4719,7 +4719,7 @@ public void moveFileMustThrowIfTargetFileIsMapped() throws Exception
}

@Test( expected = FileAlreadyExistsException.class )
public void moveFileMustThrowIfTargetFileExistsAndReplaceExistingIsNotEnabled() throws Exception
public void renameFileMustThrowIfTargetFileExistsAndReplaceExistingIsNotEnabled() throws Exception
{
File a = file( "a" );
File b = existingFile( "b" );
Expand All @@ -4728,7 +4728,7 @@ public void moveFileMustThrowIfTargetFileExistsAndReplaceExistingIsNotEnabled()
}

@Test
public void moveFileMustThrowIfTargetDirectoryDoesNotExist() throws Exception
public void renameFileMustThrowIfTargetDirectoryDoesNotExist() throws Exception
{
File a = file( "a" );
File b = new File( file( "targetDir" ), "targetFile" );
Expand All @@ -4745,7 +4745,7 @@ public void moveFileMustThrowIfTargetDirectoryDoesNotExist() throws Exception
}

@Test( expected = NoSuchFileException.class )
public void moveFileMustThrowIfSourceFileDoesNotExist() throws Exception
public void renameFileMustThrowIfSourceFileDoesNotExist() throws Exception
{
File a = file( "doesNotExist" );
File b = file( "b" );
Expand Down Expand Up @@ -4809,15 +4809,15 @@ public void sourceFileContentsMustBeUnchangedAfterMoveEvenIfReplacingExistingFil
}
}

// Do the move
// Do the rename
pageCache.renameFile( a, b, REPLACE_EXISTING );

// Then verify that the old random data we put in 'b' has been replaced with the contents of 'a'
verifyRecordsInFile( b, recordCount );
}

@Test
public void moveFileMustCanonicaliseSourceFile() throws Exception
public void renameFileMustCanonicaliseSourceFile() throws Exception
{
File a = new File( new File( file( "a" ), "poke" ), ".." );
File b = file( "b" );
Expand All @@ -4828,7 +4828,7 @@ public void moveFileMustCanonicaliseSourceFile() throws Exception
}

@Test
public void moveFileMustCanonicaliseTargetFile() throws Exception
public void renameFileMustCanonicaliseTargetFile() throws Exception
{
File a = file( "a" );
File b = new File( new File( file( "b" ), "poke" ), ".." );
Expand Down
Expand Up @@ -111,7 +111,7 @@ public long write( String path, ReadableByteChannel data, ByteBuffer temporaryBu
private void addPageCacheMoveAction( File file )
{
fileMoveActions.add( ( ( toDir, copyOptions ) ->
pageCache.moveFile( file, new File( toDir, file.getName() ), copyOptions ) ) );
pageCache.renameFile( file, new File( toDir, file.getName() ), copyOptions ) ) );
}

private int filePageSize( int recordSize )
Expand Down

0 comments on commit 77c967c

Please sign in to comment.