• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

openmrs / openmrs-core / 29365517473

14 Jul 2026 08:23PM UTC coverage: 63.813% (+0.04%) from 63.775%
29365517473

push

github

web-flow
TRUNK-6675: Module is not updated when omod changes (#6257)

* TRUNK-6675: Module is not updated when omod changes

* TRUNK-6675: Address review comments

- Split the deleteDirectory try-catch in the optimized-startup branch so IOException from deletion logs an accurate message instead of "Error while reading module last modified file"
- Pin getLibCacheFolderForModule_shouldRecreateNonEmptyDirWhenModuleChanged to the module-changed branch by explicitly setting optimized.startup=true

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* TRUNK-6675: Address review comments

- Extract deleteLibCacheDir helper to reduce cognitive complexity (fixes SonarCloud quality gate)
- Guard .moduleLastModified write on successful deletion so a failed delete does not mask the problem on the next restart
- Fix Context.getRuntimeProperties() defensive-copy bug in both tests: mutate the copy and push it back via Context.setRuntimeProperties() so isOptimizedStartup() actually sees the change

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Update api/src/main/java/org/openmrs/module/ModuleClassLoader.java

Co-authored-by: dkayiwa <dkayiwa@openmrs.org>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-authored-by: dkayiwa <dkayiwa@openmrs.org>

7 of 11 new or added lines in 1 file covered. (63.64%)

21 existing lines in 8 files now uncovered.

24094 of 37757 relevant lines covered (63.81%)

0.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/api/src/main/java/org/openmrs/scheduler/jobrunr/JobRunrTaskContext.java
1
/**
2
 * This Source Code Form is subject to the terms of the Mozilla Public License,
3
 * v. 2.0. If a copy of the MPL was not distributed with this file, You can
4
 * obtain one at http://mozilla.org/MPL/2.0/. OpenMRS is also distributed under
5
 * the terms of the Healthcare Disclaimer located at http://openmrs.org/license.
6
 *
7
 * Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
8
 * graphic logo is a trademark of OpenMRS Inc.
9
 */
10
package org.openmrs.scheduler.jobrunr;
11

12
import java.time.Instant;
13
import java.util.Map;
14
import java.util.Optional;
15

16
import org.jobrunr.jobs.context.JobContext;
17
import org.openmrs.User;
18
import org.openmrs.scheduler.TaskContext;
19
import org.openmrs.scheduler.TaskProgress;
20
import org.openmrs.scheduler.TaskState;
21

22
/**
23
 * @since 2.9.0
24
 */
25
public class JobRunrTaskContext implements TaskContext {
26

27
        private final JobContext jobContext;
28
        private final String userSystemId;
29
        
30
        public JobRunrTaskContext(JobContext jobContext, User scheduledBy) {
×
31
                this.jobContext = jobContext;
×
32
                this.userSystemId = scheduledBy.getUuid();
×
33
        }
×
34

UNCOV
35
        public JobRunrTaskContext(JobContext jobContext, String userSystemId) {
×
UNCOV
36
                this.jobContext = jobContext;
×
UNCOV
37
                this.userSystemId = userSystemId;
×
UNCOV
38
        }
×
39

40
        @Override
41
        public String getUuid() {
42
                return jobContext.getJobId().toString();
×
43
        }
44

45
        @Override
46
        public Optional<String> getRecurringTaskUuid() {
47
                throw new UnsupportedOperationException("Please use SchedulerService#getTask() instead until JobRunr is upgraded.");
×
48
        }
49

50
        @Override
51
        public String getName() {
52
                return jobContext.getJobName();
×
53
        }
54

55
        @Override
56
        public Optional<Instant> getScheduledAt() {
57
                throw new UnsupportedOperationException("Please use SchedulerService#getTask() instead until JobRunr is upgraded.");
×
58
        }
59

60
        @Override
61
        public String getUserSystemId() {
62
                return userSystemId;
×
63
        }
64

65
        @Override
66
        public Instant getCreatedAt() {
67
                return jobContext.getCreatedAt();
×
68
        }
69

70
        @Override
71
        public Instant getUpdatedAt() {
72
                return jobContext.getUpdatedAt();
×
73
        }
74

75
        @Override
76
        public String getSignature() {
77
                return jobContext.getSignature();
×
78
        }
79

80
        @Override
81
        public TaskState getState() {
82
                return TaskState.valueOf(jobContext.getJobState().name());
×
83
        }
84

85
        @Override
86
        public void saveMetadata(String key, Object value) {
87
                jobContext.saveMetadata(key, value);
×
88
        }
×
89

90
        @Override
91
        public void saveMetadataIfAbsent(String key, Object value){
92
                jobContext.saveMetadataIfAbsent(key, value);
×
93
        }
×
94

95
        @Override
96
        public Map<String, Object> getMetadata() {
97
                return jobContext.getMetadata();
×
98
        }
99

100
        @Override
101
        public TaskProgress setProgressBar(int totalProgress) {
102
                return new JobRunrTaskProgress(jobContext.progressBar(totalProgress), totalProgress);
×
103
        }
104

105
        
106
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc