-
Notifications
You must be signed in to change notification settings - Fork 8
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
724fb2c
commit b2dc172
Showing
2 changed files
with
41 additions
and
1 deletion.
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
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,41 @@ | ||
component extends="org.lucee.cfml.test.LuceeTestCase" { | ||
|
||
function run( testResults , testBox ) { | ||
describe( "Loud test", function() { | ||
it( 'make a load test', parallel); | ||
}); | ||
|
||
} | ||
|
||
private function parallel() threadCount=10 repetitition=2 { | ||
var udfs=getPageContext().getUDFs(); | ||
var meta=getMetadata(udfs[len(udfs)]); | ||
|
||
if(meta.threadcount<1 || meta.threadcount>1000) { | ||
throw "thread count need to be a number between 1 and 1000, now it is [#meta.threadcount#]"; | ||
} | ||
if(meta.repetitition<1 || meta.repetitition>1000) { | ||
throw "repetitition need to be a number between 1 and 1000, now it is [#meta.repetitition#]"; | ||
} | ||
if(meta.threadcount==1 || meta.repetitition==1) { | ||
throw "repetitition or thread count need to be bigger than 1"; | ||
|
||
var names = []; | ||
for (var i = 1; i <= arguments.repetitition; i++) { | ||
for (var y = 1; y <= arguments.threadcount; y++) { | ||
var name="testThread:#i#:#y#"; | ||
arrayAppend(names, name); | ||
thread action="run" name=name udf=code args=arguments { | ||
udf(argumentCollection:args); | ||
} | ||
} | ||
} | ||
thread action="join" name=arrayToList(names); | ||
|
||
} | ||
|
||
private function code() { | ||
systemOutput("execute the code",1,1); | ||
} | ||
|
||
} |