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

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


    final File[]             roots      = new File[]{ new File( "c:\\" ), new File( "a:\\" ) };

    @Test
    public void simpleTests() {

        final FileSystem fileSystem = new SimpleWindowsFileSystem( roots, fsProvider, "c:\\" );

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

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

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

        assertThat( fileSystem.getFileStores() ).isNotNull().hasSize( 2 );
        assertThat( fileSystem.getFileStores().iterator().next().name() ).isEqualTo( "c:\\" );

        assertThat( fileSystem.getRootDirectories() ).isNotNull().hasSize( 2 );
        assertThat( fileSystem.getRootDirectories().iterator().next().toString() ).isEqualTo( "c:\\" );
        assertThat( fileSystem.getRootDirectories().iterator().next().isAbsolute() ).isTrue();
    }
View Full Code Here


        assertThat( fileSystem.getRootDirectories().iterator().next().isAbsolute() ).isTrue();
    }

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

        new SimpleWindowsFileSystem( fsProvider, "home" );
    }

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

        new SimpleWindowsFileSystem( fsProvider, "c:\\" ).getPathMatcher( "*.*" );
    }

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

        new SimpleWindowsFileSystem( fsProvider, "c:\\" ).getUserPrincipalLookupService();
    }

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

        new SimpleWindowsFileSystem( fsProvider, "c:\\" ).newWatchService();
    }

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

        new SimpleWindowsFileSystem( fsProvider, "c:\\" ).getRootDirectories().iterator().remove();
    }

    @Test(expected = NoSuchElementException.class)
    public void invalidElementFromRootIterator() {
        final Iterator<Path> iterator = new SimpleWindowsFileSystem( fsProvider, "c:\\" ).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 SimpleWindowsFileSystem( fsProvider, "c:\\" ).getFileStores().iterator().remove();
    }
View Full Code Here

        new SimpleWindowsFileSystem( fsProvider, "c:\\" ).getFileStores().iterator().remove();
    }

    @Test(expected = NoSuchElementException.class)
    public void invalidElementFromFStoreIterator() {
        final Iterator<FileStore> iterator = new SimpleWindowsFileSystem( fsProvider, "c:\\" ).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.SimpleWindowsFileSystem

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.