Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
fc35660
create assertive status extension
rfns Feb 7, 2025
3b35b4e
refactor web app resolver
rfns Feb 7, 2025
988f8cc
create dispatch handler interface
rfns Feb 7, 2025
ca94bcc
create configuration dto
rfns Feb 7, 2025
a9bf60b
refactor device interception
rfns Feb 7, 2025
f6c8bc4
add support for default headers
rfns Feb 7, 2025
5f1f86f
change naming and add invalid cookies test
rfns Feb 7, 2025
f97bad9
restore redirection flag on finish
rfns Feb 7, 2025
57d9287
change method signature
rfns Feb 7, 2025
a994aef
create parameter setup class
rfns Feb 10, 2025
176e1fb
create configuration merger
rfns Feb 10, 2025
b45cd34
clear stream after interception
rfns Feb 10, 2025
3896205
fix agent interface and finish base agent
rfns Feb 10, 2025
4fd53e1
refactor package naming
rfns Feb 10, 2025
97eb63d
update interface contract
rfns Feb 11, 2025
05f4595
provide required data to the dispatch handler
rfns Feb 11, 2025
5f7f054
refactored request object
rfns Feb 11, 2025
ec3ee0a
fix broken test
rfns Feb 11, 2025
4642920
add abstract request class
rfns Feb 11, 2025
cce07ee
create context and factory
rfns Feb 11, 2025
cf2ae4c
create request dispatcher
rfns Feb 11, 2025
e3185ab
simplify device interceptor redirection flag
rfns Feb 12, 2025
7241f1a
make properties editable due to a strange session behavior
rfns Feb 12, 2025
24dd3b3
improve separation of concerns
rfns Feb 12, 2025
72e4c1e
kill public variables
rfns Feb 12, 2025
3197053
use setup class for web app creation
rfns Feb 12, 2025
a2aa6fb
fix fake router
rfns Feb 12, 2025
45051d5
add agent builder
rfns Feb 12, 2025
b1c82a0
purge obsolete folder structure
rfns Feb 12, 2025
8d0ed0c
keep methods abstract
rfns Feb 18, 2025
747468c
refactoring
rfns Feb 25, 2025
9d888ac
define config defaults
rfns Feb 25, 2025
dd6bd5f
remove unused initializer
rfns Feb 25, 2025
dfc5a01
modify dispatcher to depend on config
rfns Feb 25, 2025
86a10b8
fix response misplacement
rfns Feb 25, 2025
2e6b857
add file test
rfns Apr 4, 2025
9e8b9ad
add safecheck to prevent null dispatch classes
rfns Apr 4, 2025
933ebb5
distinguish formdata provision
rfns Aug 18, 2025
7678eb4
fix signature
rfns Aug 18, 2025
fd6d4bb
improve interception shutdown
rfns Aug 18, 2025
a0ee141
add test action
rfns Aug 18, 2025
0327e43
add helper scripts
rfns Aug 18, 2025
9cdb50f
fix docker registry address
rfns Aug 18, 2025
f892058
bump iris-ci image version
rfns Aug 19, 2025
6329ae7
fix signature and bump iris-ci again
rfns Aug 19, 2025
fc5acef
test commit
rfns Aug 19, 2025
fde0c01
fix invalid type ref
rfns Aug 19, 2025
7fc2598
fix wrong return type
rfns Aug 19, 2025
e371a4b
update action to use recent format
rfns Aug 19, 2025
4769ae7
add interceptor as arg and ready to use dispatcher
rfns Aug 19, 2025
fa072de
semantic segregation between url and web app
rfns Aug 19, 2025
1587382
add flush method, missing fixes and tests
rfns Aug 19, 2025
baef2f9
fix more invalid types
rfns Aug 19, 2025
da80821
missing patch method and cleanup
rfns Aug 21, 2025
08391ac
improve handling of url paths
rfns Aug 21, 2025
24448aa
fix interface detail
rfns Aug 21, 2025
dc13c6c
move test classes to a more appropriate folder
rfns Aug 21, 2025
3535bda
add class member documentation
rfns Aug 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Run unit and integration tests

on:
pull_request:
types: [opened, synchronize]
branches: ['master']
paths: ['cls/**/*.cls', 'tests/**/*.cls']

jobs:
run_tests:
runs-on: ubuntu-latest
name: Run tests
steps:
- name: Clone this repository
uses: actions/checkout@v2
with:
path: app
- name: Install dos2unix
run: |
sudo apt-get update
sudo apt-get install -y dos2unix
- name: Convert line endings to LF (Unix format)
run: find . -type f -exec dos2unix {} \;
- name: Strip ROUTINE marks
run: app/bin/strip-atelier-headers.sh app
- name: Back-compatibilize with Cache
run: app/bin/iris-bc.sh app
- name: Import classes and run tests
run: |
docker run --rm -t --name test-ci \
-e TEST_SUITE="tests" \
-e TEST_AUTOLOAD_DIR="_setup" \
-v $PWD/app:/opt/ci/app ghcr.io/rfns/iris-ci/iris-ci:v0.6.5

