Skip to content

Commit

Permalink
add additional log to figure out the regression
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeloffner committed Dec 8, 2023
1 parent 0157320 commit 07190ae
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4863,7 +4863,7 @@ private static void _loadExtensionBundles(ConfigServerImpl cs, ConfigImpl config
String md5 = CollectionUtil.md5(children);
if (!changed) {
if (md5.equals(config.getExtensionsMD5())) {
return;
// return;
}
}
try {
Expand Down
30 changes: 13 additions & 17 deletions core/src/main/java/lucee/runtime/engine/CFMLEngineImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ public static String toList(Collection<ExtensionDefintion> coll) {
}

public int deployBundledExtension(boolean validate) {
return deployBundledExtension(getConfigServerImpl(), validate);
return deployBundledExtension(getConfigServerImpl(null, false, true), validate);
}

private int deployBundledExtension(ConfigServerImpl cs, boolean validate) {
Expand Down Expand Up @@ -799,7 +799,7 @@ public void addServletConfig(ServletConfig config) throws ServletException {
servletConfigs.add(config);
String real = ReqRspUtil.getRootPath(config.getServletContext());
if (!initContextes.containsKey(real)) {
CFMLFactory jspFactory = loadJSPFactory(getConfigServerImpl(), config, initContextes.size());
CFMLFactory jspFactory = loadJSPFactory(getConfigServerImpl(null, false, false), config, initContextes.size());
initContextes.put(real, jspFactory);
}
}
Expand Down Expand Up @@ -887,36 +887,32 @@ private Object extractServletContext(Object sc) {

@Override
public ConfigServer getConfigServer(Password password) throws PageException {
getConfigServerImpl().checkAccess(password);
getConfigServerImpl(null, false, false).checkAccess(password);
return configServer;
}

@Override
public ConfigServer getConfigServer(String key, long timeNonce) throws PageException {
getConfigServerImpl().checkAccess(key, timeNonce);
getConfigServerImpl(null, false, false).checkAccess(key, timeNonce);
return configServer;
}

public void setConfigServerImpl(ConfigServerImpl cs) {
this.configServer = cs;
}

private ConfigServerImpl getConfigServerImpl() {
return getConfigServerImpl(null, false, false);
}

private ConfigServerImpl getConfigServerImpl(ConfigServerImpl existing, boolean essentialOnly, boolean allowGrapingThreadConfig) {
if (configServer == null) {
print.ds("--->>> getConfigServerImpl");
print.e("--->>> getConfigServerImpl");
// if in process to be build, this may only exists with the thread yet
if (true) {
if (allowGrapingThreadConfig) {
Config config = ThreadLocalPageContext.getConfig();
if (config instanceof ConfigServerImpl) {
print.e("--->>> config server");
print.ds("--->>> config server");
// return (ConfigServerImpl) config;
}
if (config instanceof ConfigWebImpl) {
print.e("--->>> config web");
print.ds("--->>> config web");
// return ((ConfigWebImpl) config).getConfigServerImpl();
}
}
Expand Down Expand Up @@ -1157,7 +1153,7 @@ public CFMLFactory getCFMLFactory(ConfigServerImpl cs, ServletConfig srvConfig,
ServletContext srvContext = srvConfig.getServletContext();

String real = ReqRspUtil.getRootPath(srvContext);
if (cs == null) cs = getConfigServerImpl();
if (cs == null) cs = getConfigServerImpl(null, false, true);

// Load JspFactory

Expand Down Expand Up @@ -1321,12 +1317,12 @@ public URL getUpdateLocation() {

@Override
public Identification getIdentification() {
return getConfigServerImpl().getIdentification();
return getConfigServerImpl(null, false, true).getIdentification();
}

@Override
public boolean can(int type, Password password) {
return getConfigServerImpl().passwordEqual(password);
return getConfigServerImpl(null, false, true).passwordEqual(password);
}

@Override
Expand Down Expand Up @@ -1362,7 +1358,7 @@ public void reset(String configId) {
// release HTTP Pool
HTTPEngine4Impl.releaseConnectionManager();

releaseCache(getConfigServerImpl());
releaseCache(getConfigServerImpl(null, false, true));

CFMLFactoryImpl cfmlFactory;
// ScopeContext scopeContext;
Expand Down Expand Up @@ -1516,7 +1512,7 @@ public Strings getStringUtil() {
public Object getFDController() {
engine.allowRequestTimeout(false);

return new FDControllerImpl(engine, engine.getConfigServerImpl().getSerialNumber());
return new FDControllerImpl(engine, engine.getConfigServerImpl(null, false, true).getSerialNumber());
}

public Map<String, CFMLFactory> getCFMLFactories() {
Expand Down
11 changes: 10 additions & 1 deletion test/tickets/LDEV1269.cfc
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
component extends="org.lucee.cfml.test.LuceeTestCase"{
function run( testResults , testBox ) {
describe( title="Test suite for LDEV-1269", body=function() {
it( title="checking QoQ operations", body=function( currentSpec ) {
it( title="checking QoQ operations",skip=isMySqlNotSupported(), body=function( currentSpec ) {

var uri = createURI("LDEV1269/test.cfm");
var result = _InternalRequest(
template:uri
Expand All @@ -15,4 +16,12 @@ component extends="org.lucee.cfml.test.LuceeTestCase"{
var baseURI = "/test/#listLast(getDirectoryFromPath(getCurrenttemplatepath()),"\/")#/";
return baseURI & "" & calledName;
}

private function isMySqlNotSupported() {
return isEmpty(mySqlCredentials());
}

private struct function mySqlCredentials() {
return server.getDatasource("mysql");
}
}
28 changes: 16 additions & 12 deletions test/tickets/LDEV2298.cfc
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" {
function run( testResults, testBox ) {
describe( "Test case for LDEV2298, inserting date with null=false, no sqltype", function(){

it( title="queryExecute() column doesn't allow nulls", body = function( currentSpec ) {
it( title="queryExecute() column doesn't allow nulls", skip=isMSSqlNotSupported(), body = function( currentSpec ) {
local.result = _InternalRequest(
template : "#uri#\test.cfm",
forms : {Scene = 1,tablename = 'ldev2298_null'}
);
expect( trim( result.filecontent) ).toInclude("{ts '1900-01-01 00:00:00'}"); // feels wrong, but that's sql server, i.e. SELECT CAST('' AS DATE)
});

it( title="queryExecute() column allows nulls", body = function( currentSpec ) {
it( title="queryExecute() column allows nulls", skip=isMSSqlNotSupported(), body = function( currentSpec ) {
local.result = _InternalRequest(
template : "#uri#\test.cfm",
forms : {Scene = 3,tablename = 'ldev2298_notnull'}
Expand All @@ -26,15 +26,15 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" {

describe( "Test case for LDEV2298, inserting date with null=false, no sqltype, missing date param", function(){

it( title="queryExecute() column doesn't allow nulls", body = function( currentSpec ) {
it( title="queryExecute() column doesn't allow nulls", skip=isMSSqlNotSupported(), body = function( currentSpec ) {
local.result = _InternalRequest(
template : "#uri#\test.cfm",
forms : {Scene = 1,tablename = 'ldev2298_null', passDateParam=false}
);
expect( trim( result.filecontent) ).toInclude("param [utcNow] not found");
});

it( title="queryExecute() column allows nulls", body = function( currentSpec ) {
it( title="queryExecute() column allows nulls", skip=isMSSqlNotSupported(), body = function( currentSpec ) {
local.result = _InternalRequest(
template : "#uri#\test.cfm",
forms : {Scene = 3,tablename = 'ldev2298_notnull', passDateParam=false}
Expand All @@ -45,15 +45,15 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" {

describe( "Test case for LDEV2298, inserting date with null=false, with sqltype, via array of structs", function(){

it( title="queryExecute() column allows nulls", body = function( currentSpec ) {
it( title="queryExecute() column allows nulls", skip=isMSSqlNotSupported(), body = function( currentSpec ) {
local.result = _InternalRequest(
template : "#uri#\test.cfm",
forms : {Scene = 4,tablename = 'ldev2298_null'}
);
expect( trim( result.filecontent) ).toInclude("can't cast [] to date value");
});

it( title="queryExecute() column doesn't allow nulls", body = function( currentSpec ) {
it( title="queryExecute() column doesn't allow nulls", skip=isMSSqlNotSupported(), body = function( currentSpec ) {
local.result = _InternalRequest(
template : "#uri#\test.cfm",
forms : {Scene = 2,tablename = 'ldev2298_notnull'}
Expand All @@ -65,15 +65,15 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" {

describe( "Test case for LDEV2298, inserting date with null=false, with sqltype, via array of structs, missing date param", function(){

it( title="queryExecute() column allows nulls", body = function( currentSpec ) {
it( title="queryExecute() column allows nulls", skip=isMSSqlNotSupported(), body = function( currentSpec ) {
local.result = _InternalRequest(
template : "#uri#\test.cfm",
forms : {Scene = 4,tablename = 'ldev2298_null', passDateParam=false}
);
expect( trim( result.filecontent) ).toInclude("param [utcNow] not found");
});

it( title="queryExecute() column doesn't allow nulls", body = function( currentSpec ) {
it( title="queryExecute() column doesn't allow nulls", skip=isMSSqlNotSupported(), body = function( currentSpec ) {
local.result = _InternalRequest(
template : "#uri#\test.cfm",
forms : {Scene = 2,tablename = 'ldev2298_notnull', passDateParam=false}
Expand All @@ -86,15 +86,15 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" {
describe( "Test case for LDEV2298, inserting date with null=false, with sqltype", function(){


it( title="queryExecute() column allows nulls", body = function( currentSpec ) {
it( title="queryExecute() column allows nulls", skip=isMSSqlNotSupported(), body = function( currentSpec ) {
local.result = _InternalRequest(
template : "#uri#\test.cfm",
forms : {Scene = 4,tablename = 'ldev2298_null'}
);
expect( trim( result.filecontent) ).toInclude("can't cast [] to date value");
});

it( title="queryExecute() column doesn't allow nulls", body = function( currentSpec ) {
it( title="queryExecute() column doesn't allow nulls", skip=isMSSqlNotSupported(), body = function( currentSpec ) {
local.result = _InternalRequest(
template : "#uri#\test.cfm",
forms : {Scene = 2,tablename = 'ldev2298_notnull',}
Expand All @@ -106,15 +106,15 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" {

describe( "Test case for LDEV2298, inserting date with null=true, with sqltype", function(){

it( title="queryExecute() column allows nulls", body = function( currentSpec ) {
it( title="queryExecute() column allows nulls", skip=isMSSqlNotSupported(), body = function( currentSpec ) {
local.result = _InternalRequest(
template : "#uri#\test.cfm",
forms : {Scene = 4,tablename = 'ldev2298_null', allowNull=true}
);
expect( trim( result.filecontent) ).toBe("");
});

it( title="queryExecute() column doesn't allow nulls", body = function( currentSpec ) {
it( title="queryExecute() column doesn't allow nulls", skip=isMSSqlNotSupported(), body = function( currentSpec ) {
local.result = _InternalRequest(
template : "#uri#\test.cfm",
forms : {Scene = 2,tablename = 'ldev2298_notnull',allowNull=true}
Expand All @@ -129,4 +129,8 @@ component extends = "org.lucee.cfml.test.LuceeTestCase" {
var baseURI="/test/#listLast(getDirectoryFromPath(getCurrenttemplatepath()),"\/")#/";
return baseURI&""&calledName;
}

private function isMSSqlNotSupported() {
return isEmpty(server.getDatasource("mssql"));
}
}
14 changes: 8 additions & 6 deletions test/tickets/LDEV4181.cfc
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
component extends="org.lucee.cfml.test.LuceeTestCase" skip="false" labels="qoq" {

variables.mysql = server.getDatasource("mysql");



function beforeAll(){
if ( !hasMysql() )
if ( isMySqlNotSupported() )
return;
afterAll();
queryExecute(
Expand All @@ -18,7 +20,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" skip="false" labels="qoq"
};

function afterAll(){
if ( !hasMysql() )
if ( isMySqlNotSupported() )
return;
queryExecute(
sql="drop table if exists ldev4181",
Expand All @@ -29,13 +31,13 @@ component extends="org.lucee.cfml.test.LuceeTestCase" skip="false" labels="qoq"

};

private function hasMysql(){
return !isEmpty(variables.mysql);
private function isMySqlNotSupported() {
return isEmpty(variables.mysql);
}

function run( testResults , testBox ) {
describe( title="Testcase for LDEV-4181", body=function() {
it(title="Checking QoQ with numeric column, trailing 000s", body = function( currentSpec ) {
it(title="Checking QoQ with numeric column, trailing 000s", skip=isMySqlNotSupported(), body = function( currentSpec ) {
var qry = queryNew( 'id,test', 'numeric,string', [ [1,',1,10'],[2,',2,20'],[3,',3,30'],[4,',4,40'],[5,',5,50'],[10,',10,100'],[15,',15,150'] ] );
var queryResult = queryExecute("
SELECT id
Expand All @@ -47,7 +49,7 @@ component extends="org.lucee.cfml.test.LuceeTestCase" skip="false" labels="qoq"
expect(valueList(queryResult.id)).tobe("1,10,15");
});

it(title="Checking mysql query with numeric column, trailing 000s", body = function( currentSpec ) {
it(title="Checking mysql query with numeric column, trailing 000s", skip=isMySqlNotSupported(), body = function( currentSpec ) {
var price = 3.14;
queryExecute(
sql="INSERT INTO ldev4181 ( id, price ) VALUES ( :id, :price )",
Expand Down

0 comments on commit 07190ae

Please sign in to comment.