From ec4fbbb42929fa9a222149a6253505a47a9796dd Mon Sep 17 00:00:00 2001 From: Zac Spitzer Date: Tue, 10 Dec 2024 12:53:03 +0100 Subject: [PATCH] LDEV-5187 use server scope for query async test --- test/_testRunner.cfc | 2 +- test/tags/Query.cfc | 38 +++++++++++++++----------------------- 2 files changed, 16 insertions(+), 24 deletions(-) diff --git a/test/_testRunner.cfc b/test/_testRunner.cfc index 1808173795..e797ba5862 100644 --- a/test/_testRunner.cfc +++ b/test/_testRunner.cfc @@ -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); diff --git a/test/tags/Query.cfc b/test/tags/Query.cfc index c96c6aec72..ba637ec4ed 100644 --- a/test/tags/Query.cfc +++ b/test/tags/Query.cfc @@ -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(); @@ -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() {