Package com.cloudloop.storage

Examples of com.cloudloop.storage.CloudStorePath


  }

  @Test
  public void testGetParent_File()
  {
    CloudStorePath path = new CloudStorePath("/foo/bar/file.txt");
    assertEquals( new CloudStorePath("/foo/bar/"), path.getParent() );
  }
View Full Code Here


  }

  @Test
  public void testIsDirectory_NonRootDirectory()
  {
    assertTrue( new CloudStorePath("/foo/bar/").isDirectory() );
  }
View Full Code Here

  }

  @Test
  public void testIsDirectory_File()
  {
    assertFalse( new CloudStorePath("/foo/bar/file.txt").isDirectory() );
  }
View Full Code Here

  }

  @Test
  public void testIsRoot_NotRoot()
  {
    assertFalse( new CloudStorePath("/foo/bar/").isRoot() );
  }
View Full Code Here

  }

  @Test
  public void testIsRoot_File()
  {
    assertFalse( new CloudStorePath("/foo/bar/file.txt").isRoot() );
  }
View Full Code Here

    ///////////////////////////

  @Test
  public void testCombine()
  {
    CloudStorePath lhs = new CloudStorePath("/foo/");
    CloudStorePath rhs = new CloudStorePath("/bar/");
    CloudStorePath path = lhs.combine(rhs);
    assertEquals( "/foo/bar/", path.getAbsolutePath() );
  }
View Full Code Here

  @Test
  public void testCombine_SourceIsFile()
  {
    try {
      CloudStorePath lhs = new CloudStorePath("/foo.txt");
      CloudStorePath rhs = new CloudStorePath("/bar/");
      lhs.combine(rhs);
    } catch (InvalidPathException e) {}
  }
View Full Code Here

    ///////////////////////////

  @Test
  public void testIsChildOf_NotAChild()
  {
    CloudStorePath a;
    CloudStorePath b;
   
    // a path is not a child of itself
    a = new CloudStorePath("/foo/bar/");
    b = new CloudStorePath("/foo/bar/");
    assertFalse( a.isChildOf(b) );
    assertFalse( b.isChildOf(a) );
   
    // root directory not a child of itself
    a = new CloudStorePath("/");
    b = new CloudStorePath("/");
    assertFalse( a.isChildOf(b) );
    assertFalse( b.isChildOf(a) );
   
    // two mutually exclusive directories
    // are not children of eachother
    a = new CloudStorePath("/bar/foo/");
    b = new CloudStorePath("/foo/bar/");
    assertFalse( a.isChildOf(b) );
    assertFalse( b.isChildOf(a) );
 
    a = new CloudStorePath("/foo/bar/biz");
    b = new CloudStorePath("/foo/bar/");
    assertFalse( b.isChildOf(a) );
   
    // a parent path cannot be a file
    a = new CloudStorePath("/foo/bar");
    b = new CloudStorePath("/foo/biz/");
    assertFalse( b.isChildOf(a) );
  }
View Full Code Here

  }

  @Test
  public void testIsChildOf_IsAChild()
  {
    CloudStorePath child;
    CloudStorePath parent;
   
    child = new CloudStorePath("/foo/bar/");
    parent = new CloudStorePath("/");
    assertTrue( child.isChildOf(parent) );
    assertFalse( parent.isChildOf(child) );
   
    child = new CloudStorePath("/foo/bar/");
    parent = new CloudStorePath("/foo/");
    assertTrue( child.isChildOf(parent) );
    assertFalse( parent.isChildOf(child) );
   
  }
View Full Code Here

        if ( !storePath.endsWith( "/" ) )
        {
            storePath += ( directory ? "/" : "" );
        }

        return new CloudStorePath( storePath );
    }
View Full Code Here

TOP

Related Classes of com.cloudloop.storage.CloudStorePath

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.