Package org.uberfire.java.nio.fs.file

Examples of org.uberfire.java.nio.fs.file.SimpleFileSystemProvider.checkAccess()


    public void checkAccess() throws IOException {
        final SimpleFileSystemProvider fsProvider = new SimpleFileSystemProvider();
        final Path path = GeneralPathImpl.create( fsProvider.getFileSystem( URI.create( "file:///" ) ), "/path/to/file.txt", false );

        try {
            fsProvider.checkAccess( path, WRITE );
            fail( "can't have write access on non existent file" );
        } catch ( Exception ex ) {
        }

        try {
View Full Code Here


            fail( "can't have write access on non existent file" );
        } catch ( Exception ex ) {
        }

        try {
            fsProvider.checkAccess( path, READ );
            fail( "can't have read access on non existent file" );
        } catch ( Exception ex ) {
        }

        try {
View Full Code Here

            fail( "can't have read access on non existent file" );
        } catch ( Exception ex ) {
        }

        try {
            fsProvider.checkAccess( path, EXECUTE );
            fail( "can't have execute access on non existent file" );
        } catch ( Exception ex ) {
        }

        final File tempFile = File.createTempFile( "foo", "bar" );
View Full Code Here

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

        try {
            fsProvider.checkAccess( path2, WRITE );
        } catch ( Exception ex ) {
            fail( "write access should be ok" );
        }

        tempFile.setWritable( false );
View Full Code Here

        }

        tempFile.setWritable( false );

        try {
            fsProvider.checkAccess( path2, WRITE );
            fail( "can't have write access on file" );
        } catch ( Exception ex ) {
        }

        tempFile.setWritable( true );
View Full Code Here

        }

        tempFile.setWritable( true );

        try {
            fsProvider.checkAccess( path2, READ );
        } catch ( Exception ex ) {
            fail( "read access should be ok" );
        }

        tempFile.setReadable( false );
View Full Code Here

        }

        tempFile.setReadable( false );

        try {
            fsProvider.checkAccess( path2, READ );
            fail( "can't have read access on file" );
        } catch ( Exception ex ) {
        }

        tempFile.setReadable( true );
View Full Code Here

        }

        tempFile.setReadable( true );

        try {
            fsProvider.checkAccess( path2, EXECUTE );
            fail( "can't have execute access on file" );
        } catch ( Exception ex ) {
        }

        tempFile.setExecutable( true );
View Full Code Here

        }

        tempFile.setExecutable( true );

        try {
            fsProvider.checkAccess( path2, EXECUTE );
        } catch ( Exception ex ) {
            fail( "execute access should be ok" );
        }

        try {
View Full Code Here

        } catch ( Exception ex ) {
            fail( "execute access should be ok" );
        }

        try {
            fsProvider.checkAccess( path2, READ, WRITE, EXECUTE );
        } catch ( Exception ex ) {
            fail( "all access should be ok" );
        }

    }
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.