Introduction


This page shows how you can verify whether some object (file) is present at some Amazon S3-compatible storage.

As in other RBV components the benefit is that verification client retries (verifies) as many times as needed in order to check that expected condition is or becomes true.



Constructing the verification object


import com.axway.ats.rbv.clients.S3Verification;

// Make an instance of the verification object.
S3Verification s3Verification = new S3Verification( endpoint, accessKey, secretKey, bucketName, basePath, objName, isRecursive );

This instance constructs verification object for checks:

  • at specified endpoint and bucketName
  • about objName which should exist in basePath "directory" or some some sub-directory.
    Note that directories are not real but emulated in Amazon S3 storage and default separator is "/" (slash). 

 What this object should have as properties is specified by verification rules mentioned in next section.



Add verification rules


Using the different check... methods you can add as many checks as you need.


// check the size of the object in bytes
s3Verification.checkSize( 62 );
// alternatively use s3Verification.checkSizeDifferent( 123 );

// verify the file MD5 sum by providing the exact sum
s3Verification.checkMd5( "560bba529205da4d92bebb026b2e6e8b" );

// verify last modification timestamp
s3Verification.checkModificationTime( expectedTime );

So far we have just specified what kind of object (file) we are interested in.

But the actual verification starts at the moment you call one of the verify... methods

 


Verify that object exists


Keep polling until expected set of rules becomes true, i.e. object is (or not) present and all property checks are met.

Fail if the searched file is not found for all polling attempts.

s3Verification.verifyObjectExists();

Upon successful checks test continues. If not all of the rules match within the expected time frame then an exception will be thrown and test fails.

 


Verify that object does not exist

Keep polling until verify the searched object is NOT present.

Fail if the searched object is present for all polling attempts.

s3Verification.verifyObjectDoesNotExist();

 


Verify that object always exists

The next code will succeed if the searched object is present for all polling attempts, otherwise it will fail.

s3Verification.verifyObjectAlwaysExists();

 


Verify that object never exists

The next code will succeed if the searched object is NOT present for all polling attempts, otherwise it will fail.

s3Verification.verifyObjectNeverExist();



Back to parent page

Go to Table of Contents