Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Running Processes Counter on Workers Page #209

Merged
merged 6 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -400,8 +400,8 @@ public int getCountForClaimedProcInstPerKey(String procDefKey, List<String> clai

public List<Map<String, Object>> getProcDefKeyLatestCompleteInst(String procDefKey) {
return jdbcTemplate.queryForList(
"SELECT proc_inst_id, start_time, end_time FROM cws_proc_inst_status WHERE proc_def_key=? AND status='complete' ORDER BY start_time DESC LIMIT 1",
new Object[]{procDefKey}
"SELECT proc_inst_id, start_time, end_time FROM cws_proc_inst_status WHERE proc_def_key=? AND status='complete' ORDER BY start_time DESC LIMIT 1",
new Object[]{procDefKey}
);
}

Expand Down Expand Up @@ -604,8 +604,8 @@ public int getNumUpWorkers() {
*/
public List<Map<String, Object>> getWorkerNumRunningProcs() {
return jdbcTemplate.queryForList(
"SELECT cws_worker.id, active_count as cnt " +
"FROM cws_worker");
"SELECT cws_worker.id, COUNT(*) AS cnt FROM cws_proc_inst_status,cws_worker "
+ "WHERE cws_proc_inst_status.status NOT LIKE '%complete%' GROUP BY cws_worker.id");
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public void runWorkerTest() throws IOException {

log.info("Checking if 1 worker is up, 0 are down, and none are running...");
if (findOnPage("1 Workers (1 up, 0 down)")
&& findOnPage("0 running")) {
&& findOnPage("Idle")) {
log.info("SUCCESS: 1 worker is up, 0 are down, and none are running.");
WebElement myTable = driver.findElement(By.id("workers-table"));
List<WebElement> myRows = myTable.findElements(By.tagName("td"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public void runWorkersPageTest() {
gotoLoginPage();
login();
goToPage("deployments");
startProcDef("test_workers_page", "Test Workers Page", 30000);
startProcDef("test_workers_page", "Test Workers Page", 0);
runNumberActiveTest();
runThreadLimitTest();
runWorkersCheckBoxTest();
Expand Down
56 changes: 29 additions & 27 deletions cws-test/src/test/resources/bpmn/test_workers_page.bpmn
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
<bpmn:serviceTask id="Task_0xel5sm" camunda:modelerTemplate="jpl.cws.task.CmdLineExecTask" camunda:class="jpl.cws.task.SleepTask" camunda:type="external" camunda:topic="__CWS_CMD_TOPIC__">
<bpmn:extensionElements>
<camunda:field name="cmdLine">
<camunda:expression>sleep 30</camunda:expression>
<camunda:expression>sleep 192</camunda:expression>
</camunda:field>
<camunda:field name="workingDir">
<camunda:expression>.</camunda:expression>
</camunda:field>
<camunda:field name="workingDir" />
<camunda:field name="successExitValues">
<camunda:expression>0</camunda:expression>
</camunda:field>
Expand Down Expand Up @@ -99,6 +101,31 @@
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="test_workers_page">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="173" y="102" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0gg43c2_di" bpmnElement="Task_0v4t5rk">
<dc:Bounds x="259" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_1e035vf_di" bpmnElement="Task_0xel5sm">
<dc:Bounds x="409" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1cxkvmz_di" bpmnElement="EndEvent_1cxkvmz">
<dc:Bounds x="702" y="102" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="577" y="141" width="0" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1l0ogp6_di" bpmnElement="Activity_1l0ogp6">
<dc:Bounds x="560" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1narsmd_di" bpmnElement="SequenceFlow_1narsmd">
<di:waypoint x="209" y="120" />
<di:waypoint x="259" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="234" y="98.5" width="0" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1n3skp5_di" bpmnElement="SequenceFlow_1n3skp5">
<di:waypoint x="509" y="120" />
<di:waypoint x="560" y="120" />
Expand All @@ -113,35 +140,10 @@
<dc:Bounds x="384" y="98.5" width="0" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1narsmd_di" bpmnElement="SequenceFlow_1narsmd">
<di:waypoint x="209" y="120" />
<di:waypoint x="259" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="234" y="98.5" width="0" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="Flow_0w3boed_di" bpmnElement="Flow_0w3boed">
<di:waypoint x="660" y="120" />
<di:waypoint x="702" y="120" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
<dc:Bounds x="173" y="102" width="36" height="36" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0gg43c2_di" bpmnElement="Task_0v4t5rk">
<dc:Bounds x="259" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_1e035vf_di" bpmnElement="Task_0xel5sm">
<dc:Bounds x="409" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="Activity_1l0ogp6_di" bpmnElement="Activity_1l0ogp6">
<dc:Bounds x="560" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1cxkvmz_di" bpmnElement="EndEvent_1cxkvmz">
<dc:Bounds x="702" y="102" width="36" height="36" />
<bpmndi:BPMNLabel>
<dc:Bounds x="577" y="141" width="0" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
Loading