john pfeiffer
  • Home
  • Categories
  • Tags
  • Archives

FileSystemTest

// 2012-12-05 johnpfeiffer

// System.getProperties() can be overridden by calls to System.setProperty(String key, String value) or
// with command line parameters -Dfile.separator=/ File.separator gets the separator for the default filesystem.
// FileSystems.getDefault() gets you the default filesystem. FileSystem.getSeparator() gets you the separator character for the filesystem.
// Note that as an instance method you can use this to pass different filesystems to your code other than the default,
// in cases where you need your code to operate on multiple filesystems in the one JVM. */

package net.kittyandbear.util;


import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Properties;

import org.easymock.EasyMock;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

public class FileSystemTest {

    private static final String WINDOWS_TEMP_DIRECTORY_LOCATION = "C:\\Users\\Username\\AppData\\Local\\Temp\\" ;
    private Properties mockWindows7;
    private Properties mockLinux;
    private Properties mockOSX;

    private FileSystem currentSystem = null;
    private File testFile = null;
    private static final String NEWLINE = System.getProperty( "line.separator" );
    private static final String SINGLELINE = "test content";
    private static final String SECONDLINE = " SECOND LINE ";


    @Before
    public void setUp() throws Exception {

        currentSystem = new FileSystem( System.getProperties() );

        mockWindows7 = EasyMock.createMock(Properties.class);
        EasyMock.expect( mockWindows7.getProperty( "os.name" )).andReturn( "Windows 7" );
        EasyMock.expect( mockWindows7.getProperty( "file.separator" )).andReturn( "\\" );
        EasyMock.expect( mockWindows7.getProperty( "line.separator" )).andReturn( "\r\n" );
        EasyMock.expect( mockWindows7.getProperty( "java.io.tmpdir" )).andReturn( WINDOWS_TEMP_DIRECTORY_LOCATION );
        EasyMock.replay( mockWindows7 );

        mockLinux = EasyMock.createMock(Properties.class);
        EasyMock.expect( mockLinux.getProperty( "os.name" )).andReturn( "Linux" );
        EasyMock.expect( mockLinux.getProperty( "file.separator" )).andReturn( "/" );
        EasyMock.expect( mockLinux.getProperty( "line.separator" )).andReturn( "\n" );
        EasyMock.expect( mockLinux.getProperty( "java.io.tmpdir" )).andReturn( "/tmp" );
        EasyMock.replay( mockLinux );

        mockOSX = EasyMock.createMock(Properties.class);
        EasyMock.expect( mockOSX.getProperty( "os.name" )).andReturn( "Mac OS X" );
        EasyMock.expect( mockOSX.getProperty( "file.separator" )).andReturn( "/" );
        EasyMock.expect( mockOSX.getProperty( "line.separator" )).andReturn( "\n" );
        EasyMock.expect( mockOSX.getProperty( "java.io.tmpdir" )).andReturn( "/tmp" );
        EasyMock.replay( mockOSX );

    }

    @Test
    public void testGetVersion() {
        assertEquals( "0.80", FileSystem.CLASSVERSION );
    }


    @Test
    public void testIsWindows() {
        FileSystem currentSystem = new FileSystem( mockWindows7 );
        assertTrue( currentSystem.isWindows() );

        assertFalse( currentSystem.isLinux() );
        assertFalse( currentSystem.isMac() );
        assertFalse( currentSystem.isOther() );

        EasyMock.verify(mockWindows7);
    }

    @Test
    public void testIsLinux() {
        FileSystem currentSystem = new FileSystem( mockLinux );
        assertTrue( currentSystem.isLinux() );

        assertFalse( currentSystem.isMac() );
        assertFalse( currentSystem.isWindows() );
        assertFalse( currentSystem.isOther() );

        EasyMock.verify(mockLinux);
    }

