Skip to content

Validator running against Core 2.6.9. #294

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

public class BillableServicesLoaderIntegrationTest extends DomainBaseModuleContextSensitive_2_4_test {
public class BillableServicesLoaderIntegrationTest extends DomainBaseModuleContextSensitive_2_4_Test {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what got changed here? There's a bunch of files with similar changesets... 🤔

Copy link
Contributor Author

@Ruhanga Ruhanga Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, it has to do with changing from *_test to *_Test.


@Autowired
@Qualifier("conceptService")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

public class CashPointsLoaderIntegrationTest extends DomainBaseModuleContextSensitive_2_4_test {
public class CashPointsLoaderIntegrationTest extends DomainBaseModuleContextSensitive_2_4_Test {

@Autowired
@Qualifier("locationService")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
* This allows to perform Spring context sensitive tests when Data Filter API is a dependency. In
* that case it is necessary for each context sensitive test to update the search index.
*/
public abstract class DomainBaseModuleContextSensitive_2_4_test extends DomainBaseModuleContextSensitiveTest {
public abstract class DomainBaseModuleContextSensitive_2_4_Test extends DomainBaseModuleContextSensitiveTest {

public DomainBaseModuleContextSensitive_2_4_test() {
public DomainBaseModuleContextSensitive_2_4_Test() {
super();
{
Module mod = new Module("", "billing", "", "", "", "1.1.0");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.openmrs.module.initializer.api.billing.PaymentModesLoader;
import org.springframework.beans.factory.annotation.Autowired;

public class PaymentModesLoaderIntegrationTest extends DomainBaseModuleContextSensitive_2_4_test {
public class PaymentModesLoaderIntegrationTest extends DomainBaseModuleContextSensitive_2_4_Test {

@Autowired
private IPaymentModeService paymentModeService;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,10 +189,6 @@ public List<String[]> getLines() {
* @return The resulting CsvParserResult instance.
*/
public CsvFailingLines process(List<String[]> 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;
Expand All @@ -209,8 +205,11 @@ public CsvFailingLines process(List<String[]> lines) {
}
catch (Exception e) {
result.addFailingLine(new CsvLine(getHeaderLine(), line), e);
if (instance != null) {
Context.evictFromSession(instance);
if (instance != null && instance.getId() != null) {
try {
Context.evictFromSession(instance);
}
catch (Exception hibernateError) {}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ public OpenmrsObject bootstrap(CsvLine line) throws IllegalArgumentException {
public OpenmrsObject save(OpenmrsObject instance) {
// Clearing object from session to prevent possibly saving it later on.
// See CsvParser#process(List<String[]>)
Context.clearSession();
if (instance != null && instance.getId() != null) {
Context.evictFromSession(instance);
}
return instance;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.openmrs.module.initializer.api.idgen;

import org.openmrs.PatientIdentifierType;
import org.openmrs.annotation.OpenmrsProfile;
import org.openmrs.module.idgen.service.IdentifierSourceService;
import org.openmrs.module.initializer.api.CsvLine;
Expand All @@ -20,6 +21,10 @@ public CommonIdentifierSourceLineProcessor(IdentifierSourceService idgenService)
@Override
public IdgenSourceWrapper fill(IdgenSourceWrapper instance, CsvLine line) throws IllegalArgumentException {

PatientIdentifierType idType = getPatientIdentifierType(line.getString(HEADER_IDTYPE));
if (idType == null) {
throw new IllegalArgumentException("No identifier type found for '" + line.get(HEADER_IDTYPE) + "'");
}
instance.getIdentifierSource().setIdentifierType(getPatientIdentifierType(line.getString(HEADER_IDTYPE)));
instance.getIdentifierSource().setName(line.getString(HEADER_NAME));
instance.getIdentifierSource().setDescription(line.getString(HEADER_DESC));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

@OpenmrsProfile(modules = { "idgen:4.6.0" })
@OpenmrsProfile(modules = { "idgen:*" })
public class AutoGenerationOptionLineProcessor extends BaseLineProcessor<AutoGenerationOption> {

final public static String IDENTIFIER_TYPE = "identifier type";
Expand Down Expand Up @@ -49,12 +49,19 @@ public AutoGenerationOption fill(AutoGenerationOption option, CsvLine line) thro
// Fill identifier type
{
String identifierTypeRef = line.get(IDENTIFIER_TYPE, true);
option.setIdentifierType(Utils.fetchPatientIdentifierType(identifierTypeRef, ps));
PatientIdentifierType idType = Utils.fetchPatientIdentifierType(identifierTypeRef, ps);
if (idType == null) {
throw new IllegalArgumentException("No identifier type found for '" + identifierTypeRef + "'");
}
option.setIdentifierType(idType);
}
// Fill identifier source
{
String identifierSourceRef = line.get(IDENTIFIER_SOURCE, true);
IdentifierSource source = iss.getIdentifierSourceByUuid(identifierSourceRef);
if (source == null) {
throw new IllegalArgumentException("No identifier source found for '" + identifierSourceRef + "'");
}
option.setSource(source);
}
// Fill location
Expand Down
132 changes: 106 additions & 26 deletions validator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,16 @@
<description>Validator project for Initializer</description>

<properties>
<springVersion>4.1.4.RELEASE</springVersion>
<!-- OpenMRS Core and modules -->
<openmrsPlatformVersion>2.3.6</openmrsPlatformVersion>
<openmrsPlatformVersion>2.6.9</openmrsPlatformVersion>
<reportingCompatibilityVersion>2.0.6</reportingCompatibilityVersion>
<htmlwidgetsVersion>1.7.2</htmlwidgetsVersion>
<mysqlTestContainerVersion>1.15.3</mysqlTestContainerVersion>
<mysqlTestContainerVersion>1.17.6</mysqlTestContainerVersion>
<metadatasharingVersion>1.9.0</metadatasharingVersion>
<metadatamappingVersion>1.6.0</metadatamappingVersion>
<billingVersion>1.1.0</billingVersion>
<datafilterVersion>2.2.0</datafilterVersion>
<openconceptlabVersion>2.3.0</openconceptlabVersion>
</properties>

<dependencies>
Expand Down Expand Up @@ -70,13 +71,6 @@
<type>jar</type>
</dependency>

<dependency>
<groupId>ch.vorburger.mariaDB4j</groupId>
<artifactId>mariaDB4j</artifactId>
<version>2.4.0</version>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
Expand All @@ -87,11 +81,19 @@
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.45</version>
<type>jar</type>
<version>8.0.30</version>
<scope>runtime</scope>
<type>jar</type>
</dependency>

<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-mxj</artifactId>
<version>5.0.11</version>
<scope>runtime</scope>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.hsqldb</groupId>
<artifactId>sqltool</artifactId>
Expand Down Expand Up @@ -146,34 +148,26 @@
<artifactId>openmrs-api</artifactId>
<version>${openmrsPlatformVersion}</version>
<type>jar</type>
<exclusions>
<!-- slf4j-api is coming from mariaDB4j -->
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.openmrs.api</groupId>
<artifactId>openmrs-api</artifactId>
<type>test-jar</type>
<version>${openmrsPlatformVersion}</version>
<exclusions>
<!-- slf4j-api is coming from mariaDB4j -->
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.openmrs.test</groupId>
<artifactId>openmrs-test</artifactId>
<version>${openmrsPlatformVersion}</version>
<type>pom</type>
<exclusions>
<exclusion>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
Expand Down Expand Up @@ -351,6 +345,22 @@
<scope>runtime</scope>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>fhir2-api-2.5</artifactId>
<version>${fhir2Version}</version>
<scope>runtime</scope>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>fhir2-api-2.6</artifactId>
<version>${fhir2Version}</version>
<scope>runtime</scope>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
Expand Down Expand Up @@ -380,6 +390,7 @@
<groupId>org.testcontainers</groupId>
<artifactId>mysql</artifactId>
<version>${mysqlTestContainerVersion}</version>
<type>jar</type>
</dependency>

<dependency>
Expand All @@ -405,6 +416,34 @@
<scope>runtime</scope>
<type>jar</type>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.10.1</version>
</dependency>

<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.10.5.1</version>
</dependency>

<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.24</version>
<scope>runtime</scope>
<type>jar</type>
</dependency>

<dependency>
<groupId>org.liquibase.ext</groupId>
<artifactId>liquibase-compat</artifactId>
<type>jar</type>
<scope>runtime</scope>
<version>4.0.0-beta2</version>
</dependency>

</dependencies>

Expand Down Expand Up @@ -485,7 +524,48 @@
<transformer implementation="org.apache.maven.plugins.shade.resource.XmlAppendingTransformer">
<resource>moduleApplicationContext.xml</resource>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
<resource>log4j2.xml</resource>
<file>src/main/resources/log4j2.xml</file>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
<resource>hibernate.default.properties</resource>
<file>src/main/resources/hibernate.default.properties</file>
</transformer>
</transformers>
<filters>
<!-- Exclude Log4j2Plugins.dat files -->
<filter>
<artifact>*:*</artifact>
<excludes>
<include>META-INF/org/apache/logging/log4j/core/config/plugins/Log4j2Plugins.dat</include>
</excludes>
</filter>
<filter>
<artifact>*:*</artifact>
<excludes>
<include>log4j2.xml</include>
</excludes>
</filter>
<filter>
<artifact>org.liquibase:liquibase-core</artifact>
<excludes>
<include>META-INF/services/liquibase.servicelocator.ServiceLocator</include>
</excludes>
</filter>
<filter>
<artifact>org.openmrs.module:initializer-validator</artifact>
<excludes>
<include>META-INF/services/liquibase.servicelocator.ServiceLocator</include>
</excludes>
</filter>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>hibernate.default.properties</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
Expand Down
Loading