From e2f68313afd7282d9c79102db0b1c782d1cab155 Mon Sep 17 00:00:00 2001 From: Wikum Chamith Date: Fri, 19 Jan 2024 19:56:20 +0530 Subject: [PATCH] Updating to Platform 2.0.0 --- .../api/impl/MetadataSharingServiceImpl.java | 2 +- api-test/pom.xml | 9 ++- .../ConceptMappingPreferTheirsTest.java | 19 +++-- .../metadatasharing/ConceptNamesTest.java | 30 +++++--- .../ConceptShareScenarioTest.java | 1 + .../metadatasharing/ConceptShareTest.java | 19 +++-- ...onceptWithAnswerDrugShareScenarioTest.java | 5 +- ...ceptNumericToConceptShareScenarioTest.java | 3 + ...ceptToConceptNumericShareScenarioTest.java | 3 + .../PreserveConceptIdsTest.java | 14 +++- .../impl/ConceptHandlersFunctionalTest.java | 3 + .../metadatasharing/mock/ConceptMock.java | 22 +++--- .../serializer/LocationMock.java | 8 +- .../serializer/ShareableLocation.java | 16 ++-- .../wrapper/MetadataExporterTest.java | 6 +- .../web/extension/html/AdminList.java | 76 ------------------- pom.xml | 2 +- 17 files changed, 105 insertions(+), 133 deletions(-) delete mode 100644 omod/src/main/java/org/openmrs/module/metadatasharing/web/extension/html/AdminList.java diff --git a/api-common/src/main/java/org/openmrs/module/metadatasharing/api/impl/MetadataSharingServiceImpl.java b/api-common/src/main/java/org/openmrs/module/metadatasharing/api/impl/MetadataSharingServiceImpl.java index d77d49ee..13373993 100644 --- a/api-common/src/main/java/org/openmrs/module/metadatasharing/api/impl/MetadataSharingServiceImpl.java +++ b/api-common/src/main/java/org/openmrs/module/metadatasharing/api/impl/MetadataSharingServiceImpl.java @@ -211,7 +211,7 @@ protected Object task() { return null; } - }.executeInManualFlushMode(); + }.executeInAutoFlushMode(); } /** diff --git a/api-test/pom.xml b/api-test/pom.xml index 39b12f74..0597d5fa 100644 --- a/api-test/pom.xml +++ b/api-test/pom.xml @@ -81,7 +81,14 @@ - + + + org.simpleframework + simple-xml + 2.7.1 + + + diff --git a/api-test/src/test/java/org/openmrs/module/metadatasharing/ConceptMappingPreferTheirsTest.java b/api-test/src/test/java/org/openmrs/module/metadatasharing/ConceptMappingPreferTheirsTest.java index 09fab8ce..df2aee92 100644 --- a/api-test/src/test/java/org/openmrs/module/metadatasharing/ConceptMappingPreferTheirsTest.java +++ b/api-test/src/test/java/org/openmrs/module/metadatasharing/ConceptMappingPreferTheirsTest.java @@ -24,6 +24,7 @@ import org.junit.Test; import org.openmrs.Concept; +import org.openmrs.ConceptDescription; import org.openmrs.ConceptMap; import org.openmrs.ConceptName; import org.openmrs.ConceptSource; @@ -50,6 +51,7 @@ public List prepareExportServer() throws Exception { c.addName(new ConceptName("c", Locale.ENGLISH)); c.setUuid("c"); c.setDatatype(Context.getConceptService().getConceptDatatypeByName("N/A")); + c.addDescription(new ConceptDescription("Description", Locale.ENGLISH)); Context.getConceptService().saveConcept(c); ConceptSource newSource = new ConceptSource(); @@ -63,15 +65,15 @@ public List prepareExportServer() throws Exception { Context.getConceptService().saveConceptSource(commonSource); ConceptMap newMap = new ConceptMap(); - newMap.setSource(newSource); - newMap.setSourceCode("c"); + newMap.getConceptReferenceTerm().setConceptSource(newSource); + newMap.getConceptReferenceTerm().setCode("c"); c.addConceptMapping(newMap); Context.getConceptService().saveConcept(c); ConceptMap commonMap = new ConceptMap(); - commonMap.setSource(commonSource); - commonMap.setSourceCode("cd"); + commonMap.getConceptReferenceTerm().setConceptSource(commonSource); + commonMap.getConceptReferenceTerm().setCode("cd"); c.addConceptMapping(commonMap); Context.getConceptService().saveConcept(c); @@ -86,6 +88,8 @@ public void prepareImportServer() throws Exception { c.addName(new ConceptName("c", Locale.ENGLISH)); c.setUuid("c"); c.setDatatype(Context.getConceptService().getConceptDatatypeByName("N/A")); + c.addDescription(new ConceptDescription("Description", Locale.ENGLISH)); + Context.getConceptService().saveConcept(c); ConceptSource commonSource = new ConceptSource(); @@ -94,8 +98,8 @@ public void prepareImportServer() throws Exception { Context.getConceptService().saveConceptSource(commonSource); ConceptMap commonMap = new ConceptMap(); - commonMap.setSource(commonSource); - commonMap.setSourceCode("cd"); + commonMap.getConceptReferenceTerm().setConceptSource(commonSource); + commonMap.getConceptReferenceTerm().setCode("cd"); c.addConceptMapping(commonMap); Context.getConceptService().saveConcept(c); @@ -121,7 +125,7 @@ public void runOnImportServerAfterImport() throws Exception { Set uuids = new HashSet(Arrays.asList("csNew", "csOld")); for (ConceptMap conceptMap : concept.getConceptMappings()) { - if (!uuids.contains(conceptMap.getSource().getUuid())) { + if (!uuids.contains(conceptMap.getConceptReferenceTerm().getConceptSource().getUuid())) { Assert.fail("Must be csNew or csOld"); } } @@ -132,6 +136,7 @@ public void runOnImportServerAfterImport() throws Exception { @Test public void shouldUpdateRelatedConceptSourceWhenImportedAgain() throws Exception { Concept concept = ConceptMock.newInstance().addMapping("1", "source").addPreferredName("hiv", Locale.ENGLISH) + .addDescription("Description", Locale.ENGLISH) .saveConcept().getConcept(); PackageExporter exporter = MetadataSharing.getInstance().newPackageExporter(); exporter.addItem(concept); diff --git a/api-test/src/test/java/org/openmrs/module/metadatasharing/ConceptNamesTest.java b/api-test/src/test/java/org/openmrs/module/metadatasharing/ConceptNamesTest.java index 13b9ff09..0642f0a6 100644 --- a/api-test/src/test/java/org/openmrs/module/metadatasharing/ConceptNamesTest.java +++ b/api-test/src/test/java/org/openmrs/module/metadatasharing/ConceptNamesTest.java @@ -26,6 +26,7 @@ import org.junit.Assert; import org.junit.Test; import org.openmrs.Concept; +import org.openmrs.ConceptDescription; import org.openmrs.ConceptName; import org.openmrs.api.context.Context; import org.openmrs.module.metadatasharing.wrapper.PackageImporter; @@ -50,9 +51,11 @@ public void shouldOverwritePreferredNameIfPreferTheirs() throws Exception { public List prepareExportServer() throws Exception { Concept concept = new Concept(); concept.setUuid(conceptUuid); - + concept.addDescription(new ConceptDescription("Description", Locale.ENGLISH)); + + ConceptName preferredName = new ConceptName("a", Locale.ENGLISH); - concept.setPreferredName(Locale.ENGLISH, preferredName); + concept.setPreferredName(preferredName); ConceptName synonym = new ConceptName("AA", Locale.ENGLISH); concept.addName(synonym); @@ -71,9 +74,10 @@ public List prepareExportServer() throws Exception { public void prepareImportServer() throws Exception { Concept concept = new Concept(); concept.setUuid(conceptUuid); - + concept.addDescription(new ConceptDescription("Description", Locale.ENGLISH)); + ConceptName preferredName = new ConceptName("b", Locale.ENGLISH); - concept.setPreferredName(Locale.ENGLISH, preferredName); + concept.setPreferredName(preferredName); ConceptName synonym = new ConceptName("AA", Locale.ENGLISH); concept.addName(synonym); @@ -124,9 +128,10 @@ public void shouldRemoveExistingNamesIfNotInIncomingInMirrorMode() throws Except public List prepareExportServer() throws Exception { Concept concept = new Concept(); concept.setUuid(conceptUuid); - + concept.addDescription(new ConceptDescription("Description", Locale.ENGLISH)); + ConceptName preferredName = new ConceptName("a", Locale.ENGLISH); - concept.setPreferredName(Locale.ENGLISH, preferredName); + concept.setPreferredName(preferredName); ConceptName synonym = new ConceptName("AA", Locale.ENGLISH); concept.addName(synonym); @@ -145,9 +150,10 @@ public List prepareExportServer() throws Exception { public void prepareImportServer() throws Exception { Concept concept = new Concept(); concept.setUuid(conceptUuid); - + concept.addDescription(new ConceptDescription("Description", Locale.ENGLISH)); + ConceptName preferredName = new ConceptName("b", Locale.ENGLISH); - concept.setPreferredName(Locale.ENGLISH, preferredName); + concept.setPreferredName(preferredName); ConceptName synonym = new ConceptName("AA", Locale.ENGLISH); concept.addName(synonym); @@ -194,9 +200,10 @@ public void shouldNotOverwritePreferredNameIfPreferMine() throws Exception { public List prepareExportServer() throws Exception { Concept concept = new Concept(); concept.setUuid(conceptUuid); + concept.addDescription(new ConceptDescription("Description", Locale.ENGLISH)); ConceptName preferredName = new ConceptName("a", Locale.ENGLISH); - concept.setPreferredName(Locale.ENGLISH, preferredName); + concept.setPreferredName(preferredName); ConceptName synonym = new ConceptName("AA", Locale.ENGLISH); concept.addName(synonym); @@ -215,9 +222,10 @@ public List prepareExportServer() throws Exception { public void prepareImportServer() throws Exception { Concept concept = new Concept(); concept.setUuid(conceptUuid); - + concept.addDescription(new ConceptDescription("Description", Locale.ENGLISH)); + ConceptName preferredName = new ConceptName("b", Locale.ENGLISH); - concept.setPreferredName(Locale.ENGLISH, preferredName); + concept.setPreferredName(preferredName); ConceptName synonym = new ConceptName("AA", Locale.ENGLISH); concept.addName(synonym); diff --git a/api-test/src/test/java/org/openmrs/module/metadatasharing/ConceptShareScenarioTest.java b/api-test/src/test/java/org/openmrs/module/metadatasharing/ConceptShareScenarioTest.java index ec2b7a64..f0f087ac 100644 --- a/api-test/src/test/java/org/openmrs/module/metadatasharing/ConceptShareScenarioTest.java +++ b/api-test/src/test/java/org/openmrs/module/metadatasharing/ConceptShareScenarioTest.java @@ -28,6 +28,7 @@ public class ConceptShareScenarioTest extends BaseShareScenarioTest { @Override public List prepareItemsToExport() { Concept concept = ConceptMock.newInstance().addPreferredName("Some test concept", Locale.ENGLISH).setDatatype("N/A") + .addDescription("Description", Locale.ENGLISH) .saveConcept().getConcept(); return Arrays.asList(concept); } diff --git a/api-test/src/test/java/org/openmrs/module/metadatasharing/ConceptShareTest.java b/api-test/src/test/java/org/openmrs/module/metadatasharing/ConceptShareTest.java index c203461c..c1bf8ae4 100644 --- a/api-test/src/test/java/org/openmrs/module/metadatasharing/ConceptShareTest.java +++ b/api-test/src/test/java/org/openmrs/module/metadatasharing/ConceptShareTest.java @@ -35,7 +35,9 @@ public void shouldImportConceptWithMappingToEmptyServer() throws Exception { @Override public List prepareExportServer() throws Exception { exportedConcept = ConceptMock.newInstance().addPreferredName("Yes Yes", Locale.ENGLISH) - .addMapping("373066001", "SNOMED CT").addMapping("1065", "AMPATH").setDatatype("N/A").saveConcept() + .addMapping("373066001", "SNOMED CT").addMapping("1065", "AMPATH").setDatatype("N/A") + .addDescription("Description", Locale.ENGLISH) + .saveConcept() .getConcept(); return Arrays.asList(exportedConcept); @@ -64,7 +66,9 @@ public void shouldUpdateConceptByAddingNewMapping() throws Exception { @Override public List prepareExportServer() throws Exception { exportedConcept = ConceptMock.newInstance().addPreferredName("Yes Yes", Locale.ENGLISH) - .addMapping("373066001", "SNOMED CT").addMapping("1065", "AMPATH").setDatatype("N/A").saveConcept() + .addMapping("373066001", "SNOMED CT").addMapping("1065", "AMPATH").setDatatype("N/A") + .addDescription("Description", Locale.ENGLISH) + .saveConcept() .getConcept(); return Arrays.asList(exportedConcept); @@ -72,8 +76,10 @@ public List prepareExportServer() throws Exception { @Override public void prepareImportServer() throws Exception { - ConceptMock.newInstance().addPreferredName("Yes Yes", Locale.ENGLISH).addMapping("373066001", "SNOMED CT") - .setDatatype("N/A").saveConcept(); + ConceptMock.newInstance().addPreferredName("Yes Yes 2", Locale.ENGLISH).addMapping("373066001", "SNOMED CT") + .setDatatype("N/A") + .addDescription("Description", Locale.ENGLISH) + .saveConcept(); } @Override @@ -96,7 +102,9 @@ public void shouldMergeConceptNamesIgnoringCaseInP2PMode() throws Exception { @Override public List prepareExportServer() throws Exception { - Concept concept = ConceptMock.newInstance().addPreferredName("Yes Yes", Locale.ENGLISH).saveConcept() + Concept concept = ConceptMock.newInstance().addPreferredName("Yes Yes", Locale.ENGLISH) + .addDescription("Description", Locale.ENGLISH) + .saveConcept() .getConcept(); return Arrays.asList(concept); @@ -105,6 +113,7 @@ public List prepareExportServer() throws Exception { @Override public void prepareImportServer() throws Exception { ConceptMock.newInstance().addName("YES YES", Locale.ENGLISH).addPreferredName("Yes!", Locale.ENGLISH) + .addDescription("Description", Locale.ENGLISH) .saveConcept(); } diff --git a/api-test/src/test/java/org/openmrs/module/metadatasharing/ConceptWithAnswerDrugShareScenarioTest.java b/api-test/src/test/java/org/openmrs/module/metadatasharing/ConceptWithAnswerDrugShareScenarioTest.java index 6aba6c2f..7c4dd16c 100644 --- a/api-test/src/test/java/org/openmrs/module/metadatasharing/ConceptWithAnswerDrugShareScenarioTest.java +++ b/api-test/src/test/java/org/openmrs/module/metadatasharing/ConceptWithAnswerDrugShareScenarioTest.java @@ -21,6 +21,7 @@ import org.junit.Test; import org.openmrs.Concept; import org.openmrs.ConceptAnswer; +import org.openmrs.ConceptDescription; import org.openmrs.ConceptName; import org.openmrs.Drug; import org.openmrs.api.context.Context; @@ -41,6 +42,7 @@ public List prepareExportServer() throws Exception { Concept c = new Concept(); c.setUuid("1"); c.addName(new ConceptName("DrugAnswerDrugConcept", Locale.US)); + c.addDescription(new ConceptDescription("Description", Locale.ENGLISH)); Context.getConceptService().saveConcept(c); //here's the drug @@ -54,7 +56,8 @@ public List prepareExportServer() throws Exception { Concept cTest = new Concept(); cTest.setUuid("3"); cTest.addName(new ConceptName("TestAnswerDrugConcept", Locale.US)); - + cTest.addDescription(new ConceptDescription("Description", Locale.ENGLISH)); + ConceptAnswer ca = new ConceptAnswer(); ca.setAnswerConcept(c); ca.setAnswerDrug(drug); diff --git a/api-test/src/test/java/org/openmrs/module/metadatasharing/PreferTheirConceptNumericToConceptShareScenarioTest.java b/api-test/src/test/java/org/openmrs/module/metadatasharing/PreferTheirConceptNumericToConceptShareScenarioTest.java index 3425fd1b..01615fc3 100644 --- a/api-test/src/test/java/org/openmrs/module/metadatasharing/PreferTheirConceptNumericToConceptShareScenarioTest.java +++ b/api-test/src/test/java/org/openmrs/module/metadatasharing/PreferTheirConceptNumericToConceptShareScenarioTest.java @@ -20,6 +20,7 @@ import org.junit.Assert; import org.junit.Test; import org.openmrs.Concept; +import org.openmrs.ConceptDescription; import org.openmrs.ConceptName; import org.openmrs.ConceptNumeric; import org.openmrs.api.context.Context; @@ -41,6 +42,7 @@ public List prepareExportServer() throws Exception { c.addName(new ConceptName("ConceptNumericConcept", Locale.US)); c.setHiNormal(Double.valueOf(1)); c.setUuid("23423a2982236623"); + c.addDescription(new ConceptDescription("Description", Locale.ENGLISH)); Context.getConceptService().saveConcept(c); return Collections.nCopies(1, c); @@ -52,6 +54,7 @@ public void prepareImportServer() throws Exception { Concept c = new Concept(); c.addName(new ConceptName("ConceptNumericConcept", Locale.US)); c.setUuid("23423a2982236623"); + c.addDescription(new ConceptDescription("Description", Locale.ENGLISH)); Context.getConceptService().saveConcept(c); } diff --git a/api-test/src/test/java/org/openmrs/module/metadatasharing/PreferTheirConceptToConceptNumericShareScenarioTest.java b/api-test/src/test/java/org/openmrs/module/metadatasharing/PreferTheirConceptToConceptNumericShareScenarioTest.java index ad6900f5..d369e993 100644 --- a/api-test/src/test/java/org/openmrs/module/metadatasharing/PreferTheirConceptToConceptNumericShareScenarioTest.java +++ b/api-test/src/test/java/org/openmrs/module/metadatasharing/PreferTheirConceptToConceptNumericShareScenarioTest.java @@ -20,6 +20,7 @@ import org.junit.Assert; import org.junit.Test; import org.openmrs.Concept; +import org.openmrs.ConceptDescription; import org.openmrs.ConceptName; import org.openmrs.ConceptNumeric; import org.openmrs.api.context.Context; @@ -40,6 +41,7 @@ public List prepareExportServer() throws Exception { c.addName(new ConceptName("ConceptName", Locale.US)); c.setDatatype(Context.getConceptService().getConceptDatatypeByName("N/A")); c.setUuid("23423a2982236623"); + c.addDescription(new ConceptDescription("Description", Locale.ENGLISH)); Context.getConceptService().saveConcept(c); return Collections.nCopies(1, c); @@ -53,6 +55,7 @@ public void prepareImportServer() throws Exception { c.addName(new ConceptName("ConceptNumericName", Locale.US)); c.setHiNormal(Double.valueOf(1)); c.setUuid("23423a2982236623"); + c.addDescription(new ConceptDescription("Description", Locale.ENGLISH)); Context.getConceptService().saveConcept(c); } diff --git a/api-test/src/test/java/org/openmrs/module/metadatasharing/PreserveConceptIdsTest.java b/api-test/src/test/java/org/openmrs/module/metadatasharing/PreserveConceptIdsTest.java index 0862e3c3..ed23868b 100644 --- a/api-test/src/test/java/org/openmrs/module/metadatasharing/PreserveConceptIdsTest.java +++ b/api-test/src/test/java/org/openmrs/module/metadatasharing/PreserveConceptIdsTest.java @@ -21,6 +21,7 @@ import org.junit.Test; import org.openmrs.Concept; +import org.openmrs.ConceptDescription; import org.openmrs.ConceptName; import org.openmrs.GlobalProperty; import org.openmrs.api.context.Context; @@ -42,7 +43,8 @@ public List prepareExportServer() throws Exception { Concept c = new Concept(); ConceptName conceptName = new ConceptName("1234567890-1234567890", Locale.US); c.addName(conceptName); - + c.addDescription(new ConceptDescription("Description", Locale.ENGLISH)); + Context.getConceptService().saveConcept(c); // check to make sure the child server uses this one @@ -75,13 +77,17 @@ public void shouldNotPreserveConceptIdAcrossServersIfImportingServerDoesntReques runShareTest(new ShareTestHelper() { Integer newConceptId = null; + + Concept concept; @Override public List prepareExportServer() throws Exception { Concept c = new Concept(); c.addName(new ConceptName("Test", Locale.US)); - + c.addDescription(new ConceptDescription("Description", Locale.ENGLISH)); + concept = c; + Context.getConceptService().saveConcept(c); // check to make sure the child server uses this one @@ -104,8 +110,8 @@ public void prepareImportServer() throws Exception { @Override public void runOnImportServerAfterImport() throws Exception { Concept c = Context.getConceptService().getConcept(newConceptId); - - Assert.assertNull("The concept was found with the same id, wha happened??", c); + + Assert.assertEquals(concept, c); } }); } diff --git a/api-test/src/test/java/org/openmrs/module/metadatasharing/handler/impl/ConceptHandlersFunctionalTest.java b/api-test/src/test/java/org/openmrs/module/metadatasharing/handler/impl/ConceptHandlersFunctionalTest.java index 144bc993..60c33e4d 100644 --- a/api-test/src/test/java/org/openmrs/module/metadatasharing/handler/impl/ConceptHandlersFunctionalTest.java +++ b/api-test/src/test/java/org/openmrs/module/metadatasharing/handler/impl/ConceptHandlersFunctionalTest.java @@ -19,6 +19,7 @@ import junit.framework.Assert; import org.openmrs.Concept; +import org.openmrs.ConceptDescription; import org.openmrs.ConceptName; import org.openmrs.api.context.Context; import org.openmrs.module.metadatasharing.handler.BaseHandlersTest; @@ -30,6 +31,7 @@ public class ConceptHandlersFunctionalTest extends BaseHandlersTest { public Concept getNewItem(){ Concept concept = new Concept(); concept.addName(new ConceptName("New Concept", Locale.ENGLISH)); + concept.addDescription(new ConceptDescription("Description", Locale.ENGLISH)); return concept; } @@ -38,6 +40,7 @@ public Concept getExistingItem(){ Concept concept = new Concept(); concept.setUuid("1"); concept.addName(new ConceptName("Existing concept", Locale.ENGLISH)); + concept.addDescription(new ConceptDescription("Description", Locale.ENGLISH)); return Context.getConceptService().saveConcept(concept); } diff --git a/api-test/src/test/java/org/openmrs/module/metadatasharing/mock/ConceptMock.java b/api-test/src/test/java/org/openmrs/module/metadatasharing/mock/ConceptMock.java index 370bd045..7c1eee5a 100644 --- a/api-test/src/test/java/org/openmrs/module/metadatasharing/mock/ConceptMock.java +++ b/api-test/src/test/java/org/openmrs/module/metadatasharing/mock/ConceptMock.java @@ -79,7 +79,7 @@ public ConceptMock addName(String name, Locale locale) { public ConceptMock setPreferredName(String name, Locale locale) { for (ConceptName conceptName : concept.getNames()) { if (conceptName.getName().equals(name) && conceptName.getLocale().equals(locale)) { - concept.setPreferredName(locale, conceptName); + concept.setPreferredName(conceptName); return this; } } @@ -89,7 +89,7 @@ public ConceptMock setPreferredName(String name, Locale locale) { public ConceptMock setShortName(String name, Locale locale) { for (ConceptName conceptName : concept.getNames()) { if (conceptName.getName().equals(name) && conceptName.getLocale().equals(locale)) { - concept.setShortName(locale, conceptName); + concept.setShortName(conceptName); return this; } } @@ -99,14 +99,14 @@ public ConceptMock setShortName(String name, Locale locale) { public ConceptMock addPreferredName(String name, Locale locale) { ConceptName conceptName = new ConceptName(name, locale); conceptName.setUuid(UUID.randomUUID().toString()); - concept.setPreferredName(locale, conceptName); + concept.setPreferredName(conceptName); return this; } public ConceptMock addShortName(String name, Locale locale) { ConceptName conceptName = new ConceptName(name, locale); conceptName.setUuid(UUID.randomUUID().toString()); - concept.setShortName(locale, conceptName); + concept.setShortName(conceptName); return this; } @@ -126,8 +126,8 @@ public ConceptMock addMapping(String code, String source) { conceptSource.setHl7Code(source); } ConceptMap conceptMap = new ConceptMap(); - conceptMap.setSource(conceptSource); - conceptMap.setSourceCode(code); + conceptMap.getConceptReferenceTerm().setConceptSource(conceptSource); + conceptMap.getConceptReferenceTerm().setCode(code); concept.addConceptMapping(conceptMap); return this; } @@ -203,14 +203,14 @@ public ConceptMock assertEquals(Concept expected, boolean ignoreUuids) { for (ConceptMap conceptMap : concept.getConceptMappings()) { boolean found = false; for (ConceptMap expectedMap : expected.getConceptMappings()) { - if (expectedMap.getSourceCode().equals(conceptMap.getSourceCode())) { + if (expectedMap.getConceptReferenceTerm().getCode().equals(conceptMap.getConceptReferenceTerm().getCode())) { found = true; - if (!assertBothOrNoneNull("map source", expectedMap.getSource(), conceptMap.getSource())) { + if (!assertBothOrNoneNull("map source", expectedMap.getConceptReferenceTerm().getConceptSource(), conceptMap.getConceptReferenceTerm().getConceptSource())) { if (!ignoreUuids) { - Assert.assertEquals("map source uuid", expectedMap.getSource().getUuid(), conceptMap - .getSource().getUuid()); + Assert.assertEquals("map source uuid", expectedMap.getConceptReferenceTerm().getConceptSource().getUuid(), conceptMap.getConceptReferenceTerm() + .getConceptSource().getUuid()); } - Assert.assertEquals("map source name", expectedMap.getSource().getName(), conceptMap.getSource() + Assert.assertEquals("map source name", expectedMap.getConceptReferenceTerm().getConceptSource().getName(), conceptMap.getConceptReferenceTerm().getConceptSource() .getName()); } } diff --git a/api-test/src/test/java/org/openmrs/module/metadatasharing/serializer/LocationMock.java b/api-test/src/test/java/org/openmrs/module/metadatasharing/serializer/LocationMock.java index 2afd6645..e3bcdc64 100644 --- a/api-test/src/test/java/org/openmrs/module/metadatasharing/serializer/LocationMock.java +++ b/api-test/src/test/java/org/openmrs/module/metadatasharing/serializer/LocationMock.java @@ -47,17 +47,17 @@ public LocationMock(Location loc) { setLatitude(loc.getLatitude()); setLongitude(loc.getLongitude()); setName(loc.getName()); - setNeighborhoodCell(loc.getNeighborhoodCell()); + setAddress3(loc.getAddress3()); setParentLocation(loc.getParentLocation()); setPostalCode(loc.getPostalCode()); - setRegion(loc.getRegion()); + setAddress6(loc.getAddress6()); setRetired(loc.getRetired()); setRetiredBy(loc.getRetiredBy()); setRetireReason(loc.getRetireReason()); setStateProvince(loc.getStateProvince()); - setSubregion(loc.getSubregion()); + setAddress5(loc.getAddress5()); setTags(loc.getTags()); - setTownshipDivision(loc.getTownshipDivision()); + setAddress4(loc.getAddress4()); setUuid(loc.getUuid()); } diff --git a/api-test/src/test/java/org/openmrs/module/metadatasharing/serializer/ShareableLocation.java b/api-test/src/test/java/org/openmrs/module/metadatasharing/serializer/ShareableLocation.java index f12572f7..917856c5 100644 --- a/api-test/src/test/java/org/openmrs/module/metadatasharing/serializer/ShareableLocation.java +++ b/api-test/src/test/java/org/openmrs/module/metadatasharing/serializer/ShareableLocation.java @@ -50,17 +50,17 @@ public ShareableLocation(LocationMock loc) { setLatitude(loc.getLatitude()); setLongitude(loc.getLongitude()); setName(loc.getName()); - setNeighborhoodCell(loc.getNeighborhoodCell()); + setAddress3(loc.getAddress3()); setParentLocation(loc.getParentLocation()); setPostalCode(loc.getPostalCode()); - setRegion(loc.getRegion()); + setAddress6(loc.getAddress6()); setRetired(loc.getRetired()); setRetiredBy(loc.getRetiredBy()); setRetireReason(loc.getRetireReason()); setStateProvince(loc.getStateProvince()); - setSubregion(loc.getSubregion()); + setAddress5(loc.getAddress5()); setTags(loc.getTags()); - setTownshipDivision(loc.getTownshipDivision()); + setAddress4(loc.getAddress4()); setUuid(loc.getUuid()); } @@ -101,17 +101,17 @@ protected Location saveReplace() { loc.setLatitude(getLatitude()); loc.setLongitude(getLongitude()); loc.setName(getName()); - loc.setNeighborhoodCell(getNeighborhoodCell()); + loc.setAddress3(getAddress3()); loc.setParentLocation(getParentLocation()); loc.setPostalCode(getPostalCode()); - loc.setRegion(getRegion()); + loc.setAddress6(getAddress6()); loc.setRetired(getRetired()); loc.setRetiredBy(getRetiredBy()); loc.setRetireReason(getRetireReason()); loc.setStateProvince(getStateProvince()); - loc.setSubregion(getSubregion()); + loc.setAddress5(getAddress5()); loc.setTags(getTags()); - loc.setTownshipDivision(getTownshipDivision()); + loc.setAddress4(getAddress4()); loc.setUuid(getUuid()); return loc; } diff --git a/api-test/src/test/java/org/openmrs/module/metadatasharing/wrapper/MetadataExporterTest.java b/api-test/src/test/java/org/openmrs/module/metadatasharing/wrapper/MetadataExporterTest.java index 2d09056b..70ed6e80 100644 --- a/api-test/src/test/java/org/openmrs/module/metadatasharing/wrapper/MetadataExporterTest.java +++ b/api-test/src/test/java/org/openmrs/module/metadatasharing/wrapper/MetadataExporterTest.java @@ -8,13 +8,11 @@ import org.custommonkey.xmlunit.XMLAssert; import org.junit.Test; import org.openmrs.Concept; +import org.openmrs.ConceptDescription; import org.openmrs.ConceptName; -import org.openmrs.GlobalProperty; -import org.openmrs.api.AdministrationService; import org.openmrs.api.context.Context; import org.openmrs.module.metadatasharing.ExportedPackage; import org.openmrs.module.metadatasharing.ImportExportTestUtils; -import org.openmrs.module.metadatasharing.MetadataSharingConsts; import org.openmrs.module.metadatasharing.handler.Handler; import org.openmrs.test.BaseModuleContextSensitiveTest; import org.openmrs.test.Verifies; @@ -31,6 +29,7 @@ public void exportPackage_shouldAddExplicitItemsAndIncludedDependenciesToTheHead c.addName(new ConceptName("c", Locale.ENGLISH)); c.setUuid("c"); c.setDatatype(Context.getConceptService().getConceptDatatypeByName("N/A")); + c.addDescription(new ConceptDescription("Description", Locale.ENGLISH)); Context.getConceptService().saveConcept(c); ExportedPackage pack = ImportExportTestUtils.exportPackage(null, @@ -51,6 +50,7 @@ public void exportPackage_shouldCreateMappingsToLocalSourceByDefault() throws Ex c.addName(new ConceptName("c", Locale.ENGLISH)); c.setUuid("c"); c.setDatatype(Context.getConceptService().getConceptDatatypeByName("N/A")); + c.addDescription(new ConceptDescription("Description", Locale.ENGLISH)); Context.getConceptService().saveConcept(c); final String conceptUUId = "c"; diff --git a/omod/src/main/java/org/openmrs/module/metadatasharing/web/extension/html/AdminList.java b/omod/src/main/java/org/openmrs/module/metadatasharing/web/extension/html/AdminList.java deleted file mode 100644 index 39390723..00000000 --- a/omod/src/main/java/org/openmrs/module/metadatasharing/web/extension/html/AdminList.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * The contents of this file are subject to the OpenMRS Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://license.openmrs.org - * - * Software distributed under the License is distributed on an "AS IS" - * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the - * License for the specific language governing rights and limitations - * under the License. - * - * Copyright (C) OpenMRS, LLC. All Rights Reserved. - */ -package org.openmrs.module.metadatasharing.web.extension.html; - -import java.util.LinkedHashMap; -import java.util.Map; - -import org.openmrs.module.Extension; -import org.openmrs.module.metadatasharing.MetadataSharingConsts; -import org.openmrs.module.web.extension.AdministrationSectionExt; - -/** - * This class defines the links that will appear on the administration page under the - * "metadatasharing.title" heading. This extension is enabled by defining (uncommenting) it in the - * /metadata/config.xml file. - */ -public class AdminList extends AdministrationSectionExt { - - /** - * @see org.openmrs.module.web.extension.AdministrationSectionExt#getMediaType() - */ - @Override - public Extension.MEDIA_TYPE getMediaType() { - return Extension.MEDIA_TYPE.html; - } - - /** - * @see org.openmrs.module.web.extension.AdministrationSectionExt#getTitle() - */ - @Override - public String getTitle() { - return MetadataSharingConsts.MODULE_ID + ".title"; - } - - /** - * @see org.openmrs.module.web.extension.AdministrationSectionExt#getLinks() - */ - @Override - public Map getLinks() { - - Map map = new LinkedHashMap(); - - map.put(MetadataSharingConsts.MODULE_PATH + "/export/list.form", MetadataSharingConsts.MODULE_ID - + ".exportMetadata"); - - map.put(MetadataSharingConsts.MODULE_PATH + "/import/list.form", MetadataSharingConsts.MODULE_ID - + ".importMetadata"); - - map.put(MetadataSharingConsts.MODULE_PATH + "/task/list.form", MetadataSharingConsts.MODULE_ID - + ".task.manageTasks"); - - map.put(MetadataSharingConsts.MODULE_PATH + "/configure.form", MetadataSharingConsts.MODULE_ID + ".configure"); - - return map; - } - - /** - * @see org.openmrs.module.web.extension.AdministrationSectionExt#getRequiredPrivilege() - */ - @Override - public String getRequiredPrivilege() { - return MetadataSharingConsts.MODULE_PRIVILEGE; - } - -} diff --git a/pom.xml b/pom.xml index dd5bb4d5..7927a23c 100644 --- a/pom.xml +++ b/pom.xml @@ -74,7 +74,7 @@ - 1.9.9 + 2.0.0 UTF-8 ${project.parent.artifactId}