diff options
Diffstat (limited to 'src/app/vnfs/build-artifacts/parameter-definitions')
3 files changed, 39 insertions, 40 deletions
diff --git a/src/app/vnfs/build-artifacts/parameter-definitions/parameter-definition.service.spec.ts b/src/app/vnfs/build-artifacts/parameter-definitions/parameter-definition.service.spec.ts index 8a9c112..a629bcf 100644 --- a/src/app/vnfs/build-artifacts/parameter-definitions/parameter-definition.service.spec.ts +++ b/src/app/vnfs/build-artifacts/parameter-definitions/parameter-definition.service.spec.ts @@ -100,15 +100,35 @@ describe('ParameterDefinitionService', () => { })); - // it('processKeyFile...', inject([ParameterDefinitionService, ParamShareService], (service: ParameterDefinitionService, paramShareService: ParamShareService)=> { - // let keyFile = "PARAMVALUE|SOURCE|RULETYPE|KEY1|VALUE1|KEY2|VALUE2|KEY3|VALUE3\nvalue1|INSTAR|interface_ip_address|UniqueKeyName1|addressfqdn123|UniqueKeyValue|m001ssc001p1n001v001|FieldKeyName|ipaddress_v4\nvalue2|INSTAR|interface_ip_address|UniqueKeyName2|addressfqdnAsgar1|UniqueKeyValue|m001ssc001p1n001v002|FieldKeyName|ipaddress_v4"; - // let expectedPD = [{"name":"name1","type":null,"description":null,"required":null,"default":null,"source":"Manual","rule-type":null, - // "request-keys":[{"key-name":null,"key-value":null},{"key-name":null,"key-value":null},{"key-name":null,"key-value":null}],"response-keys":[{"key-name":null - // ,"key-value":null},{"key-name":null,"key-value":null},{"key-name":null,"key-value":null},{"key-name":null,"key-value":null},{"key-name":null,"key-value":null}],"ruleTypeValues":[null]}]; - // localStorage['paramsContent'] = "{ \"name1\":\"value1\",\"name2\":\"value2\"}"; - // paramShareService.setSessionParamData(expectedPD) - // expect(service.processKeyFile("testfile.txt", keyFile)).toEqual(expectedPD); - - // })); + it('processKeyFile...', inject([ParameterDefinitionService, ParamShareService], (service: ParameterDefinitionService, paramShareService: ParamShareService)=> { + let keyFile = "PARAMVALUE|SOURCE|RULETYPE|KEY1|VALUE1|KEY2|VALUE2|KEY3|VALUE3\nvalue1|INSTAR|interface_ip_address|UniqueKeyName1|addressfqdn123|UniqueKeyValue|m001ssc001p1n001v001|FieldKeyName|ipaddress_v4\nvalue2|INSTAR|interface_ip_address|UniqueKeyName2|addressfqdnAsgar1|UniqueKeyValue|m001ssc001p1n001v002|FieldKeyName|ipaddress_v4"; + let expectedPD = [{"name":"name1","type":null,"description":null,"required":null,"default":null,"source":"Manual","rule-type":null, + "request-keys":[{"key-name":null,"key-value":null},{"key-name":null,"key-value":null},{"key-name":null,"key-value":null}],"response-keys":[{"key-name":null + ,"key-value":null},{"key-name":null,"key-value":null},{"key-name":null,"key-value":null},{"key-name":null,"key-value":null},{"key-name":null,"key-value":null}],"ruleTypeValues":[null]}]; + localStorage['paramsContent'] = "{ \"name1\":\"value1\",\"name2\":\"value2\"}"; + paramShareService.setSessionParamData(expectedPD) + expect(service.processKeyFile("testfile.txt", keyFile)).toEqual(expectedPD); + + })); + + it('destroy...', inject([ParameterDefinitionService, ParamShareService, MappingEditorService], (service: ParameterDefinitionService, paramShareService: ParamShareService, mappingEditorService: MappingEditorService)=> { + mappingEditorService.referenceNameObjects = {"action":"Configure","action-level":"vnf","scope":{"vnf-type":"ticktack","vnfc-type":""},"template":"Y","vm":[],"device-protocol":"CHEF","user-name":"","port-number":"","artifact-list":[{"artifact-name":"template_Configure_ticktack_0.0.1V.json","artifact-type":"config_template"},{"artifact-name":"pd_Configure_ticktack_0.0.1V.yaml","artifact-type":"parameter_definitions"}],"scopeType":"vnf-type"}; + + let displayParamObjects = [{"name":"name1","type":null,"description":null,"required":null,"default":null,"source":"Manual","rule-type":null, + "request-keys":[{"key-name":null,"key-value":null},{"key-name":null,"key-value":null},{"key-name":null,"key-value":null}],"response-keys":[{"key-name":null + ,"key-value":null},{"key-name":null,"key-value":null},{"key-name":null,"key-value":null},{"key-name":null,"key-value":null},{"key-name":null,"key-value":null}],"ruleTypeValues":[null]}]; + localStorage['paramsContent'] = "{ \"name1\":\"value1\",\"name2\":\"value2\"}"; + + let expectedPDdata = "---\nkind: \"Property Definition\"\nversion: V1\nvnf-parameter-list:\n- name: name1\n type: null\n description: null\n required: null\n default: null\n source: Manual\n rule-type: null\n request-keys: null\n response-keys: null\n"; + let expectedAppData = {"input":{"design-request":{"request-id":"115599612197","action":"uploadArtifact","payload":{"userID": "test Usr","vnf-type" : "undefined","action" : "undefined","artifact-name" : "undefined","artifact-type" : "APPC-CONFIG","artifact-version" : "0.0.1","artifact-contents" : "---\nkind: \"Property Definition\"\nversion: V1\nvnf-parameter-list:\n- name: name1\n type: null\n description: null\n required: null\n default: null\n source: Manual\n rule-type: null\n request-keys: null\n response-keys: null\n"}}}}; + service.appDataObject = {pd:""}; + service.downloadDataObject = {pd:{pdData:"", pdFileName:""}}; + service.destroy(displayParamObjects); + expect(mappingEditorService.downloadDataObject.pd.pdData).toEqual(expectedPDdata); + //expect(mappingEditorService.appDataObject.pd).toEqual(expectedAppData); + + + })); + }); diff --git a/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.html b/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.html index ed0fbd3..cb02db9 100644 --- a/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.html +++ b/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.html @@ -23,8 +23,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. --> <simple-notifications [options]="options"></simple-notifications> -<ng-progress [positionUsing]="'marginLeft'" [minimum]="0.15" [maximum]="1" [speed]="200" [showSpinner]="false" [direction]="'leftToRightIncreased'" [color]="'#6ab344'" - [trickleSpeed]="250" [thick]="true" [ease]="'linear'"></ng-progress> +<ng-progress [positionUsing]="'marginLeft'" [minimum]="0.15" [maximum]="1" [speed]="200" [showSpinner]="false" [direction]="'leftToRightIncreased'" [color]="'#6ab344'" [trickleSpeed]="250" [thick]="true" [ease]="'linear'"></ng-progress> <div class="card" style=" margin-bottom: 23px;"> <img class="card-img-top" data-src="holder.js/100%x180/" alt=""> <div class="card-block" style="border-top: 5px solid #6ab344;border-top-right-radius: 7px;border-top-left-radius: 7px;"> @@ -43,7 +42,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. <label>Protocol</label><input class="form-control" type="text" disabled value="{{protocol}}" /> </div> <div *ngIf="(action === 'ConfigScaleOut')" class="col-lg-3 col-sm-6 col-md-3 col-xs-12"> - <label>templateIdentifier</label><input class="form-control" type="text" disabled value="{{identifier}}" /> + <label>Template Identifier</label><input class="form-control" type="text" disabled value="{{identifier}}" /> </div> </div> </div> @@ -55,18 +54,15 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. <div class="input-group"> <input id="inputFile1" class="file" hidden #myInput1 type='file' (change)="fileChange(myInput1, 'pdfile')"> <input [(ngModel)]="myPdFileName" type="text" class="input-lg" disabled placeholder="Upload parameters from PC" style="width:85%;"> - <button [disabled]="(undefined == mappingEditorService.latestAction)" (click)="browsePdFile($event)" class="browse mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary input-lg" - type="button"> UPLOAD PD FILE + <button [disabled]="(undefined == mappingEditorService.latestAction)" (click)="browsePdFile($event)" class="browse mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary input-lg" type="button"> UPLOAD PD FILE </button> </div> </div> <div class="col-12"> <div class="input-group"> <input id="inputFile2" class="file" hidden #myInput2 type='file' (change)="fileChange(myInput2, 'keyfile')"> - <input [(ngModel)]="myKeyFileName" type="text" class="input-lg" disabled placeholder="Upload key file from PC. You can upload a key file only if you have some parameters." - style="width:85%;"> - <button [disabled]="(!(undefined !== displayParamObjects && displayParamObjects.length>0))" (click)="browseKeyFile($event)" class="browse mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary input-lg" - type="button">UPLOAD KEY FILE + <input [(ngModel)]="myKeyFileName" type="text" class="input-lg" disabled placeholder="Upload key file from PC. You can upload a key file only if you have some parameters." style="width:85%;"> + <button [disabled]="(!(undefined !== displayParamObjects && displayParamObjects.length>0))" (click)="browseKeyFile($event)" class="browse mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary input-lg" type="button">UPLOAD KEY FILE </button> </div> </div> @@ -148,8 +144,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. </td> <td class="mdl-data-table__cell--non-numeric"> - <select (ngModelChange)="ruleTypeChanged($event,obj)" class="form-control" id="id4" [(ngModel)]="obj['rule-type']" #objRuleType="ngModel" name="objRuleType{{i}}" - list="ruleTypes"> + <select (ngModelChange)="ruleTypeChanged($event,obj)" class="form-control" id="id4" [(ngModel)]="obj['rule-type']" #objRuleType="ngModel" name="objRuleType{{i}}" list="ruleTypes"> <option *ngFor="let rTyp of obj.ruleTypeValues;" [value]="rTyp" [selected]="rTyp === obj.rule-type"> {{rTyp}} @@ -158,8 +153,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. </td> <td> - <select *ngIf="obj.showFilterFields" (ngModelChange)="filetrByFieldChanged($event,obj)" class="form-control" id="id4" [(ngModel)]="obj['response-keys'][3]['key-value']" - #objfilterByField="ngModel" name="filterByField{{i}}" list="ruleTypes"> + <select *ngIf="obj.showFilterFields" (ngModelChange)="filetrByFieldChanged($event,obj)" class="form-control" id="id4" [(ngModel)]="obj['response-keys'][3]['key-value']" #objfilterByField="ngModel" name="filterByField{{i}}" list="ruleTypes"> <option *ngFor="let fTyp of filterByFieldvalues;" [value]="fTyp" [selected]="fTyp === obj['response-keys'][3]['key-value']"> {{fTyp}} @@ -167,8 +161,8 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property. </select> </td> <td> - <input *ngIf="obj.showFilterFields" [disabled]="!(obj.enableFilterByValue)" type="text" [value]="obj['response-keys'][4]['key-value']" class="form-control" - id="id4" [(ngModel)]="obj['response-keys'][4]['key-value']" #objfilterByValue="ngModel" name="objfilterByValue{{i}}" list="ruleTypes"> + <input *ngIf="obj.showFilterFields" [disabled]="!(obj.enableFilterByValue)" type="text" [value]="obj['response-keys'][4]['key-value']" class="form-control" id="id4" [(ngModel)]="obj['response-keys'][4]['key-value']" #objfilterByValue="ngModel" name="objfilterByValue{{i}}" + list="ruleTypes"> </td> <td class="mdl-data-table__cell--non-numeric">{{obj['response-keys'][0]['key-name']}} diff --git a/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.spec.ts b/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.spec.ts index 2668f2b..0d220c8 100644 --- a/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.spec.ts +++ b/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.spec.ts @@ -119,21 +119,6 @@ describe('ParameterComponent', () => { expect(component.ngAfterViewInit()).toEqual("TEST PD INFORMATION"); })); -/* - it('should read file key file content...', () => { - let input = {"__zone_symbol__changefalse":[{"type":"eventTask","state":"running","source":"HTMLInputElement.addEventListener:change","zone":"angular","runCount":2}]}; - expect(component.fileChange(input, 'keyfile')); - }); - -let content = new Blob(["PARAMVALUE|SOURCE|RULETYPE|KEY1|VALUE1|KEY2|VALUE2|KEY3|VALUE3\nvalue1|INSTAR|interface_ip_address|UniqueKeyName1|addressfqdn123|UniqueKeyValue|m001ssc001p1n001v001|FieldKeyName|ipaddress_v4\nvalue2|INSTAR|interface_ip_address|UniqueKeyName2|addressfqdnAsgar1|UniqueKeyValue|m001ssc001p1n001v002|FieldKeyName|ipaddress_v4"] -{includes:()}); -let file = new File(content, "test.txt"); - it('should read file PD file content...', () => { - let input = {"__zone_symbol__changefalse":[{"type":"eventTask","state":"running","source":"HTMLInputElement.addEventListener:change","zone":"angular","runCount":2}]}; - - expect(component.fileChange(input, 'pdfile')); - }); - */ it('should set the ruletypes for source A&AI...', inject([MappingEditorService, ParamShareService], (mappingEditorService: MappingEditorService, paramShareService:ParamShareService) => { let obj = {"name":"name1","type":"ipv4-address","description":"xxx","required":"true","default":null,"source":"A&AI","rule-type":null,"request-keys":[{"key-name":null,"key-value":null},{"key-name":null,"key-value":null},{"key-name":null,"key-value":null}],"response-keys":[{"key-name":null,"key-value":null},{"key-name":null,"key-value":null},{"key-name":null,"key-value":null},{"key-name":null,"key-value":null},{"key-name":null,"key-value":null}],"ruleTypeValues":[null]} |