From c3ee2020d0bfd48c9b2a687d0f80e67190edb5d4 Mon Sep 17 00:00:00 2001 From: brunomilitzer Date: Thu, 3 Feb 2022 09:08:47 +0000 Subject: Added Policy Jest Tests Added more tests to increase overall coverage Issue-ID: POLICY-3899 Change-Id: I97e7954d42199145948f2ac2738a0ceaa7e6a44f Signed-off-by: brunomilitzer --- .../dialogs/Policy/PoliciesTreeViewer.js | 150 +++--- .../dialogs/Policy/PoliciesTreeViewer.test.js | 54 ++ .../components/dialogs/Policy/PolicyEditor.test.js | 1 - .../dialogs/Policy/PolicyToscaFileSelector.js | 6 +- .../dialogs/Policy/PolicyToscaFileSelector.test.js | 128 +++++ .../dialogs/Policy/ViewAllPolicies.test.js | 6 + .../__snapshots__/PoliciesTreeViewer.test.js.snap | 23 + .../PolicyToscaFileSelector.test.js.snap | 80 +++ .../__snapshots__/ViewAllPolicies.test.js.snap | 598 +++++++++++++++++++++ .../dialogs/Policy/toscaPoliciesData.test.json | 244 +++++++++ .../dialogs/Tosca/ViewLoopTemplatesModal.test.js | 8 +- .../ui-react/src/components/menu/MenuBar.test.js | 1 - 12 files changed, 1222 insertions(+), 77 deletions(-) create mode 100644 gui-clamp/ui-react/src/components/dialogs/Policy/PoliciesTreeViewer.test.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/Policy/PolicyToscaFileSelector.test.js create mode 100644 gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PoliciesTreeViewer.test.js.snap create mode 100644 gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyToscaFileSelector.test.js.snap create mode 100644 gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/ViewAllPolicies.test.js.snap (limited to 'gui-clamp/ui-react') diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/PoliciesTreeViewer.js b/gui-clamp/ui-react/src/components/dialogs/Policy/PoliciesTreeViewer.js index 5bca4e6..7ec7eef 100644 --- a/gui-clamp/ui-react/src/components/dialogs/Policy/PoliciesTreeViewer.js +++ b/gui-clamp/ui-react/src/components/dialogs/Policy/PoliciesTreeViewer.js @@ -2,8 +2,8 @@ * ============LICENSE_START======================================================= * ONAP POLICY-CLAMP * ================================================================================ - * Copyright (C) 2021 AT&T Intellectual Property. All rights - * reserved. + * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,7 @@ * */ -import React, { forwardRef } from 'react' +import React from 'react' import TreeView from '@material-ui/lab/TreeView'; import TreeItem from '@material-ui/lab/TreeItem'; import FolderIcon from '@material-ui/icons/Folder'; @@ -31,79 +31,91 @@ import DescriptionIcon from '@material-ui/icons/Description'; export default class PoliciesTreeViewer extends React.Component { - separator = "."; + separator = "."; - nodesList = new Map(); + nodesList = new Map(); - constructor(props, context) { - super(props, context); - this.createPoliciesTree = this.createPoliciesTree.bind(this); - this.handleTreeItemClick = this.handleTreeItemClick.bind(this); - this.buildNameWithParent = this.buildNameWithParent.bind(this); + constructor(props, context) { + super(props, context); + this.createPoliciesTree = this.createPoliciesTree.bind(this); + this.handleTreeItemClick = this.handleTreeItemClick.bind(this); + this.buildNameWithParent = this.buildNameWithParent.bind(this); - } + } - state = { - policiesTreeData: this.createPoliciesTree(this.props.policiesData), - } + state = { + policiesTreeData: this.createPoliciesTree(this.props.policiesData), + } - componentDidUpdate(prevProps) { - if (prevProps.policiesData !== this.props.policiesData) { - this.setState({ policiesTreeData: this.createPoliciesTree(this.props.policiesData) }) + componentDidUpdate(prevProps) { + if (prevProps.policiesData !== this.props.policiesData) { + this.setState({policiesTreeData: this.createPoliciesTree(this.props.policiesData)}) + } } - } - - createPoliciesTree(policiesArray) { - // put my policies array in a Json - let nodeId = 1; - let root = { id: nodeId, policyCount: 0, name: "ROOT", children: [], parent: undefined }; - this.nodesList.set(nodeId++, root); - - policiesArray.forEach(policy => { - let currentTreeNode = root; - policy[this.props.valueForTreeCreation].split(this.separator).forEach((policyNamePart, index, policyNamePartsArray) => { - let node = currentTreeNode["children"].find(element => element.name === policyNamePart); - if (typeof (node) === "undefined") { - node = { id: nodeId, policyCount: 0, children: [], name: policyNamePart, parent: currentTreeNode }; - this.nodesList.set(nodeId++, node); - currentTreeNode["children"].push(node); + + createPoliciesTree(policiesArray) { + console.log('createPoliciesTree called') + // put my policies array in a Json + let nodeId = 1; + let root = {id: nodeId, policyCount: 0, name: "ROOT", children: [], parent: undefined}; + this.nodesList.set(nodeId++, root); + + if (policiesArray !== null && policiesArray.forEach !== undefined) { + + policiesArray.forEach(policy => { + let currentTreeNode = root; + policy[this.props.valueForTreeCreation].split(this.separator).forEach((policyNamePart, index, policyNamePartsArray) => { + let node = currentTreeNode["children"].find(element => element.name === policyNamePart); + if (typeof (node) === "undefined") { + node = { + id: nodeId, + policyCount: 0, + children: [], + name: policyNamePart, + parent: currentTreeNode + }; + this.nodesList.set(nodeId++, node); + currentTreeNode["children"].push(node); + } + if ((index + 1) === policyNamePartsArray.length) { + ++currentTreeNode["policyCount"]; + } + currentTreeNode = node; + }) + }); } - if ((index + 1) === policyNamePartsArray.length) { - ++currentTreeNode["policyCount"]; + return root; + } + + buildNameWithParent(node) { + let nameToBuild = node.name; + if (node.parent !== undefined) { + nameToBuild = this.buildNameWithParent(node.parent) + this.separator + node.name; } - currentTreeNode = node; - }) - }) - return root; - } - - buildNameWithParent(node) { - let nameToBuild = node.name; - if (node.parent !== undefined) { - nameToBuild = this.buildNameWithParent(node.parent) + this.separator + node.name; + return nameToBuild; + } + + handleTreeItemClick(event, value) { + let fullName = this.buildNameWithParent(this.nodesList.get(value[0])).substring(5); + this.props.policiesFilterFunction(fullName); + } + + renderTreeItems(nodes) { + return ( + { + Array.isArray(nodes.children) ? nodes.children.map((node) => this.renderTreeItems(node)) : null + } + ); + }; + + render() { + return ( + } + defaultExpandIcon={} defaultEndIcon={} + onNodeSelect={this.handleTreeItemClick} multiSelect> + {this.renderTreeItems(this.state.policiesTreeData)} + + ); } - return nameToBuild; - } - - handleTreeItemClick(event, value) { - let fullName = this.buildNameWithParent(this.nodesList.get(value[0])).substring(5); - this.props.policiesFilterFunction(fullName); - } - - renderTreeItems(nodes) { - return ( - { - Array.isArray(nodes.children) ? nodes.children.map((node) => this.renderTreeItems(node)) : null - } - ); - }; - - render() { - return ( - } - defaultExpandIcon={ } defaultEndIcon={ } onNodeSelect={ this.handleTreeItemClick } multiSelect> - { this.renderTreeItems(this.state.policiesTreeData) } - - ); - } } diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/PoliciesTreeViewer.test.js b/gui-clamp/ui-react/src/components/dialogs/Policy/PoliciesTreeViewer.test.js new file mode 100644 index 0000000..7a6a76a --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/Policy/PoliciesTreeViewer.test.js @@ -0,0 +1,54 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2022 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +import {shallow} from "enzyme"; +import React from "react"; +import PoliciesTreeViewer from "./PoliciesTreeViewer"; +import fs from "fs"; +import toJson from "enzyme-to-json"; + +describe('Verify PoliciesTreeViewer', () => { + + let toscaPoliciesData = fs.readFileSync('src/components/dialogs/Policy/toscaPoliciesData.test.json', { + encoding: 'utf8', + flag: 'r' + }); + const toscaPoliciesDataArray = JSON.parse(toscaPoliciesData); + + const logSpy = jest.spyOn(console, 'log'); + + + it("renders correctly", () => { + const component = shallow(); + + expect(toJson(component)).toMatchSnapshot(); + }); + + it("tests createPoliciesTree handler", () => { + const component = shallow(); + component.setState({ policiesTreeData: toscaPoliciesDataArray }); + + const instance = component.instance(); + instance.createPoliciesTree(toscaPoliciesDataArray); + + expect(logSpy).toHaveBeenCalledWith('createPoliciesTree called'); + expect(component.state('policiesTreeData')).toEqual(toscaPoliciesDataArray); + }); + +}); \ No newline at end of file diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyEditor.test.js b/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyEditor.test.js index 111f2c6..5e63ab4 100644 --- a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyEditor.test.js +++ b/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyEditor.test.js @@ -56,7 +56,6 @@ describe('Verify PolicyEditor', () => { } }; - it('Test the render method', async () => { PolicyToscaService.getToscaPolicyModel = jest.fn().mockImplementation(() => { return Promise.resolve(toscaJson); diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyToscaFileSelector.js b/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyToscaFileSelector.js index 8093b7e..8051059 100644 --- a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyToscaFileSelector.js +++ b/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyToscaFileSelector.js @@ -3,6 +3,7 @@ * ONAP POLICY-CLAMP * ================================================================================ * Copyright (C) 2021 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,9 +28,9 @@ import Row from 'react-bootstrap/Row'; import Col from 'react-bootstrap/Col'; import styled from 'styled-components'; import Alert from 'react-bootstrap/Alert'; -import { Input, InputLabel, Button, SvgIcon } from "@material-ui/core"; +import { Button, SvgIcon } from "@material-ui/core"; import PublishIcon from '@material-ui/icons/Publish'; -import PolicyService from '../../../api/PolicyService'; +import PolicyService from "../../../api/PolicyService"; const ModalStyled = styled(Modal)` background-color: transparent; @@ -66,6 +67,7 @@ export default class PolicyToscaFileSelector extends React.Component { } onFileChange(target) { + console.log('onFileChange target'); this.setState({ alertMessages: [] }); target.currentTarget.files.forEach(file => { const fileReader = new FileReader(); diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyToscaFileSelector.test.js b/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyToscaFileSelector.test.js new file mode 100644 index 0000000..412b1b0 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/Policy/PolicyToscaFileSelector.test.js @@ -0,0 +1,128 @@ +/* + * ============LICENSE_START======================================================= + * Copyright (C) 2022 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + * ============LICENSE_END========================================================= + */ + +import {shallow} from "enzyme"; +import toJson from "enzyme-to-json"; +import React from "react"; +import PolicyToscaFileSelector from "./PolicyToscaFileSelector"; +import PolicyService from "../../../api/PolicyService"; +import Alert from "react-bootstrap/Alert"; +import PolicyToscaService from "../../../api/PolicyToscaService"; +import fs from "fs"; + +describe('Verify PolicyToscaFileSelector', () => { + + let toscaPoliciesList = fs.readFileSync('src/components/dialogs/Policy/toscaPoliciesList.test.json', { + encoding: 'utf8', + flag: 'r' + }); + + const uploadFile = JSON.stringify( + { + name: 'test-file.yaml', + lastModified: 1639414348371, + lastModifiedDate: 'Sat Jan 1 2022 00:00:01 GMT+0000', + size: 32880, + type: '' + }); + + const file = new Blob([uploadFile], {type: 'file'}) + const logSpy = jest.spyOn(console, 'log'); + + const alertMessages = [( + {file.name}

Policy Tosca Model Creation Test

+
+

Type: {file.type}

Size: {file.size}

)]; + + it("renders correctly", () => { + const component = shallow(); + expect(toJson(component)).toMatchSnapshot(); + }); + + it('Test handleClose', async () => { + const flushPromises = () => new Promise(setImmediate); + const showFileSelectorMock = jest.fn(); + const showFileSelector = showFileSelectorMock.bind({ + showFileSelector: false + }); + const handleClose = jest.spyOn(PolicyToscaFileSelector.prototype, 'handleClose'); + const component = shallow(); + + component.find('[variant="secondary"]').get(0).props.onClick(); + await flushPromises(); + component.update(); + + expect(handleClose).toHaveBeenCalledTimes(1); + expect(component.state('show')).toEqual(false); + + handleClose.mockClear(); + }); + + it('handleClose called when top-right button clicked', async () => { + const flushPromises = () => new Promise(setImmediate); + const showFileSelectorMock = jest.fn(); + const showFileSelector = showFileSelectorMock.bind({ + showFileSelector: false + }); + const handleClose = jest.spyOn(PolicyToscaFileSelector.prototype, 'handleClose'); + const component = shallow(); + + component.find('[size="lg"]').get(0).props.onHide(); + await flushPromises(); + component.update(); + + expect(handleClose).toHaveBeenCalledTimes(1); + expect(component.state('show')).toEqual(false); + + handleClose.mockClear(); + }); + + it("onFileChange called when upload button clicked", () => { + PolicyService.sendNewPolicyModel = jest.fn().mockImplementation(() => { + return Promise.resolve({}); + }); + + const component = shallow(); + const instance = component.instance(); + const target = { + currentTarget: {files: [file]} + } + + instance.onFileChange(target); + + component.find('[type="file"]').get(0).props.onChange(target); + expect(logSpy).toHaveBeenCalledWith('onFileChange target'); + }); + + it("setAlertMessage state", () => { + PolicyToscaService.getToscaPolicyModels = jest.fn().mockImplementation(() => { + return Promise.resolve(toscaPoliciesList); + }); + const getAllToscaModelsMock = jest.fn(); + const getAllToscaModels = getAllToscaModelsMock.bind({ + toscaModelsListData: toscaPoliciesList, + toscaModelsListDataFiltered: toscaPoliciesList + }); + + const component = shallow(); + component.setState({alertMessages: alertMessages}); + + expect(component.state('alertMessages')).toEqual(alertMessages); + }); +}); \ No newline at end of file diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/ViewAllPolicies.test.js b/gui-clamp/ui-react/src/components/dialogs/Policy/ViewAllPolicies.test.js index d477c9a..d4a3fd9 100644 --- a/gui-clamp/ui-react/src/components/dialogs/Policy/ViewAllPolicies.test.js +++ b/gui-clamp/ui-react/src/components/dialogs/Policy/ViewAllPolicies.test.js @@ -24,6 +24,7 @@ import fs from "fs"; import PolicyToscaService from "../../../api/PolicyToscaService"; import PolicyService from "../../../api/PolicyService"; import CreateLoopModal from "../Loop/CreateLoopModal"; +import toJson from "enzyme-to-json"; describe('Verify ViewAllPolicies', () => { let toscaPolicyModels = fs.readFileSync('src/components/dialogs/Policy/toscaData.test.json', { @@ -35,6 +36,11 @@ describe('Verify ViewAllPolicies', () => { flag: 'r' }); + it("renders correctly", () => { + const component = shallow(); + expect(toJson(component)).toMatchSnapshot(); + }); + it('Test handleClose', () => { const historyMock = {push: jest.fn()}; const handleClose = jest.spyOn(ViewAllPolicies.prototype, 'handleClose'); diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PoliciesTreeViewer.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PoliciesTreeViewer.test.js.snap new file mode 100644 index 0000000..8d14fa4 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PoliciesTreeViewer.test.js.snap @@ -0,0 +1,23 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Verify PoliciesTreeViewer renders correctly 1`] = ` +} + defaultEndIcon={} + defaultExpandIcon={} + defaultExpanded={ + Array [ + "root", + ] + } + multiSelect={true} + onNodeSelect={[Function]} +> + + +`; diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyToscaFileSelector.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyToscaFileSelector.test.js.snap new file mode 100644 index 0000000..10a5559 --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/PolicyToscaFileSelector.test.js.snap @@ -0,0 +1,80 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Verify PolicyToscaFileSelector renders correctly 1`] = ` + + + + Create New Policy Tosca Model + + + + + + + + + + + + + + Close + + + +`; diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/ViewAllPolicies.test.js.snap b/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/ViewAllPolicies.test.js.snap new file mode 100644 index 0000000..24b631b --- /dev/null +++ b/gui-clamp/ui-react/src/components/dialogs/Policy/__snapshots__/ViewAllPolicies.test.js.snap @@ -0,0 +1,598 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Verify ViewAllPolicies renders correctly 1`] = ` + + + + + + +
+ + + + + + +
+
+
+ + +
+ + + + + + +
+
+
+
+ + + + + + + + + +
+ +
+`; diff --git a/gui-clamp/ui-react/src/components/dialogs/Policy/toscaPoliciesData.test.json b/gui-clamp/ui-react/src/components/dialogs/Policy/toscaPoliciesData.test.json index 9305243..a852daf 100644 --- a/gui-clamp/ui-react/src/components/dialogs/Policy/toscaPoliciesData.test.json +++ b/gui-clamp/ui-react/src/components/dialogs/Policy/toscaPoliciesData.test.json @@ -88,5 +88,249 @@ "tableData": { "id": 0 } + }, + { + "type": "onap.policies.controlloop.operational.common.Drools", + "type_version": "1.0.0", + "properties": { + "abatement": false, + "operations": [ + { + "failure_retries": "final_failure_retries", + "id": "test1", + "failure_timeout": "final_failure_timeout", + "failure": "final_failure", + "operation": { + "payload": { + "artifact_name": "baseconfiguration", + "artifact_version": "1.0.0", + "mode": "async", + "data": "{\"resource-assignment-properties\":{\"request-id\":\"\",\"service-instance-id\":\"\",\"hostname\":\"\",\"request-info\":{\"prop1\":\"\",\"prop2\":\"\"}}}" + }, + "target": { + "entityIds": { + "resourceID": "Vloadbalancerms..vdns..module-3", + "modelInvariantId": "4c10ba9b-f88f-415e-9de3-5d33336047fa", + "modelVersionId": "4fa73b49-8a6c-493e-816b-eb401567b720", + "modelName": "Vloadbalancerms..vdns..module-3", + "modelVersion": "1", + "modelCustomizationId": "bafcdab0-801d-4d81-9ead-f464640a38b1" + }, + "targetType": "VNF" + }, + "actor": "SDNR", + "operation": "BandwidthOnDemand" + }, + "failure_guard": "final_failure_guard", + "retries": 0, + "timeout": 0, + "failure_exception": "final_failure_exception", + "description": "test", + "success": "final_success" + } + ], + "trigger": "test1", + "timeout": 0, + "id": "LOOP_test" + }, + "name": "OPERATIONAL_vLoadBalancerMS_v1_0_Drools_1_0_0_7xd", + "version": "1.0.0", + "metadata": { + "policy-id": "OPERATIONAL_vLoadBalancerMS_v1_0_Drools_1_0_0_7xd", + "policy-version": "1.0.0" + }, + "pdpGroupInfo": [ + { + "controlloop": { + "name": "controlloop", + "description": "This group should be used for managing all control loop related policies and pdps", + "pdpGroupState": "ACTIVE", + "properties": {}, + "pdpSubgroups": [ + { + "pdpType": "apex", + "supportedPolicyTypes": [ + { + "name": "onap.policies.controlloop.Operational", + "version": "1.0.0" + }, + { + "name": "onap.policies.controlloop.operational.common.*", + "version": "1.0.0" + } + ], + "policies": [ + { + "name": "OPERATIONAL_vLoadBalancerMS_v1_0_Drools_1_0_0_7xd", + "version": "1.0.0" + } + ], + "currentInstanceCount": 0, + "desiredInstanceCount": 1, + "properties": {}, + "pdpInstances": [ + { + "instanceId": "controlloop-f8287777-5f3e-4f0f-b21b-d8829c93f57b", + "pdpState": "ACTIVE", + "healthy": "HEALTHY", + "message": "Pdp Heartbeat", + "lastUpdate": "2021-09-29T02:51:21Z" + } + ] + }, + { + "pdpType": "drools", + "supportedPolicyTypes": [ + { + "name": "onap.policies.controlloop.operational.common.*", + "version": "1.0.0" + }, + { + "name": "onap.policies.controlloop.Operational", + "version": "1.0.0" + } + ], + "policies": [ + { + "name": "OPERATIONAL_vLoadBalancerMS_v1_0_Drools_1_0_0_7xd", + "version": "1.0.0" + } + ], + "currentInstanceCount": 0, + "desiredInstanceCount": 1, + "properties": {}, + "pdpInstances": [ + { + "instanceId": "drools-f8287777-5f3e-4f0f-b21b-d8829c93f57b", + "pdpState": "ACTIVE", + "healthy": "HEALTHY", + "message": "Pdp Heartbeat", + "lastUpdate": "2021-09-29T02:51:21Z" + } + ] + } + ] + } + } + ], + "supportedPdpGroups": [ + { + "controlloop": [ + "apex", + "drools" + ] + } + ], + "supportedPdpGroupsString": "controlloop/apex\r\ncontrolloop/drools\r\n", + "pdpGroupInfoString": "controlloop/apex (ACTIVE)\r\ncontrolloop/drools (ACTIVE)\r\n", + "tableData": { + "id": 1 + } + }, + { + "type": "onap.policies.Naming", + "type_version": "1.0.0", + "properties": { + "naming-models": [ + { + "naming-type": "VNF", + "naming-recipe": "AIC_CLOUD_REGION|DELIMITER|CONSTANT|DELIMITER|TIMESTAMP", + "name-operation": "to_lower_case()", + "naming-properties": [ + { + "property-name": "AIC_CLOUD_REGION" + }, + { + "property-name": "CONSTANT", + "property-value": "onap-nf" + }, + { + "property-name": "TIMESTAMP" + }, + { + "property-value": "-", + "property-name": "DELIMITER" + } + ] + }, + { + "naming-type": "VNFC", + "naming-recipe": "VNF_NAME|DELIMITER|NFC_NAMING_CODE|DELIMITER|SEQUENCE", + "name-operation": "to_lower_case()", + "naming-properties": [ + { + "property-name": "VNF_NAME" + }, + { + "property-name": "SEQUENCE", + "increment-sequence": { + "max": "zzz", + "scope": "ENTIRETY", + "start-value": "1", + "length": "3", + "increment": "1", + "sequence-type": "alpha-numeric" + } + }, + { + "property-name": "NFC_NAMING_CODE" + }, + { + "property-value": "-", + "property-name": "DELIMITER" + } + ] + }, + { + "naming-type": "VF-MODULE", + "naming-recipe": "VNF_NAME|DELIMITER|VF_MODULE_LABEL|DELIMITER|VF_MODULE_TYPE|DELIMITER|SEQUENCE", + "name-operation": "to_lower_case()", + "naming-properties": [ + { + "property-name": "VNF_NAME" + }, + { + "property-value": "-", + "property-name": "DELIMITER" + }, + { + "property-name": "VF_MODULE_LABEL" + }, + { + "property-name": "VF_MODULE_TYPE" + }, + { + "property-name": "SEQUENCE", + "increment-sequence": { + "max": "zzz", + "scope": "PRECEEDING", + "start-value": "1", + "length": "3", + "increment": "1", + "sequence-type": "alpha-numeric" + } + } + ] + } + ], + "policy-instance-name": "ONAP_NF_NAMING_TIMESTAMP" + }, + "name": "SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP", + "version": "1.0.0", + "metadata": { + "policy-id": "SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP", + "policy-version": "1.0.0" + }, + "supportedPdpGroups": [ + { + "monitoring": [ + "xacml" + ] + } + ], + "supportedPdpGroupsString": "monitoring/xacml\r\n", + "tableData": { + "id": 2 + } } ] \ No newline at end of file diff --git a/gui-clamp/ui-react/src/components/dialogs/Tosca/ViewLoopTemplatesModal.test.js b/gui-clamp/ui-react/src/components/dialogs/Tosca/ViewLoopTemplatesModal.test.js index d93f0b0..fd52761 100644 --- a/gui-clamp/ui-react/src/components/dialogs/Tosca/ViewLoopTemplatesModal.test.js +++ b/gui-clamp/ui-react/src/components/dialogs/Tosca/ViewLoopTemplatesModal.test.js @@ -2,8 +2,8 @@ * ============LICENSE_START======================================================= * ONAP CLAMP * ================================================================================ - * Copyright (C) 2019 AT&T Intellectual Property. All rights - * reserved. + * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. + * Modifications Copyright (C) 2022 Nordix Foundation. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ describe('Verify ViewLoopTemplatesModal', () => { } }); }); - const component = shallow(); + shallow(); }); it('Test API Rejection', () => { @@ -78,7 +78,7 @@ describe('Verify ViewLoopTemplatesModal', () => { }), 100 ); - const component = shallow(); + shallow(); expect(myMockFunc.mock.calls.length).toBe(1); }); diff --git a/gui-clamp/ui-react/src/components/menu/MenuBar.test.js b/gui-clamp/ui-react/src/components/menu/MenuBar.test.js index 1e6dd1c..bd55687 100644 --- a/gui-clamp/ui-react/src/components/menu/MenuBar.test.js +++ b/gui-clamp/ui-react/src/components/menu/MenuBar.test.js @@ -82,7 +82,6 @@ describe('Verify MenuBar', () => { it('Finds StyledNavLink', () => { const component = shallow(); - console.log(component.debug()); expect(component.find('Styled(NavLink)').length).toEqual(2); }); }); -- cgit 1.2.3-korg