From 9f8e4016e14ab70763bfc516faaa2f65a1974cf2 Mon Sep 17 00:00:00 2001 From: Luis Majano <lmajano@gmail.com> Date: Tue, 11 Jan 2022 10:22:06 +0100 Subject: [PATCH 1/7] version bump --- box.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/box.json b/box.json index de9bc2b..b888462 100644 --- a/box.json +++ b/box.json @@ -1,6 +1,6 @@ { "name":"MockDataCFC", - "version":"3.5.0", + "version":"3.6.0", "location":"https://downloads.ortussolutions.com/ortussolutions/coldbox-modules/MockDataCFC/@build.version@/MockDataCFC-@build.version@.zip", "author":"Ortus Solutions", "homepage":"https://github.com/Ortus-Solutions/MockDataCFC", From 5c32c1bc652be958ad0ca18469f62eab9e58d7a2 Mon Sep 17 00:00:00 2001 From: Luis Majano <lmajano@gmail.com> Date: Thu, 13 Jan 2022 14:59:33 +0100 Subject: [PATCH 2/7] Create FUNDING.YML --- .github/FUNDING.YML | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/FUNDING.YML diff --git a/.github/FUNDING.YML b/.github/FUNDING.YML new file mode 100644 index 0000000..7e59d13 --- /dev/null +++ b/.github/FUNDING.YML @@ -0,0 +1 @@ +patreon: ortussolutions From fa1975845bb17ab3ad54d90a73eca705ab648c68 Mon Sep 17 00:00:00 2001 From: Eric Peterson <elpete@users.noreply.github.com> Date: Fri, 1 Apr 2022 17:26:30 -0600 Subject: [PATCH 3/7] Make dateRange actually work --- models/MockData.cfc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/models/MockData.cfc b/models/MockData.cfc index 31d6bd1..019b38f 100644 --- a/models/MockData.cfc +++ b/models/MockData.cfc @@ -703,8 +703,7 @@ component { timeFormat = "medium" ){ var timeDifference = dateDiff( "s", arguments.from, arguments.to ); - var timeIncrement = createTimespan( 0, 0, 0, randRange( 0, timeDifference ) ); - var result = arguments.from + timeIncrement; + var result = dateAdd( "s", randRange( 0, timeDifference ), arguments.from ); if ( arguments.showTime ) { return dateFormat( result, arguments.dateFormat ) & " " & timeFormat( result, arguments.timeFormat ); From e448b6b4e113d5edb0632a27d9cd447fe8f25b98 Mon Sep 17 00:00:00 2001 From: Eric Peterson <eric@elpete.com> Date: Mon, 23 May 2022 09:56:10 -0600 Subject: [PATCH 4/7] chore(LICENSE): Add MIT License --- LICENSE | 21 +++++++++++++++++++++ box.json | 6 ++++++ 2 files changed, 27 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..4cf8113 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 Eric Peterson + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/box.json b/box.json index b888462..d035abd 100644 --- a/box.json +++ b/box.json @@ -9,6 +9,12 @@ "type":"git", "URL":"https://github.com/Ortus-Solutions/MockDataCFC" }, + "license":[ + { + "type":"MIT", + "URL":"https://github.com/Ortus-Solutions/MockDataCFC/LICENSE" + } + ], "bugs":"https://github.com/Ortus-Solutions/MockDataCFC/issues", "slug":"mockdatacfc", "shortDescription":"MockData is a service to generate fake JSON data via command line arguments, CFC calls or embedded RESTFul service", From 82bce06cfdf1d52522c8a90454880aa62a9be0e8 Mon Sep 17 00:00:00 2001 From: Luis Majano <lmajano@gmail.com> Date: Thu, 22 Sep 2022 12:14:16 +0200 Subject: [PATCH 5/7] new module layouts and testibng --- test-harness/.cfconfig.json => .cfconfig.json | 17 +-- .github/workflows/ci.yml | 110 +--------------- .github/workflows/gh-release.yml | 27 ++++ .github/workflows/pr.yml | 78 +----------- .github/workflows/tests.yml | 117 ++++++++++++++++++ box.json | 27 +++- build/Build.cfc | 2 + changelog.md | 12 ++ ...-adobe@2018.json => server-adobe@2018.json | 11 +- ...-adobe@2021.json => server-adobe@2021.json | 9 +- ...server-lucee@5.json => server-lucee@5.json | 11 +- test-harness/box.json | 4 +- test-harness/config/Coldbox.cfc | 12 +- test-harness/server-adobe@2016.json | 16 --- test-harness/tests/Application.cfc | 52 ++++++-- 15 files changed, 277 insertions(+), 228 deletions(-) rename test-harness/.cfconfig.json => .cfconfig.json (74%) create mode 100644 .github/workflows/gh-release.yml create mode 100644 .github/workflows/tests.yml rename test-harness/server-adobe@2018.json => server-adobe@2018.json (58%) rename test-harness/server-adobe@2021.json => server-adobe@2021.json (59%) rename test-harness/server-lucee@5.json => server-lucee@5.json (57%) delete mode 100644 test-harness/server-adobe@2016.json diff --git a/test-harness/.cfconfig.json b/.cfconfig.json similarity index 74% rename from test-harness/.cfconfig.json rename to .cfconfig.json index 2d64dd1..6e65198 100644 --- a/test-harness/.cfconfig.json +++ b/.cfconfig.json @@ -1,8 +1,9 @@ -{ - "debuggingEnabled":true, - "debuggingReportExecutionTimes":false, - "disableInternalCFJavaComponents":false, - "inspectTemplate":"always", - "requestTimeout":"0,0,0,90", - "robustExceptionEnabled":true -} \ No newline at end of file +{ + "adminPassword" : "coldbox", + "debuggingEnabled":true, + "debuggingReportExecutionTimes":false, + "disableInternalCFJavaComponents":false, + "inspectTemplate":"always", + "requestTimeout":"0,0,5,0", + "robustExceptionEnabled":true +} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb994c6..ec7bd3d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,100 +15,9 @@ jobs: # Tests First baby! We fail, no build :( ############################################# tests: - name: Tests - runs-on: ubuntu-20.04 - env: - DB_USER: root - DB_PASSWORD: root - strategy: - fail-fast: false - matrix: - cfengine: [ "lucee@5", "adobe@2016", "adobe@2018", "adobe@2021" ] - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Setup Java - uses: actions/setup-java@v2 - with: - distribution: "adopt" - java-version: "11" - - - name: Cache CommandBox Dependencies - uses: actions/cache@v1 - if: ${{ true }} - with: - path: ~/.CommandBox/artifacts - key: ${{ runner.OS }}-commandbox-cache-${{ hashFiles( 'box.json' ) }}-${{ hashFiles( 'test-harness/box.json' ) }} - restore-keys: | - ${{ runner.OS }}-commandbox-cache-${{ hashFiles( 'box.json' ) }}-${{ hashFiles( 'test-harness/box.json' ) }} - - - name: Setup CommandBox - uses: elpete/setup-commandbox@v1.0.0 - - - name: Install Test Harness Dependencies - working-directory: ./test-harness - run: | - box install - - - name: Start ${{ matrix.cfengine }} Server - working-directory: ./test-harness - run: | - box server start serverConfigFile="server-${{ matrix.cfengine }}.json" --noSaveSettings --debug - # Install Adobe 2021 cfpm modules - if [[ "${{ matrix.cfengine }}" == "adobe@2021" ]] ; then - box run-script install:2021 - fi - curl http://127.0.0.1:60299 - - - name: Run Tests - working-directory: ./test-harness - run: | - mkdir tests/results - box package set testbox.runner="http://localhost:60299/tests/runner.cfm" - box testbox run --verbose outputFile=tests/results/test-results outputFormats=json,antjunit - - - name: Publish Test Results - uses: EnricoMi/publish-unit-test-result-action@v1 - if: always() - with: - files: test-harness/tests/results/**/*.xml - check_name: "${{ matrix.cfengine }} Test Results" - - - name: Upload Test Results Artifacts - if: always() - uses: actions/upload-artifact@v2 - with: - name: test-results-${{ matrix.cfengine }} - path: | - test-harness/tests/results/**/* - - - name: Slack Notification - if: failure() - uses: rtCamp/action-slack-notify@v2 - env: - SLACK_CHANNEL: coding - SLACK_COLOR: ${{ job.status }} # or a specific color like 'green' or '#ff00ff' - SLACK_ICON_EMOJI: ":bell:" - SLACK_MESSAGE: '${{ env.MODULE_ID }} tests failed :cry:' - SLACK_TITLE: ${{ env.MODULE_ID }} Tests For ${{ matrix.cfengine }} failed - SLACK_USERNAME: CI - SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} - - - name: Failure Debugging Info - if: ${{ failure() }} - working-directory: ./test-harness - run: | - box server log serverConfigFile="server-${{ matrix.cfengine }}.json" - - - name: Upload Debugging Info To Artifacts - if: ${{ failure() }} - uses: actions/upload-artifact@v2 - with: - name: Failure Debugging Info - ${{ matrix.cfengine }} - path: | - test-harness/.engine/**/logs/* - test-harness/.engine/**/WEB-INF/cfusion/logs/* + uses: ./.github/workflows/tests.yml + secrets: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} ############################################# # Build Module @@ -129,19 +38,10 @@ jobs: distribution: "adopt" java-version: "11" - - name: Cache CommandBox Dependencies - uses: actions/cache@v1 - if: ${{ true }} - with: - path: ~/.CommandBox/artifacts - key: ${{ runner.OS }}-commandbox-cache-${{ hashFiles( 'box.json' ) }}-${{ hashFiles( 'test-harness/box.json' ) }} - restore-keys: | - ${{ runner.OS }}-commandbox-cache-${{ hashFiles( 'box.json' ) }}-${{ hashFiles( 'test-harness/box.json' ) }} - - name: Setup CommandBox - uses: elpete/setup-commandbox@v1.0.0 + uses: Ortus-Solutions/setup-commandbox@main with: - forgeboxAPIKey: ${{ secrets.FORGEBOX_API_TOKEN }} + forgeboxAPIKey: ${{ secrets.FORGEBOX_TOKEN }} - name: Setup Environment Variables For Build Process id: current_version diff --git a/.github/workflows/gh-release.yml b/.github/workflows/gh-release.yml new file mode 100644 index 0000000..90cf619 --- /dev/null +++ b/.github/workflows/gh-release.yml @@ -0,0 +1,27 @@ +name: Pull Requests + +on: + pull_request: + branches: + - development + +jobs: + tests: + uses: coldbox-modules/MockDataCFC/.github/workflows/tests.yml@development + + # Format PR + format: + name: Format + runs-on: ubuntu-20.04 + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - uses: Ortus-Solutions/commandbox-action@v1.0.2 + with: + cmd: run-script format + + - name: Commit Format Changes + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Apply cfformat changes diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 0567b70..90cf619 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -1,74 +1,15 @@ name: Pull Requests on: - push: - branches-ignore: - - "main" - - "master" - - "development" pull_request: branches: - development jobs: tests: - name: Tests - runs-on: ubuntu-20.04 - env: - DB_USER: root - DB_PASSWORD: root - strategy: - fail-fast: true - matrix: - cfengine: [ "lucee@5", "adobe@2016", "adobe@2018", "adobe@2021" ] - steps: - - name: Checkout Repository - uses: actions/checkout@v2 - - - name: Setup Java - uses: actions/setup-java@v2 - with: - distribution: "adopt" - java-version: "11" - - - name: Setup CommandBox - uses: elpete/setup-commandbox@v1.0.0 - - - name: Install Test Harness Dependencies - working-directory: ./test-harness - run: | - box install - - - name: Start ${{ matrix.cfengine }} Server - working-directory: ./test-harness - run: | - box server start serverConfigFile="server-${{ matrix.cfengine }}.json" --noSaveSettings --debug - # Install Adobe 2021 cfpm modules - if [[ "${{ matrix.cfengine }}" == "adobe@2021" ]] ; then - box run-script install:2021 - fi - curl http://127.0.0.1:60299 - - - name: Run Tests - working-directory: ./test-harness - run: | - mkdir tests/results - box package set testbox.runner="http://localhost:60299/tests/runner.cfm" - box testbox run --verbose outputFile=tests/results/test-results outputFormats=json,antjunit - - - name: Publish PR Test Reports - uses: mikepenz/action-junit-report@v2 - with: - report_paths: 'test-harness/tests/results/**/*.xml' - check_name: "${{ matrix.cfengine }} Test Results" - summary: true - - - name: Failure Debugging Info - if: ${{ failure() }} - working-directory: ./test-harness - run: | - box server log serverConfigFile="server-${{ matrix.cfengine }}.json" + uses: coldbox-modules/MockDataCFC/.github/workflows/tests.yml@development + # Format PR format: name: Format runs-on: ubuntu-20.04 @@ -76,20 +17,9 @@ jobs: - name: Checkout Repository uses: actions/checkout@v2 - - name: Setup Java - uses: actions/setup-java@v2 + - uses: Ortus-Solutions/commandbox-action@v1.0.2 with: - distribution: "adopt" - java-version: "11" - - - name: Set Up CommandBox - uses: elpete/setup-commandbox@v1.0.0 - - - name: Install CFFormat - run: box install commandbox-cfformat - - - name: Run CFFormat - run: box run-script format + cmd: run-script format - name: Commit Format Changes uses: stefanzweifel/git-auto-commit-action@v4 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..d8b29d2 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,117 @@ +name: Test Suites + +# We are a reusable Workflow only +on: + workflow_call: + secrets: + SLACK_WEBHOOK_URL: + required: true + +jobs: + tests: + name: Tests + runs-on: ubuntu-20.04 + env: + DB_USER: root + DB_PASSWORD: root + strategy: + fail-fast: false + matrix: + cfengine: [ "lucee@5", "adobe@2018", "adobe@2021" ] + steps: + - name: Checkout Repository + uses: actions/checkout@v2 + + - name: Setup Java + uses: actions/setup-java@v2 + with: + distribution: "adopt" + java-version: "11" + + - name: Setup Database and Fixtures + run: | + #sudo systemctl start mysql.service + # Create Database + #mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} -e 'CREATE DATABASE coolblog;' + # Import Database + #mysql -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} < test-harness/tests/resources/coolblog.sql + + - name: Setup Environment For Testing Process + run: | + # Setup .env + touch .env + # ENV + printf "ENVIRONMENT=development\n" >> .env + printf "DB_HOST=localhost\n" >> .env + printf "DB_USER=${{ env.DB_USER }}\n" >> .env + printf "DB_PASSWORD=${{ env.DB_PASSWORD }}\n" >> .env + printf "DB_CLASS=com.mysql.cj.jdbc.Driver\n" >> .env + printf "DB_BUNDLEVERSION=8.0.19\n" >> .env + printf "DB_BUNDLENAME=com.mysql.cj\n" >> .env + + - name: Setup CommandBox CLI + uses: Ortus-Solutions/setup-commandbox@main + with: + version: 5.4.2 + + - name: Install Dependencies + run: | + box install + cd test-harness && box install + + - name: Start ${{ matrix.cfengine }} Server + run: | + box server start serverConfigFile="server-${{ matrix.cfengine }}.json" --noSaveSettings --debug + # Install Adobe 2021 cfpm modules + if [[ "${{ matrix.cfengine }}" == "adobe@2021" ]] ; then + box run-script install:2021 + fi + curl http://127.0.0.1:60299 + + - name: Run Tests + run: | + mkdir -p test-harness/tests/results + box testbox run --verbose outputFile=test-harness/tests/results/test-results outputFormats=json,antjunit + ls -lR test-harness/tests + + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v1 + if: always() + with: + files: test-harness/tests/results/**/*.xml + check_name: "${{ matrix.cfengine }} Test Results" + + - name: Upload Test Results to Artifacts + if: always() + uses: actions/upload-artifact@v2 + with: + name: test-results-${{ matrix.cfengine }} + path: | + test-harness/tests/results/**/* + + - name: Failure Debugging Log + if: ${{ failure() }} + run: | + box server log serverConfigFile="server-${{ matrix.cfengine }}.json" + + - name: Upload Debugging Log To Artifacts + if: ${{ failure() }} + uses: actions/upload-artifact@v2 + with: + name: Failure Debugging Info - ${{ matrix.cfengine }} + path: | + .engine/**/logs/* + .engine/**/WEB-INF/cfusion/logs/* + + - name: Slack Notifications + # Only on failures and NOT in pull requests + if: ${{ failure() && !startsWith( 'pull_request', github.event_name ) }} + uses: rtCamp/action-slack-notify@v2 + env: + SLACK_CHANNEL: coding + SLACK_COLOR: ${{ job.status }} # or a specific color like 'green' or '#ff00ff' + SLACK_ICON_EMOJI: ":bell:" + SLACK_MESSAGE: '${{ github.repository }} tests failed :cry:' + SLACK_TITLE: ${{ github.repository }} Tests For ${{ matrix.cfengine }} failed + SLACK_USERNAME: CI + SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/box.json b/box.json index d035abd..06c418a 100644 --- a/box.json +++ b/box.json @@ -27,17 +27,32 @@ "Luis Majano <lmajano@ortussolutions.com>" ], "dependencies":{}, - "devDependencies":{}, + "devDependencies":{ + "commandbox-cfformat":"*", + "commandbox-docbox":"*", + "commandbox-dotenv":"*", + "commandbox-cfconfig":"*" + }, "installPaths":{}, "ignore":[ "**/.*", + "build/**", "test-harness", - "*/.md" + "/server*.json" ], + "testbox":{ + "runner":"http://localhost:60299/tests/runner.cfm" + }, "scripts":{ + "build:module":"task run taskFile=build/Build.cfc :projectName=`package show slug` :version=`package show version`", + "build:docs":"task run taskFile=build/Build.cfc target=docs :projectName=`package show slug` :version=`package show version`", "release":"recipe build/release.boxr", - "format":"cfformat run handlers,models,test-harness/tests/,ModuleConfig.cfc --overwrite", - "format:watch":"cfformat watch handlers,models,test-harness/tests/,ModuleConfig.cfc ./.cfformat.json", - "format:check":"cfformat check handlers,models,test-harness/tests/,ModuleConfig.cfc" + "format":"cfformat run handlers,models,test-harness/tests/**.cfc,ModuleConfig.cfc --overwrite", + "format:watch":"cfformat watch handlers,models,test-harness/tests/**.cfc,ModuleConfig.cfc ./.cfformat.json", + "format:check":"cfformat check handlers,models,test-harness/tests/**.cfc,ModuleConfig.cfc", + "cfpm":"echo '\".engine/adobe2021/WEB-INF/cfusion/bin/cfpm.sh\"' | run", + "cfpm:install":"echo '\".engine/adobe2021/WEB-INF/cfusion/bin/cfpm.sh\" install ${1}' | run", + "install:2021":"run-script cfpm:install zip,debugger,orm,mysql,postgresql,sqlserver,feed,chart", + "install:dependencies":"install && cd test-harness && install" } -} \ No newline at end of file +} diff --git a/build/Build.cfc b/build/Build.cfc index ae94650..926cce1 100644 --- a/build/Build.cfc +++ b/build/Build.cfc @@ -23,6 +23,8 @@ component { "test-harness", "(package|package-lock).json", "webpack.config.js", + "server-.*\.json", + "docker-compose.yml", "^\..*" ]; diff --git a/changelog.md b/changelog.md index ba33d43..e422970 100644 --- a/changelog.md +++ b/changelog.md @@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ---- +## [3.6.0] => 2022-SEP-22 + +### Added + +* New module layout + +### Fixed + +* DateRanges + +---- + ## [3.5.0] => 2022-JAN-11 ### Added diff --git a/test-harness/server-adobe@2018.json b/server-adobe@2018.json similarity index 58% rename from test-harness/server-adobe@2018.json rename to server-adobe@2018.json index 92b394e..dd7855d 100644 --- a/test-harness/server-adobe@2018.json +++ b/server-adobe@2018.json @@ -10,7 +10,14 @@ }, "rewrites":{ "enable":"true" + }, + "webroot":"test-harness", + "aliases":{ + "/moduleroot/MockDataCFC":"../" } }, - "openBrowser":"false" -} \ No newline at end of file + "openBrowser":"false", + "cfconfig":{ + "file":".cfconfig.json" + } +} diff --git a/test-harness/server-adobe@2021.json b/server-adobe@2021.json similarity index 59% rename from test-harness/server-adobe@2021.json rename to server-adobe@2021.json index 0b554e8..580a3a9 100644 --- a/test-harness/server-adobe@2021.json +++ b/server-adobe@2021.json @@ -10,7 +10,14 @@ }, "rewrites":{ "enable":"true" + }, + "webroot":"test-harness", + "aliases":{ + "/moduleroot/MockDataCFC":"../" } }, - "openBrowser":"false" + "openBrowser":"false", + "cfconfig":{ + "file":".cfconfig.json" + } } diff --git a/test-harness/server-lucee@5.json b/server-lucee@5.json similarity index 57% rename from test-harness/server-lucee@5.json rename to server-lucee@5.json index e637924..ce49d2a 100644 --- a/test-harness/server-lucee@5.json +++ b/server-lucee@5.json @@ -10,7 +10,14 @@ }, "rewrites":{ "enable":"true" + }, + "webroot":"test-harness", + "aliases":{ + "/moduleroot/MockDataCFC":"../" } }, - "openBrowser":"false" -} \ No newline at end of file + "openBrowser":"false", + "cfconfig":{ + "file":".cfconfig.json" + } +} diff --git a/test-harness/box.json b/test-harness/box.json index 34bee41..66df675 100644 --- a/test-harness/box.json +++ b/test-harness/box.json @@ -5,10 +5,10 @@ "private":true, "description":"", "dependencies":{ - "coldbox":"^6.0.0" + "coldbox":"*" }, "devDependencies":{ - "testbox":"^4.0.0" + "testbox":"*" }, "installPaths":{ "coldbox":"coldbox/", diff --git a/test-harness/config/Coldbox.cfc b/test-harness/config/Coldbox.cfc index 956c398..3a02869 100644 --- a/test-harness/config/Coldbox.cfc +++ b/test-harness/config/Coldbox.cfc @@ -56,12 +56,14 @@ logBox = { // Define Appenders appenders = { - files={class="coldbox.system.logging.appenders.RollingFileAppender", - properties = { - filename = "tester", filePath="/#appMapping#/logs" + myConsole : { class : "ConsoleAppender" }, + files : { + class : "coldbox.system.logging.appenders.RollingFileAppender", + properties : { + filename : "tester", + filePath : "/#appMapping#/logs" } - }, - console : { class : "coldbox.system.logging.appenders.ConsoleAppender" } + } }, // Root Logger root = { levelmax="DEBUG", appenders="*" }, diff --git a/test-harness/server-adobe@2016.json b/test-harness/server-adobe@2016.json deleted file mode 100644 index e560824..0000000 --- a/test-harness/server-adobe@2016.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name":"mockdatacfc-adobe@2016", - "app":{ - "serverHomeDirectory":".engine/adobe2016", - "cfengine":"adobe@2016" - }, - "web":{ - "http":{ - "port":"60299" - }, - "rewrites":{ - "enable":"true" - } - }, - "openBrowser":"false" -} \ No newline at end of file diff --git a/test-harness/tests/Application.cfc b/test-harness/tests/Application.cfc index 8740b1d..7bbdc6a 100644 --- a/test-harness/tests/Application.cfc +++ b/test-harness/tests/Application.cfc @@ -4,12 +4,19 @@ */ component { + // UPDATE THE NAME OF THE MODULE IN TESTING BELOW + request.MODULE_NAME = "MockDataCFC"; + request.MODULE_PATH = "MockDataCFC"; + // APPLICATION CFC PROPERTIES - this.name = "ColdBoxTestingSuite" & hash( getCurrentTemplatePath() ); - this.sessionManagement = true; - this.sessionTimeout = createTimespan( 0, 0, 15, 0 ); - this.applicationTimeout = createTimespan( 0, 0, 15, 0 ); - this.setClientCookies = true; + this.name = "ColdBoxTestingSuite"; + this.sessionManagement = true; + this.setClientCookies = true; + this.sessionTimeout = createTimeSpan( 0, 0, 15, 0 ); + this.applicationTimeout = createTimeSpan( 0, 0, 15, 0 ); + // Turn on/off white space management + this.whiteSpaceManagement = "smart"; + this.enableNullSupport = shouldEnableFullNullSupport(); // Create testing mapping this.mappings[ "/tests" ] = getDirectoryFromPath( getCurrentTemplatePath() ); @@ -18,8 +25,6 @@ component { rootPath = reReplaceNoCase( this.mappings[ "/tests" ], "tests(\\|/)", "" ); this.mappings[ "/root" ] = rootPath; - // UPDATE THE NAME OF THE MODULE IN TESTING BELOW - request.MODULE_NAME = "MockDataCFC"; // The module root path moduleRootPath = reReplaceNoCase( @@ -30,4 +35,37 @@ component { this.mappings[ "/moduleroot" ] = moduleRootPath; this.mappings[ "/#request.MODULE_NAME#" ] = moduleRootPath & "#request.MODULE_NAME#"; + public boolean function onRequestStart( targetPage ){ + // Set a high timeout for long running tests + setting requestTimeout="9999"; + // New ColdBox Virtual Application Starter + request.coldBoxVirtualApp = new coldbox.system.testing.VirtualApp( appMapping = "/root" ); + + // If hitting the runner or specs, prep our virtual app + if ( getBaseTemplatePath().replace( expandPath( "/tests" ), "" ).reFindNoCase( "(runner|specs)" ) ) { + request.coldBoxVirtualApp.startup(); + } + + // ORM Reload for fresh results + if( structKeyExists( url, "fwreinit" ) ){ + if( structKeyExists( server, "lucee" ) ){ + pagePoolClear(); + } + // ormReload(); + request.coldBoxVirtualApp.restart(); + } + + return true; + } + + public void function onRequestEnd( required targetPage ) { + request.coldBoxVirtualApp.shutdown(); + } + + private boolean function shouldEnableFullNullSupport() { + var system = createObject( "java", "java.lang.System" ); + var value = system.getEnv( "FULL_NULL" ); + return isNull( value ) ? false : !!value; + } + } From 430b37271f297e5626a2be79e1be7dee11ddddcf Mon Sep 17 00:00:00 2001 From: Luis Majano <lmajano@gmail.com> Date: Thu, 22 Sep 2022 13:44:50 +0200 Subject: [PATCH 6/7] token is different in `ortus-solutions` org --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec7bd3d..a8babb7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,9 +39,9 @@ jobs: java-version: "11" - name: Setup CommandBox - uses: Ortus-Solutions/setup-commandbox@main + uses: Ortus-Solutions/setup-commandbox@2.0.1 with: - forgeboxAPIKey: ${{ secrets.FORGEBOX_TOKEN }} + forgeboxAPIKey: ${{ secrets.FORGEBOX_API_TOKEN }} - name: Setup Environment Variables For Build Process id: current_version From 7b5bad5b053bd5ec074670c722567e2f195cf008 Mon Sep 17 00:00:00 2001 From: Luis Majano <lmajano@gmail.com> Date: Thu, 22 Sep 2022 13:52:34 +0200 Subject: [PATCH 7/7] version change setup commandbox --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a8babb7..efb5140 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -39,7 +39,7 @@ jobs: java-version: "11" - name: Setup CommandBox - uses: Ortus-Solutions/setup-commandbox@2.0.1 + uses: Ortus-Solutions/setup-commandbox@main with: forgeboxAPIKey: ${{ secrets.FORGEBOX_API_TOKEN }}