From 18750938b1513ee32d4d68f0871ec90efdf3ddfd Mon Sep 17 00:00:00 2001 From: Vodafone Date: Fri, 5 Apr 2019 15:49:06 +0530 Subject: [PATCH] VSP Compliance Check for Compute Flavor Change-Id: I04768a20413393026606a3f5b200e959e37c1410 Issue-ID: SDC-2051 Co-authored-by: rahul.ghugikar@vodafone.com, soumyarup.paul@vodafone.com Signed-off-by: Vodafone --- .../_softwareProductValidationResultsPage.scss | 18 +- openecomp-ui/src/nfvo-utils/i18n/en.json | 6 +- .../SoftwareProductValidationActionHelper.js | 2 +- .../validation/SoftwareProductValidationView.jsx | 24 +- .../validation/inputs/VspValidationInputsView.jsx | 4 +- .../SoftwareProductValidationResultsView.jsx | 268 ++++++++++++++------- .../SoftwareProductValidationFactory.js | 8 +- .../SoftwareProductValidationResultsFactory.js | 80 ++++++ .../SoftwareProductValidationActionHelper.test.js | 216 +++++++++++++---- .../SoftwareProductValidationInputView.test.js | 41 +++- .../SoftwareProductValidationView.test.js | 77 +++--- .../SoftwareProductValidationResultsView.test.js | 18 +- 12 files changed, 570 insertions(+), 192 deletions(-) diff --git a/openecomp-ui/resources/scss/modules/_softwareProductValidationResultsPage.scss b/openecomp-ui/resources/scss/modules/_softwareProductValidationResultsPage.scss index 9ff3696dcb..303f1f041d 100644 --- a/openecomp-ui/resources/scss/modules/_softwareProductValidationResultsPage.scss +++ b/openecomp-ui/resources/scss/modules/_softwareProductValidationResultsPage.scss @@ -1,4 +1,20 @@ .validation-results-test-result-label { - padding-left: 10px + padding-left: 10px; +} +.validation-results-test-result-json { + min-height: 50px; + overflow: auto; + min-width: 100px; + height: 100px; + width: 900px; + max-width: 900px; +} +.validation-results-test-result-string { + min-height: 50px; + overflow: auto; + min-width: 100px; + height: 100px; + width: 900px; + max-width: 900px; } diff --git a/openecomp-ui/src/nfvo-utils/i18n/en.json b/openecomp-ui/src/nfvo-utils/i18n/en.json index 1ad23b7a1a..f57b7fdd3c 100644 --- a/openecomp-ui/src/nfvo-utils/i18n/en.json +++ b/openecomp-ui/src/nfvo-utils/i18n/en.json @@ -650,8 +650,10 @@ "Selected Compliance Tests": "Selected Compliance Tests", "Value Should Be Minimum of {minLength} characters and a Maximum of {maxLength} characters": "Value Should Be Minimum of {minLength} characters and a Maximum of {maxLength} characters", "{title} Inputs :": "{title} Inputs :", - "Scenario: {scenario} | Status: {status}": "Scenario: {scenario} | Status: {status}", + "Scenario: {scenario} | Title: {title} | Test Case: {testCaseName} | Status: {status}": "Scenario: {scenario} | Title: {title} | Test Case: {testCaseName} | Status: {status}", "{title} results are not available": "{title} results are not available", "Test Results": "Test Results", - "No Validation Checks Performed": "No Validation Checks Performed" + "No Validation Checks Performed": "No Validation Checks Performed", + "Unknown": "Unknown" + } diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/validation/SoftwareProductValidationActionHelper.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/validation/SoftwareProductValidationActionHelper.js index d19416a2aa..1ebb94b77c 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/validation/SoftwareProductValidationActionHelper.js +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/validation/SoftwareProductValidationActionHelper.js @@ -32,7 +32,7 @@ function postVSPCertificationChecks(tests) { function fetchVspChecks() { const restPrefix = Configuration.get('restPrefix'); - return RestAPIUtil.get(`${restPrefix}/v1.0/externaltesting/testcasetree`); + return RestAPIUtil.fetch(`${restPrefix}/v1.0/externaltesting/testcasetree`); } const SoftwareProductValidationActionHelper = { diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/validation/SoftwareProductValidationView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/validation/SoftwareProductValidationView.jsx index 8611c41937..a8ea3804b4 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/validation/SoftwareProductValidationView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/validation/SoftwareProductValidationView.jsx @@ -210,7 +210,10 @@ class SoftwareProductValidation extends Component { softwareProductValidation.vspChecks ); } - this.setState({ activeTab: tabsMapping.SETUP }); + this.setState({ + activeTab: tabsMapping.SETUP, + goToValidationInput: false + }); setActiveTab({ activeTab: tabsMapping.SETUP }); } } @@ -269,6 +272,20 @@ class SoftwareProductValidation extends Component { } } + fetchDefaultValue(value) { + let { softwareProductId, version } = this.props; + let versionName = parseFloat(version.name).toFixed(1), + versionNumber = + versionName > 1 ? (versionName - 1).toFixed(1) : versionName, + versionUUID = version.id; + value = + value === '$vspid' + ? softwareProductId + : value === '$vspPreviousVersion' ? versionNumber : value; + value = value === '$vspVersionUUID' ? versionUUID : value || ''; + return value; + } + formTestsRequest(item, testsRequest) { let { vspTestsMap } = this.props.softwareProductValidation; testsRequest[item] = { @@ -279,8 +296,9 @@ class SoftwareProductValidation extends Component { endpoint: vspTestsMap[item]['endpoint'] }; vspTestsMap[item].parameters.forEach(parameter => { - testsRequest[item].parameters[parameter.name] = - parameter.defaultValue || ''; + testsRequest[item].parameters[ + parameter.name + ] = this.fetchDefaultValue(parameter.defaultValue); }); return testsRequest; } diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/validation/inputs/VspValidationInputsView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/validation/inputs/VspValidationInputsView.jsx index c2990a2058..26a6003b5a 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/validation/inputs/VspValidationInputsView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/validation/inputs/VspValidationInputsView.jsx @@ -284,8 +284,8 @@ class VspValidationInputs extends Component { size="default" data-test-id="proceed-to-validation-results-btn" disabled={false} - className="proceed-to-validation-monitor-btn" - onClick={() => this.performVSPTests()}> + type="submit" + className="proceed-to-validation-monitor-btn"> {i18n('Submit')} diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/validationResults/SoftwareProductValidationResultsView.jsx b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/validationResults/SoftwareProductValidationResultsView.jsx index b6cc1d5bdc..162d281ee4 100644 --- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/validationResults/SoftwareProductValidationResultsView.jsx +++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/validationResults/SoftwareProductValidationResultsView.jsx @@ -74,109 +74,215 @@ class SoftwareProductValidationResultsView extends React.Component { }; } - buildSubAccordions(result) { - if (result.status && result.status.toLowerCase() === 'completed') { - if (!result.results.testResults) { + getTitle(result) { + let { vspTestsMap } = this.props.softwareProductValidation; + let title = vspTestsMap[result.testCaseName] + ? vspTestsMap[result.testCaseName].title + : i18n('Unknown'); + return i18n( + 'Scenario: {scenario} | Title: {title} | Test Case: {testCaseName} | Status: {status}', + { + scenario: result.scenario || i18n('Unknown'), + status: result.status || i18n('Unknown'), + testCaseName: result.testCaseName || i18n('Unknown'), + title: title + } + ); + } + + renderJSON(result) { + return ( +
  • +