Class FakeDriver
java.lang.Object
io.clonecloudstore.test.driver.fake.FakeDriver
- All Implemented Interfaces:
DriverApi
,Closeable
,AutoCloseable
Fake Driver that does not store anything except references in memory
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionbucketCreate
(StorageBucket bucket) Create one Bucket and returns itvoid
bucketDelete
(String bucket) Delete one Bucket if it exists and is emptyboolean
bucketExists
(String bucket) Check existence of BucketGet one Bucket and returns itbucketImport
(StorageBucket bucket) Import one Bucket and returns itlong
Count BucketsIterator on Buckets listStream Buckets listvoid
close()
Close with no exception.directoryOrObjectExistsInBucket
(String bucket, String directoryOrObject) Check if Directory or Object exists in specified Bucket (based on prefix)void
forTestsOnlyCreateMultipleObjects
(StorageObject object, long realLen, String sha256, List<String> names) Take the object as base definition, and use name from listobjectCopy
(StorageObject objectSource, StorageObject objectTarget) Copy one object to another one, possibly in a different bucket.void
objectDeleteInBucket
(String bucket, String object) Delete the Object from this BucketobjectFinalizeCreateInBucket
(String bucket, String object, long realLen, String sha256) Second step in creation of an object within a Bucket.objectGetInputStreamInBucket
(String bucket, String object) Get the content of the specified Object within specified BucketobjectGetMetadataInBucket
(String bucket, String object) Get the Object metadata from this Bucket (those available from Object Storage)void
objectPrepareCreateInBucket
(StorageObject object, InputStream inputStream) First step in creation of an object within a Bucket.long
objectsCountInBucket
(String bucket) Count Objects in specified Bucketlong
objectsCountInBucket
(String bucket, String prefix, Instant from, Instant to) Count Objects in specified Bucket with filters (all optionals)objectsIteratorInBucket
(String bucket) Iterator on Objects in specified BucketobjectsIteratorInBucket
(String bucket, String prefix, Instant from, Instant to) Iterator on Objects in specified Bucket with filters (all optionals)objectsStreamInBucket
(String bucket) Stream Objects in specified BucketobjectsStreamInBucket
(String bucket, String prefix, Instant from, Instant to) Stream Objects in specified Bucket with filters (all optionals)Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.clonecloudstore.driver.api.DriverApi
bucketDelete, bucketExists, directoryOrObjectExistsInBucket, objectCopy, objectDeleteInBucket, objectFinalizeCreateInBucket, objectGetInputStreamInBucket, objectGetMetadataInBucket, objectsCountInBucket, objectsCountInBucket, objectsIteratorInBucket, objectsIteratorInBucket, objectsStreamInBucket, objectsStreamInBucket, validCopy
-
Field Details
-
shallRaiseAnException
public static boolean shallRaiseAnException
-
-
Method Details
-
bucketsCount
Description copied from interface:DriverApi
Count Buckets- Specified by:
bucketsCount
in interfaceDriverApi
- Throws:
DriverException
-
bucketsStream
Description copied from interface:DriverApi
Stream Buckets list- Specified by:
bucketsStream
in interfaceDriverApi
- Throws:
DriverException
-
bucketsIterator
Description copied from interface:DriverApi
Iterator on Buckets list- Specified by:
bucketsIterator
in interfaceDriverApi
- Throws:
DriverException
-
bucketGet
Description copied from interface:DriverApi
Get one Bucket and returns it- Specified by:
bucketGet
in interfaceDriverApi
- Returns:
- the StorageBucket as instantiated within the Object Storage (real values)
- Throws:
DriverNotFoundException
DriverException
-
bucketCreate
public StorageBucket bucketCreate(StorageBucket bucket) throws DriverNotAcceptableException, DriverAlreadyExistException, DriverException Description copied from interface:DriverApi
Create one Bucket and returns it- Specified by:
bucketCreate
in interfaceDriverApi
- Parameters:
bucket
- contains various information that could be implemented within Object Storage, but, except the name of the bucket and the client Id, nothing is mandatory- Returns:
- the StorageBucket as instantiated within the Object Storage (real values)
- Throws:
DriverNotAcceptableException
DriverAlreadyExistException
DriverException
-
bucketImport
public StorageBucket bucketImport(StorageBucket bucket) throws DriverNotAcceptableException, DriverAlreadyExistException, DriverException Description copied from interface:DriverApi
Import one Bucket and returns it- Specified by:
bucketImport
in interfaceDriverApi
- Parameters:
bucket
- contains various information that could be implemented within Object Storage, but, except the name of the bucket and the client Id, nothing is mandatory- Returns:
- the StorageBucket as instantiated within the Object Storage (real values)
- Throws:
DriverNotAcceptableException
DriverAlreadyExistException
DriverException
-
bucketDelete
public void bucketDelete(String bucket) throws DriverNotAcceptableException, DriverNotFoundException, DriverException Description copied from interface:DriverApi
Delete one Bucket if it exists and is empty- Specified by:
bucketDelete
in interfaceDriverApi
- Throws:
DriverNotAcceptableException
DriverNotFoundException
DriverException
-
bucketExists
Description copied from interface:DriverApi
Check existence of Bucket- Specified by:
bucketExists
in interfaceDriverApi
- Throws:
DriverException
-
objectsCountInBucket
Description copied from interface:DriverApi
Count Objects in specified Bucket- Specified by:
objectsCountInBucket
in interfaceDriverApi
- Throws:
DriverNotFoundException
DriverException
-
objectsCountInBucket
public long objectsCountInBucket(String bucket, String prefix, Instant from, Instant to) throws DriverNotFoundException, DriverException Description copied from interface:DriverApi
Count Objects in specified Bucket with filters (all optionals)- Specified by:
objectsCountInBucket
in interfaceDriverApi
- Throws:
DriverNotFoundException
DriverException
-
objectsStreamInBucket
public Stream<StorageObject> objectsStreamInBucket(String bucket) throws DriverNotFoundException, DriverException Description copied from interface:DriverApi
Stream Objects in specified Bucket- Specified by:
objectsStreamInBucket
in interfaceDriverApi
- Throws:
DriverNotFoundException
DriverException
-
objectsStreamInBucket
public Stream<StorageObject> objectsStreamInBucket(String bucket, String prefix, Instant from, Instant to) throws DriverNotFoundException, DriverException Description copied from interface:DriverApi
Stream Objects in specified Bucket with filters (all optionals)- Specified by:
objectsStreamInBucket
in interfaceDriverApi
- Throws:
DriverNotFoundException
DriverException
-
objectsIteratorInBucket
public Iterator<StorageObject> objectsIteratorInBucket(String bucket) throws DriverNotFoundException, DriverException Description copied from interface:DriverApi
Iterator on Objects in specified Bucket- Specified by:
objectsIteratorInBucket
in interfaceDriverApi
- Throws:
DriverNotFoundException
DriverException
-
objectsIteratorInBucket
public Iterator<StorageObject> objectsIteratorInBucket(String bucket, String prefix, Instant from, Instant to) throws DriverNotFoundException, DriverException Description copied from interface:DriverApi
Iterator on Objects in specified Bucket with filters (all optionals)- Specified by:
objectsIteratorInBucket
in interfaceDriverApi
- Throws:
DriverNotFoundException
DriverException
-
directoryOrObjectExistsInBucket
public StorageType directoryOrObjectExistsInBucket(String bucket, String directoryOrObject) throws DriverException Description copied from interface:DriverApi
Check if Directory or Object exists in specified Bucket (based on prefix)- Specified by:
directoryOrObjectExistsInBucket
in interfaceDriverApi
- Throws:
DriverException
-
objectPrepareCreateInBucket
public void objectPrepareCreateInBucket(StorageObject object, InputStream inputStream) throws DriverNotFoundException, DriverAlreadyExistException, DriverException Description copied from interface:DriverApi
First step in creation of an object within a Bucket. The InputStream is ready to be read in a concurrent independent thread to be provided by the driver. Sha256 might be null or empty. Len might be 0, meaning unknown.- Specified by:
objectPrepareCreateInBucket
in interfaceDriverApi
- Parameters:
object
- contains various information that could be implemented within Object Storage, but, except the name of the bucket and the key of the object, nothing is mandatory- Throws:
DriverNotFoundException
DriverAlreadyExistException
DriverException
-
objectFinalizeCreateInBucket
public StorageObject objectFinalizeCreateInBucket(String bucket, String object, long realLen, String sha256) throws DriverNotFoundException, DriverAlreadyExistException, DriverException Description copied from interface:DriverApi
Second step in creation of an object within a Bucket. Sha256 might be null or empty. Reallen must not be 0. This method waits for the prepare method to end and returns the final result.- Specified by:
objectFinalizeCreateInBucket
in interfaceDriverApi
- Returns:
- the StorageObject as instantiated within the Object Storage (real values)
- Throws:
DriverNotFoundException
DriverAlreadyExistException
DriverException
-
objectCopy
public StorageObject objectCopy(StorageObject objectSource, StorageObject objectTarget) throws DriverNotFoundException, DriverAlreadyExistException, DriverException Copy one object to another one, possibly in a different bucket. Hash and Size come from given source, while Metadata and expired date come from target- Specified by:
objectCopy
in interfaceDriverApi
- Parameters:
objectSource
- source objectobjectTarget
- target object- Throws:
DriverNotFoundException
DriverAlreadyExistException
DriverException
-
forTestsOnlyCreateMultipleObjects
public void forTestsOnlyCreateMultipleObjects(StorageObject object, long realLen, String sha256, List<String> names) throws DriverNotFoundException, DriverAlreadyExistException, DriverException Take the object as base definition, and use name from list -
objectGetInputStreamInBucket
public InputStream objectGetInputStreamInBucket(String bucket, String object) throws DriverNotFoundException, DriverException Description copied from interface:DriverApi
Get the content of the specified Object within specified Bucket- Specified by:
objectGetInputStreamInBucket
in interfaceDriverApi
- Throws:
DriverNotFoundException
DriverException
-
objectGetMetadataInBucket
public StorageObject objectGetMetadataInBucket(String bucket, String object) throws DriverNotFoundException, DriverException Description copied from interface:DriverApi
Get the Object metadata from this Bucket (those available from Object Storage)- Specified by:
objectGetMetadataInBucket
in interfaceDriverApi
- Throws:
DriverNotFoundException
DriverException
-
objectDeleteInBucket
public void objectDeleteInBucket(String bucket, String object) throws DriverNotAcceptableException, DriverNotFoundException, DriverException Description copied from interface:DriverApi
Delete the Object from this Bucket- Specified by:
objectDeleteInBucket
in interfaceDriverApi
- Throws:
DriverNotAcceptableException
DriverNotFoundException
DriverException
-
close
public void close()Description copied from interface:DriverApi
Close with no exception. Closes this resource, relinquishing any underlying resources. This method is invoked automatically on objects managed by the try-with-resources statement.
-