From bfcee3fa054238cbc0c247913f857ea7f8b7e6e0 Mon Sep 17 00:00:00 2001 From: MathisSenicourt Date: Fri, 6 Oct 2023 15:18:14 +0200 Subject: [PATCH] Fixed reading Jira XRay response Key when DC solution is used --- .../cerberus/core/service/xray/impl/XRayService.java | 11 ++++++++++- .../D2/include/en/changelog_4.17_en.adoc | 5 +++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/source/src/main/java/org/cerberus/core/service/xray/impl/XRayService.java b/source/src/main/java/org/cerberus/core/service/xray/impl/XRayService.java index fac837bd7..9e49bebad 100644 --- a/source/src/main/java/org/cerberus/core/service/xray/impl/XRayService.java +++ b/source/src/main/java/org/cerberus/core/service/xray/impl/XRayService.java @@ -259,7 +259,7 @@ public boolean isTrusted(X509Certificate[] chain, String authType) throws Certif LOG.debug("XRay Test Execution request http return code : " + rc); String responseString = EntityUtils.toString(response.getEntity()); LOG.debug("Response : {}", responseString); - JSONObject xRayResponse = new JSONObject(responseString); + JSONObject xRayResponse = getXRayResponseJSON(execution, responseString); String xrayURL = ""; String xrayTestExecution = ""; if (xRayResponse.has("key")) { @@ -315,6 +315,15 @@ public boolean isTrusted(X509Certificate[] chain, String authType) throws Certif } + private JSONObject getXRayResponseJSON(TestCaseExecution execution, String responseString) throws JSONException { + if (TestCase.TESTCASE_ORIGIN_JIRAXRAYDC.equalsIgnoreCase(execution.getTestCaseObj().getOrigine())) { + return new JSONObject(responseString).getJSONObject("testExecIssue"); + } + else { + return new JSONObject(responseString); + } + } + private void getXRayAuthenticationToken(String origin, String system) throws Exception { String xRayUrl = XRAYCLOUD_AUTHENT_URL; diff --git a/source/src/main/resources/documentation/D2/include/en/changelog_4.17_en.adoc b/source/src/main/resources/documentation/D2/include/en/changelog_4.17_en.adoc index 7ad3323c5..d903cec8c 100644 --- a/source/src/main/resources/documentation/D2/include/en/changelog_4.17_en.adoc +++ b/source/src/main/resources/documentation/D2/include/en/changelog_4.17_en.adoc @@ -8,7 +8,8 @@ * Record a file at control level was saving it at action level #2412 * Fixed delete of Campaigns, Services and Users with special Characters #2486 * Fix display of group 2 and 3 on campaign page -* Fix Log Viewer entry when the XRay Key is not provided +* When executing a compaign that has XRay links, fixed an issue where campaign stays PENDING forever in case there is a connectivity issue with JIRA Backend. It now return ERROR with the correct trace message. +* Fixed reading Jira XRay response Key when DC solution is used *Improvements / New features* [square] @@ -17,7 +18,7 @@ * A pdf report is now available for campaign execution for download #2475 * New action "Switch To Context" #2408 * Added new execution parameter column on campaign list page #2489 -* Added new test case 'Verify Text in Element does not contain' +* Added new test case control 'Verify Text in Element does not contain' #2471 *Warning to be considered before applying the version (deprecated features)* [square]