diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 08b91d7c..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "java.configuration.updateBuildConfiguration" : "automatic", - "java.debug.settings.onBuildFailureProceed" : true -} \ No newline at end of file diff --git a/api-2.4/src/main/java/org/openmrs/module/initializer/api/billing/PaymentModesCsvParser.java b/api-2.4/src/main/java/org/openmrs/module/initializer/api/billing/PaymentModesCsvParser.java index c6565b57..92ac2b5a 100644 --- a/api-2.4/src/main/java/org/openmrs/module/initializer/api/billing/PaymentModesCsvParser.java +++ b/api-2.4/src/main/java/org/openmrs/module/initializer/api/billing/PaymentModesCsvParser.java @@ -18,7 +18,7 @@ public class PaymentModesCsvParser extends CsvParser 3) { - paymentMode.addAttributeType(parts[0].trim(), parts[1].trim(), parts[2].trim(), Boolean.parseBoolean(parts[3].trim())); + paymentMode.addAttributeType(parts[0].trim(), parts[1].trim(), parts[2].trim(), + Boolean.parseBoolean(parts[3].trim())); } else if (parts.length > 2) { paymentMode.addAttributeType(parts[0].trim(), parts[1].trim(), parts[2].trim(), false); } else if (parts.length > 1) { paymentMode.addAttributeType(parts[0].trim(), parts[1].trim(), null, false); } else { paymentMode.addAttributeType(parts[0].trim(), null, null, false); - } + } } } diff --git a/api-2.4/src/test/java/org/openmrs/module/initializer/api/PaymentModesLoaderIntegrationTest.java b/api-2.4/src/test/java/org/openmrs/module/initializer/api/PaymentModesLoaderIntegrationTest.java index 855a7a36..d7695335 100644 --- a/api-2.4/src/test/java/org/openmrs/module/initializer/api/PaymentModesLoaderIntegrationTest.java +++ b/api-2.4/src/test/java/org/openmrs/module/initializer/api/PaymentModesLoaderIntegrationTest.java @@ -49,16 +49,16 @@ public void load_shouldLoadPaymentModesAccordingToCsvFiles() { { PaymentMode paymentMode = paymentModeService.getByUuid("e168c141-f5fd-4eec-bd3e-633bed1c9606"); assertNotNull(paymentMode); - assertEquals("Paypal", paymentMode.getName()); + assertEquals("Paypal", paymentMode.getName()); paymentMode.getAttributeTypes().forEach(attributeType -> { - if (attributeType.getName().equals("Maximum")) { - assertEquals("Numeric", attributeType.getFormat()); - assertTrue(attributeType.getRequired()); - } else { - assertEquals("Minimum", attributeType.getName()); - } - }); + if (attributeType.getName().equals("Maximum")) { + assertEquals("Numeric", attributeType.getFormat()); + assertTrue(attributeType.getRequired()); + } else { + assertEquals("Minimum", attributeType.getName()); + } + }); } // Verify edition diff --git a/api-2.4/src/test/resources/testAppDataDir/configuration/paymentmodes/paymentModes.csv b/api-2.4/src/test/resources/testAppDataDir/configuration/paymentmodes/paymentModes.csv index bdaac54a..ab05a985 100644 --- a/api-2.4/src/test/resources/testAppDataDir/configuration/paymentmodes/paymentModes.csv +++ b/api-2.4/src/test/resources/testAppDataDir/configuration/paymentmodes/paymentModes.csv @@ -1,4 +1,4 @@ -uuid, Void/Retire, name, attributes -526bf278-ba81-4436-b867-c2f6641d060a, , Visa card edited, -2b1b9aae-5d35-43dd-9214-3fd370fd7737, true, Bank transfer, -e168c141-f5fd-4eec-bd3e-633bed1c9606, , Paypal, Maximum::Numeric::::True;Minimum \ No newline at end of file +uuid,Void/Retire,name,attributes +526bf278-ba81-4436-b867-c2f6641d060a,,Visa card edited, +2b1b9aae-5d35-43dd-9214-3fd370fd7737,true,Bank transfer, +e168c141-f5fd-4eec-bd3e-633bed1c9606,,Paypal,Maximum::Numeric::::True;Minimum diff --git a/api/src/main/java/org/openmrs/module/initializer/api/CsvParser.java b/api/src/main/java/org/openmrs/module/initializer/api/CsvParser.java index bab06e56..cc952bfc 100644 --- a/api/src/main/java/org/openmrs/module/initializer/api/CsvParser.java +++ b/api/src/main/java/org/openmrs/module/initializer/api/CsvParser.java @@ -189,6 +189,10 @@ public List getLines() { * @return The resulting CsvParserResult instance. */ public CsvFailingLines process(List lines) { + // Save cached objects to avoid losing them prematurely by other Parsers + // See DisplaysCsvParser#save(OpenmrsObject) + Context.flushSession(); + Context.clearSession(); CsvFailingLines result = new CsvFailingLines(); int saved = 0; diff --git a/api/src/test/java/org/openmrs/module/initializer/api/ProgramWorkflowStatesLoaderIntegrationTest.java b/api/src/test/java/org/openmrs/module/initializer/api/ProgramWorkflowStatesLoaderIntegrationTest.java index 3aacbdc8..dc5f6fcb 100644 --- a/api/src/test/java/org/openmrs/module/initializer/api/ProgramWorkflowStatesLoaderIntegrationTest.java +++ b/api/src/test/java/org/openmrs/module/initializer/api/ProgramWorkflowStatesLoaderIntegrationTest.java @@ -1,11 +1,14 @@ package org.openmrs.module.initializer.api; +import java.util.Arrays; +import java.util.Collections; import java.util.Locale; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openmrs.Concept; +import org.openmrs.ConceptDescription; import org.openmrs.ConceptName; import org.openmrs.ProgramWorkflow; import org.openmrs.ProgramWorkflowState; @@ -50,6 +53,7 @@ public void setup() { { Concept c = new Concept(); c.setShortName(new ConceptName("Active treatment (initial)", Locale.ENGLISH)); + c.setDescriptions(Collections.singleton(new ConceptDescription("Active treatment (initial)", Locale.ENGLISH))); c.setConceptClass(cs.getConceptClassByName("State")); c.setDatatype(cs.getConceptDatatypeByName("Text")); c = cs.saveConcept(c); @@ -124,8 +128,8 @@ public void load_shouldLoadProgramWorkflowStatesAccordingToCsvFiles() { Assert.assertEquals(wf, state.getProgramWorkflow()); Assert.assertEquals(cs.getConceptByName("Active treatment (initial)"), state.getConcept()); - Assert.assertEquals("Active treatment (initial)", state.getName()); - Assert.assertEquals("Active treatment (initial)", state.getDescription()); + Assert.assertEquals("Active treatment (initial)", state.getConcept().getName().getName()); + Assert.assertEquals("Active treatment (initial)", state.getConcept().getDescription().getDescription()); Assert.assertFalse(state.isRetired()); Assert.assertTrue(state.getInitial()); Assert.assertFalse(state.getTerminal()); diff --git a/api/src/test/java/org/openmrs/module/initializer/api/ProgramWorkflowsLoaderIntegrationTest.java b/api/src/test/java/org/openmrs/module/initializer/api/ProgramWorkflowsLoaderIntegrationTest.java index 51976b56..c0761456 100644 --- a/api/src/test/java/org/openmrs/module/initializer/api/ProgramWorkflowsLoaderIntegrationTest.java +++ b/api/src/test/java/org/openmrs/module/initializer/api/ProgramWorkflowsLoaderIntegrationTest.java @@ -1,11 +1,13 @@ package org.openmrs.module.initializer.api; +import java.util.Collections; import java.util.Locale; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.openmrs.Concept; +import org.openmrs.ConceptDescription; import org.openmrs.ConceptName; import org.openmrs.Program; import org.openmrs.ProgramWorkflow; @@ -39,6 +41,8 @@ public static void setupWorkflows(ConceptService cs, ProgramWorkflowService pws) { Concept c = new Concept(); c.setShortName(new ConceptName("TB Treatment Status (workflow)", Locale.ENGLISH)); + c.setDescriptions( + Collections.singleton(new ConceptDescription("TB Treatment Status (workflow)", Locale.ENGLISH))); c.setConceptClass(cs.getConceptClassByName("Workflow")); c.setDatatype(cs.getConceptDatatypeByName("Text")); c = cs.saveConcept(c); @@ -133,8 +137,8 @@ public void load_shouldLoadProgramWorkflowsAccordingToCsvFiles() { Program prog = pws.getProgramByName("TB Program"); Assert.assertEquals(prog, wf.getProgram()); Assert.assertEquals(cs.getConceptByName("TB Treatment Status (workflow)"), wf.getConcept()); - Assert.assertEquals("TB Treatment Status (workflow)", wf.getName()); - Assert.assertEquals("TB Treatment Status (workflow)", wf.getDescription()); + Assert.assertEquals("TB Treatment Status (workflow)", wf.getConcept().getName().getName()); + Assert.assertEquals("TB Treatment Status (workflow)", wf.getConcept().getDescription().getDescription()); Assert.assertFalse(wf.isRetired()); Assert.assertEquals(wf, prog.getWorkflow(wf.getId())); } diff --git a/api/src/test/java/org/openmrs/module/initializer/api/RelationshipTypesLoaderIntegrationTest.java b/api/src/test/java/org/openmrs/module/initializer/api/RelationshipTypesLoaderIntegrationTest.java index 4464e456..5f7e9fa2 100644 --- a/api/src/test/java/org/openmrs/module/initializer/api/RelationshipTypesLoaderIntegrationTest.java +++ b/api/src/test/java/org/openmrs/module/initializer/api/RelationshipTypesLoaderIntegrationTest.java @@ -29,7 +29,7 @@ public void load_shouldLoadRelationshipTypesAccordingToCsvFiles() { { RelationshipType rt = ps.getRelationshipTypeByUuid("c86d9979-b8ac-4d8c-85cf-cc04e7f16315"); Assert.assertNotNull(rt); - Assert.assertEquals("Uncle/Nephew", rt.getName()); + Assert.assertEquals("Uncle/Nephew", rt.toString()); Assert.assertEquals("A relationship of an uncle and his nephew", rt.getDescription()); Assert.assertEquals("Uncle", rt.getaIsToB()); Assert.assertEquals("Nephew", rt.getbIsToA()); @@ -41,7 +41,7 @@ public void load_shouldLoadRelationshipTypesAccordingToCsvFiles() { { RelationshipType rt = ps.getRelationshipTypeByUuid("53d8a8f3-0084-4a52-8666-c655f5bd2689"); Assert.assertNotNull(rt); - Assert.assertEquals("Supervisor/Supervisee", rt.getName()); + Assert.assertEquals("Supervisor/Supervisee", rt.toString()); Assert.assertEquals("A new description for supervisor to supervisee relationship", rt.getDescription()); } diff --git a/pom.xml b/pom.xml index 2d4a99d2..6ce21311 100644 --- a/pom.xml +++ b/pom.xml @@ -73,6 +73,7 @@ 1.2.9 1.6.0 1.1.0 + 2.0.2-SNAPSHOT 1.0.0 diff --git a/validator/pom.xml b/validator/pom.xml index 239a4481..17a705bd 100644 --- a/validator/pom.xml +++ b/validator/pom.xml @@ -382,6 +382,22 @@ ${mysqlTestContainerVersion} + + org.openmrs.module + exti18n-api + ${exti18nVersion} + runtime + jar + + + + org.openmrs.module + stockmanagement-api + ${stockmanagementVersion} + runtime + jar + +