public static Path dot( final Path path ) { if ( path.getFileName() == null ) { return path.resolve( ".root" ); } return path.resolveSibling( "." + path.getFileName() ); }
@Test(expected = NoSuchFileException.class) public void readAttributesNoSuchFileException() { final Path path = getDirectoryPath().resolveSibling( "somethingXXX" ); ioService().deleteIfExists( path ); ioService().readAttributes( path ); } }
@Test(expected = FileAlreadyExistsException.class) public void createDirectoryFileAlreadyExistsException() { final Path path = getDirectoryPath().resolveSibling( "otherDir" ); ioService().deleteIfExists( path ); ioService().createDirectory( path ); ioService().createDirectory( path ); }
@Test(expected = FileAlreadyExistsException.class) public void newByteChannelFileAlreadyExistsException() { final Path path = getFilePath().resolveSibling( "alreadyExists.txt" ); ioService().deleteIfExists( path ); ioService().write( path, "ooooo!" ); ioService().newByteChannel( path ); }
@Test(expected = DirectoryNotEmptyException.class) public void deleteIfExistsDirectoryNotEmptyException() { final Path path = getDirectoryPath().resolveSibling( "dirToBugIfExists" ); ioService().createDirectories( path ); ioService().write( path.resolve( "myFile.txt" ), "ooooo!" ); ioService().deleteIfExists( path ); }
@Test(expected = FileAlreadyExistsException.class) public void createDirectoriesFileAlreadyExistsException() { final Path path = getDirectoryPath().resolveSibling( "otherDir" ).resolve( "innerDir" ); ioService().deleteIfExists( path ); ioService().createDirectories( path ); ioService().createDirectories( path ); }
@Test(expected = DirectoryNotEmptyException.class) public void deleteDirectoryNotEmptyException() { final Path path = getDirectoryPath().resolveSibling( "dirToBug" ); ioService().createDirectories( path ); ioService().write( path.resolve( "myFile.txt" ), "ooooo!" ); ioService().delete( path ); }
@Test public void testIndexedFile() throws IOException { final Path path = getDirectoryPath().resolveSibling( "someNewOtherPath" ).resolve( "myIndexedFile.txt" ); ioService().write( path, "ooooo!", Collections.<OpenOption>emptySet(), new FileAttribute<Object>() { @Override assertTrue( metaModelStore.getMetaObject( Path.class.getName() ).getProperty( "my_new_key" ).getTypes().contains( String.class ) ); ioService().write( path.resolveSibling( "otherIndexedFile.txt" ), "ooooo!", Collections.<OpenOption>emptySet(), new FileAttribute<Object>() { @Override public String name() {
@Test public void testIndexedFile() throws IOException { final Path dir = ioService().createDirectories( getDirectoryPath().resolveSibling( "someNewOtherPath" ) ); assertTrue( metaModelStore.getMetaObject( Path.class.getName() ).getProperty( "my_new_key" ).getTypes().contains( String.class ) ); ioService().write( path.resolveSibling( "otherIndexedFile.txt" ), "ooooo!", Collections.<OpenOption>emptySet(), new FileAttribute<Object>() { @Override public String name() {
@Test(expected = FileAlreadyExistsException.class) public void copyFileAlreadyExistsException() { final Path path = getDirectoryPath().resolveSibling( "alreadyExistsTest" ); ioService().deleteIfExists( path ); ioService().createDirectories( path ); ioService().write( path.resolve( "myFile.txt" ), "ooooo!" ); ioService().write( path.resolve( "mytarget" ), "xooooo!" ); ioService().copy( path.resolve( "myFile.txt" ), path.resolve( "mytarget" ) ); }