    @Test
    public void testIsMac() {
        FileSystem currentSystem = new FileSystem( mockOSX );
        assertTrue( currentSystem.isMac() );

        assertFalse( currentSystem.isLinux() );
        assertFalse( currentSystem.isWindows() );
        assertFalse( currentSystem.isOther() );

        EasyMock.verify(mockOSX);
    }


    @Test
    public void testIsOtherOS() {

        Properties mockOther = EasyMock.createMock(Properties.class);
        EasyMock.expect( mockOther.getProperty( "os.name" )).andReturn( "Other" );
        EasyMock.expect( mockOther.getProperty( "file.separator" )).andReturn( "/" );
        EasyMock.expect( mockOther.getProperty( "line.separator" )).andReturn( "\n" );
        EasyMock.expect( mockOther.getProperty( "java.io.tmpdir" )).andReturn( "/tmp" );
        EasyMock.replay( mockOther );

        FileSystem currentSystem = new FileSystem( mockOther );
        assertTrue( currentSystem.isOther() );

        assertFalse( currentSystem.isMac() );
        assertFalse( currentSystem.isLinux() );
        assertFalse( currentSystem.isWindows() );

        EasyMock.verify(mockOther);
    }


    @Test
    public void testGetLineSeparatorLinux() {
        FileSystem currentSystem = new FileSystem( mockLinux );
        assertTrue( currentSystem.isLinux() );

        char lineSeparatorCharacters[] = currentSystem.getLineSeparator().toCharArray();
        char expected [] = "\n".toCharArray();
        assertArrayEquals( expected , lineSeparatorCharacters );

        EasyMock.verify(mockLinux);
    }

    @Test
    public void testGetLineSeparatorMac() {
        FileSystem currentSystem = new FileSystem( mockOSX );
        assertTrue( currentSystem.isMac() );

        char lineSeparatorCharacters[] = currentSystem.getLineSeparator().toCharArray();
        char expected [] = "\n".toCharArray();
        assertArrayEquals( expected , lineSeparatorCharacters );

        EasyMock.verify(mockOSX);
    }

    @Test
    public void testGetLineSeparatorWindows() {
        FileSystem currentSystem = new FileSystem( mockWindows7 );
        assertTrue( currentSystem.isWindows() );

        char lineSeparatorCharacters[] = currentSystem.getLineSeparator().toCharArray();
        char expected [] = "\r\n".toCharArray();
        assertArrayEquals( expected , lineSeparatorCharacters );

        EasyMock.verify(mockWindows7);
    }


    @Test
    public void testGetTempDirectoryLinux() {
        FileSystem currentSystem = new FileSystem( mockLinux );
        assertTrue( currentSystem.isLinux() );
        assertEquals( "/tmp" , currentSystem.getTempDirectory() );
        EasyMock.verify(mockLinux);
    }

    @Test
    public void testGetTempDirectoryMac() {
        FileSystem currentSystem = new FileSystem( mockOSX );
        assertTrue( currentSystem.isMac() );
        assertEquals( "/tmp" , currentSystem.getTempDirectory() );
        EasyMock.verify(mockOSX);
    }

    @Test
    public void testGetTempDirectoryWindows() {
        FileSystem currentSystem = new FileSystem( mockWindows7 );
        assertTrue( currentSystem.isWindows() );
        assertEquals( WINDOWS_TEMP_DIRECTORY_LOCATION , currentSystem.getTempDirectory() );
        EasyMock.verify(mockWindows7);
    }


    @Test
    public void testGetFileSeparatorLinux() {
        FileSystem currentSystem = new FileSystem( mockLinux );
        assertTrue( currentSystem.isLinux() );
        assertEquals( "/" , currentSystem.getFileSeparator() );
        EasyMock.verify(mockLinux);
    }

    @Test
    public void testGetFileSeparatorMac() {
        FileSystem currentSystem = new FileSystem( mockOSX );
        assertTrue( currentSystem.isMac() );
        assertEquals( "/" , currentSystem.getFileSeparator() );
        EasyMock.verify(mockOSX);
    }

