Package edu.sdsc.grid.io.srb

Examples of edu.sdsc.grid.io.srb.SRBFileExt


    }

    @Test
    public void testDeleteRecursive()
    {
        SRBFileExt home = new SRBFileExt(sys, acc.getHomeDirectory());
        SRBFileExt child = new SRBFileExt(home, "TestDir/Blah");
        SRBFileExt child2 = new SRBFileExt(child, "TestFile");
                                                                     
        try
        {
            System.out.println("child: " + child.getPath());
            child.mkdir();
            child2.createNewFile();
            assertEquals(child.exists(), true);
            assertEquals(child2.exists(), true);
        }
        catch(IOException ioe)
        {
            //BAD
            ioe.printStackTrace();
        }
           //expectations here

        //delete the directory TestDir
        SRBFileExt file = new SRBFileExt(sys, "TestDir");
        boolean result = file.delete(true);
        assertEquals(result, true);

        //get folder again
        SRBFile afterDelete = new SRBFile(sys, "TestDir");
View Full Code Here


    }

    @Test
    public void testListTimeout()
    {
        SRBFileExt unresponsiveZone = new SRBFileExt(sys, "/srb.sapac.edu.au");

        System.out.println("listing dir: " + unresponsiveZone.getAbsolutePath());

        long start = System.currentTimeMillis();
        int TIMEOUT = 5000;

        SRBFileSystemExt sys = unresponsiveZone.getFileSystem();

        RemoteFile[] children = unresponsiveZone.list(TIMEOUT);

        System.out.println("children:");

        for(int i = 0; i < children.length; i++)
        {
View Full Code Here

    }

    @Test
    public void testListWithinTimeout()
    {
        SRBFileExt unresponsiveZone = new SRBFileExt(sys, "/" + SRB_ZONE);

        long start = System.currentTimeMillis();
        int TIMEOUT = 10000;

        RemoteFile[] result = unresponsiveZone.list(TIMEOUT);

        long now = System.currentTimeMillis();
        System.out.println("diff: " + (now - start));

        assertTrue(result.length > 0);
View Full Code Here


    @Test
    public void testRecusiveCopy()
    {
        SRBFileExt home = new SRBFileExt(sys, sys.getHomeDirectory());
        SRBFileExt testDir = new SRBFileExt(home, "TestRecursiveDir");
        SRBFileExt destDir = new SRBFileExt(home, "TestRecursiveDirDestination");

        if(testDir.exists())
        {
            //go recursive delete!
            testDir.delete(true);
        }

        if(destDir.exists())
        {
            destDir.delete();
        }

        SRBFileExt dir = new SRBFileExt(home, "TestRecursiveDir/Folder1/Folder2/Folder3");
        SRBFileExt file1 = new SRBFileExt(home, "TestRecursiveDir/Folder1/File 1");
        SRBFileExt file2 = new SRBFileExt(home, "TestRecursiveDir/Folder1/Folder2/Folder3/File 3");
        dir.mkdir();

        try
        {
            file1.createNewFile();
            file2.createNewFile();
        }
        catch(IOException ioe)
        {
            ioe.printStackTrace();
        }

        try
        {
            testDir.copyTo(destDir, true, true);
            SRBFileExt checkFile1 = new SRBFileExt(destDir, "Folder1/File 1");

            System.out.println(checkFile1.getAbsoluteFile());

            SRBFileExt checkFile2 = new SRBFileExt(destDir, "Folder1/Folder2/Folder3/File 3");
            System.out.println(checkFile2.getAbsoluteFile());

            SRBFileExt checkFolder = new SRBFileExt(destDir, "Folder1/Folder2/");
            System.out.println(checkFolder.getAbsolutePath());


            assertTrue(checkFile1.exists());
            assertTrue(checkFile2.exists());
            assertTrue(checkFolder.exists());

        }
        catch(Exception e)
        {
            //damn it. no exception should have been thrown!
View Full Code Here

            if((newUserName == null) || (newUserDomain == null))
            {
                throw new FileSystemException("Cannot change permission without specifying user and user domain");
            }

            SRBFileExt srbFile = file.getSRBFile();
            srbFile.setStickyBit(false, isInherited, isRecurssive);

            srbFile.changePermissions(perm, newUserName, newUserDomain, isRecurssive);
        }
        catch(Exception e)
        {
            e.printStackTrace();
            throw new FileSystemException("Cannot change permssion " + e.toString());
View Full Code Here

TOP

Related Classes of edu.sdsc.grid.io.srb.SRBFileExt

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.