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

openmrs / openmrs-core / 15462307321

05 Jun 2025 08:30AM UTC coverage: 63.633% (-0.2%) from 63.8%
15462307321

push

github

rkorytkowski
TRUNK-6345 Fix testing framework to be used by modules for openmrs-core 2.4+

(cherry picked from commit 202eb8b65)
(cherry picked from commit bfb74a2d0)

4 of 9 new or added lines in 2 files covered. (44.44%)

54 existing lines in 14 files now uncovered.

21804 of 34265 relevant lines covered (63.63%)

0.64 hits per line

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

64.71
/web/src/main/java/org/openmrs/web/WebDaemon.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.web;
11

12
import javax.servlet.ServletContext;
13

14
import org.openmrs.api.context.Context;
15
import org.openmrs.api.context.Daemon;
16
import org.openmrs.module.ModuleException;
17
import org.openmrs.util.DatabaseUpdateException;
18
import org.openmrs.util.InputRequiredException;
19

20
/**
21
 * This class provides {@link Daemon} functionality in a web context.
22
 * 
23
 * @since 1.9
24
 */
25
public class WebDaemon extends Daemon {
×
26
        
27
        /**
28
         * Start openmrs in a new thread that is authenticated as the daemon user.
29
         * 
30
         * @param servletContext the servlet context.
31
         */
32
        public static void startOpenmrs(final ServletContext servletContext) throws DatabaseUpdateException,
33
                InputRequiredException {
34
                
35
                // create a new thread and start openmrs in it.
36
                DaemonThread startOpenmrsThread = new DaemonThread() {
1✔
37
                        
38
                        @Override
39
                        public void run() {
40
                                isDaemonThread.set(true);
1✔
41
                                try {
42
                                        Listener.startOpenmrs(servletContext);
×
43
                                }
44
                                catch (Exception e) {
1✔
45
                                        exceptionThrown = e;
1✔
46
                                }
47
                                finally {
48
                                        try {
UNCOV
49
                                                Context.closeSession();
×
50
                                        } finally {
51
                                                isDaemonThread.remove();
1✔
52
                                        }
53
                                }
UNCOV
54
                        }
×
55
                };
56
                
57
                startOpenmrsThread.start();
1✔
58
                
59
                // wait for the "startOpenmrs" thread to finish
60
                try {
61
                        startOpenmrsThread.join();
1✔
62
                }
63
                catch (InterruptedException e) {
×
64
                        // ignore
65
                }
1✔
66
                
67
                if (startOpenmrsThread.getExceptionThrown() != null) {
1✔
68
                        throw new ModuleException("Unable to start OpenMRS. Error thrown was: "
1✔
69
                                + startOpenmrsThread.getExceptionThrown().getMessage(), startOpenmrsThread.getExceptionThrown());
1✔
70
                }
71
        }
×
72
}
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