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 <ikram@research.att.com>
Change-Id: I378cb2afd0f2c994a856ad31895cec3fca376b33
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.spec.ts
index 90ecb85..f76cf21 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.spec.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.spec.ts
@@ -75,9 +75,10 @@
       new TreeNodeContextMenuModel('undoDelete', 'context-menu-undoDelete', 'Undo Delete', 'undo-delete'),
       new TreeNodeContextMenuModel('undoUpgrade', 'context-menu-undoUpgrade', 'Undo Upgrade', 'undo-delete'),
       new TreeNodeContextMenuModel('changeAssociations', 'context-menu-changeAssociations', 'Change Associations', 'edit-file-o'),
-      new TreeNodeContextMenuModel('pauseInstantiation', 'context-menu-pause', 'Add pause upon completion', 'pause-upon-completion')
+      new TreeNodeContextMenuModel('pauseInstantiation', 'context-menu-pause', 'Add pause upon completion', 'pause-upon-completion'),
+      new TreeNodeContextMenuModel('removePause', 'context-menu-removePause', 'Remove Pause', 'pause-upon-completion')
     ];
-    expect(options.length).toEqual(11);
+    expect(options.length).toEqual(12);
     expect(options).toEqual(expected);
   });
 
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.ts
index 3fc5c53..fe3f093 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.ts
@@ -54,7 +54,8 @@
       new TreeNodeContextMenuModel('undoDelete', 'context-menu-undoDelete', 'Undo Delete', 'undo-delete'),
       new TreeNodeContextMenuModel('undoUpgrade', 'context-menu-undoUpgrade', 'Undo Upgrade', 'undo-delete'),
       new TreeNodeContextMenuModel('changeAssociations', 'context-menu-changeAssociations', 'Change Associations', 'edit-file-o'),
-      new TreeNodeContextMenuModel('pauseInstantiation', 'context-menu-pause', 'Add pause upon completion', 'pause-upon-completion')
+      new TreeNodeContextMenuModel('pauseInstantiation', 'context-menu-pause', 'Add pause upon completion', 'pause-upon-completion'),
+      new TreeNodeContextMenuModel('removePause', 'context-menu-removePause', 'Remove Pause', 'pause-upon-completion')
     ];
   }
 
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 f7bf35a..33ec080 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
@@ -23,6 +23,7 @@
   deleteActionVfModuleInstance,
   deleteVFModuleField,
   pauseActionVFModuleInstance,
+  removePauseActionVFModuleInstance,
   removeVfModuleInstance,
   undoDeleteVfModuleInstance,
   undoUgradeVFModule,
@@ -393,7 +394,14 @@
         method: (node, serviceModelId) => {
           this._store.dispatch(pauseActionVFModuleInstance(node.data.dynamicModelName, node.parent.data.vnfStoreKey, serviceModelId, node.data.modelName));
         },
-        visible: () => this._sharedTreeService.shouldShowPauseInstantiation(),
+        visible: () => this._sharedTreeService.shouldShowPauseInstantiation(node),
+        enable: () => true,
+      },
+      removePause: {
+        method: (node, serviceModelId) => {
+          this._store.dispatch(removePauseActionVFModuleInstance(node.data.dynamicModelName, node.parent.data.vnfStoreKey, serviceModelId, node.data.modelName));
+        },
+        visible: () => this._sharedTreeService.shouldShowRemovePause(node),
         enable: () => true,
       }
     };
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
index 98edb41..3b00e64 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
@@ -1,7 +1,7 @@
 import {Injectable} from "@angular/core";
 import {NgRedux} from "@angular-redux/store";
 import {AppState} from "../../../shared/store/reducers";
-import {ServiceInstanceActions} from "../../../shared/models/serviceInstanceActions";
+import {PauseStatus, ServiceInstanceActions} from "../../../shared/models/serviceInstanceActions";
 import {MessageBoxData} from "../../../shared/components/messageBox/messageBox.data";
 import {MessageBoxService} from "../../../shared/components/messageBox/messageBox.service";
 import * as _ from "lodash";
@@ -222,7 +222,17 @@
     }
   }
 
-  shouldShowPauseInstantiation(): boolean {
+  shouldShowRemovePause(node) : boolean {
+    if(FeatureFlagsService.getFlagState(Features.FLAG_2008_REMOVE_PAUSE_INSTANTIATION, this._store)){
+      return node.pauseInstantiation === PauseStatus.AFTER_COMPLETION;
+    }
+    return false;
+  }
+
+  shouldShowPauseInstantiation(node): boolean {
+    if(FeatureFlagsService.getFlagState(Features.FLAG_2008_REMOVE_PAUSE_INSTANTIATION, this._store)){
+      return (FeatureFlagsService.getFlagState(Features.FLAG_2006_PAUSE_VFMODULE_INSTANTIATION_CREATION, this._store) && node.pauseInstantiation == null);
+    }
     return (FeatureFlagsService.getFlagState(Features.FLAG_2006_PAUSE_VFMODULE_INSTANTIATION_CREATION, this._store));
   }
   /****************************************************
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 9926d6c..e652be7 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 @@
   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 82e2409..c250993 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 @@
   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 @@
   vfModuleModelName : string;
 }
 
+export interface RemovePauseOnVFModuleInstanciationAction extends Action {
+  dynamicModelName: string;
+  vnfStoreKey : string;
+  serviceId: string;
+  vfModuleModelName : string;
+}
+
 export const removeVfModuleInstance: ActionCreator<DeleteVfModuleInstanceAction> = (modelName, serviceModelId, vfName, vnfStoreKey, dynamicModelName) => ({
   type: VfModuleActions.REMOVE_VNF_MODULE_INSTANCE,
   modelName: modelName,
@@ -190,3 +198,11 @@
   serviceId,
   vfModuleModelName
 });
+
+export const removePauseActionVFModuleInstance: ActionCreator<RemovePauseOnVFModuleInstanciationAction> = (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 e73fe0c..50981e1 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 @@
   CreateVFModuleInstanceAction,
   DeleteActionVfModuleInstanceAction,
   DeleteVFModuleField,
-  DeleteVfModuleInstanceAction, PauseVFModuleInstanciationAction,
+  DeleteVfModuleInstanceAction, PauseVFModuleInstanciationAction, RemovePauseOnVFModuleInstanciationAction,
   UndoDeleteActionVfModuleInstanceAction,
   UpdateVFModluePosition,
   UpdateVFModuleField,
@@ -251,6 +251,18 @@
   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(<any>getPausedRedux(), getRemovePauseActionVfModule(dynamicModelName))
+      .serviceInstance['serviceModelId'].vnfs['vnfStoreKey'].vfModules['vfModuleModelName'][dynamicModelName];
+    expect(vfModule).toBeDefined();
+    expect(vfModule.pauseInstantiation).toEqual(pauseInstantiation);
+  });
+
 test('#UPGRADE_VFMODULE', () => {
   let vfModule = vfModuleReducer(<any>getReduxState(),
     <UpgradeVfModuleInstanceAction>{
@@ -415,4 +427,14 @@
     vfModuleModelName: 'vfModuleModelName'
   }
 }
+
+  function getRemovePauseActionVfModule(dynamicModelName: string) {
+    return <RemovePauseOnVFModuleInstanciationAction>{
+      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 fa6bd9e..f3584eb 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 @@
   DeleteActionVfModuleInstanceAction,
   DeleteVFModuleField,
   DeleteVfModuleInstanceAction,
-  PauseVFModuleInstanciationAction,
+  PauseVFModuleInstanciationAction, RemovePauseOnVFModuleInstanciationAction,
   UndoDeleteActionVfModuleInstanceAction,
   UpdateVFModluePosition,
   UpdateVFModuleField,
@@ -85,13 +85,21 @@
     case VfModuleActions.PAUSE_ACTION_VFMODULE_INSTANCE : {
       const pauseVfModuleAction = (<PauseVFModuleInstanciationAction>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 = (<RemovePauseOnVFModuleInstanciationAction>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 = (<DeleteActionVfModuleInstanceAction>action);
       let newState = _.cloneDeep(state);