Skip to content

Commit

Permalink
Merge pull request #419 from mayuradesh/my1.2.0
Browse files Browse the repository at this point in the history
MOSIP-27440 CTK Sonar UI Bugs
  • Loading branch information
mayuradesh committed Jun 26, 2023
2 parents f4f15ca + d6594cf commit 950b433
Showing 1 changed file with 58 additions and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -677,7 +677,6 @@ export class ExecuteTestRunComponent implements OnInit {
}

async executeABISTestCase(testCase: TestCaseModel) {
//return new Promise(async (resolve, reject) => {
this.isCombinationAbisTestcase = testCase.methodName.length > 1 ? true : false;
if (this.isCombinationAbisTestcase && this.currentAbisMethod == appConstants.BLANK_STRING) {
this.currentAbisMethod = appConstants.ABIS_METHOD_INSERT;
Expand Down Expand Up @@ -764,33 +763,38 @@ export class ExecuteTestRunComponent implements OnInit {
);
if (abisReq)
console.log(`send to queue status ${abisReq[appConstants.STATUS]}`);
//console.log(abisReq);
if (abisReq && abisReq[appConstants.STATUS] && abisReq[appConstants.STATUS] == appConstants.SUCCESS) {
if (insertCount > 1) {
this.cbeffFileSuffix = this.cbeffFileSuffix + 1;
}
if (this.cbeffFileSuffix > insertCount) {
//reset the cbeffFileSuffix to zero, since all are processed
this.cbeffFileSuffix = 0;
}
this.abisSentMessage = abisReq.methodRequest;
if (this.isCombinationAbisTestcase && this.currentAbisMethod !== appConstants.ABIS_METHOD_IDENTIFY) {
this.abisSentDataSource = abisReq.testDataSource;
}
console.log(`this.abisSentDataSource ${this.abisSentDataSource}`);
this.subscribeToABISQueue(requestId);
const p = await new Promise(async (resolve, reject) => { });
return p;
} else {
console.log("INSERT REQUEST FAILED");
//console.log(abisReq);
if (abisReq && abisReq[appConstants.STATUS] && abisReq[appConstants.STATUS] == appConstants.SUCCESS) {
if (insertCount > 1) {
this.cbeffFileSuffix = this.cbeffFileSuffix + 1;
}
if (this.cbeffFileSuffix > insertCount) {
//reset the cbeffFileSuffix to zero, since all are processed
this.cbeffFileSuffix = 0;
this.abisRequestSendFailure = true;
this.abisSentMessage = appConstants.BLANK_STRING;
this.abisSentDataSource = appConstants.BLANK_STRING;
//resolve(true);
}
this.abisSentMessage = abisReq.methodRequest;
if (this.isCombinationAbisTestcase && this.currentAbisMethod !== appConstants.ABIS_METHOD_IDENTIFY) {
this.abisSentDataSource = abisReq.testDataSource;
}
console.log(`this.abisSentDataSource ${this.abisSentDataSource}`);
this.subscribeToABISQueue(requestId);
//wait till some message arrives in active mq
const promise = new Promise((resolve, reject) => { });
if (await promise) {
return true;
} else {
return false;
}
} else {
console.log("INSERT REQUEST FAILED");
this.cbeffFileSuffix = 0;
this.abisRequestSendFailure = true;
this.abisSentMessage = appConstants.BLANK_STRING;
this.abisSentDataSource = appConstants.BLANK_STRING;
//resolve(true);
return true;
}
} else {
this.showLoader = true;
//run validations
let methodIndex = 0;
Expand All @@ -803,14 +807,11 @@ export class ExecuteTestRunComponent implements OnInit {
this.isCombinationAbisTestcase = false;
this.currentAbisMethod = appConstants.BLANK_STRING;
}
//resolve(validatorsResp);
return validatorsResp;
}
//});
}

async executeSBITestCase(testCase: TestCaseModel) {
//return new Promise(async (resolve, reject) => {
if (
testCase.methodName[0] == appConstants.SBI_METHOD_CAPTURE ||
testCase.methodName[0] == appConstants.SBI_METHOD_RCAPTURE
Expand Down Expand Up @@ -841,10 +842,14 @@ export class ExecuteTestRunComponent implements OnInit {
}
//resolve(res);
return res;
} else {
}
else {
//no resp to keep the for loop on hold
const p = await new Promise(async (resolve, reject) => { });
return p;
//wait till user clicks on the required button in UI
const promise = new Promise((resolve, reject) => { });
if (await promise) {
return false;
}
}
} else {
if (this.showResumeBtn) {
Expand Down Expand Up @@ -877,15 +882,18 @@ export class ExecuteTestRunComponent implements OnInit {
);
}
this.beforeKeyRotationResp = null;
//resolve(res);
return res;
} else {
}
else {
//no resp to keep the for loop on hold
const p = await new Promise(async (resolve, reject) => { });
return p;
//wait till user clicks on the required button in UI
const promise = new Promise((resolve, reject) => { });
if (await promise) {
return false;
}

}
}
//});
}

calculateTestcaseResults(res: any) {
Expand Down Expand Up @@ -1083,22 +1091,23 @@ export class ExecuteTestRunComponent implements OnInit {
}
this.rxStompService
.watch(this.abisProjectData.inboundQueueName)
.forEach(async (message: Message) => {
const respObj = JSON.parse(message.body);
const recvdRequestId = respObj[appConstants.REQUEST_ID];
console.log(`recvdRequestId: ${recvdRequestId}`);
if (sentRequestId == recvdRequestId) {
this.abisRecvdMessage = message.body;
//console.log(this.abisRecvdMessage);
await this.runExecuteForLoop(false, false);
this.runComplete = true;
this.basicTimer.stop();
}
}).catch((error) => {
console.log(error);
.subscribe((message: Message) => {
this.handleMessage(message, sentRequestId);
});
}


async handleMessage(message: Message, sentRequestId: string) {
const respObj = JSON.parse(message.body);
const recvdRequestId = respObj[appConstants.REQUEST_ID];
console.log(`recvdRequestId: ${recvdRequestId}`);
if (sentRequestId == recvdRequestId) {
this.abisRecvdMessage = message.body;
//console.log(this.abisRecvdMessage);
await this.runExecuteForLoop(false, false);
this.runComplete = true;
this.basicTimer.stop();
}
}
ngOnDestroy() {
if (this.rxStompService) {
this.rxStompService.deactivate()
Expand Down

0 comments on commit 950b433

Please sign in to comment.