    @Test
    public void testGetFileSeparatorWindows() {
        FileSystem currentSystem = new FileSystem( mockWindows7 );
        assertTrue( currentSystem.isWindows() );
        assertEquals( "\\" , currentSystem.getFileSeparator() );
        EasyMock.verify(mockWindows7);
    }


    @Test( expected = IllegalArgumentException.class )
    public void testConstructorNull()   {
        new FileSystem( null );
    }


    // TODO: requires Mock Objects
    @Test
    public void testGetRoots() {
        FileSystem test = new FileSystem( System.getProperties() );
        if( test.isWindows())
        {
            assertTrue( test.getRootsAsString().toLowerCase().contains( "c:" ) );
        }

        if( test.isLinux())
        {
            assertTrue( test.getRoots().contains( "\\" ) );
        }
    }


    @Test
    public void testConvertFileSystemPathFile(){

        String windows = "C:\\var\\lib\\ssl\\cert.crt";
        String macLinux = "/var/lib/ssl/cert.crt";
        FileSystem windowsOS = new FileSystem( mockWindows7 );
        FileSystem linuxOS = new FileSystem( mockLinux );
        FileSystem macOS = new FileSystem( mockOSX );

        assertEquals( macLinux, macOS.convertFileSystemPath( macLinux ) );
        assertEquals( macLinux, linuxOS.convertFileSystemPath( macLinux ) );
        assertEquals( windows , windowsOS.convertFileSystemPath( windows ) );

        assertEquals( macLinux , linuxOS.convertFileSystemPath( windows ) );
        assertEquals( windows.toLowerCase() , windowsOS.convertFileSystemPath( macLinux  ) );
        EasyMock.verify(mockWindows7);
        EasyMock.verify(mockLinux);
        EasyMock.verify(mockOSX);
    }


    @Test
    public void testConvertFileSystemPathTrailingSlash(){

        String windows = "C:\\var\\lib\\ssl\\";
        String macLinux = "/var/lib/ssl/";
        FileSystem windowsOS = new FileSystem( mockWindows7 );
        FileSystem linuxOS = new FileSystem( mockLinux );
        FileSystem macOS = new FileSystem( mockOSX );

        assertEquals( macLinux, macOS.convertFileSystemPath( macLinux ) );
        assertEquals( macLinux, linuxOS.convertFileSystemPath( macLinux ) );
        assertEquals( windows , windowsOS.convertFileSystemPath( windows ) );

        assertEquals( macLinux , linuxOS.convertFileSystemPath( windows ) );
        assertEquals( windows.toLowerCase() , windowsOS.convertFileSystemPath( macLinux  ) );
        EasyMock.verify(mockWindows7);
        EasyMock.verify(mockLinux);
        EasyMock.verify(mockOSX);
    }


    @Test( expected = IllegalArgumentException.class )
    public void testConvertFileSystemPathNull() {
        FileSystem test = new FileSystem( mockWindows7 );
        test.convertFileSystemPath( null );
    }

    @Test
    public void testConvertFileSystemPathEmpty() {
        FileSystem test = new FileSystem( mockWindows7 );
        try {
            test.convertFileSystemPath( "" );
        } catch( IllegalArgumentException e ) {
            assertEquals( "ERROR: path cannot be empty", e.getMessage() );
            return;
        }
        fail( "Should create IllegalArgumentException" );
    }


    // FILE READING AND WRITING TESTS , HAPPY MAIN PATH

    @Rule
    public TemporaryFolder folder = new TemporaryFolder();


    @Test
    public void testStringFromFileSingleLine() throws Exception {
        //Given
        writeTotestFile( SINGLELINE );
        String pathFile = testFile.getAbsolutePath().toString();
        //When
        //Then
        assertEquals( SINGLELINE, currentSystem.stringFromFile( pathFile ) );
    }

    @Test
    public void testStringFromFileMultiLine() throws Exception {
        //Given
        writeTotestFile( SINGLELINE + NEWLINE + SECONDLINE );
        String pathFile = testFile.getAbsolutePath().toString();
        //When
        //Then
        assertEquals( SINGLELINE + NEWLINE + SECONDLINE, currentSystem.stringFromFile( pathFile ) );
    }


