# Demonstrate difference in cfcomponent method query json serialization
# and preserveCaseForQueryColumn between lucee 5 and 6
#
# https://dev.lucee.org/t/preservecaseforquerycolumn-no-longer-working/14269
# https://luceeserver.atlassian.net/browse/LDEV-5518
#
# Start up both lucee 5 and 6 servers with Docker compose:
#
# docker compose up -d
#
# Then load responses to see the difference in column case:
# Lucee 5:
# http://localhost:7005/Test.cfc?method=test
# Lucee 6:
# http://localhost:7006/Test.cfc?method=test
#
# If changes are made to the configs files here,
# remove the existing containers before restarting
#
# docker compose down && docker compose up -d

services:
  lucee5:
    image: lucee/lucee:5.4.6.9-tomcat9.0-jre8-temurin-jammy
    configs:
      - source: Application.cfc
        target: /var/www/Application.cfc
      - source: Test.cfc
        target: /var/www/Test.cfc
    ports:
      - 7005:8888

  lucee6:
    image: lucee/lucee:6.2.1.116-SNAPSHOT-tomcat11.0-jre21-temurin-noble
    configs:
      - source: Application.cfc
        target: /var/www/Application.cfc
      - source: Test.cfc
        target: /var/www/Test.cfc
    ports:
      - 7006:8888

configs:
  Application.cfc:
    content: |
      <cfcomponent output="false">
        <cfscript>
          this.serialization.preserveCaseForQueryColumn = false;
        </cfscript>
      </cfcomponent>
  Test.cfc:
    content: |
      <cfcomponent output="false">
        <cffunction name="test" access="remote" output="false" returntype="query" returnformat="json">
          <cfscript>
            return queryNew(
              "iD,NaMe",
              "numeric,varchar",
              {
                id: [1,2,3],
                name: ['Neo','Trinity','Morpheus']
              }
            );
          </cfscript>
        </cffunction>
      </cfcomponent>
