From 09a6562a16715a2b89be11c941486be783c72364 Mon Sep 17 00:00:00 2001 From: ikram Date: Wed, 22 Jul 2020 10:28:15 -0400 Subject: Test Cases Addition and Fixes Issue-ID: VID-858 Integration Tests are edited in this patch to support functionality in VID-858. Signed-off-by: ikram Change-Id: I378cb2afd0f2c994a856ad31895cec3fca376b33 --- .../services/featureFlag/feature-flags.service.ts | 1 + .../storeUtil/utils/vfModule/vfModule.actions.ts | 16 +++++++++++++++ .../utils/vfModule/vfModule.reducers.spec.ts | 24 +++++++++++++++++++++- .../storeUtil/utils/vfModule/vfModule.reducers.ts | 12 +++++++++-- 4 files changed, 50 insertions(+), 3 deletions(-) (limited to 'vid-webpack-master/src/app/shared') diff --git a/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts b/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts index 9926d6c67..e652be79d 100644 --- a/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts +++ b/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts @@ -24,6 +24,7 @@ export enum Features { FLAG_2006_NEW_VIEW_EDIT_BUTTON_IN_INSTANTIATION_STATUS= 'FLAG_2006_NEW_VIEW_EDIT_BUTTON_IN_INSTANTIATION_STATUS', FLAG_2006_PAUSE_VFMODULE_INSTANTIATION_CREATION = 'FLAG_2006_PAUSE_VFMODULE_INSTANTIATION_CREATION', FLAG_2008_PAUSE_INSTANTIATION_ON_VFMODULE_POPUP = 'FLAG_2008_PAUSE_INSTANTIATION_ON_VFMODULE_POPUP', + FLAG_2008_REMOVE_PAUSE_INSTANTIATION = 'FLAG_2008_REMOVE_PAUSE_INSTANTIATION', } @Injectable() diff --git a/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.actions.ts b/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.actions.ts index 82e24091b..c250993df 100644 --- a/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.actions.ts +++ b/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.actions.ts @@ -12,6 +12,7 @@ export enum VfModuleActions { UPDATE_VFMODULE_FEILD = "UPDATE_VFMODULE_FEILD", DELETE_VFMODULE_FIELD = "DELETE_VFMODULE_FEILD", PAUSE_ACTION_VFMODULE_INSTANCE = "PAUSE_ACTION_VFMODULE_INSTANCE", + REMOVE_PAUSE_ON_VFMODULE_INSTANCE = "REMOVE_PAUSE_ON_VFMODULE_INSTANCE" } @@ -97,6 +98,13 @@ export interface PauseVFModuleInstanciationAction extends Action { vfModuleModelName : string; } +export interface RemovePauseOnVFModuleInstanciationAction extends Action { + dynamicModelName: string; + vnfStoreKey : string; + serviceId: string; + vfModuleModelName : string; +} + export const removeVfModuleInstance: ActionCreator = (modelName, serviceModelId, vfName, vnfStoreKey, dynamicModelName) => ({ type: VfModuleActions.REMOVE_VNF_MODULE_INSTANCE, modelName: modelName, @@ -190,3 +198,11 @@ export const pauseActionVFModuleInstance: ActionCreator = (dynamicModelName, vnfStoreKey, serviceId, vfModuleModelName) => ({ + type: VfModuleActions.REMOVE_PAUSE_ON_VFMODULE_INSTANCE, + dynamicModelName, + vnfStoreKey, + serviceId, + vfModuleModelName +}); diff --git a/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.spec.ts b/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.spec.ts index e73fe0c48..50981e158 100644 --- a/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.spec.ts +++ b/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.spec.ts @@ -2,7 +2,7 @@ import { CreateVFModuleInstanceAction, DeleteActionVfModuleInstanceAction, DeleteVFModuleField, - DeleteVfModuleInstanceAction, PauseVFModuleInstanciationAction, + DeleteVfModuleInstanceAction, PauseVFModuleInstanciationAction, RemovePauseOnVFModuleInstanciationAction, UndoDeleteActionVfModuleInstanceAction, UpdateVFModluePosition, UpdateVFModuleField, @@ -251,6 +251,18 @@ test('#PAUSE_ACTION_VF_MODULE_INSTANTIATION %s', (description: string, dynamicMo expect(vfModule.pauseInstantiation).toEqual(pauseInstantiation); }); + each([ + ['for the first vfModule', 'dynamicModelName1', null], + ['for the third vfModule', 'dynamicModelName3', null], + ['for the last vfModule', 'dynamicModelName5', null], + ]). + test('#REMOVE_PAUSE_ON_VFMODULE_INSTANCE %s', (description: string, dynamicModelName:string, pauseInstantiation: string) => { + let vfModule = vfModuleReducer(getPausedRedux(), getRemovePauseActionVfModule(dynamicModelName)) + .serviceInstance['serviceModelId'].vnfs['vnfStoreKey'].vfModules['vfModuleModelName'][dynamicModelName]; + expect(vfModule).toBeDefined(); + expect(vfModule.pauseInstantiation).toEqual(pauseInstantiation); + }); + test('#UPGRADE_VFMODULE', () => { let vfModule = vfModuleReducer(getReduxState(), { @@ -415,4 +427,14 @@ function getPausedActionVfModule(dynamicModelName: string) { vfModuleModelName: 'vfModuleModelName' } } + + function getRemovePauseActionVfModule(dynamicModelName: string) { + return { + type: VfModuleActions.REMOVE_PAUSE_ON_VFMODULE_INSTANCE, + dynamicModelName: dynamicModelName, + vnfStoreKey: 'vnfStoreKey', + serviceId: 'serviceModelId', + vfModuleModelName: 'vfModuleModelName' + } + } }); diff --git a/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.ts b/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.ts index fa6bd9ecb..f3584ebd9 100644 --- a/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.ts +++ b/vid-webpack-master/src/app/shared/storeUtil/utils/vfModule/vfModule.reducers.ts @@ -5,7 +5,7 @@ import { DeleteActionVfModuleInstanceAction, DeleteVFModuleField, DeleteVfModuleInstanceAction, - PauseVFModuleInstanciationAction, + PauseVFModuleInstanciationAction, RemovePauseOnVFModuleInstanciationAction, UndoDeleteActionVfModuleInstanceAction, UpdateVFModluePosition, UpdateVFModuleField, @@ -85,13 +85,21 @@ export function vfModuleReducer(state: ServiceState , action: Action) : ServiceS case VfModuleActions.PAUSE_ACTION_VFMODULE_INSTANCE : { const pauseVfModuleAction = (action); let newState = _.cloneDeep(state); - newState.serviceInstance[pauseVfModuleAction.serviceId].vnfs[pauseVfModuleAction.vnfStoreKey] .vfModules[pauseVfModuleAction.vfModuleModelName][pauseVfModuleAction.dynamicModelName] .pauseInstantiation = PauseStatus.AFTER_COMPLETION; return newState; } + case VfModuleActions.REMOVE_PAUSE_ON_VFMODULE_INSTANCE : { + const removePauseVfModuleAction = (action); + let newState = _.cloneDeep(state); + newState.serviceInstance[removePauseVfModuleAction.serviceId].vnfs[removePauseVfModuleAction.vnfStoreKey] + .vfModules[removePauseVfModuleAction.vfModuleModelName][removePauseVfModuleAction.dynamicModelName] + .pauseInstantiation = null; + return newState; + } + case VfModuleActions.DELETE_ACTION_VF_MODULE_INSTANCE : { const deleteAction = (action); let newState = _.cloneDeep(state); -- cgit 1.2.3-korg