Package org.uberfire.java.nio.file

Examples of org.uberfire.java.nio.file.Path.toFile()


        fsProvider.createDirectory( path );

        assertThat( path.toFile().exists() ).isTrue();
        path.toFile().delete();
        assertThat( path.toFile().exists() ).isFalse();
    }

    @Test(expected = FileAlreadyExistsException.class)
    public void checkCreateDirectoryAlreadyExists() {
        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();
View Full Code Here


        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();

        final String userBasedPath = System.getProperty( "user.dir" ) + "/temp";

        final Path path = GeneralPathImpl.create( fsProvider.getFileSystem( URI.create( "file:///" ) ), userBasedPath, false );
        assertThat( path.toFile().exists() ).isFalse();

        fsProvider.createDirectory( path );
        assertThat( path.toFile().exists() ).isTrue();
        fsProvider.createDirectory( path );
    }
View Full Code Here

        final Path path = GeneralPathImpl.create( fsProvider.getFileSystem( URI.create( "file:///" ) ), userBasedPath, false );
        assertThat( path.toFile().exists() ).isFalse();

        fsProvider.createDirectory( path );
        assertThat( path.toFile().exists() ).isTrue();
        fsProvider.createDirectory( path );
    }

    @Test(expected = IllegalArgumentException.class)
    public void createDirectoryNull() {
View Full Code Here

        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();

        final File tempFile = File.createTempFile( "foo", "bar" );
        final Path path = GeneralPathImpl.newFromFile( fsProvider.getFileSystem( URI.create( "file:///" ) ), tempFile );

        assertThat( path.toFile().exists() ).isTrue();
        fsProvider.delete( path );
        assertThat( path.toFile().exists() ).isFalse();
    }

    @Test(expected = NoSuchFileException.class)
View Full Code Here

        final File tempFile = File.createTempFile( "foo", "bar" );
        final Path path = GeneralPathImpl.newFromFile( fsProvider.getFileSystem( URI.create( "file:///" ) ), tempFile );

        assertThat( path.toFile().exists() ).isTrue();
        fsProvider.delete( path );
        assertThat( path.toFile().exists() ).isFalse();
    }

    @Test(expected = NoSuchFileException.class)
    public void checkDeleteNonExistent() throws IOException {
        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();
View Full Code Here

    public void checkDeleteNonExistent() throws IOException {
        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();

        final Path path = GeneralPathImpl.create( fsProvider.getFileSystem( URI.create( "file:///" ) ), "/path/to/file.txt", false );

        assertThat( path.toFile().exists() ).isFalse();
        fsProvider.delete( path );
    }

    @Test(expected = IllegalArgumentException.class)
    public void checkDeleteNull() {
View Full Code Here

        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();

        final File tempFile = File.createTempFile( "foo", "bar" );
        final Path path = GeneralPathImpl.newFromFile( fsProvider.getFileSystem( URI.create( "file:///" ) ), tempFile );

        assertThat( path.toFile().exists() ).isTrue();
        assertThat( fsProvider.deleteIfExists( path ) ).isTrue();
        assertThat( path.toFile().exists() ).isFalse();
    }

    @Test
View Full Code Here

        final File tempFile = File.createTempFile( "foo", "bar" );
        final Path path = GeneralPathImpl.newFromFile( fsProvider.getFileSystem( URI.create( "file:///" ) ), tempFile );

        assertThat( path.toFile().exists() ).isTrue();
        assertThat( fsProvider.deleteIfExists( path ) ).isTrue();
        assertThat( path.toFile().exists() ).isFalse();
    }

    @Test
    public void checkDeleteIfExistsNonExistent() throws IOException {
        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();
View Full Code Here

    public void checkDeleteIfExistsNonExistent() throws IOException {
        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();

        final Path path = GeneralPathImpl.create( fsProvider.getFileSystem( URI.create( "file:///" ) ), "/path/to/file.txt", false );

        assertThat( path.toFile().exists() ).isFalse();
        assertThat( fsProvider.deleteIfExists( path ) ).isFalse();
        assertThat( path.toFile().exists() ).isFalse();
    }

    @Test(expected = IllegalArgumentException.class)
View Full Code Here

        final Path path = GeneralPathImpl.create( fsProvider.getFileSystem( URI.create( "file:///" ) ), "/path/to/file.txt", false );

        assertThat( path.toFile().exists() ).isFalse();
        assertThat( fsProvider.deleteIfExists( path ) ).isFalse();
        assertThat( path.toFile().exists() ).isFalse();
    }

    @Test(expected = IllegalArgumentException.class)
    public void checkDeleteIfExistsNull() {
        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.