Skip to content

Commit

Permalink
LDEV-5187 use server scope for query async test
Browse files Browse the repository at this point in the history
  • Loading branch information
zspitzer committed Dec 10, 2024
1 parent 7034338 commit ec4fbbb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 24 deletions.
2 changes: 1 addition & 1 deletion test/_testRunner.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ component {
onBundleStart = function( cfc, testResults ){
var meta = getComponentMetadata( cfc );
systemOutput( "" , true );
// application name="testBundle-#meta.name#"; // TODO see https://luceeserver.atlassian.net/browse/LDEV-5187
application name="testBundle-#meta.name#";
//systemOutput(structKeyList(getApplicationSettings().mappings), true );
SystemOut.setOut( out );
//SystemOut.setErr(err);
Expand Down
38 changes: 15 additions & 23 deletions test/tags/Query.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ component extends="org.lucee.cfml.test.LuceeTestCase" {
//processingdirective pageencoding="UTF-8";
variables.suffix="Query";

function afterAll(){
structDelete( server, "query_testAsynUDF");
}

public function beforeTests(){
defineDatasource();

Expand Down Expand Up @@ -223,36 +227,24 @@ component extends="org.lucee.cfml.test.LuceeTestCase" {
testAsyn(new query.QueryListener2(tbl),tbl,1);
}

public void function testAsynUDF() {
var udf=function (caller,args,result,meta) {
arguments.args.sql="insert into QueryTestAsync(id,i,dec) values('6',1,1.0)"; // change SQL
request.query_testAsynUDF=true;
return arguments;
};
var tbl="QueryTestAsync";
request.query_testAsynUDF=false;
testAsyn(udf,tbl,0);
sleep(500);
expect(request.query_testAsynUDF).toBeTrue();
structDelete(request, "query_testAsynUDF");
}

// Query Listener UDFs don't have the current application scope https://luceeserver.atlassian.net/browse/LDEV-5187
public void function testAsynUDFApplicationScope() skip="true" {
/*
Async Query Listener UDFs get the current application scope
but get the default name="" application scope instead
https://luceeserver.atlassian.net/browse/LDEV-5187
*/
public void function testAsynUDF {
server.query_testAsynUDF=false;
var udf=function (caller,args,result,meta) {
arguments.args.sql="insert into QueryTestAsync(id,i,dec) values('6',1,1.0)"; // change SQL
application.query_testAsynUDF=true;
systemOutput(application.query_testAsynUDF & " listener [#getApplicationSettings().name#]", true);
systemOutput(arguments, true);
server.query_testAsynUDF=true;
return arguments;
};
var tbl="QueryTestAsync";
application.query_testAsynUDF=false;
systemOutput(application.query_testAsynUDF & " pre test, [#getApplicationSettings().name#]" , true);
server.query_testAsynUDF=false;
testAsyn(udf,tbl,0);
sleep(500);
systemOutput(application.query_testAsynUDF & " post test, [#getApplicationSettings().name#]" , true);
expect(application.query_testAsynUDF).toBeTrue();
expect(server.query_testAsynUDF).toBeTrue();
structDelete( server, "query_testAsynUDF");
}

public void function testAsynStructUDF() {
Expand Down

0 comments on commit ec4fbbb

Please sign in to comment.