Skip to content
Snippets Groups Projects
Commit 46bd7f55 authored by Henning Josef Moritz Werner Schmeink's avatar Henning Josef Moritz Werner Schmeink
Browse files

added update priority function to the frontend

parent 286bf96c
No related branches found
No related tags found
No related merge requests found
...@@ -15,8 +15,8 @@ ...@@ -15,8 +15,8 @@
</div> </div>
<br> <br>
<div class="col"> <div class="col">
<label for="priority" i18n="testcase priority">Test priority</label> <label for="testPriority" i18n="testcase priority">Test priority</label>
<input mdbInput type="number" class="form-control" id="priority" value="{{testcase.priority}}"> <input mdbInput type="number" class="form-control" id="testPriority" value="{{testcase.priority}}">
</div> </div>
</div> </div>
......
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { BPMNTestcase } from 'src/app/models/bpmn-testcase'; import { BPMNTestcase } from 'src/app/models/bpmn-testcase';
import { Router, ActivatedRoute } from '@angular/router'; import { Router, ActivatedRoute } from '@angular/router';
import { TestService } from 'src/app/services/test.service'; import { TestService } from 'src/app/services/test.service';
import { FlowInfo } from 'src/app/models/flow-info'; import { FlowInfo } from 'src/app/models/flow-info';
import { TaskVariables } from 'src/app/models/task-variables'; import { TaskVariables } from 'src/app/models/task-variables';
import { VariableValue } from 'src/app/models/variable-value'; import { VariableValue } from 'src/app/models/variable-value';
import { FormGroup, FormBuilder, FormArray, Validators, FormControl } from '@angular/forms'; import { FormGroup, FormBuilder, FormArray, Validators, FormControl } from '@angular/forms';
import ValidationUtils from 'src/app/utils/validation'; import ValidationUtils from 'src/app/utils/validation';
import { DataType } from 'src/app/models/data-type'; import { DataType } from 'src/app/models/data-type';
import { VariableProposals } from 'src/app/models/variable-proposals'; import { VariableProposals } from 'src/app/models/variable-proposals';
import { VariableValueEndCheck } from 'src/app/models/variable-value-endcheck'; import { VariableValueEndCheck } from 'src/app/models/variable-value-endcheck';
import { ServiceWithMock } from 'src/app/models/service-with-mock'; import { ServiceWithMock } from 'src/app/models/service-with-mock';
import { ExternalTopicWithMocks } from 'src/app/models/external-topic-with-mocks'; import { ExternalTopicWithMocks } from 'src/app/models/external-topic-with-mocks';
@Component({ @Component({
selector: 'app-test', selector: 'app-test',
templateUrl: './test.component.html', templateUrl: './test.component.html',
styleUrls: ['./test.component.css'] styleUrls: ['./test.component.css']
}) })
export class TestComponent implements OnInit { export class TestComponent implements OnInit {
isTestLoading: boolean; isTestLoading: boolean;
testcase: BPMNTestcase; testcase: BPMNTestcase;
actualProject: number; actualProject: number;
actualFlow: string; actualFlow: string;
actualTest: string; actualTest: string;
isInfoLoading: boolean; isInfoLoading: boolean;
flowInfo: FlowInfo; flowInfo: FlowInfo;
isEdit: boolean; isEdit: boolean;
isLoading: boolean; isLoading: boolean;
dataTypes = new Map<string, string>(); dataTypes = new Map<string, string>();
dataTypesEnum: typeof DataType = DataType; dataTypesEnum: typeof DataType = DataType;
mocks = new Map<string, Array<string>>(); mocks = new Map<string, Array<string>>();
proposals: Array<Array<VariableProposals>>; proposals: Array<Array<VariableProposals>>;
public formGroup: FormGroup; public formGroup: FormGroup;
constructor(private _fb: FormBuilder, private testService: TestService, private router: Router, private route: ActivatedRoute) { constructor(private _fb: FormBuilder, private testService: TestService, private router: Router, private route: ActivatedRoute) {
this.route.params.subscribe(params => { this.route.params.subscribe(params => {
this.actualProject = params['projectId']; this.actualProject = params['projectId'];
this.actualFlow = params['flowId']; this.actualFlow = params['flowId'];
this.actualTest = params['testId']; this.actualTest = params['testId'];
}) })
this.initFormGroup(); this.initFormGroup();
} }
async ngOnInit() { async ngOnInit() {
this.isLoading = true; this.isLoading = true;
await this.loadInfo(); await this.loadInfo();
if (this.actualTest) { if (this.actualTest) {
this.isEdit = true; this.isEdit = true;
await this.loadTest(); await this.loadTest();
} else { } else {
this.isEdit = false; this.isEdit = false;
} }
this.initTestcase(); this.initTestcase();
this.isLoading = false; this.isLoading = false;
} }
/** /**
* Because the structure of the underlying bpmn-process-model isn't known during development, * Because the structure of the underlying bpmn-process-model isn't known during development,
* the creation of the formGroup and testcase needs to be dynamic. This method creates the formGroup * the creation of the formGroup and testcase needs to be dynamic. This method creates the formGroup
* on a basis of flowInfo (variables, userTasks) and pushs the corresponding testcase values to this formGroup. * on a basis of flowInfo (variables, userTasks) and pushs the corresponding testcase values to this formGroup.
* The testcase has two sections. * The testcase has two sections.
* 1. Input of variable values for user tasks * 1. Input of variable values for user tasks
* 2. End checking concrete values at the end of the process instance * 2. End checking concrete values at the end of the process instance
* *
* Both sections are going to be prepared in this method. * Both sections are going to be prepared in this method.
*/ */
initTestcase() { initTestcase() {
if (!this.testcase) { if (!this.testcase) {
this.testcase = this.createTestcase(this.actualFlow); this.testcase = this.createTestcase(this.actualFlow);
} }
//1. Preparing formGroup and testcase-values for user task //1. Preparing formGroup and testcase-values for user task
this.proposals = []; this.proposals = [];
let taskVariableValueList = []; let taskVariableValueList = [];
let taskVariableList = []; let taskVariableList = [];
for (let userInputs of this.flowInfo.userInputs) { for (let userInputs of this.flowInfo.userInputs) {
if (userInputs.inputVariables.length > 0) { if (userInputs.inputVariables.length > 0) {
let inputProposals = []; let inputProposals = [];
let valueObj = {}; let valueObj = {};
let variableList = []; let variableList = [];
for (let variables of userInputs.inputVariables) { for (let variables of userInputs.inputVariables) {
inputProposals.push(this.getVariableProposals(variables)); inputProposals.push(this.getVariableProposals(variables));
let countVariableFrequency = this.countVariable(variables, taskVariableValueList); let countVariableFrequency = this.countVariable(variables, taskVariableValueList);
let value = this.getVariableValueOrDefault(userInputs.name, variables, countVariableFrequency); let value = this.getVariableValueOrDefault(userInputs.name, variables, countVariableFrequency);
valueObj[variables] = value; valueObj[variables] = value;
let newVariable = this.createVariableValue(variables, value); let newVariable = this.createVariableValue(variables, value);
variableList.push(newVariable); variableList.push(newVariable);
} }
this.proposals.push(inputProposals); this.proposals.push(inputProposals);
taskVariableValueList.push(valueObj); taskVariableValueList.push(valueObj);
let newTaskVariable = this.createTaskVariables(userInputs.name, variableList); let newTaskVariable = this.createTaskVariables(userInputs.name, variableList);
this.addTaskVariableFormGroup(variableList); this.addTaskVariableFormGroup(variableList);
taskVariableList.push(newTaskVariable); taskVariableList.push(newTaskVariable);
} }
} }
//2. Preparing formGroup and testcase-values for end check //2. Preparing formGroup and testcase-values for end check
let endCheckVariableList = []; let endCheckVariableList = [];
let endCheckValueObj = {}; let endCheckValueObj = {};
let valueObj = {}; let valueObj = {};
for (let endCheckVariable of this.flowInfo.variables) { for (let endCheckVariable of this.flowInfo.variables) {
let value = this.getEndCheckValueOrDefault(endCheckVariable.variable); let value = this.getEndCheckValueOrDefault(endCheckVariable.variable);
let compareOperator = this.getEndCheckCompareOperatorOrDefault(endCheckVariable.variable); let compareOperator = this.getEndCheckCompareOperatorOrDefault(endCheckVariable.variable);
let newVariable = this.createVariableValueEndCheck(endCheckVariable.variable, value, compareOperator); let newVariable = this.createVariableValueEndCheck(endCheckVariable.variable, value, compareOperator);
valueObj[endCheckVariable.variable] = value; valueObj[endCheckVariable.variable] = value;
endCheckVariableList.push(newVariable); endCheckVariableList.push(newVariable);
endCheckValueObj[endCheckVariable.variable] = value; endCheckValueObj[endCheckVariable.variable] = value;
let endCheckCompareField = endCheckVariable.variable + "Compare"; let endCheckCompareField = endCheckVariable.variable + "Compare";
endCheckValueObj[endCheckCompareField] = newVariable.compareOperator; endCheckValueObj[endCheckCompareField] = newVariable.compareOperator;
this.addEndVariableFormGroup(newVariable); this.addEndVariableFormGroup(newVariable);
} }
//3. Preparing formGroup and testcase-values for mock //3. Preparing formGroup and testcase-values for mock
let mockObj = {}; let mockObj = {};
for(let service of this.flowInfo.delegateServices) { for(let service of this.flowInfo.delegateServices) {
this.addMockFormGroupDelegate(service); this.addMockFormGroupDelegate(service);
let mockValue = this.getServiceMockOrNull(service.mocks); let mockValue = this.getServiceMockOrNull(service.mocks);
mockObj[service.serviceName] = mockValue; mockObj[service.serviceName] = mockValue;
} }
for(let externalTopic of this.flowInfo.externalTopics) { for(let externalTopic of this.flowInfo.externalTopics) {
this.addMockFormGroupExternal(externalTopic); this.addMockFormGroupExternal(externalTopic);
let mockValue = this.getServiceMockOrNull(externalTopic.mocks); let mockValue = this.getServiceMockOrNull(externalTopic.mocks);
mockObj[externalTopic.externalTopicName] = mockValue; mockObj[externalTopic.externalTopicName] = mockValue;
} }
//Patching all values to formGroup bound object //Patching all values to formGroup bound object
this.testcase.taskVariableList = taskVariableList; this.testcase.taskVariableList = taskVariableList;
this.testcase.endChecks = endCheckVariableList; this.testcase.endChecks = endCheckVariableList;
let formObj = {}; let formObj = {};
formObj['name'] = this.testcase.name; formObj['name'] = this.testcase.name;
formObj['priority'] = this.testcase.priority; formObj['priority'] = this.testcase.priority;
formObj['taskVariableList'] = taskVariableValueList; formObj['taskVariableList'] = taskVariableValueList;
formObj['endChecks'] = endCheckValueObj; formObj['endChecks'] = endCheckValueObj;
formObj['mocks'] = mockObj; formObj['mocks'] = mockObj;
this.formGroup.patchValue(formObj);
console.log(formObj); }
this.formGroup.patchValue(formObj); async loadTest() {
} this.isTestLoading = true;
try {
async loadTest() { let result = await this.testService.getTest(this.actualProject, this.actualTest);
this.isTestLoading = true; this.testcase = result;
try { } finally {
let result = await this.testService.getTest(this.actualProject, this.actualTest); this.isTestLoading = false;
this.testcase = result; }
} finally { }
this.isTestLoading = false;
} async loadInfo() {
} this.isInfoLoading = true;
try {
async loadInfo() { let result = await this.testService.getInfo(this.actualProject, this.actualFlow);
this.isInfoLoading = true; this.flowInfo = result;
try { this.cleanUpServiceWithMocks();
let result = await this.testService.getInfo(this.actualProject, this.actualFlow); this.initVariableDataTypes();
this.flowInfo = result; } finally {
this.cleanUpServiceWithMocks(); this.isInfoLoading = false;
this.initVariableDataTypes(); }
} finally { }
this.isInfoLoading = false;
} async save() {
} if (!this.formGroup.invalid) {
async save() { this.extractForm();
if (!this.formGroup.invalid) {
/**
this.extractForm(); * Add Priority to the test case
* @info wenn die Priorität über ein FormGroupName/NgModel hinzugefügt wird,
if (this.isEdit) { * initialisiert der Test nicht. Daher gehen wir über die ID
await this.updateTestcase(); */
} else { this.testcase.priority = parseInt((<HTMLInputElement>document.getElementById("testPriority")).value);
await this.saveTestcase();
} if (this.isEdit) {
} else { await this.updateTestcase();
ValidationUtils.validateAllFormFields(this.formGroup); } else {
} await this.saveTestcase();
} }
} else {
async saveTestcase() { ValidationUtils.validateAllFormFields(this.formGroup);
try { }
await this.testService.createTest(this.actualProject, this.testcase); }
this.router.navigate(['../'], { relativeTo: this.route });
} catch (err) { async saveTestcase() {
if (err.status === 409) { try {
this.formGroup.controls['name'].setErrors({ 'testIdTaken': true }); await this.testService.createTest(this.actualProject, this.testcase);
} else { this.router.navigate(['../'], { relativeTo: this.route });
throw err; } catch (err) {
} if (err.status === 409) {
} finally { this.formGroup.controls['name'].setErrors({ 'testIdTaken': true });
// } else {
} throw err;
} }
} finally {
async updateTestcase() { //
try { }
await this.testService.updateTest(this.actualProject, this.actualTest, this.testcase); }
this.router.navigate(['../../'], { relativeTo: this.route });
} catch (err) { async updateTestcase() {
if (err.status === 409) { try {
this.formGroup.controls['name'].setErrors({ 'testIdTaken': true }); // TODO
} else { await this.testService.updateTest(this.actualProject, this.actualTest, this.testcase);
throw err; this.router.navigate(['../../'], { relativeTo: this.route });
} } catch (err) {
} finally { if (err.status === 409) {
// this.formGroup.controls['name'].setErrors({ 'testIdTaken': true });
} } else {
} throw err;
}
createVariableValue(variable: string, value: Object): VariableValue { } finally {
return { //
variable: variable, }
value: value }
}
} createVariableValue(variable: string, value: Object): VariableValue {
return {
createVariableValueEndCheck(variable: string, value: Object, compareOperator: string): VariableValueEndCheck { variable: variable,
return { value: value
variable: variable, }
value: value, }
compareOperator: compareOperator
} createVariableValueEndCheck(variable: string, value: Object, compareOperator: string): VariableValueEndCheck {
} return {
variable: variable,
createTaskVariables(id: string, variableList: Array<VariableValue>): TaskVariables { value: value,
return { compareOperator: compareOperator
task: id, }
variableValues: variableList }
}
} createTaskVariables(id: string, variableList: Array<VariableValue>): TaskVariables {
return {
createTestcase(flow: string): BPMNTestcase { task: id,
return { variableValues: variableList
name: "", }
flow: flow, }
taskVariableList: [],
endChecks: [], createTestcase(flow: string): BPMNTestcase {
mocks: [], return {
priority: 0 name: "",
} flow: flow,
} taskVariableList: [],
endChecks: [],
countVariable(variable: string, taskVariableValueList: any[]) { mocks: [],
let count = 0; priority: 0
for(let taskVariable of taskVariableValueList) { }
if(taskVariable[variable]) { }
count++;
} countVariable(variable: string, taskVariableValueList: any[]) {
} let count = 0;
for(let taskVariable of taskVariableValueList) {
return count; if(taskVariable[variable]) {
} count++;
}
getVariableValueOrDefault(task: string, variable: string, count: number) { }
for (let taskVariables of this.testcase.taskVariableList) {
if (taskVariables.task == task) { return count;
for (let variableValue of taskVariables.variableValues) { }
if (variableValue.variable == variable) {
if(count == 0) { getVariableValueOrDefault(task: string, variable: string, count: number) {
if (this.dataTypes.get(variable) == 'java.lang.Boolean') { for (let taskVariables of this.testcase.taskVariableList) {
return variableValue.value.toString(); if (taskVariables.task == task) {
} else { for (let variableValue of taskVariables.variableValues) {
return variableValue.value; if (variableValue.variable == variable) {
} if(count == 0) {
} else { if (this.dataTypes.get(variable) == 'java.lang.Boolean') {
count--; return variableValue.value.toString();
} } else {
} return variableValue.value;
} }
} } else {
} count--;
}
if (this.dataTypes.get(variable) == 'java.lang.Boolean') { }
return 'null'; }
} }
}
return null;
} if (this.dataTypes.get(variable) == 'java.lang.Boolean') {
return 'null';
getEndCheckValueOrDefault(variable: string) { }
for (let endCheck of this.testcase.endChecks) {
if (endCheck.variable == variable) { return null;
if (this.dataTypes.get(variable) == 'java.lang.Boolean') { }
return endCheck.value.toString();
} else { getEndCheckValueOrDefault(variable: string) {
return endCheck.value; for (let endCheck of this.testcase.endChecks) {
} if (endCheck.variable == variable) {
} if (this.dataTypes.get(variable) == 'java.lang.Boolean') {
} return endCheck.value.toString();
} else {
if (this.dataTypes.get(variable) == 'java.lang.Boolean') { return endCheck.value;
return 'null'; }
} }
}
return null;
} if (this.dataTypes.get(variable) == 'java.lang.Boolean') {
return 'null';
getEndCheckCompareOperatorOrDefault(variable: string) { }
for (let endCheck of this.testcase.endChecks) {
if (endCheck.variable == variable) { return null;
return endCheck.compareOperator; }
}
} getEndCheckCompareOperatorOrDefault(variable: string) {
for (let endCheck of this.testcase.endChecks) {
return "=="; if (endCheck.variable == variable) {
} return endCheck.compareOperator;
}
getVariableProposals(variable: string): VariableProposals { }
for (let infoVariable of this.flowInfo.variables) {
if (infoVariable.variable == variable) { return "==";
return infoVariable; }
}
} getVariableProposals(variable: string): VariableProposals {
for (let infoVariable of this.flowInfo.variables) {
return null; if (infoVariable.variable == variable) {
} return infoVariable;
}
initFormGroup() { }
this.formGroup = this._fb.group({
name: ['', Validators.compose([Validators.required])], return null;
taskVariableList: this._fb.array([ }
]),
endChecks: this._fb.group({}), initFormGroup() {
mocks: this._fb.group({}) this.formGroup = this._fb.group({
}); name: ['', Validators.compose([Validators.required])],
} taskVariableList: this._fb.array([
]),
private addTaskVariableFormGroup(variableList: Array<VariableValue>) { endChecks: this._fb.group({}),
mocks: this._fb.group({})
let controls = {}; });
for (let v of variableList) { }
controls[v.variable] = [''];
} private addTaskVariableFormGroup(variableList: Array<VariableValue>) {
let formGroup = this._fb.group(controls);
let controls = {};
this.taskVariableList.push(formGroup); for (let v of variableList) {
} controls[v.variable] = [''];
}
get taskVariableList(): FormArray { let formGroup = this._fb.group(controls);
return <FormArray>this.formGroup.get('taskVariableList');
} this.taskVariableList.push(formGroup);
}
private addEndVariableFormGroup(variableObj: VariableValueEndCheck) {
this.endChecks.addControl(variableObj.variable, new FormControl('')); get taskVariableList(): FormArray {
this.endChecks.addControl(variableObj.variable + "Compare", new FormControl('')); return <FormArray>this.formGroup.get('taskVariableList');
} }
private addMockFormGroupDelegate(serviceWithMocks: ServiceWithMock) { private addEndVariableFormGroup(variableObj: VariableValueEndCheck) {
this.mocksForm.addControl(serviceWithMocks.serviceName, new FormControl('')); this.endChecks.addControl(variableObj.variable, new FormControl(''));
} this.endChecks.addControl(variableObj.variable + "Compare", new FormControl(''));
}
private addMockFormGroupExternal(externalTopicMocks: ExternalTopicWithMocks) {
this.mocksForm.addControl(externalTopicMocks.externalTopicName, new FormControl('')); private addMockFormGroupDelegate(serviceWithMocks: ServiceWithMock) {
} this.mocksForm.addControl(serviceWithMocks.serviceName, new FormControl(''));
}
get endChecks(): FormGroup {
return <FormGroup>this.formGroup.get('endChecks'); private addMockFormGroupExternal(externalTopicMocks: ExternalTopicWithMocks) {
} this.mocksForm.addControl(externalTopicMocks.externalTopicName, new FormControl(''));
}
get mocksForm(): FormGroup {
return <FormGroup>this.formGroup.get('mocks'); get endChecks(): FormGroup {
} return <FormGroup>this.formGroup.get('endChecks');
}
private extractForm() {
const formValue = this.formGroup.value; get mocksForm(): FormGroup {
console.log(formValue); return <FormGroup>this.formGroup.get('mocks');
}
//Extract name
this.testcase.name = formValue.name; private extractForm() {
const formValue = this.formGroup.value;
//Extract priority
this.testcase.priority = formValue.priority; //Extract name
this.testcase.name = formValue.name;
//Extract task-variables
for (var _i = 0; _i < formValue.taskVariableList.length; _i++) { //Extract task-variables
let variableValue = formValue.taskVariableList[_i]; for (var _i = 0; _i < formValue.taskVariableList.length; _i++) {
for (let v of this.testcase.taskVariableList[_i].variableValues) { let variableValue = formValue.taskVariableList[_i];
if (this.dataTypes.get(v.variable) == 'java.lang.Boolean') { for (let v of this.testcase.taskVariableList[_i].variableValues) {
v.value = JSON.parse(variableValue[v.variable]); if (this.dataTypes.get(v.variable) == 'java.lang.Boolean') {
} else { v.value = JSON.parse(variableValue[v.variable]);
v.value = variableValue[v.variable]; } else {
} v.value = variableValue[v.variable];
} }
this.testcase.taskVariableList[_i].variableValues = this.testcase.taskVariableList[_i].variableValues }
.filter(v => v.value !== null); this.testcase.taskVariableList[_i].variableValues = this.testcase.taskVariableList[_i].variableValues
} .filter(v => v.value !== null);
}
this.testcase.taskVariableList = this.testcase.taskVariableList
.filter(v => v.variableValues.length > 0); this.testcase.taskVariableList = this.testcase.taskVariableList
.filter(v => v.variableValues.length > 0);
//Extract endchecks
for (var _i = 0; _i < this.testcase.endChecks.length; _i++) { //Extract endchecks
let value = formValue.endChecks[this.testcase.endChecks[_i].variable]; for (var _i = 0; _i < this.testcase.endChecks.length; _i++) {
if (this.dataTypes.get(this.testcase.endChecks[_i].variable) == 'java.lang.Boolean') { let value = formValue.endChecks[this.testcase.endChecks[_i].variable];
this.testcase.endChecks[_i].value = JSON.parse(value); if (this.dataTypes.get(this.testcase.endChecks[_i].variable) == 'java.lang.Boolean') {
} else { this.testcase.endChecks[_i].value = JSON.parse(value);
this.testcase.endChecks[_i].value = value; } else {
} this.testcase.endChecks[_i].value = value;
}
let variableCompareField = this.testcase.endChecks[_i].variable + "Compare";
this.testcase.endChecks[_i].compareOperator = formValue.endChecks[variableCompareField]; let variableCompareField = this.testcase.endChecks[_i].variable + "Compare";
} this.testcase.endChecks[_i].compareOperator = formValue.endChecks[variableCompareField];
}
this.testcase.endChecks = this.testcase.endChecks
.filter(v => v.value != null); this.testcase.endChecks = this.testcase.endChecks
.filter(v => v.value != null);
//Extract mocks
this.testcase.mocks = []; //Extract mocks
for(let serviceName of this.mocks.keys()) { this.testcase.mocks = [];
let mockName = formValue.mocks[serviceName]; for(let serviceName of this.mocks.keys()) {
if(mockName) { let mockName = formValue.mocks[serviceName];
this.testcase.mocks.push(mockName); if(mockName) {
} this.testcase.mocks.push(mockName);
} }
}
console.log(this.testcase);
} console.log(this.testcase);
}
private cleanUpServiceWithMocks() {
this.flowInfo.delegateServices = this.flowInfo.delegateServices private cleanUpServiceWithMocks() {
.filter(delegateService => delegateService.mocks.length > 0); this.flowInfo.delegateServices = this.flowInfo.delegateServices
.filter(delegateService => delegateService.mocks.length > 0);
this.flowInfo.externalTopics = this.flowInfo.externalTopics
.filter(externalTopic => externalTopic.mocks.length > 0); this.flowInfo.externalTopics = this.flowInfo.externalTopics
.filter(externalTopic => externalTopic.mocks.length > 0);
this.flowInfo.delegateServices.forEach(service => {
let mockNames = service.mocks; this.flowInfo.delegateServices.forEach(service => {
mockNames.unshift(null); let mockNames = service.mocks;
this.mocks.set(service.serviceName, mockNames); mockNames.unshift(null);
}); this.mocks.set(service.serviceName, mockNames);
});
this.flowInfo.externalTopics.forEach(service => {
let mockNames = service.mocks; this.flowInfo.externalTopics.forEach(service => {
mockNames.unshift(null); let mockNames = service.mocks;
this.mocks.set(service.externalTopicName, mockNames); mockNames.unshift(null);
}); this.mocks.set(service.externalTopicName, mockNames);
} });
}
private initVariableDataTypes() {
for (let variableValue of this.flowInfo.variables) { private initVariableDataTypes() {
this.dataTypes.set(variableValue.variable, variableValue.type); for (let variableValue of this.flowInfo.variables) {
} this.dataTypes.set(variableValue.variable, variableValue.type);
} }
}
private getServiceMockOrNull(serviceMocks: Array<string>) {
for(let serviceMockName of serviceMocks) { private getServiceMockOrNull(serviceMocks: Array<string>) {
if(this.testcase.mocks.indexOf(serviceMockName) >= 0) { for(let serviceMockName of serviceMocks) {
return serviceMockName; if(this.testcase.mocks.indexOf(serviceMockName) >= 0) {
} return serviceMockName;
} }
}
return null;
} return null;
} }
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment