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

openmrs / openmrs-core / 23193642646

17 Mar 2026 12:13PM UTC coverage: 63.1% (-0.3%) from 63.429%
23193642646

push

github

rkorytkowski
Fixing: Fix an issue with the ModuleResourceServlet

0 of 2 new or added lines in 1 file covered. (0.0%)

925 existing lines in 17 files now uncovered.

23137 of 36667 relevant lines covered (63.1%)

0.63 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/tasks/TestTask.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.tasks;
11

12
import java.util.Date;
13

14
import org.openmrs.scheduler.TaskDefinition;
15
import org.slf4j.Logger;
16
import org.slf4j.LoggerFactory;
17

18
/**
19
 * Implementation of a simple task that throws an exception every 10 executions.
20
 */
UNCOV
21
public class TestTask extends AbstractTask {
×
22
        
UNCOV
23
        private static int executionCount = 0;
×
24
        
25
        // Logger 
UNCOV
26
        private static final Logger log = LoggerFactory.getLogger(TestTask.class);
×
27
        
28
        /**
29
         * @see org.openmrs.scheduler.tasks.AbstractTask#initialize(TaskDefinition)
30
         */
31
        @Override
32
        public void initialize(TaskDefinition taskDefinition) {
UNCOV
33
                log.info("Initializing task " + taskDefinition);
×
UNCOV
34
        }
×
35
        
36
        public static void setExecutionCount(int executionCount) {
UNCOV
37
                TestTask.executionCount = executionCount;
×
UNCOV
38
        }
×
39
        
40
        /**
41
         * @see org.openmrs.scheduler.tasks.AbstractTask#execute()
42
         */
43
        @Override
44
        public void execute() {
UNCOV
45
                log.info("Executing task at " + new Date());
×
46
                
UNCOV
47
                setExecutionCount(executionCount + 1);
×
48
                // Throw a runtime exception once every ten executions
UNCOV
49
                if (executionCount % 10 == 0) {
×
50
                        log.info("Throwing a runtime exception in an attempt to break the scheduler");
×
51
                        throw new RuntimeException();
×
52
                }
UNCOV
53
        }
×
54
        
55
        /**
56
         * @see org.openmrs.scheduler.tasks.AbstractTask#shutdown()
57
         */
58
        @Override
59
        public void shutdown() {
60
                log.info("Shutting down task ...");
×
61
                super.shutdown();
×
62
        }
×
63
        
64
}
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