    @Test
    public void testWriteStringToFileSingleLine() throws IOException {
        // Given
        testFile = folder.newFile( "testWriteStringToFile.txt" );
        // When
        currentSystem.writeStringToFile( SINGLELINE, testFile.getAbsoluteFile().toString() );
        // Then
        assertTrue( testFile.exists() );
        assertEquals( SINGLELINE, readFile( testFile ) );
    }

    @Test
    public void testWriteStringToFileMultiLine() throws IOException {
        // Given
        testFile = folder.newFile( "testWriteStringToFile.txt" );
        //When
        currentSystem.writeStringToFile( SINGLELINE + NEWLINE + SECONDLINE, testFile.getAbsoluteFile().toString() );
        //Then
        assertTrue( testFile.exists() );
        assertEquals( SINGLELINE + NEWLINE + SECONDLINE, readFile( testFile ) );
    }


    @Test
    public void testDelimitedListFromFileSingleLine() throws IOException {
        //Given
        writeTotestFile( SINGLELINE );
        String pathFile = testFile.getAbsolutePath().toString();
        //When
        ArrayList<String> result = currentSystem.delimitedListFromFile( NEWLINE , pathFile );
        //Then
        assertEquals( 1, result.size() );
        assertEquals( SINGLELINE, result.get( 0 ) );
    }

    @Test
    public void testDelimitedListFromFileSingleLineNewline() throws IOException {
        //Given
        writeTotestFile( SINGLELINE + NEWLINE );
        String pathFile = testFile.getAbsolutePath().toString();
        //When
        ArrayList<String> result = currentSystem.delimitedListFromFile( System.getProperty( "line.separator" ), pathFile );
        //Then
        assertEquals( 1, result.size() );
        assertEquals( SINGLELINE + NEWLINE, result.get( 0 ) );
    }

    @Test
    public void testDelimitedListFromFileMultiLineNoFinalNewlineEnding() throws IOException {
        //Given
        writeTotestFile( SINGLELINE + NEWLINE + SECONDLINE );
        String pathFile = testFile.getAbsolutePath().toString();
        //When
        ArrayList<String> result = currentSystem.delimitedListFromFile( System.getProperty( "line.separator" ), pathFile );
        //Then
        assertEquals( 2, result.size() );
        assertEquals( SINGLELINE + NEWLINE, result.get( 0 ) );
        assertEquals( SECONDLINE, result.get( 1 ) );
    }

    @Test
    public void testDelimitedListFromFileMultiLine() throws IOException {
        //Given
        writeTotestFile( SINGLELINE + NEWLINE + SECONDLINE + NEWLINE );
        //When
        ArrayList<String> result = currentSystem.delimitedListFromFile( NEWLINE, testFile.getAbsolutePath().toString() );
        //Then
        assertEquals( 2, result.size() );
        assertEquals( SINGLELINE + NEWLINE, result.get( 0 ) );
        assertEquals( SECONDLINE + NEWLINE, result.get( 1 ) );
    }


    @Test
    public void testListOfLinesFromFileSingleNewlineThenContent() throws IOException {
        //Given
        writeTotestFile( NEWLINE + SINGLELINE );
        //When
        ArrayList<String> result = currentSystem.listOfLinesFromFile( testFile.getAbsolutePath().toString() );
        //Then
        assertEquals( 2, result.size() );
        assertEquals( NEWLINE, result.get( 0 ) );
        assertEquals( SINGLELINE, result.get( 1 ) );
    }

    @Test
    public void testListOfLinesFromFileSingleLineNewline() throws IOException {
        //Given
        writeTotestFile( SINGLELINE + NEWLINE );
        //When
        ArrayList<String> result = currentSystem.listOfLinesFromFile( testFile.getAbsolutePath().toString() );
        //Then
        assertEquals( 1, result.size() );
        assertEquals( SINGLELINE + NEWLINE, result.get( 0 ) );
    }

    @Test
    public void testListOfLinesFromFileMultiLineNoFinalNewline() throws IOException {
        //Given
        writeTotestFile( SINGLELINE + NEWLINE + SECONDLINE );
        //When
        ArrayList<String> result = currentSystem.listOfLinesFromFile( testFile.getAbsolutePath().toString() );
        //Then
        assertEquals( 2, result.size() );
        assertEquals( SINGLELINE + NEWLINE, result.get( 0 ) );
        assertEquals( SECONDLINE, result.get( 1 ) );
    }

    @Test
    public void testListOfLinesFromFileMultiLine() throws IOException {
        //Given
        writeTotestFile( SINGLELINE + NEWLINE + SECONDLINE + NEWLINE );
        //When
        ArrayList<String> result = currentSystem.listOfLinesFromFile( testFile.getAbsolutePath().toString() );
        //Then
        assertEquals( 2, result.size() );
        assertEquals( SINGLELINE + NEWLINE, result.get( 0 ) );
        assertEquals( SECONDLINE + NEWLINE, result.get( 1 ) );
    }

    // EDGE CASES OF WEIRD FILE TEXT CONTENT

    @Test
    public void testListOfLinesFromFileSingleSpace() throws IOException {
        //Given
        writeTotestFile( " " );
        //When
        ArrayList<String> result = currentSystem.listOfLinesFromFile( testFile.getAbsolutePath().toString() );
        //Then
        assertEquals( 1, result.size() );
        assertEquals( " ", result.get( 0 ) );
    }

    @Test
    public void testListOfLinesFromFileTabSpace() throws IOException {
        //Given
        writeTotestFile( "   " );
        //When
        ArrayList<String> result = currentSystem.listOfLinesFromFile( testFile.getAbsolutePath().toString() );
        //Then
        assertEquals( 1, result.size() );
        assertEquals( "  ", result.get( 0 ) );
    }

    @Test
    public void testListOfLinesFromFileSingleNewline() throws IOException {
        //Given
        writeTotestFile( NEWLINE );
        //When
        ArrayList<String> result = currentSystem.listOfLinesFromFile( testFile.getAbsolutePath().toString() );
        //Then
        assertEquals( 1, result.size() );
        assertEquals( NEWLINE, result.get( 0 ) );
    }


    // ERROR CONDITIONS AND BAD INPUT TESTING

    @Test
    public void testWriteStringToReadOnlyFile() throws IOException {
        testFile = folder.newFile( "testWriteStringToReadOnlyFile.txt" );
        testFile.setReadOnly();

        try {
            currentSystem.writeStringToFile( SINGLELINE, testFile.getAbsoluteFile().toString() );
        } catch( IOException e ) {
            assertEquals( "ERROR: cannot write to " + testFile.getAbsoluteFile().toString(), e.getMessage() );
            return;
        }
        fail( "Expected IOException" );
    }


    @Test
    public void testWriteStringToFileNull() throws IOException {
        try {
            currentSystem.writeStringToFile( SINGLELINE, null );
        } catch( IllegalArgumentException e ) {
            assertEquals( "ERROR: path cannot be null", e.getMessage() );
            return;
        }
        fail( "Expected IllegalArgumentException" );
    }


    @Test
    public void testWriteStringToFileEmpty() throws IOException {
        try {
            currentSystem.writeStringToFile( SINGLELINE, "" );
        } catch( IllegalArgumentException e ) {
            assertEquals( "ERROR: path cannot be empty", e.getMessage() );
            return;
        }
        fail( "Expected IllegalArgumentException" );
    }


    @Test
    public void testWriteStringToFileContentNull() throws IOException {
        File testFile = folder.newFile( "testWriteStringToFileContentNull.txt" );
        try {
            currentSystem.writeStringToFile( null, testFile.getAbsoluteFile().toString() );
        } catch( IllegalArgumentException e ) {
            assertEquals( "ERROR: content cannot be null", e.getMessage() );
            return;
        }
        fail( "Expected IllegalArgumentException" );
    }


    @Test
    public void testStringFromFileNull() throws IOException {
        try {
            currentSystem.stringFromFile( null );
        } catch( IllegalArgumentException e ) {
            assertEquals( "ERROR: path cannot be null", e.getMessage() );
            return;
        }
        fail( "Expected IllegalArgumentException" );
    }

    @Test
    public void testStringFromFileEmptyString() throws IOException {
        try {
            currentSystem.stringFromFile( "" );
        } catch( IllegalArgumentException e ) {
            assertEquals( "ERROR: path cannot be empty", e.getMessage() );
            return;
        }
        fail( "Expected IllegalArgumentException" );
    }



    @Test
    public void testDelimitedListFromFileNull() throws IOException {
        try {
            currentSystem.delimitedListFromFile( NEWLINE, null );
        } catch( IllegalArgumentException iae ) {
            return;
        }
        fail( "Expected IllegalArgumentException" );
    }

    @Test
    public void testDelimitedListFromFilePathEmpty() throws IOException {
        try {
            currentSystem.delimitedListFromFile( NEWLINE, "" );
        } catch( IllegalArgumentException iae ) {
            return;
        }
        fail( "Expected IllegalArgumentException" );
    }

    @Test
    public void testDelimiterNull() throws IOException {
        try {
            currentSystem.delimitedListFromFile( null, "testFile.txt" );
        } catch( IllegalArgumentException iae ) {
            return;
        }
        fail( "Expected IllegalArgumentException" );
    }

    @Test
    public void testDelimiterEmpty() throws IOException {
        try {
            currentSystem.delimitedListFromFile( "", "testFile.txt" );
        } catch( IllegalArgumentException iae ) {
            return;
        }
        fail( "Expected IllegalArgumentException" );
    }


    @Test
    public void testlistOfLinesFromFileNull() throws IOException {
        try {
            currentSystem.listOfLinesFromFile( null );
        } catch( IllegalArgumentException iae ) {
            return;
        }
        fail( "Expected IllegalArgumentException" );
    }

    @Test
    public void testlistOfLinesFromFileEmpty() throws IOException {
        try {
            currentSystem.listOfLinesFromFile( "" );
        } catch( IllegalArgumentException iae ) {
            return;
        }
        fail( "Expected IllegalArgumentException" );
    }

    @Test
    public void testRunSystemCommand() {
        try {
            currentSystem.runSystemCommand( null );
        } catch( NullPointerException npe ) {
            assertEquals( "ERROR: command cannot be null", npe.getMessage() );
            return;
        }
        fail( "Expected NullPointerException" );
    }




    // HELPER FUNCTIONS test read and write

    private String readFile( File f ) {
        if( f == null ) {
            fail( "File should not be null" );
        }
        String pathfile = f.getAbsolutePath().toString();
        StringBuilder strb = new StringBuilder();
        BufferedReader br = null;
        try {
            FileInputStream fileInputStream = new FileInputStream( pathfile );
            InputStreamReader in = new InputStreamReader( fileInputStream );
            int character;
            while( (character = in.read()) != -1 ) {
                strb.append( (char) character );
            }

        } catch( IOException ioe ) {
            System.err.println( "Unable to read file: " + pathfile );
            ioe.printStackTrace();
        } finally {
            if( br != null ) {
                try {
                    br.close();
                } catch( Exception e ) {
                    e.printStackTrace();
                }
            }
        }
        return strb.toString();
    }

    private void writeTotestFile( String fileContent ) {
        testFile = null;
        try {
            testFile = folder.newFile( "testFile.txt" );
            FileWriter outFile = new FileWriter( testFile );
            PrintWriter out = new PrintWriter( outFile );
            out.print( fileContent );
            out.close();
        } catch( Exception e ) {
            e.printStackTrace();
        }
    }



} //end class
/*
     //  -- listing properties --
     // java.runtime.name=Java(TM) SE Runtime Environment
     // sun.boot.library.path=C:\Program Files\Java\jre6\bin
     // java.vm.version=20.6-b01
     // java.vm.vendor=Sun Microsystems Inc.
     // java.vendor.url=http://java.sun.com/
     // path.separator=;
     // java.vm.name=Java HotSpot(TM) 64-Bit Server VM
     // file.encoding.pkg=sun.io
     // user.country=US
     // sun.java.launcher=SUN_STANDARD
     // sun.os.patch.level=Service Pack 1
     // java.vm.specification.name=Java Virtual Machine Specification
     // user.dir=C:\Users\John\Desktop
     // java.runtime.version=1.6.0_31-b05
     // java.awt.graphicsenv=sun.awt.Win32GraphicsEnvironment
     // java.endorsed.dirs=C:\Program Files\Java\jre6\lib\endorsed
     // os.arch=amd64
     // java.io.tmpdir=C:\Users\John\AppData\Local\Temp\
     // line.separator=
     //
     // java.vm.specification.vendor=Sun Microsystems Inc.
     // user.variant=
     // os.name=Windows 7
     // sun.jnu.encoding=Cp1252
     // java.library.path=C:\Windows\system32;C:\Windows\Sun\Ja...
     // java.specification.name=Java Platform API Specification
     // java.class.version=50.0
     // sun.management.compiler=HotSpot 64-Bit Tiered Compilers
     // os.version=6.1
     // user.home=C:\Users\John
     // user.timezone=
     // java.awt.printerjob=sun.awt.windows.WPrinterJob
     // file.encoding=Cp1252
     // java.specification.version=1.6
     // user.name=John
     // java.class.path=.
     // java.vm.specification.version=1.0
     // sun.arch.data.model=64
     // java.home=C:\Program Files\Java\jre6
     // sun.java.command=Intro
     // java.specification.vendor=Sun Microsystems Inc.
     // user.language=en
     // awt.toolkit=sun.awt.windows.WToolkit
     // java.vm.info=mixed mode
     // java.version=1.6.0_31
     // java.ext.dirs=C:\Program Files\Java\jre6\lib\ext;C:...
     // sun.boot.class.path=C:\Program Files\Java\jre6\lib\resour...
     // java.vendor=Sun Microsystems Inc.
     // file.separator=\
     // java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport...
     // sun.cpu.endian=little
     // sun.io.unicode.encoding=UnicodeLittle
     // sun.desktop=windows
     // sun.cpu.isalist=amd64

    //  -- listing properties --
     // java.runtime.name=Java(TM) SE Runtime Environment
     // sun.boot.library.path=/usr/lib/jvm/java-6-sun-1.6.0.26/jre/...
     // java.vm.version=20.1-b02
     // java.vm.vendor=Sun Microsystems Inc.
     // java.vendor.url=http://java.sun.com/
     // path.separator=:
     // java.vm.name=Java HotSpot(TM) Server VM
     // file.encoding.pkg=sun.io
     // user.country=US
     // sun.java.launcher=SUN_STANDARD
     // sun.os.patch.level=unknown
     // java.vm.specification.name=Java Virtual Machine Specification
     // user.dir=/home/oadmin
     // java.runtime.version=1.6.0_26-b03
     // java.awt.graphicsenv=sun.awt.X11GraphicsEnvironment
     // java.endorsed.dirs=/usr/lib/jvm/java-6-sun-1.6.0.26/jre/...
     // os.arch=i386
     // java.io.tmpdir=/tmp
     // line.separator=
     //
     // java.vm.specification.vendor=Sun Microsystems Inc.
     // os.name=Linux
     // sun.jnu.encoding=UTF-8
     // java.library.path=/usr/lib/jvm/java-6-sun-1.6.0.26/jre/...
     // java.specification.name=Java Platform API Specification
     // java.class.version=50.0
     // sun.management.compiler=HotSpot Tiered Compilers
     // os.version=2.6.32-24-generic-pae
     // user.home=/home/oadmin
     // user.timezone=
     // java.awt.printerjob=sun.print.PSPrinterJob
     // file.encoding=UTF-8
     // java.specification.version=1.6
     // user.name=oadmin
     // java.class.path=.
     // java.vm.specification.version=1.0
     // sun.arch.data.model=32
     // java.home=/usr/lib/jvm/java-6-sun-1.6.0.26/jre
     // sun.java.command=Intro
     // java.specification.vendor=Sun Microsystems Inc.
     // user.language=en
     // java.vm.info=mixed mode
     // java.version=1.6.0_26
     // java.ext.dirs=/usr/lib/jvm/java-6-sun-1.6.0.26/jre/...
     // sun.boot.class.path=/usr/lib/jvm/java-6-sun-1.6.0.26/jre/...
     // java.vendor=Sun Microsystems Inc.
     // file.separator=/
     // java.vendor.url.bug=http://java.sun.com/cgi-bin/bugreport...
     // sun.cpu.endian=little
     // sun.io.unicode.encoding=UnicodeLittle
     // sun.cpu.isalist=
     //

     //      -- listing properties --
     // os.name=Mac OS X
     // mrj.version=1050.1.5.0_16-284
     // java.vm.vendor=Apple Inc.
     // java.vendor.url=http://www.apple.com/
     //
     // java.awt.graphicsenv=apple.awt.CGraphicsEnvironment
     // awt.toolkit=apple.awt.CToolkit
     // java.vendor=Apple Inc.
     // java.vendor.url.bug=http://bugreport.apple.com/
     //
     // java.runtime.name=Java(TM) 2 Runtime Environment, Stand...
     // sun.boot.library.path=/System/Library/Frameworks/JavaVM.fra...
     // java.vm.version=1.5.0_16-133
     // awt.nativeDoubleBuffering=true
     // gopherProxySet=false
     // path.separator=:
     // java.vm.name=Java HotSpot(TM) Client VM
     // file.encoding.pkg=sun.io
     // user.country=US
     // sun.java.launcher=SUN_STANDARD
     // sun.os.patch.level=unknown
     // java.vm.specification.name=Java Virtual Machine Specification
     // user.home=/Users/al
     // user.dir=/Users/al/stuff
     // user.name=al
     // java.class.path=/Users/al/stuff...
     // java.runtime.version=1.5.0_16-b06-284
     // java.endorsed.dirs=/System/Library/Frameworks/JavaVM.fra...
     // os.arch=i386
     // java.io.tmpdir=/tmp
     // line.separator=
     //
     // java.vm.specification.vendor=Sun Microsystems Inc.
     // sun.jnu.encoding=MacRoman
     // java.library.path=.:/Library/Java/Extensions:/System/Li...
     // java.specification.name=Java Platform API Specification
     // java.class.version=49.0
     // sun.management.compiler=HotSpot Client Compiler
     // os.version=10.5.7
     // user.timezone=
     // java.awt.printerjob=apple.awt.CPrinterJob
     // file.encoding=MacRoman
     // java.specification.version=1.5
     // java.vm.specification.version=1.0
     // sun.arch.data.model=32
     // java.home=/System/Library/Frameworks/JavaVM.fra...
     // java.specification.vendor=Sun Microsystems Inc.
     // user.language=en
     // java.vm.info=mixed mode, sharing
     // java.version=1.5.0_16
     // java.ext.dirs=/Library/Java/Extensions:/System/Libr...
     // sun.boot.class.path=/System/Library/Frameworks/JavaVM.fra...
     // file.separator=/
     // sun.cpu.endian=little
     // sun.io.unicode.encoding=UnicodeLittle
     // sun.cpu.isalist=


*/

  • « array to ArrayList Pairs
  • FileSystem »

Published

Dec 5, 2012

Category

java-classes

~1690 words

Tags

  • classes 92
  • filesystemtest 1
  • java 252