Package org.uberfire.java.nio.file

Examples of org.uberfire.java.nio.file.FileStore


public class SimpleUnixFileStoreTest {

    @Test
    public void simpleTests() {
        final FileStore fileStore = new SimpleUnixFileStore( null );

        assertThat( fileStore.name() ).isNotNull().isEqualTo( "/" );
        assertThat( fileStore.type() ).isNull();
        assertThat( fileStore.isReadOnly() ).isFalse();
        assertThat( fileStore.getTotalSpace() ).isEqualTo( File.listRoots()[ 0 ].getTotalSpace() );
        assertThat( fileStore.getUsableSpace() ).isEqualTo( File.listRoots()[ 0 ].getUsableSpace() );

        assertThat( fileStore.supportsFileAttributeView( BasicFileAttributeView.class ) ).isTrue();
        assertThat( fileStore.supportsFileAttributeView( MyFileAttributeView.class ) ).isFalse();
        assertThat( fileStore.supportsFileAttributeView( MyAlsoInvalidFileAttributeView.class ) ).isFalse();
        assertThat( fileStore.supportsFileAttributeView( "basic" ) ).isTrue();
        assertThat( fileStore.supportsFileAttributeView( "any" ) ).isFalse();
        assertThat( fileStore.supportsFileAttributeView( BasicFileAttributeView.class.getName() ) ).isFalse();
        assertThat( fileStore.supportsFileAttributeView( MyAlsoInvalidFileAttributeView.class.getName() ) ).isFalse();
        assertThat( fileStore.getFileStoreAttributeView( FileStoreAttributeView.class ) ).isNull();

        assertThat( fileStore.getAttribute( "name" ) ).isNotNull().isEqualTo( fileStore.name() );
        assertThat( fileStore.getAttribute( "totalSpace" ) ).isNotNull().isEqualTo( fileStore.getTotalSpace() );
        assertThat( fileStore.getAttribute( "usableSpace" ) ).isNotNull().isEqualTo( fileStore.getUsableSpace() );
        assertThat( fileStore.getAttribute( "readOnly" ) ).isNotNull().isEqualTo( fileStore.isReadOnly() );
    }
View Full Code Here


        }
        if ( !( o instanceof FileStore ) ) {
            return false;
        }

        final FileStore ofs = (FileStore) o;

        return name().equals( ofs.name() );
    }
View Full Code Here

        }
        if ( !( o instanceof FileStore ) ) {
            return false;
        }

        final FileStore ofs = (FileStore) o;

        return name().equals( ofs.name() );
    }
View Full Code Here

        final Git git = setupGit( tempDir );

        final JGitFileSystem fileSystem = new JGitFileSystem( fsProvider, null, git, "my-repo", CredentialsProvider.getDefault() );

        assertThat( fileSystem.getFileStores() ).hasSize( 1 );
        final FileStore fileStore = fileSystem.getFileStores().iterator().next();
        assertThat( fileStore ).isNotNull();

        assertThat( fileStore.getTotalSpace() ).isEqualTo( tempDir.getTotalSpace() );
        assertThat( fileStore.getUsableSpace() ).isEqualTo( tempDir.getUsableSpace() );
    }
View Full Code Here

        final OutputStream outStream = PROVIDER.newOutputStream( path );
        outStream.write( "my cool content".getBytes() );
        outStream.close();

        final FileStore fileStore = PROVIDER.getFileStore( path );

        assertThat( fileStore ).isNotNull();

        assertThat( fileStore.getAttribute( "readOnly" ) ).isEqualTo( Boolean.FALSE );
    }
View Full Code Here

    final Path               nonNullPath = GeneralPathImpl.create( fileSystem, "c:\\something", false );

    @Test
    public void simpleTests() {
        final Path path = GeneralPathImpl.create( fileSystem, "something", false );
        final FileStore fileStore = new SimpleWindowsFileStore( roots, path );

        assertThat( fileStore.name() ).isNotNull().isEqualTo( "c:\\" );
        assertThat( fileStore.type() ).isNull();
        assertThat( fileStore.isReadOnly() ).isFalse();
        assertThat( fileStore.getTotalSpace() ).isEqualTo( 0L );
        assertThat( fileStore.getUsableSpace() ).isEqualTo( 0L );

        assertThat( fileStore.supportsFileAttributeView( BasicFileAttributeView.class ) ).isTrue();
        assertThat( fileStore.supportsFileAttributeView( MyFileAttributeView.class ) ).isFalse();
        assertThat( fileStore.supportsFileAttributeView( MyAlsoInvalidFileAttributeView.class ) ).isFalse();
        assertThat( fileStore.supportsFileAttributeView( "basic" ) ).isTrue();
        assertThat( fileStore.supportsFileAttributeView( "any" ) ).isFalse();
        assertThat( fileStore.supportsFileAttributeView( BasicFileAttributeView.class.getName() ) ).isFalse();
        assertThat( fileStore.supportsFileAttributeView( MyAlsoInvalidFileAttributeView.class.getName() ) ).isFalse();
        assertThat( fileStore.getFileStoreAttributeView( FileStoreAttributeView.class ) ).isNull();

        assertThat( fileStore.getAttribute( "name" ) ).isNotNull().isEqualTo( fileStore.name() );
        assertThat( fileStore.getAttribute( "totalSpace" ) ).isNotNull().isEqualTo( fileStore.getTotalSpace() );
        assertThat( fileStore.getAttribute( "usableSpace" ) ).isNotNull().isEqualTo( fileStore.getUsableSpace() );
        assertThat( fileStore.getAttribute( "readOnly" ) ).isNotNull().isEqualTo( fileStore.isReadOnly() );
    }
View Full Code Here

TOP

Related Classes of org.uberfire.java.nio.file.FileStore

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.