41 changes: 22 additions & 19 deletions .github/workflows/xml-asset.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,36 @@ jobs:
- name: Convert line endings to LF (Unix format)
run: find . -type f -exec dos2unix {} \;
- name: Parse the tag
id: parse-tag
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
id: parse-metadata
run: |
export VERSION=${GITHUB_REF/refs\/tags\//}
echo "VERSION=${VERSION}" >> $GITHUB_OUTPUT
echo "REPOSITORY_NAME=$(echo "$GITHUB_REPOSITORY" | awk -F / '{print $2}' | sed -e "s/:refs//")" >> $GITHUB_OUTPUT
echo "PACKAGE_NAME=$(echo "$REPOSITORY_NAME-$VERSION")" >> $GITHUB_OUTPUT
- name: Import this repository and generate XML artifacts
run: |
touch $PWD/app/forgery.xml
chmod 777 $PWD/app/forgery.xml
touch "app/${{ steps.parse-metadata.outputs.REPOSITORY_NAME }}.xml"
chmod 777 "app/${{ steps.parse-metadata.outputs.REPOSITORY_NAME }}.xml"
docker run --rm \
-t --name xml-ci \
-v $PWD/app:/opt/ci/app \
-v $PWD/iris-ci-xml/ci/App/Installer.cls:/opt/ci/App/Installer.cls \
-v $PWD/iris-ci-xml/ci/Runner.cls:/opt/ci/Runner.cls \
-e PORT_CONFIGURATION_PROJECTNAME="forgery" \
-e PORT_CONFIGURATION_LOGLEVEL=1 \
-e PORT_CONFIGURATION_LOGLEVEL=2 \
-e CI_XML_FLAGS="/exportversion=2016.2" \
rfns/iris-ci:0.6.1
- name: Retrieve the latest asset upload url
id: release-asset-metadata
ghcr.io/rfns/iris-ci/iris-ci:v0.6.5
mv "app/${{ steps.parse-metadata.outputs.REPOSITORY_NAME }}.xml" "app/${{ steps.parse-metadata.outputs.PACKAGE_NAME }}.xml"
- name: Calculate SHA1s
run: |
upload_url=$(curl -s -X GET -L -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/$GITHUB_REPOSITORY/releases/latest | jq -r '. | .upload_url')
echo ::set-output name=UPLOAD_URL::$upload_url
- name: Upload release asset
id: release-asset-upload
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
sha1sum app/manifest.cls | cut -f 1 -d " " > app/manifest.sha1
sha1sum "app/${{ steps.parse-metadata.outputs.PACKAGE_NAME }}-iris.xml" | \
cut -f 1 -d " " > "app/${{ steps.parse-metadata.outputs.PACKAGE_NAME }}-iris.sha1"
- name: Upload release files
id: release-files
uses: softprops/action-gh-release@v2
with:
upload_url: ${{ steps.release-asset-metadata.outputs.UPLOAD_URL }}
asset_path: app/forgery.xml
asset_name: forgery-${{ steps.parse-tag.outputs.VERSION }}.xml
asset_content_type: application/xml
files: |
app/${{ steps.parse-metadata.outputs.PACKAGE_NAME }}.xml
app/${{ steps.parse-metadata.outputs.PACKAGE_NAME }}.sha1

19 changes: 19 additions & 0 deletions bin/iris-bc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

cwd_dir=${1:-$PWD}

echo "iris-bc: Checking for class directory at $cwd_dir ..."

if [[ -d "$cwd_dir/cls" ]]; then
echo "iris-bc: Found class directory. Swapping IRIS expressions for Caché back compatibility ..."

find $cwd_dir/cls -type f -iname '*.cls' -exec sh -c 'cat "$1" | sed "s/%Storage.Persistent/%Library.CacheStorage/g" > "$1.bak" && mv "$1.bak" "$1"' sh {} \;
find $cwd_dir/cls -type f -iname '*.cls' -exec sh -c 'cat "$1" | sed "s/%Storage.SQL/%CacheSQLStorage/g" > "$1.bak" && mv "$1.bak" "$1"' sh {} \;
find $cwd_dir/cls -type f -iname '*.cls' -exec sh -c 'cat "$1" | sed "s/%Any/%CacheString/g" > "$1.bak" && mv "$1.bak" "$1"' sh {} \;
find $cwd_dir/cls -type f -iname '*.cls' -exec sh -c 'cat "$1" | sed "s/\[ Language = objectscript \]/\[ Language = cache \]/g" > "$1.bak" && mv "$1.bak" "$1"' sh {} \;
fi

echo "iris-bc: Done."

exit 0

24 changes: 24 additions & 0 deletions bin/strip-atelier-headers.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash

cwd_dir=${1:-$PWD}

find_and_replace() {
category="$1"

echo "strip-atelier-headers: Scanning for files in $cwd_dir/$category"

if [[ -d "$cwd_dir/$category" ]]; then
echo "strip-atelier-headers: Files for category $category were found. Stripping ..."
find "$cwd_dir/$category" -type f -iname "*.$category" -exec sh -c 'grep -v "ROUTINE\s.*\[Type=.*\]" "$1" > "$1.bak" && mv "$1.bak" "$1"' sh {} \;
else
echo "strip-atelier-headers: Category $category has been skipped: No entries were found at the destination."
fi
}

find_and_replace "inc"
find_and_replace "int"
find_and_replace "mac"

echo "strip-atelier-headers: Done."

exit 0
53 changes: 23 additions & 30 deletions cls/Forgery/Agent.cls
Original file line number Diff line number Diff line change
@@ -1,51 +1,44 @@
Class Forgery.Agent Extends Forgery.Agent.Core
/// End-user agent for sending requests.
///
/// This class provides the implementations required for dispatching requests.
/// However, it's recommended to instantiate it using the builder.
Class Forgery.Agent Extends (%RegisteredObject, Forgery.Internal.BaseAgent)
{

Method Post(settings As %DynamicObject, response As %Stream.Object, outputToDevice As %Boolean = 0) As %Status
/// Sends a HTTP POST request to a web application resource.
Method Post(resource As %String, data As %DynamicAbstractObject = {$$$NULLOREF}, overrides As %DynamicObject = {$$$NULLOREF}) As %Status
{
set settings.method = "POST"
return ..Request(settings, .response, outputToDevice)
return ..DoRequest(..#HTTPPOSTMETHOD, resource, data, overrides)
}

Method Get(settings As %DynamicObject = "", response As %Stream.Object, outputToDevice As %Boolean = 0) As %Status
/// Sends a HTTP GET request to a web application resource.
Method Get(resource As %String, queryParams As %DynamicObject = {$$$NULLOREF}, overrides As %DynamicObject = {$$$NULLOREF}) As %Status
{
if '$isobject(settings) {
set url = settings
set settings = { "url": (url) }
}
set settings.method = "GET"
return ..Request(settings, .response, outputToDevice)
return ..DoRequest(..#HTTPGETMETHOD, resource, queryParams, overrides)
}

Method Put(settings As %DynamicObject, response As %Stream.Object, outputToDevice As %Boolean = 0)
/// Sends a HTTP PUT request to a web application resource.
Method Put(resource As %String, data As %DynamicAbstractObject = {$$$NULLOREF}, overrides As %DynamicObject = {$$$NULLOREF}) As %Status
{
set settings.method = "PUT"
return ..Request(settings, .response, outputToDevice)
return ..DoRequest(..#HTTPPUTMETHOD, resource, data, overrides)
}

Method Delete(settings As %DynamicObject, response As %Stream.Object, outputToDevice As %Boolean = 0)
/// Sends a HTTP DELETE request to a web application resource.
Method Delete(resource As %String, queryParams As %DynamicObject = {$$$NULLOREF}, overrides As %DynamicObject = {$$$NULLOREF}) As %Status
{
set settings.method = "DELETE"
return ..Request(settings, .response, outputToDevice)
return ..DoRequest(..#HTTPDELETEMETHOD, resource, queryParams, overrides)
}

Method Head(settings As %DynamicObject, response As %Stream.Object, outputToDevice As %Boolean = 0)
/// Sends a HTTP HEAD request to a web application resource.
Method Head(resource As %String, queryParams As %DynamicObject = {$$$NULLOREF}, overrides As %DynamicObject = {$$$NULLOREF}) As %Status
{
set settings.method = "HEAD"
set settings.data = {}
return ..Request(settings, .response, outputToDevice)
return ..DoRequest(..#HTTPHEADMETHOD, resource, queryParams, overrides)
}

Method Patch(settings As %DynamicObject, response As %Stream.Object, outputToDevice As %Boolean = 0)
/// Sends a HTTP Patch request to a web application resource.
Method Patch(resource As %String, data As %DynamicAbstractObject = {$$$NULLOREF}, overrides As %DynamicObject = {$$$NULLOREF}) As %Status
{
set settings.method = "PATCH"
return ..Request(settings, .response, outputToDevice)
}

Method Options(settings As %DynamicObject, response As %Stream.Object, outputToDevice As %Boolean = 0)
{
set settings.method = "OPTIONS"
return ..Request(settings, .response, outputToDevice)
return ..DoRequest(..#HTTPPATCHMETHOD, resource, data, overrides)
}

}
13 changes: 0 additions & 13 deletions cls/Forgery/Agent/ApplicationInfo.cls

This file was deleted.

Loading