-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
599a3cb
commit bb558e0
Showing
1 changed file
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
component extends="org.lucee.cfml.test.LuceeTestCase" labels="s3" { | ||
function run( testResults , testBox ) { | ||
describe( title="Test suite for S3ClearBucket()", body=function() { | ||
it(title="check region with blackbaze",skip=Util::isBackBlazeNotSupported(), body = function( currentSpec ) { | ||
testit(Util::getBackBlazeCredentials()); | ||
}); | ||
|
||
it(title="check with amazon",skip=Util::isAWSNotSupported(), body = function( currentSpec ) { | ||
testit(Util::getAWSCredentials()); | ||
}); | ||
|
||
it(title="check with wasabi",skip=Util::isWasabiNotSupported(), body = function( currentSpec ) { | ||
testit(Util::getWasabiCredentials()); | ||
}); | ||
|
||
it(title="check with google",skip=Util::isGoogleNotSupported(), body = function( currentSpec ) { | ||
testit(Util::getGoogleCredentials()); | ||
}); | ||
|
||
}); | ||
} | ||
|
||
|
||
private function testit(cred) { | ||
try { | ||
// create variables | ||
var bucketName=cred.PREFIX&"-clear-bucket"; | ||
var objectName="sub/test.txt"; | ||
|
||
|
||
// create source bucket | ||
if(!S3Exists( | ||
bucketName:bucketName, objectName:objectName, | ||
accessKeyId:cred.ACCESS_KEY_ID, secretAccessKey:cred.SECRET_KEY, host:(isNull(cred.HOST)?nullvalue():cred.HOST))) { | ||
S3Write( | ||
value:"Susi Sorglos", | ||
bucketName:bucketName, objectName:objectName, | ||
accessKeyId:cred.ACCESS_KEY_ID, secretAccessKey:cred.SECRET_KEY, host:(isNull(cred.HOST)?nullvalue():cred.HOST)); | ||
} | ||
|
||
var kids=S3ListBucket(bucketName:bucketName, accessKeyId:cred.ACCESS_KEY_ID, secretAccessKey:cred.SECRET_KEY,host:(isNull(cred.HOST)?nullvalue():cred.HOST)); | ||
assertTrue(kids.recordcount>0); | ||
|
||
S3ClearBucket(bucketName:bucketName, accessKeyId:cred.ACCESS_KEY_ID, secretAccessKey:cred.SECRET_KEY,host:(isNull(cred.HOST)?nullvalue():cred.HOST)); | ||
|
||
var kids=S3ListBucket(bucketName:bucketName, accessKeyId:cred.ACCESS_KEY_ID, secretAccessKey:cred.SECRET_KEY,host:(isNull(cred.HOST)?nullvalue():cred.HOST)); | ||
assertTrue(kids.recordcount==0); | ||
} | ||
finally { | ||
Util::deleteBucketEL(cred,bucketName); | ||
} | ||
} | ||
|
||
|
||
private function doFind(value){ | ||
return value EQ "world"; | ||
} | ||
|
||
} |