diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 8d23150..240d67e 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,40 +1,54 @@ # this build is designed to replicate the Travis CI workflow -name: Build with Maven +name: Java CI with Maven on: push: - branches: [ master ] + branches: [ "master" ] pull_request: - branches: [ master ] - workflow_dispatch: + branches: [ "master" ] jobs: - build: - strategy: - matrix: - platform: [ ubuntu-latest ] - java-version: [ 8 ] + java-8: - runs-on: ${{ matrix.platform }} - env: - PLATFORM: ${{ matrix.platform }} - JAVA_VERSION: ${{ matrix.java-version }} + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up JDK - uses: actions/setup-java@v1 + - uses: actions/checkout@v3 + - name: Set up JDK 8 + uses: actions/setup-java@v3 with: - java-version: ${{ matrix.java-version }} - - name: Cache local Maven repository - uses: actions/cache@v2 + java-version: '8' + distribution: 'adopt' + cache: maven + - name: Build with Maven + run: mvn clean install --file pom.xml + + java-11: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 11 + uses: actions/setup-java@v3 with: - path: ~/.m2/repository - key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} - restore-keys: | - ${{ runner.os }}-maven- - - name: Install dependencies - run: mvn clean install -DskipTests=true -Dmaven.javadoc.skip=true --batch-mode --show-version --file pom.xml + java-version: '11' + distribution: 'adopt' + cache: maven - name: Build with Maven - run: mvn test --batch-mode --file pom.xml + run: mvn clean install --file pom.xml + java-17: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'adopt' + cache: maven + - name: Build with Maven + run: mvn clean install --file pom.xml diff --git a/api/src/main/java/org/openmrs/ui/framework/NameSupportCompatibility.java b/api/src/main/java/org/openmrs/ui/framework/NameSupportCompatibility.java index 50a6d1d..510f7fe 100644 --- a/api/src/main/java/org/openmrs/ui/framework/NameSupportCompatibility.java +++ b/api/src/main/java/org/openmrs/ui/framework/NameSupportCompatibility.java @@ -3,7 +3,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.openmrs.PersonName; -import org.openmrs.layout.web.name.NameSupport; +import org.openmrs.layout.name.NameSupport; import org.openmrs.util.OpenmrsClassLoader; import java.lang.reflect.Method; diff --git a/api/src/main/java/org/openmrs/ui/framework/converter/StringToPatientProblemConverter.java b/api/src/main/java/org/openmrs/ui/framework/converter/StringToPatientProblemConverter.java deleted file mode 100644 index 562c189..0000000 --- a/api/src/main/java/org/openmrs/ui/framework/converter/StringToPatientProblemConverter.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.openmrs.ui.framework.converter; - -import org.apache.commons.lang.StringUtils; -import org.openmrs.activelist.ProblemModifier; -import org.openmrs.annotation.OpenmrsProfile; -import org.springframework.core.convert.converter.Converter; - -@OpenmrsProfile(openmrsPlatformVersion = "[1.9.9 - 1.12.*]") -public class StringToPatientProblemConverter implements Converter { - - @Override - public ProblemModifier convert(String text) { - if (StringUtils.isBlank(text)) - return null; - return ProblemModifier.getValue(text); - } -} diff --git a/api/src/test/java/org/openmrs/ui/framework/FormatterImplTest.java b/api/src/test/java/org/openmrs/ui/framework/FormatterImplTest.java index 6e3a9d9..33fbc92 100644 --- a/api/src/test/java/org/openmrs/ui/framework/FormatterImplTest.java +++ b/api/src/test/java/org/openmrs/ui/framework/FormatterImplTest.java @@ -194,7 +194,7 @@ public void testFormattingConceptNumeric() throws Exception { ConceptDatatype numericDatatype = new ConceptDatatype(); numericDatatype.setHl7Abbreviation("NM"); conceptNumeric.setDatatype(numericDatatype); - conceptNumeric.setPrecise(true); + conceptNumeric.setAllowDecimal(true); Obs numericObs = new Obs(); numericObs.setConcept(conceptNumeric); @@ -214,7 +214,7 @@ public void testFormattingConceptNumeric_shouldNotFailIfNoUnits() throws Excepti ConceptDatatype numericDatatype = new ConceptDatatype(); numericDatatype.setHl7Abbreviation("NM"); conceptNumeric.setDatatype(numericDatatype); - conceptNumeric.setPrecise(true); + conceptNumeric.setAllowDecimal(true); Obs numericObs = new Obs(); numericObs.setConcept(conceptNumeric); diff --git a/api/src/test/java/org/openmrs/ui/framework/SimpleObjectTest.java b/api/src/test/java/org/openmrs/ui/framework/SimpleObjectTest.java index ddf924e..d5cffb8 100644 --- a/api/src/test/java/org/openmrs/ui/framework/SimpleObjectTest.java +++ b/api/src/test/java/org/openmrs/ui/framework/SimpleObjectTest.java @@ -11,7 +11,6 @@ import org.openmrs.ui.framework.formatter.FormatterService; import org.openmrs.ui.framework.fragment.FragmentActionUiUtils; import org.springframework.context.MessageSource; -import org.springframework.test.annotation.DirtiesContext; import java.util.Map; @@ -20,7 +19,6 @@ import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; -@DirtiesContext public class SimpleObjectTest { private UiUtils ui; diff --git a/api/src/test/java/org/openmrs/ui/framework/converter/StringToGlobalPropertyConverterTest.java b/api/src/test/java/org/openmrs/ui/framework/converter/StringToGlobalPropertyConverterTest.java index b359058..3ba9135 100644 --- a/api/src/test/java/org/openmrs/ui/framework/converter/StringToGlobalPropertyConverterTest.java +++ b/api/src/test/java/org/openmrs/ui/framework/converter/StringToGlobalPropertyConverterTest.java @@ -11,7 +11,7 @@ public class StringToGlobalPropertyConverterTest extends BaseModuleContextSensit public void convert_shouldConvertStringToGlobalProperty() { StringToGlobalPropertyConverter converter = new StringToGlobalPropertyConverter(); GlobalProperty prop = converter.convert("locale.allowed.list"); - Assert.assertEquals("en", prop.getPropertyValue()); + Assert.assertEquals("en_GB", prop.getPropertyValue()); } @Test diff --git a/api/src/test/java/org/openmrs/ui/framework/formatter/FormatterServiceTest.java b/api/src/test/java/org/openmrs/ui/framework/formatter/FormatterServiceTest.java index 557dbf3..1c6d0c1 100644 --- a/api/src/test/java/org/openmrs/ui/framework/formatter/FormatterServiceTest.java +++ b/api/src/test/java/org/openmrs/ui/framework/formatter/FormatterServiceTest.java @@ -9,7 +9,6 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.MessageSource; import org.springframework.core.Ordered; -import org.springframework.test.annotation.DirtiesContext; import java.util.Locale; @@ -24,7 +23,6 @@ public class FormatterServiceTest extends BaseModuleContextSensitiveTest { private FormatterService formatterService; @Test - @DirtiesContext public void testFormatting() throws Exception { HandlebarsFormatterFactory classFormatter = new HandlebarsFormatterFactory(); classFormatter.setForClass("org.openmrs.Obs"); @@ -49,25 +47,23 @@ public String toString() { } @Test - @DirtiesContext public void testMessage() throws Exception { MessageSource messageSource = mock(MessageSource.class); - + FormatterService messageFormatterService = new FormatterService(); + messageFormatterService.setMessageSource(messageSource); HandlebarsFormatterFactory classFormatter = new HandlebarsFormatterFactory(); classFormatter.setForClass("org.openmrs.Obs"); classFormatter.setTemplate("{{ message 'testing.123.testing' }} something"); - formatterService.addClassFormatter(classFormatter); + messageFormatterService.addClassFormatter(classFormatter); Context.setLocale(Locale.ENGLISH); - Formatter formatter = formatterService.getFormatter(); - formatterService.setMessageSource(messageSource); + Formatter formatter = messageFormatterService.getFormatter(); - String result = formatter.format(new Obs(), Locale.ENGLISH); + formatter.format(new Obs(), Locale.ENGLISH); verify(messageSource).getMessage("testing.123.testing", null, Locale.ENGLISH); } @Test - @DirtiesContext public void testOrder() throws Exception { HandlebarsFormatterFactory wrongFormatter1 = new HandlebarsFormatterFactory(); wrongFormatter1.setForClass("org.openmrs.Obs"); diff --git a/pom.xml b/pom.xml index ce6a09f..2f38979 100644 --- a/pom.xml +++ b/pom.xml @@ -43,19 +43,13 @@ - 1.9.9 - 3.0.5.RELEASE + 2.0.0 + 4.1.4.RELEASE 1.3.1 UTF-8 - - org.mockito - mockito-all - 1.9.0 - test - org.hamcrest hamcrest-all @@ -78,6 +72,12 @@ joda-convert 1.2 + + com.thoughtworks.xstream + xstream + 1.4.20 + test + @@ -229,8 +229,8 @@ org.apache.maven.plugins maven-compiler-plugin - 1.6 - 1.6 + 1.7 + 1.7 @@ -262,7 +262,7 @@ maven-surefire-plugin 2.22.1 - -Xmx512m -XX:MaxPermSize=512m -Djdk.net.URLClassPath.disableClassPathURLCheck=true + -Xmx512m -Djdk.net.URLClassPath.disableClassPathURLCheck=true @@ -306,4 +306,25 @@ + + + Java 17 + + 17 + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.2.2 + + --add-opens java.base/java.lang=ALL-UNNAMED + + + + + + +