Skip to content
David Sanders edited this page Jul 15, 2014 · 23 revisions

Server-side

Web server

  • Servers that run Java web applications (WARs) are called Servlet Containers
  • We use either:
    • Jetty which is lightweight and can be run on its own or from within other applications like Maven (see below) or Eclipse
    • Tomcat which needs to be installed as a service

Web framework

  • Spring Framework utilising MVC, dependency injection, etc
  • Controllers & actions are setup with annotations rather than the older way of inheriting from Controllers

Object Relational Mapping

  • Hibernate
  • Entities for our module are annotated with JPA annotations while the core code defines the Hibernate configuration file.
  • OpenMRS module persistence is setup with 3 layers: Services, Data Access Objects (DAOs) and Entities. When modules are loaded into the core OpenMRS application, the service is added to the core context from which other modules are able to access.

Database

Testing

  • Tests are setup with JUnit
  • Mocking can be achieved with:
    • Mockito which provides a simple api to mocking & verifying interactions with dependencies
    • PowerMock which extends Mockito to provide the ability to test "untestable code" which is typically final classes & methods, static methods, etc.
  • Functional tests use Selenium WebDriver

Client side

  • AngularJS is used to manage all user interface screens communicating with the server via a RESTful service. Angular provides MVC, templates, data binding, REST abstraction, dependency injection, mocking and more.
  • RequireJS is used to manage the dependencies between JavaScript files
  • Jasmine BDD framework is used to test client side code and is integrated into the build via the jasmine-maven-plugin
  • jQuery-UI for some UI widgets, like dialog boxes

Testing

Environment

  • Gradle is used to manage 3rd party Java dependencies, build & package the module
  • Continuous deployment managed by:
    • Our Go server
    • and Travis which integrates with GitHub and builds commits & pull requests
  • Testing is done in 3 stages:
    • Firstly the unit & integration test suites are run on Go (ProposalModule build)
    • Functional tests are then run (ProposalModule-CI build)
    • After successful completion of the testing a QA may deploy the new changes to QA server (by running ProposalModule-QA build) to validate user stories against the specified acceptance criteria.

Development Tools

  • Java development is best done with an IDE:
  • Both IDEs come with a wide range of plugins (such as Maven or Git integration) help facilitate the development process