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

Examples of org.uberfire.java.nio.fs.file.SimpleUnixFileSystem


    final FileSystemProvider fsProvider = mock( FileSystemProvider.class );

    @Test
    public void simpleTests() {
        final FileSystem fileSystem = new SimpleUnixFileSystem( fsProvider, "/" );

        assertThat( fileSystem.isOpen() ).isTrue();
        assertThat( fileSystem.isReadOnly() ).isFalse();
        assertThat( fileSystem.getSeparator() ).isEqualTo( System.getProperty( "file.separator" ) );
        assertThat( fileSystem.provider() ).isEqualTo( fsProvider );
        assertThat( fileSystem.supportedFileAttributeViews() ).isNotEmpty().hasSize( 1 ).contains( "basic" );

        assertThat( fileSystem.getPath( "/path/to/file.txt" ) ).isNotNull().isEqualTo( GeneralPathImpl.create( fileSystem, "/path/to/file.txt", false ) );
        assertThat( fileSystem.getPath( "/path/to/file.txt", null ) ).isNotNull().isEqualTo( GeneralPathImpl.create( fileSystem, "/path/to/file.txt", false ) );
        assertThat( fileSystem.getPath( "/path", "to", "file.txt" ) ).isNotNull().isEqualTo( GeneralPathImpl.create( fileSystem, "/path/to/file.txt", false ) );

        try {
            fileSystem.close();
            fail( "can't close this fileSystem" );
        } catch ( UnsupportedOperationException ex ) {
        }

        assertThat( fileSystem.getFileStores() ).isNotNull().hasSize( 1 );
        assertThat( fileSystem.getFileStores().iterator().next().name() ).isEqualTo( "/" );

        assertThat( fileSystem.getRootDirectories() ).isNotNull().hasSize( 1 );
        assertThat( fileSystem.getRootDirectories().iterator().next().toString() ).isEqualTo( "/" );
        assertThat( fileSystem.getRootDirectories().iterator().next().isAbsolute() ).isTrue();
    }
View Full Code Here


    @Test
    public void simpleRootTests() throws URISyntaxException {
        final SimpleFileSystemProvider fs = new SimpleFileSystemProvider();

        final FileSystem fileSystem = new SimpleUnixFileSystem( fsProvider, "/" );
        assertThat( fileSystem.getPath( "/" ) ).isEqualTo( fileSystem.getPath( "/path" ).getParent() );

        final URL parentUrl = this.getClass().getResource( "/" );
        final Path parentNioPath = fs.getPath( parentUrl.toURI() );

        final URL childUrl = this.getClass().getResource( "/Folder" );
View Full Code Here

    }

    @Test(expected = IllegalArgumentException.class)
    public void invalidCOnstructorPath() {
        new SimpleUnixFileSystem( fsProvider, "home" );
    }
View Full Code Here

        new SimpleUnixFileSystem( fsProvider, "home" );
    }

    @Test(expected = UnsupportedOperationException.class)
    public void getPathMatcherUnsupportedOp() {
        new SimpleUnixFileSystem( fsProvider, "/" ).getPathMatcher( "*.*" );
    }
View Full Code Here

        new SimpleUnixFileSystem( fsProvider, "/" ).getPathMatcher( "*.*" );
    }

    @Test(expected = UnsupportedOperationException.class)
    public void getUserPrincipalLookupServiceUnsupportedOp() {
        new SimpleUnixFileSystem( fsProvider, "/" ).getUserPrincipalLookupService();
    }
View Full Code Here

        new SimpleUnixFileSystem( fsProvider, "/" ).getUserPrincipalLookupService();
    }

    @Test(expected = UnsupportedOperationException.class)
    public void newWatchServiceUnsupportedOp() {
        new SimpleUnixFileSystem( fsProvider, "/" ).newWatchService();
    }
View Full Code Here

        new SimpleUnixFileSystem( fsProvider, "/" ).newWatchService();
    }

    @Test(expected = UnsupportedOperationException.class)
    public void removeElementFromRootIteratorUnsupportedOp() {
        new SimpleUnixFileSystem( fsProvider, "/" ).getRootDirectories().iterator().remove();
    }
View Full Code Here

        new SimpleUnixFileSystem( fsProvider, "/" ).getRootDirectories().iterator().remove();
    }

    @Test(expected = NoSuchElementException.class)
    public void invalidElementFromRootIterator() {
        final Iterator<Path> iterator = new SimpleUnixFileSystem( fsProvider, "/" ).getRootDirectories().iterator();
        try {
            iterator.next();
        } catch ( Exception e ) {
            fail( "first is valid" );
        }
View Full Code Here

        iterator.next();
    }

    @Test(expected = UnsupportedOperationException.class)
    public void removeElementFromFStoreIteratorUnsupportedOp() {
        new SimpleUnixFileSystem( fsProvider, "/" ).getFileStores().iterator().remove();
    }
View Full Code Here

        new SimpleUnixFileSystem( fsProvider, "/" ).getFileStores().iterator().remove();
    }

    @Test(expected = NoSuchElementException.class)
    public void invalidElementFromFStoreIterator() {
        final Iterator<FileStore> iterator = new SimpleUnixFileSystem( fsProvider, "/" ).getFileStores().iterator();
        try {
            iterator.next();
        } catch ( Exception e ) {
            fail( "first is valid" );
        }
View Full Code Here

TOP

Related Classes of org.uberfire.java.nio.fs.file.SimpleUnixFileSystem

Copyright © 2018 www.massapicom. 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.