Package com.cloudloop.storage.adapter

Examples of com.cloudloop.storage.adapter.CloudStoreAdapterBase


    // /////////////////////////
   
    @Test
    public void testSendCreateDirectoryRequest( )
    {
  CloudStoreAdapterBase store = getCloudStoreAdapter( );
  String dirName = "foo/";
  store.sendCreateDirectoryRequest( store.getDirectory( dirName ) );
  assertDirExists( dirName );
    }
View Full Code Here


    // /////////////////////////
   
    @Test
    public void testSendContainsRequest( )
    {
  CloudStoreAdapterBase store = getCloudStoreAdapter( );
  store.createDirectory( store.getDirectory( "foo/bar/../" ) );
  CloudStoreDirectory dir = store.getDirectory( "foo/bar/../" );
  assertTrue( store.contains( dir ) );
    }
View Full Code Here

    }
   
    @Test
    public void testSendContainsRequest_Directory_DoesNotExist( )
    {
  CloudStoreAdapterBase store = getCloudStoreAdapter( );
  CloudStoreDirectory dir = store.getDirectory( "/foo/bar/../" );
  assertFalse( store.contains( dir ) );
    }
View Full Code Here

    // /////////////////////////
   
    @Test
    public void testSendIntraStoreCopyRequest( )
    {
  CloudStoreAdapterBase store = getCloudStoreAdapter( );
  CloudStorePath dirPath = new CloudStorePath( "/foo/bar/" );
  store.createDirectory( store.getDirectory( "/foo/bar/" ) );
  CloudStoreFile fileToUpload = store.getFile( "/foo/bar/some_file.txt" );
  fileToUpload.setStreamToStore( new MockFileStream( 50 ) );
  fileToUpload.write( null );
  // HACK!! (AL) For some reason, Nirvanix needs time to process the file
  // before it can be copied. I'm not sure why this is, and I can't
  // find anything in the docs.
  // TODO: Perhaps put in a retry for the copy command?
  try
  {
      Thread.sleep( 1000 );
  }
  catch ( Throwable e )
  {
  }
  fileToUpload.copyTo( store
    .getFile( dirPath.getParent( )
    .combine(
        PathUtil.popLeaf( fileToUpload.getPath( ) ) )
    .getAbsolutePath( ) ), null );
  assertTrue( store.contains( store.getFile( "/foo/some_file.txt" ) ) );
    }
View Full Code Here

    // /////////////////////////
   
    @Test
    public void testSendUploadDownloadRequest( )
    {
  CloudStoreAdapterBase store = getCloudStoreAdapter( );
  store.createDirectory( store.getDirectory( "/foo/bar/" ) );
  CloudStoreFile fileToUpload = store.getFile( "/foo/bar/some_file.txt" );
  fileToUpload.setStreamToStore( new MockFileStream( 50 ) );
  fileToUpload.write( null );
  FileStreamComparer.areStreamsEqual( new MockFileStream( 50 ),
              fileToUpload.read( null ) );
    }
View Full Code Here

    // /////////////////////////
   
    @Test
    public void testSendRemoveFileRequest( )
    {
  CloudStoreAdapterBase store = getCloudStoreAdapter( );
  store.createDirectory( store.getDirectory( "/foo/bar/" ) );
  CloudStoreFile fileToUpload = store.getFile( "/foo/bar/some_file.txt" );
  fileToUpload.setStreamToStore( new MockFileStream( 50 ) );
  fileToUpload.write( null );
  fileToUpload.remove( );
  assertFalse( store.contains( fileToUpload ) );
    }
View Full Code Here

    // /////////////////////////
   
    private void setupDirectoryForListTest( int numSubDirs, int numFiles,
              int numSubSubObjects, String baseDir )
    {
  CloudStoreAdapterBase store = getCloudStoreAdapter( );
  store.createDirectory( store.getDirectory( baseDir ) );
 
  for ( int i = 0; i < numSubDirs; i++ )
  {
      String dirPath = baseDir + "dir_" + i + "/";
      CloudStoreDirectory dir = store.getDirectory( dirPath );
      store.createDirectory( dir );
     
      // create files and directories under each subdir
      // in order to test recursive functionality
      for ( int j = 0; j < numSubSubObjects; j++ )
      {
    CloudStoreDirectory subDir = store.getDirectory( dirPath
      + "sub_dir_" + j + "/" );
    store.createDirectory( subDir );
   
    CloudStoreFile subFile = store.getFile( dirPath + "sub_file_"
      + j );
    subFile.setStreamToStore( new MockFileStream( 50 ) );
    subFile.write( null );
      }
  }
 
  for ( int i = 0; i < numFiles; i++ )
  {
      String filePath = baseDir + "file_" + i;
      CloudStoreFile file = store.getFile( filePath );
      file.setStreamToStore( new MockFileStream( 50 ) );
      file.write( null );
  }
    }
View Full Code Here

  String baseDir = "/foo/bar/";
 
  setupDirectoryForListTest( numSubDirs, numFiles, numSubSubObjects,
           baseDir );
 
  CloudStoreAdapterBase store = getCloudStoreAdapter( );
  CloudStoreDirectory dir = store.getDirectory( baseDir );
 
  CloudStoreObject[ ] objs = store
    .listDirectoryContents( dir,
          CloudStoreObjectType.OBJECT, false );
  CloudStoreObject[ ] files = store
    .listDirectoryContents( dir,
          CloudStoreObjectType.FILE, false );
  CloudStoreObject[ ] dirs = store
    .listDirectoryContents( dir,
          CloudStoreObjectType.DIRECTORY, false );
 
  assertEquals( numSubDirs + numFiles, objs.length );
  assertEquals( numFiles, files.length );
View Full Code Here

  String baseDir = "/foo/bar/";
 
  setupDirectoryForListTest( numSubDirs, numFiles, numSubSubObjects,
           baseDir );
 
  CloudStoreAdapterBase store = getCloudStoreAdapter( );
  CloudStoreDirectory dir = store.getDirectory( baseDir );
 
  CloudStoreObject[ ] objs = store
    .listDirectoryContents( dir,
          CloudStoreObjectType.OBJECT, true );
  CloudStoreObject[ ] files = store
    .listDirectoryContents( dir,
          CloudStoreObjectType.FILE, true );
  CloudStoreObject[ ] dirs = store
    .listDirectoryContents( dir,
          CloudStoreObjectType.DIRECTORY, true );
 
  assertEquals(
          numSubDirs + numFiles + numSubDirs * 2 * numSubSubObjects,
 
View Full Code Here

  String baseDir = "/foo/bar/";
 
  setupDirectoryForListTest( numSubDirs, numFiles, numSubSubObjects,
           baseDir );
 
  CloudStoreAdapterBase store = getCloudStoreAdapter( );
  CloudStoreDirectory dir = store.getDirectory( baseDir );
 
  CloudStoreObject[ ] objs = store
    .listDirectoryContents( dir,
          CloudStoreObjectType.OBJECT, false );
  CloudStoreObject[ ] files = store
    .listDirectoryContents( dir,
          CloudStoreObjectType.FILE, false );
  CloudStoreObject[ ] dirs = store
    .listDirectoryContents( dir,
          CloudStoreObjectType.DIRECTORY, false );
 
  assertEquals( numSubDirs + numFiles, objs.length );
  assertEquals( numFiles, files.length );
View Full Code Here

TOP

Related Classes of com.cloudloop.storage.adapter.CloudStoreAdapterBase

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.