diff options
Diffstat (limited to 'vid-webpack-master')
7 files changed, 163 insertions, 19 deletions
diff --git a/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts index f9fe68b20..3c53d262f 100644 --- a/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts @@ -4,7 +4,7 @@ describe('Drawing Board: Instantiation Templates', function () { beforeEach(() => { cy.clearSessionStorage(); - cy.setTestApiParamToVNF(); + cy.setTestApiParamToGR(); cy.initAAIMock(); cy.initGetAAISubDetails(); cy.initVidMock(); @@ -29,7 +29,7 @@ describe('Drawing Board: Instantiation Templates', function () { assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd(); }); - it('Given a stored template - when "edit" vnf and vfmodules are opened - then template’s details are visible as expected', ()=> { + it('Given a stored template - when "edit" vnf and vfmodules are opened - then template’s details are visible as expected and deploy without changes', () => { loadDrawingBoardWithRecreateMode(); @@ -60,8 +60,6 @@ describe('Drawing Board: Instantiation Templates', function () { .getElementByDataTestsId("sdncPreLoad").should('have.value', 'on') .getElementByDataTestsId("cancelButton").click(); - - assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd(); }); @@ -81,6 +79,25 @@ describe('Drawing Board: Instantiation Templates', function () { }); + it('Given a stored template - edit service vnf and vfmodule without changes - deploy request should be without changes', function () { + + loadDrawingBoardWithRecreateMode(); + + //open - set edit service + cy.openServiceContextMenu() + .getElementByDataTestsId("context-menu-header-edit-item").click() + .getElementByDataTestsId('form-set').click(); + + //open - set edit vnf + editNode("node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0") + .getElementByDataTestsId('form-set').click(); + + //open - set edit vf + editNode("node-c5b26cc1-a66f-4b69-aa23-6abc7c647c88-vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0") + .getElementByDataTestsId('form-set').click(); + + assertThatBodyFromDeployRequestEqualsToFile(); + }); }); }); @@ -127,6 +144,18 @@ function assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd() { }); } + +function assertThatBodyFromDeployRequestEqualsToFile() { + cy.getDrawingBoardDeployBtn().click(); + cy.wait('@expectedPostAsyncInstantiation').then(xhr => { + + cy.readFile('../vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json').then((expectedResult) => { + cy.deepCompare(xhr.request.body, expectedResult); + }); + + }); +} + //We use this function because the deployService() on drawing-board-header.component class // changes rollbackOnFailure value from string type to boolean. function convertRollbackOnFailureValueFromStringToBoolean(expectedResult: any) { diff --git a/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts b/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts index 5444971b7..8d2bb8a24 100644 --- a/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts +++ b/vid-webpack-master/cypress/support/steps/drawingBoard/general.steps.ts @@ -26,8 +26,5 @@ function openServiceContextMenu() : Chainable<any> { return cy.getElementByDataTestsId('openMenuBtn').click({force: true}); } - - - Cypress.Commands.add('updateServiceShouldNotOverrideChild', updateServiceShouldNotOverrideChild); Cypress.Commands.add('openServiceContextMenu', openServiceContextMenu); diff --git a/vid-webpack-master/package.json b/vid-webpack-master/package.json index c9113d681..ee04de10d 100644 --- a/vid-webpack-master/package.json +++ b/vid-webpack-master/package.json @@ -8,6 +8,7 @@ "build": "ng build --no-progress --no-aot --output-hashing all", "build.prod": "ng build", "test": "jest", + "ci": "npm run test && npm run build", "test:jest": "jest", "test:jest:pipeline": "jest --silent --ci --reporters=default --reporters=jest-junit", "test:jest:watch": "jest --watch", diff --git a/vid-webpack-master/pom.xml b/vid-webpack-master/pom.xml index 2fe0a6eaf..f84a485eb 100644 --- a/vid-webpack-master/pom.xml +++ b/vid-webpack-master/pom.xml @@ -28,7 +28,7 @@ <stagingNexusPath>content/repositories/staging/</stagingNexusPath> <snapshotNexusPath>content/repositories/snapshots/</snapshotNexusPath> <releaseNexusPath>content/repositories/releases/</releaseNexusPath> - <NPM_CMD>build</NPM_CMD> + <NPM_CMD>ci</NPM_CMD> </properties> @@ -70,6 +70,7 @@ </distributionManagement> <profiles> + <profile> <id>if-not-webpack</id> <activation> @@ -107,6 +108,7 @@ </plugins> </build> </profile> + <profile> <id>webpack-npm</id> <activation> diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts index 54bc77877..8bdab11e3 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.spec.ts @@ -416,7 +416,33 @@ describe('VFModule Model Info', () => { 'modelInfo' : { modelVersionId : 'vfModuleId' } + }, + 'vnfModuleName_111_1': { + 'action': 'Create', + 'modelInfo' : { + modelVersionId : 'vfModuleId' + } + } + } + } + }, + 'vnfName_1' :{ + 'action': 'Create', + 'originalName' : 'vnfName', + 'vfModules' : { + 'vfModuleName' : { + 'vnfModuleName_111': { + 'action': 'Create', + 'modelInfo' : { + modelVersionId : 'vfModuleId' + } + }, + 'vnfModuleName_111_1': { + 'action': 'Create', + 'modelInfo' : { + modelVersionId : 'vfModuleId' } + } } } } @@ -441,6 +467,95 @@ describe('VFModule Model Info', () => { } }; let result = vfModuleModel.getNodeCount(<any>node , serviceId); + expect(result).toEqual(2); + }); + + + test('getNodeCount should return number of nodes : there is selectedVNF', ()=>{ + let serviceId : string = 'servicedId'; + jest.spyOn(MockNgRedux.getInstance(), 'getState').mockReturnValue({ + global : {}, + service : { + serviceHierarchy : { + 'servicedId' : { + 'vnfs' : { + 'vnfName' : { + 'properties' : { + 'max_instances' : 1 + } + } + }, + 'vfModules' : { + 'vfModuleName' : { + 'properties' : { + maxCountInstances : 2 + } + } + } + } + }, + serviceInstance : { + 'servicedId' : { + 'existingVNFCounterMap' : { + 'vnfId' : 1 + }, + 'vnfs' : { + 'vnfName' :{ + 'action': 'Create', + 'originalName' : 'vnfName', + 'vfModules' : { + 'vfModuleName' : { + 'vnfModuleName_111': { + 'action': 'Create', + 'modelInfo' : { + modelVersionId : 'vfModuleId' + } + }, + 'vnfModuleName_111_1': { + 'action': 'Create', + 'modelInfo' : { + modelVersionId : 'vfModuleId' + } + } + } + } + }, + 'vnfName_1' :{ + 'action': 'Create', + 'originalName' : 'vnfName', + 'vfModules' : { + 'vfModuleName' : { + 'vnfModuleName_111': { + 'action': 'Create', + 'modelInfo' : { + modelVersionId : 'vfModuleId' + } + } + } + } + } + } + } + } + } + }); + jest.spyOn(_sharedTreeService, 'getSelectedVNF').mockReturnValue('vnfName_1'); + + let node = { + data : { + id : 'vfModuleId', + name : 'vfModuleName', + 'action': 'Create', + }, + parent : { + data : { + id : 'vnfId', + name : 'vnfName_1', + 'action': 'Create', + } + } + }; + let result = vfModuleModel.getNodeCount(<any>node , serviceId); expect(result).toEqual(1); }); diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts index a82cd49d7..73f35279f 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts @@ -177,12 +177,16 @@ export class VFModuleModelInfo implements ILevelNodeInfo { * @param serviceModelId - current service id ************************************************************/ getNodeCount(node: ITreeNode, serviceModelId: string): number { + const vnfs = this._store.getState().service.serviceInstance[serviceModelId].vnfs; let count: number = 0; if (!_.isNil(this._store.getState().service.serviceInstance) && !_.isNil(this._store.getState().service.serviceInstance[serviceModelId])) { - const vnfs = this._store.getState().service.serviceInstance[serviceModelId].vnfs; - - for (let vnfKey in vnfs) { - count += this.countNumberOfVFModule(vnfs[vnfKey], node); + const selectedVNF: string = this._sharedTreeService.getSelectedVNF(); + if (selectedVNF) { + count += this.countNumberOfVFModule(vnfs[selectedVNF], node); + }else { + for (let vnfKey in vnfs) { + count += this.countNumberOfVFModule(vnfs[vnfKey], node); + } } return count; } @@ -206,11 +210,8 @@ export class VFModuleModelInfo implements ILevelNodeInfo { getCountVFModuleOfSelectedVNF(node: ITreeNode, vnfStoreKey: string, serviceModelId: string): number { let count: number = 0; if (!_.isNil(this._store.getState().service.serviceInstance) && !_.isNil(this._store.getState().service.serviceInstance[serviceModelId])) { - const vnfs = this._store.getState().service.serviceInstance[serviceModelId].vnfs; - - for (let vnfKey in vnfs) { - count += this.countNumberOfVFModule(vnfs[vnfKey], node); - } + const vnf = this._store.getState().service.serviceInstance[serviceModelId].vnfs[vnfStoreKey]; + count += this.countNumberOfVFModule(vnf, node); return count; } return count; @@ -238,7 +239,6 @@ export class VFModuleModelInfo implements ILevelNodeInfo { showVFModuleOnSelectedVNF(node: ITreeNode, selectedVNF: string, serviceModelId: string): AvailableNodeIcons { - if (!_.isNil(this._store.getState().service.serviceInstance[serviceModelId].vnfs[selectedVNF]) && node.parent.data.name === this._store.getState().service.serviceInstance[serviceModelId].vnfs[selectedVNF].originalName) { const existingVFModules = this.getCountVFModuleOfSelectedVNF(node, selectedVNF, serviceModelId); const reachedLimit = this.isVFModuleReachedLimit(node, this._store.getState().service.serviceHierarchy, serviceModelId, existingVFModules); diff --git a/vid-webpack-master/src/app/shared/components/formControls/component/multiselect/multiselect.formControl.component.ts b/vid-webpack-master/src/app/shared/components/formControls/component/multiselect/multiselect.formControl.component.ts index 26a55e9d2..cf062f0e0 100644 --- a/vid-webpack-master/src/app/shared/components/formControls/component/multiselect/multiselect.formControl.component.ts +++ b/vid-webpack-master/src/app/shared/components/formControls/component/multiselect/multiselect.formControl.component.ts @@ -35,7 +35,7 @@ export class MultiselectFormControlComponent implements OnChanges{ this.options = options; this._multiselectFormControlService.convertSelectedItems(this.data).then((res)=> { this.selectedItems = res; - this.form.controls[this.data.controlName].setValue(this.selectedItems); + this.data.onChange(this.selectedItems ,this.form); }) }); } |