diff --git a/integration-test/data/FoD/fod-integation-test-data.json b/integration-test/data/FoD/fod-integation-test-data.json deleted file mode 100644 index 71fd0b430d..0000000000 --- a/integration-test/data/FoD/fod-integation-test-data.json +++ /dev/null @@ -1,229 +0,0 @@ -[ - { - "commands": "fod session login", - "arguments": "", - "waitSeconds": "2" - }, - { - "commands": "fod session list", - "arguments": "", - "expectOutput": "default" - }, - { - "commands": "fod application create", - "arguments": "--type Web --owner={FCLI_FOD_USER} --business-criticality=High --sdlc-status='Production' INT_T_App2:INT_T_App2_Release2", - "expectOutput": "created", - "waitSeconds": "10" - }, - { - "commands": "fod app list", - "arguments": "", - "expectOutput": "INT_T_App2" - }, - { - "commands": "fod app list", - "arguments": " -q=\"applicationName.contains('{FCLI_DEFAULT_FOD_APP}')\" ", - "expectOutput": "INT_T_App2" - }, - { - "commands": "fod app ls", - "arguments": "" - }, - { - "commands": "fod app get", - "arguments": "INT_T_App2" - }, - { - "commands": "fod release create", - "arguments": "--description='New Release created by Integration test' --skip-if-exists --sdlc-status='Production' INT_T_App2:INT_T_App2_Release3", - "expectOutput": "INT_T_App2_Release3" - }, - { - "commands": "fod release list", - "arguments": "--app=INT_T_App2", - "expectOutput": "INT_T_App2_Release3" - }, - { - "commands": "fod release list", - "arguments": "--app=INT_T_App2", - "expectOutput": "INT_T_App2_Release3" - }, - { - "commands": "fod release ls", - "arguments": "", - "expectOutput": "INT_T_App2_Release3" - }, - { - "commands": "fod release get", - "arguments": "INT_T_App2:INT_T_App2_Release3", - "expectOutput": "INT_T_App2_Release3" - }, - { - "commands": "fod release update", - "arguments": "--description='Updated Release created by Integration test' --sdlc-status='QA' INT_T_App2:INT_T_App2_Release3", - "expectOutput": "Updated Release" - }, - { - "commands": "fod release get", - "arguments": "INT_T_App2:INT_T_App2_Release3", - "expectOutput": "QA" - }, - { - "commands": "fod release delete", - "arguments": "INT_T_App2:INT_T_App2_Release3" - }, - { - "commands": "fod release create", - "arguments": "--description='New app-rel created by Integration test' --skip-if-exists --sdlc-status='Production' INT_T_App2:INT_T_App2_Rel3", - "expectOutput": "INT_T_App2_Rel3", - "waitSeconds": "5" - }, - { - "commands": "fod release list", - "arguments": "--app=INT_T_App2", - "expectOutput": "INT_T_App2_Rel3" - }, - { - "commands": "fod release ls", - "arguments": "--app=INT_T_App2", - "expectOutput": "INT_T_App2_Rel3" - }, - { - "commands": "fod release get", - "arguments": "INT_T_App2:INT_T_App2_Rel3", - "expectOutput": "INT_T_App2_Rel3" - }, - { - "commands": "fod release update", - "arguments": "--description='Updated Release using app-rel param' --sdlc-status='QA' INT_T_App2:INT_T_App2_Rel3", - "expectOutput": "using app-rel", - "waitSeconds": "15" - }, - { - "commands": "fod release get", - "arguments": "INT_T_App2:INT_T_App2_Rel3", - "expectOutput": "QA" - }, - { - "commands": "fod scan list", - "arguments": "--scan-type=Dynamic" - }, - { - "commands": "fod scan get", - "arguments": "3356", - "expectOutput": "Dynamic" - }, - { - "commands": "fod rest lookup", - "arguments": "--type TechnologyTypes" - }, - { - "commands": "fod rest lookup", - "arguments": "--type LanguageLevels" - }, - { - "commands": "fod scan list", - "arguments": "--scan-type=Static" - }, - { - "commands": "fod scan import-sast", - "arguments": "--file='{PATH}\\data\\sample\\scan.fpr' INT_T_App2:INT_T_App2_Rel3", - "waitSeconds": "5" - }, - - { - "commands": "fod scan setup-sast", - "arguments": "--entitlement-frequency=Subscription --entitlement-id={ENTITLE_ID} --technology-stack='JAVA/J2EE' --language-level='11' --audit-preference=Automated --assessment-type=Static INT_T_App2:INT_T_App2_Rel3" - }, - { - "commands": "fod user list", - "arguments": "" - }, - { - "commands": "fod user ls", - "arguments": "" - }, - { - "commands": "fod user create", - "arguments": "--email=integration@test.com --firstname=INT_Test --lastname=User_001 --phone=555555555 --role=Developer INT_T_U_001", - "expectOutput": "created" - }, - { - "commands": "fod user get", - "arguments": " INT_T_U_001" - }, - { - "commands": "fod user update", - "arguments": "--email=integration@test.com --phone=555555555 --suspended=true --role=Developer INT_T_U_001", - "expectOutput": "updated" - }, - { - "commands": "fod user delete", - "arguments": " INT_T_U_001", - "expectOutput": "deleted" - }, - { - "commands": "fod user-group list", - "arguments": "" - }, - { - "commands": "fod user-group ls", - "arguments": "" - }, - { - "commands": "fod user-group create", - "arguments": " INT_T_UG_001", - "expectOutput": "created" - }, - { - "commands": "fod user-group get", - "arguments": " INT_T_UG_001" - }, - { - "commands": "fod user-group update", - "arguments": " --new-name=INT_T_UG_001x INT_T_UG_001", - "expectOutput": "updated" - }, - { - "commands": "fod user-group delete", - "arguments": " INT_T_UG_001x", - "expectOutput": "deleted" - }, - { - "commands": "fod microservice create", - "arguments": "--skip-if-exists INT_T_App2:INT_T_App2_MicroService_Test1", - "expectOutput": "Production" - }, - { - "commands": "fod microservice list", - "arguments": "--app=INT_T_App2 --include-releases", - "expectOutput": "INT_T_App2_MicroService_Test1" - }, - { - "commands": "fod microservice ls", - "arguments": "--app=INT_T_App2 --include-releases", - "expectOutput": "INT_T_App2_MicroService_Test1" - }, - { - "commands": "fod microservice update", - "arguments": "--name=INT_T_App2_MicroService_Test1_upd INT_T_App2:INT_T_App2_MicroService_Test1", - "expectOutput": "INT_T_App2_MicroService_Test1_upd" - }, - { - "commands": "fod microservice delete", - "arguments": "INT_T_App2:INT_T_App2_MicroService_Test1", - "expectOutput": "deleted" - }, - { - "commands": "fod release delete", - "arguments": "INT_T_App2:INT_T_App2_Rel3" - }, - { - "commands": "fod app delete", - "arguments": "INT_T_App2" - }, - { - "commands": "fod session logout", - "arguments": "" - } -] diff --git a/integration-test/data/SSC/ssc-integation-test-data.json b/integration-test/data/SSC/ssc-integation-test-data.json deleted file mode 100644 index cd0170d2d1..0000000000 --- a/integration-test/data/SSC/ssc-integation-test-data.json +++ /dev/null @@ -1,16 +0,0 @@ -[ - { - "commands": "ssc session login", - "arguments": "", - "waitSeconds": "2" - }, - { - "commands": "ssc session list", - "arguments": "", - "expectOutput": "default" - }, - { - "commands": "ssc session logout", - "arguments": "" - } -] \ No newline at end of file diff --git a/integration-test/data/sample/package.zip b/integration-test/data/sample/package.zip deleted file mode 100644 index 21c82caa2e..0000000000 Binary files a/integration-test/data/sample/package.zip and /dev/null differ diff --git a/integration-test/data/sample/scan.fpr b/integration-test/data/sample/scan.fpr deleted file mode 100644 index b8ef5bf7fb..0000000000 Binary files a/integration-test/data/sample/scan.fpr and /dev/null differ diff --git a/integration-test/integration-test.ps1 b/integration-test/integration-test.ps1 deleted file mode 100644 index 67674c9b98..0000000000 --- a/integration-test/integration-test.ps1 +++ /dev/null @@ -1,306 +0,0 @@ -function Set-LocalEnvironmentVariable { -<# -.SYNOPSIS - Set enviornment variable for this script scope -.DESCRIPTION - This PowerShell function set the eviornment variable for this script. -#> - param ( - [Parameter()] - [System.String] - $Name, - - [Parameter()] - [System.String] - $Value, - - [Parameter()] - [Switch] - $Append - ) - if($Append.IsPresent) - { - if(Test-Path "env:$Name") - { - $Value = (Get-Item "env:$Name").Value + $Value - } - } - Set-Item env:$Name -Value "$value" | Out-Null -} - -function Get-LocalEnviornmentVariable { -<# -.SYNOPSIS - Get enviornment variable for this script scope -.DESCRIPTION - This PowerShell function get the eviornment variable for this script. -#> - param ( - [Parameter()] - [System.String] - $Name - ) - $ValVar = $null - if(Test-Path "env:$Name") { - $ValVar = (Get-Item "env:$Name").Value - } - return $ValVar -} - -Function Validate_Variables { -<# -.SYNOPSIS - Check required enviornment variable for this script execution scope -.DESCRIPTION - This PowerShell function validates required variables and stop the execution of the script. -#> - - - #$global:FCLI_MODULE = Read-Host -Prompt $MODULE_INPUT_STR - #$FCLI_URL = Read-Host -Prompt "Enter FOD url, [Default] https://api.sandbox.fortify.com:" - #$FCLI_FOD_TENANT = Read-Host -Prompt "Enter FOD Tenant:" - #$FCLI_FOD_USER = Read-Host -Prompt "Enter FOD Username:" - #$FCLI_FOD_PWD = Read-Host -Prompt "Enter FOD Password:" -AsSecureString - - $global:FCLI_MODULE = Get-LocalEnviornmentVariable "FCLI_MODULE" - if($global:FCLI_MODULE -eq $null -or $global:FCLI_MODULE -eq "") { - if ($global:blnLinux) { - $global:FCLI_MODULE = "fcli.jar" - } else { - $global:FCLI_MODULE = "fcli.exe" - } - } - - if (-not(Test-Path -Path "$global:FCLI_MODULE" -PathType Leaf)) { - Write-Host "The file [$global:FCLI_MODULE] has not been found.set variable 'FCLI_MODULE' with exact path" -ForegroundColor Red - Break - } - - $FCLI_URL = Get-LocalEnviornmentVariable "FCLI_URL" - if($FCLI_URL) { - Set-LocalEnvironmentVariable "FCLI_DEFAULT_URL" $FCLI_URL - }else{ - Set-LocalEnvironmentVariable "FCLI_DEFAULT_URL" "https://api.ams.fortify.com" - Write-Host "FCLI_URL variable empty, setting FoD URL, the Default is set as 'ams.fortify.com'" -ForegroundColor Red - } - - $FCLI_FOD_TENANT = Get-LocalEnviornmentVariable "FCLI_FOD_TENANT" - if ($FCLI_FOD_TENANT) { - Set-LocalEnvironmentVariable "FCLI_DEFAULT_TENANT" $FCLI_FOD_TENANT - }else { - Set-LocalEnvironmentVariable "FCLI_DEFAULT_TENANT" $null - Write-Host "Environment variable not found: FCLI_FOD_TENANT" -ForegroundColor Red - break - } - - $FCLI_FOD_USER = Get-LocalEnviornmentVariable "FCLI_FOD_USER" - if ($FCLI_FOD_USER) { - Set-LocalEnvironmentVariable "FCLI_DEFAULT_USER" $FCLI_FOD_USER - } else { - Set-LocalEnvironmentVariable "FCLI_DEFAULT_USER" $null - Write-Host "Environment variable not found: FCLI_FOD_USER" -ForegroundColor Red - break - } - - $FCLI_FOD_PWD = Get-LocalEnviornmentVariable "FCLI_FOD_PWD" - if ($FCLI_FOD_PWD) { - $FCLI_FOD_PWD_UNSECURE = [System.Net.NetworkCredential]::new("", $FCLI_FOD_PWD).Password - Set-LocalEnvironmentVariable "FCLI_DEFAULT_PASSWORD" $FCLI_FOD_PWD_UNSECURE - } else { - Set-LocalEnvironmentVariable "FCLI_DEFAULT_PASSWORD" $null - Write-Host "Environment variable not found: FCLI_FOD_PWD" -ForegroundColor Red - break - } -} - -Function Clear_Variables { -<# -.SYNOPSIS - Clear enviornment variable used in this script -.DESCRIPTION - This PowerShell function clear required variables and stop the execution of the script. -#> - Set-Location Env: - #Remove-Item FCLI_MODULE -ErrorAction Ignore - Remove-Item FCLI_DEFAULT_URL -ErrorAction Ignore - Remove-Item FCLI_DEFAULT_TENANT -ErrorAction Ignore - Remove-Item FCLI_DEFAULT_USER -ErrorAction Ignore - Remove-Item FCLI_DEFAULT_PASSWORD -ErrorAction Ignore - Remove-Item FCLI_TEST_MODULES -ErrorAction Ignore - - if ($global:blnLinux) { - Set-Location - - } else { - Set-Location -Path C: - } -} - -function Join-String { -<# -.SYNOPSIS - Util to join strings from array -.DESCRIPTION - This PowerShell function util to join strings from array. -#> - [CmdletBinding()] - Param( - [Parameter(Mandatory=$true,ValueFromPipeline=$true)] [string[]]$StringArray, - $Separator=",", - [switch]$DoubleQuote=$false - ) - BEGIN{ - $joinArray = [System.Collections.ArrayList]@() - } - PROCESS { - foreach ($astring in $StringArray) { - $joinArray.Add($astring) | Out-Null - } - } - END { - $Object = [PSCustomObject]@{} - $count = 0; - foreach ($aString in $joinArray) { - - $aString = $aString.Trim() + "*" - $name = "ieo_$($count)" - $Object | Add-Member -MemberType NoteProperty -Name $name -Value $aString; - $count = $count + 1; - } - $ObjectCsv = $Object | ConvertTo-Csv -NoTypeInformation -Delimiter $separator - $result = $ObjectCsv[1] - if (-not $DoubleQuote) { - $result = $result.Replace('","',",").TrimStart('"').TrimEnd('"') - } - return $result - } -} - -Function Run_Modules($sModuleNames) { -<# -.SYNOPSIS - Run the modules given in enviornment variables. -.DESCRIPTION - This PowerShell function locate selected JSON file to triggere demo data with testing. -#> - $arrModules = $sModuleNames -split ',' - - $strFinal = Join-String -StringArray $arrModules - - $strToExecute = "Get-Childitem -Path . -Recurse -Filter *.json -Include " + $strFinal - $oFiles = Invoke-Expression $strToExecute - - $oFiles | Foreach-Object { - Run_Test -sJsonLocation $_.FullName - } -} - -Function Run_Test($sJsonLocation) { -<# -.SYNOPSIS - Run the tests given in json file. -.DESCRIPTION - This PowerShell function take json path as parameter to run the test script with given json data. -#> - Write-Host $sJsonLocation - $FCLI_FOD_USER = Get-LocalEnviornmentVariable "FCLI_FOD_USER" - $FCLI_DEFAULT_FOD_APP = Get-LocalEnviornmentVariable "FCLI_DEFAULT_FOD_APP" - Write-Host $FCLI_FOD_USER - Write-Host $Global:ENTITLE_ID - Write-Host $FCLI_DEFAULT_FOD_APP - - [PSCustomObject]$json = [PSCustomObject]((Get-Content -Raw $sJsonLocation) -replace "{PATH}",$PSScriptRoot.Replace("\","\\") ` - -replace "{FCLI_FOD_USER}",$FCLI_FOD_USER ` - -replace "{FCLI_DEFAULT_FOD_APP}",$FCLI_DEFAULT_FOD_APP ` - -replace "{ENTITLE_ID}",$Global:ENTITLE_ID ` - -replace '(?m)(?<=^([^"]|"[^"]*")*)//.*' ` - -replace '(?ms)/\*.*?\*/' | Out-String | ConvertFrom-Json) - - foreach ($jsCmd in $json) { - $validateOutput = $null - - if($prop = $jsCmd.PSObject.Properties.Item('expectOutput')) { - write-host ("Check output for :" + $prop.Value) - $validateOutput = $jsCmd.expectOutput - } - else { - write-host "No output found" - } - - #Write-Host $jsCmd.commands + $jsCmd.arguments + $validateOutput -ForegroundColor Cyan - if ($prop = $jsCmd.PSObject.Properties.Item('waitSeconds')) { - Write-Host "Waiting " $jsCmd.waitSeconds " seconds to run this command." -ForegroundColor DarkYellow - Start-Sleep -Seconds $jsCmd.waitSeconds - } - Run_Command -sCmd $jsCmd.commands -argument $jsCmd.arguments -valOutput $jsCmd.expectOutput - - } - -} - -Function Run_Command($sCmd, $argument, $valOutput) { -<# -.SYNOPSIS - Run each command as defined. -.DESCRIPTION - This PowerShell function execute command as defined in json file and output to the console. -#> - Write-Host ("command: " + $sCmd) - Write-Host ("arg: " + $argument) - Write-Host ("Output: " + $valOutput) - - #$global:blnLinux = ($env:OS -eq "" -or $env:OS -eq $null) - if ($global:blnLinux) { - $sCmd = "java -jar " + "$global:FCLI_MODULE" + " " + $sCmd + " " + $argument - }else{ - #$sCmd = "./" + $global:FCLI_MODULE + " " + $sCmd + " " + $argument - $sCmd = $global:FCLI_MODULE.Replace(' ','` ') + " " + $sCmd + " " + $argument - } - - Write-Host ("Running Command: $($sCmd)") -ForegroundColor Cyan - - $retVal = Invoke-Expression $sCmd -ErrorAction Continue | Out-String - Write-Host "Testing results returned:`n" $retVal - - if ($valOutput -ne $null -and $retVal -ne $null) - { - - $found = $retVal -match $valOutput - - if ($found) - { - Write-Host "Test Result matched with Output parameter, PASSED" -ForegroundColor Green - } else { - Write-Host "Test Result did not matched with Output parameter, FAILS..." -ForegroundColor Red - } - } - if ($valOutput -eq $null -and $retVal -ne $null) - { - Write-Host "TEST PASSED..." -ForegroundColor Green - } - if ($valOutput -eq $null -and $retVal -eq $null) - { - Write-Host "TEST FAILED..." -ForegroundColor Red - } -} - -# -# Main -# -$Global:ENTITLE_ID = 393 -Set-LocalEnvironmentVariable "FCLI_TEST_MODULES" "fod, ssc, scsast" -#$global:FCLI_MODULE="fcli-beta.exe" -$global:blnLinux = ($env:OS -eq "" -or $env:OS -eq $null) -$MODULE_INPUT_STR="Enter name and path of the command line tool along with extension[fcli.exe]" -if ($global:blnLinux) { - $MODULE_INPUT_STR="Enter name and path of the command line tool along with extension[fcli.jar]" - $global:FCLI_MODULE="fcli-beta.jar" -} - -$ErrorActionPreference="SilentlyContinue" -Stop-Transcript | out-null -$ErrorActionPreference = "Continue" -Start-Transcript -path .\fcli-$(get-date -f yyyy-MM-dd).log -append -Validate_Variables -Run_Modules(Get-LocalEnviornmentVariable "FCLI_TEST_MODULES") -Clear_Variables -Stop-Transcript diff --git a/integration-test/ssc-integration-test.sh b/integration-test/ssc-integration-test.sh deleted file mode 100755 index 10670bd1ec..0000000000 --- a/integration-test/ssc-integration-test.sh +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/bash -x -#******************************************************************************* -# Copyright 2021, 2023 Open Text. -# -# The only warranties for products and services of Open Text -# and its affiliates and licensors ("Open Text") are as may -# be set forth in the express warranty statements accompanying -# such products and services. Nothing herein should be construed -# as constituting an additional warranty. Open Text shall not be -# liable for technical or editorial errors or omissions contained -# herein. The information contained herein is subject to change -# without notice. -#******************************************************************************* - -checkVars() { - [[ -z "${FCLI_CMD}" ]] && echo "FCLI_CMD must be set to either 'java -jar path/to/fcli.jar' or path/to/fcli native binary" && exit 1 - [[ -z "${FCLI_DEFAULT_SSC_URL}" ]] && echo "FCLI_DEFAULT_SSC_URL must be set to SSC demo container URL" && exit 1 - [[ -z "${FCLI_DEFAULT_SSC_USER}" ]] && echo "FCLI_DEFAULT_SSC_USER must be set to SSC demo container user" && exit 1 - [[ -z "${FCLI_DEFAULT_SSC_PASSWORD}" ]] && echo "FCLI_DEFAULT_SSC_PASSWORD must be set to SSC demo container user password" && exit 1 -} - -sscCmd() { - runCmd ${FCLI_CMD} ssc "$@" -} - -runCmd() { - echo "$@" - lastOutput=$("$@") || exit 1 - if [[ -v checkOutput[@] ]]; then - echo "$lastOutput" | "${checkOutput[@]}" || exit 1 - unset checkOutput - fi -} - -runTestCommandsInSession() { - checkOutput=(fgrep ${FCLI_DEFAULT_SSC_SESSION}); sscCmd session login - runTestCommands - sscCmd session logout -} - -runTestCommands() { - sscCmd activity-feed list - sscCmd alert-definition list - sscCmd alert list - sscCmd app list - sscCmd appversion list - checkOutput=(fgrep DevPhase); sscCmd attribute-definition list - sscCmd user list - sscCmd event list - sscCmd issue-template list - sscCmd job list - sscCmd plugin list - checkOutput=(fgrep "OWASP Top 10"); sscCmd report-template list - checkOutput=(fgrep Administrator); sscCmd role list - checkOutput=(fgrep projectversion_add); sscCmd role-permission list - checkOutput=(fgrep CIToken); sscCmd token-definition list - - checkOutput=(fgrep CIToken); sscCmd token create CIToken --expire-in 5m --store ciToken:restToken - sscCmd token revoke ::ciToken::restToken - runCmd ${FCLI_CMD} state var delete ciToken - - appName="fcli-test $(date +%s)" - sscCmd appversion create "${appName}:v1" -d "Test fcli appversion create" --issue-template "Prioritized High Risk Issue Template" --auto-required-attrs --store currentAppVersion:id - newAppVersionId="::currentAppVersion::id" - checkOutput=(fgrep "No data"); sscCmd artifact list --appversion ${newAppVersionId} - sscCmd appversion-attribute set "DevPhase=Active Development" --appversion ${newAppVersionId} - sscCmd appversion-attribute list --appversion ${newAppVersionId} - checkOutput=(fgrep "SKIPPED_EXISTING"); sscCmd appversion create "${appName}:v1" -d "Test fcli appversion create" --issue-template "Prioritized High Risk Issue Template" --auto-required-attrs --skip-if-exists - sscCmd appversion create "${appName}:v2" -d "Test fcli appversion create" --issue-template "Prioritized High Risk Issue Template" --auto-required-attrs --store myAppVersion - checkOutput=(fgrep "v2"); sscCmd appversion get ::myAppVersion:: - sscCmd appversion create "${appName}:v3" -d "Test fcli appversion create" --issue-template "Prioritized High Risk Issue Template" --auto-required-attrs - sscCmd app delete "${appName}" --confirm - checkOutput=(fgrep -v "${appName}"); sscCmd appversion list -} - -run() { - checkVars - FCLI_DEFAULT_SSC_SESSION=integration-test runTestCommandsInSession -} - -run \ No newline at end of file