@Test public void shouldUpgradeModule() { Module module = ModuleFactory.getModuleById(MODULE3_ID); assertTrue(module.getVersion().equals("1.0-SNAPSHOT")); URL url = OpenmrsClassLoader.getInstance().getResource("org/openmrs/module/include/test3-2.0-SNAPSHOT.omod"); module.setDownloadURL("file:" + url.getFile()); createWebInfFolderIfNotExist(); ModuleFactory.stopModule(module, false, true); // stop the module with these parameters so that mandatory modules can be upgraded WebModuleUtil.stopModule(module, ((XmlWebApplicationContext) applicationContext).getServletContext()); Module newModule = ModuleFactory.updateModule(module); WebModuleUtil.startModule(newModule, ((XmlWebApplicationContext) applicationContext).getServletContext(), false); //module3 should have upgraded from version 1.0 to 2.0 module = ModuleFactory.getModuleById(MODULE3_ID); assertTrue(module.getVersion().equals("2.0-SNAPSHOT")); }
assertTrue(module.getVersion().equals("1.0-SNAPSHOT")); URL url = OpenmrsClassLoader.getInstance().getResource("org/openmrs/module/include/test1-2.0-SNAPSHOT.omod"); module.setDownloadURL("file:" + url.getFile());
URL url = OpenmrsClassLoader.getInstance().getResource("org/openmrs/module/include/test3-1.0-SNAPSHOT.omod"); File file = new File(url.getFile()); module = ModuleFactory.loadModule(file);
@Test @Verifies(value = "Should save archived form to the database", method = "reprocessArchivedForm") public void reprocessArchivedForm_shouldProcessForm() throws Exception { EncounterService encService = Context.getEncounterService(); String path = OpenmrsClassLoader.getInstance().getResource("archivedFormData.xml").getPath(); System.out.println("Path: "+path); //Get the SerializableFormObject SerializableFormObject formObject = SerializableFormObject.deserializeXml(path); Assert.assertEquals("da7f524f-27ce-4bb2-86d6-6d1d05312bd5",formObject.getPatientUuid()); Patient patient = Context.getPatientService().getPatientByUuid("da7f524f-27ce-4bb2-86d6-6d1d05312bd5"); int noEnc = encService.getEncountersByPatient(patient).size(); service.reprocessArchivedForm(path); int newNoEnc = encService.getEncountersByPatient(patient).size(); Assert.assertEquals(noEnc+1,newNoEnc); }