Skip to content

Commit 317130c

Browse files
committed
Performance improvement when inserting new execution queue.
1 parent 105b67a commit 317130c

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

source/src/main/java/org/cerberus/core/servlet/crud/testexecution/CreateTestCaseExecutionQueue.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,17 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re
197197
Answer finalAnswer = new Answer(msg1);
198198
List<TestCaseExecutionQueue> insertedList = new ArrayList<>();
199199

200+
// Feed all queue entries already existing in tag contaxt.
201+
executionQueueService = appContext.getBean(ITestCaseExecutionQueueService.class);
202+
Map<String, TestCaseExecutionQueue> queueAlreadyInsertedInTag = new HashMap<>();
203+
if (StringUtil.isNotEmptyOrNull(tag)) {
204+
LOG.debug("We don't have the list of all already inserted entries. Let's get it from tag value : " + tag);
205+
List<TestCaseExecutionQueue> queueFromTag = executionQueueService.convert(executionQueueService.readByTagByCriteria(tag, 0, 0, null, null, null));
206+
for (TestCaseExecutionQueue tceQueue : queueFromTag) {
207+
queueAlreadyInsertedInTag.put(executionQueueService.getUniqKey(tceQueue.getTest(), tceQueue.getTestCase(), tceQueue.getCountry(), tceQueue.getEnvironment()), tceQueue);
208+
}
209+
}
210+
200211
for (Long myId : idList) {
201212

202213
id = myId;
@@ -222,7 +233,6 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re
222233
/**
223234
* All data seems cleans so we can call the services.
224235
*/
225-
executionQueueService = appContext.getBean(ITestCaseExecutionQueueService.class);
226236
executionQueueFactory = appContext.getBean(IFactoryTestCaseExecutionQueue.class);
227237

228238
if (actionSave.equals("save")) {
@@ -259,14 +269,6 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re
259269
finalAnswer = AnswerUtil.agregateAnswer(finalAnswer, ansItem);
260270
if (ansItem.isCodeEquals(MessageEventEnum.DATA_OPERATION_OK.getCode())) {
261271

262-
// Feed all queue entries already existing in tag contaxt.
263-
LOG.debug("We don't have the list of all already inserted entries. Let's get it from tag value : " + tag);
264-
List<TestCaseExecutionQueue> queueFromTag = executionQueueService.convert(executionQueueService.readByTagByCriteria(tag, 0, 0, null, null, null));
265-
Map<String, TestCaseExecutionQueue> queueAlreadyInsertedInTag = new HashMap<>();
266-
for (TestCaseExecutionQueue tceQueue : queueFromTag) {
267-
queueAlreadyInsertedInTag.put(executionQueueService.getUniqKey(tceQueue.getTest(), tceQueue.getTestCase(), tceQueue.getCountry(), tceQueue.getEnvironment()), tceQueue);
268-
}
269-
270272
ansItem = executionQueueService.create(executionQueueData, withNewDep, id, TestCaseExecutionQueue.State.QUEUED, queueAlreadyInsertedInTag);
271273
TestCaseExecutionQueue addedExecution = (TestCaseExecutionQueue) ansItem.getItem();
272274
insertedList.add(addedExecution);

source/src/main/webapp/js/pages/TestCaseExecution.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ function updatePage(data, steps) {
512512
$("#rerunFromQueueandSee").attr("disabled", false);
513513
$("#rerunFromQueueandSee").unbind("click");
514514
$("#rerunFromQueueandSee").click(function () {
515-
triggerTestCaseExecutionQueueandSee(data.queueId);
515+
triggerTestCaseExecutionQueueandSee(data.queueId, data.tag);
516516
});
517517
}
518518

@@ -1479,15 +1479,16 @@ function createVideo(videos) {
14791479

14801480
}
14811481

1482-
function triggerTestCaseExecutionQueueandSee(queueId) {
1482+
function triggerTestCaseExecutionQueueandSee(queueId, tag) {
14831483
$.ajax({
14841484
url: "CreateTestCaseExecutionQueue",
14851485
async: true,
14861486
method: "POST",
14871487
data: {
14881488
id: queueId,
14891489
actionState: "toQUEUED",
1490-
actionSave: "save"
1490+
actionSave: "save",
1491+
tag: tag
14911492
},
14921493
success: function (data) {
14931494
if (getAlertType(data.messageType) === "success") {

0 commit comments

Comments
 (0)