Hi guys!
I am trying to load a resource file available in the Reporting module so I can use it in my own module. More precisely I am trying to load a XML test dataset (ReportTestDataset-openmrs-2.0.xml).
My api/pom.xml does depend on the Reporting module (Reporting Compatibility dependency was required too):
<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>reporting-api-tests</artifactId>
<version>1.14.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>reportingcompatibility-api</artifactId>
<version>2.0.4</version>
<scope>test</scope>
</dependency>
I have tried:
public static final String XML_REPORT_DATASET = "ReportTestDataset-openmrs-2.0.xml";
public static final String XML_REPORT_DATASET_PATH = "org/openmrs/module/reporting/include/";
executeDataSet(XML_REPORT_DATASET_PATH + XML_REPORT_DATASET);
with no luck =>
Unable to find ‘org/openmrs/module/reporting/include/ReportTestDataset-openmrs-2.0.xml’ in the classpath
as well as something like:
InputStream is = OpenmrsClassLoader.getInstance().getResourceAsStream(XML_REPORT_DATASET_PATH + XML_REPORT_DATASET);
or
URL url = OpenmrsClassLoader.getInstance().getResource(XML_REPORT_DATASET_PATH + XML_REPORT_DATASET);
But both cases return null.
Any example someone could point me to?
Thank you
Romain