mirror of
https://github.com/hapifhir/org.hl7.fhir.core.git
synced 2025-02-09 06:14:45 +00:00
Configure error cacheing at code level + create profile for cache clean
This commit is contained in:
parent
6e6184a425
commit
5635d96576
10
README.md
10
README.md
@ -43,12 +43,20 @@ This project uses [Apache Maven](http://maven.apache.org) to build. To build:
|
||||
```
|
||||
mvn install
|
||||
```
|
||||
Note that unit tests will run, but are currently not set to fail the build as they do not all pass. This is being worked on.
|
||||
_Note that unit tests will run, but are currently not set to fail the build as they do not all pass. This is being worked on._
|
||||
|
||||
To skip unit tests:
|
||||
```
|
||||
mvn -Dmaven.test.skip install
|
||||
```
|
||||
|
||||
To clean terminology server caches.
|
||||
```
|
||||
mvn clean -Dfhir.txcache.clean=true
|
||||
```
|
||||
_The source contains cached terminology server responses for testing. If the expected responses have changed in any way,
|
||||
this cache should be cleaned with the above so that subsequent `mvn test` calls will rebuild the cache._
|
||||
|
||||
### Publishing Binaries
|
||||
|
||||
An brief overview of our publishing process is [here][Link-Publishing].
|
||||
|
@ -128,11 +128,6 @@ public class TerminologyCache {
|
||||
@Getter @Setter
|
||||
private static boolean cacheErrors;
|
||||
|
||||
static {
|
||||
String cacheErrorsProperty = System.getProperty("fhir.txcache.cacheErrors");
|
||||
setCacheErrors(cacheErrorsProperty != null && "TRUE".equals(cacheErrorsProperty.toUpperCase(Locale.ROOT)));
|
||||
}
|
||||
|
||||
// use lock from the context
|
||||
public TerminologyCache(Object lock, String folder) throws FileNotFoundException, IOException, FHIRException {
|
||||
super();
|
||||
|
@ -17,6 +17,7 @@ import org.apache.commons.codec.binary.Base64;
|
||||
import org.fhir.ucum.UcumEssenceService;
|
||||
import org.hl7.fhir.r5.context.IWorkerContext;
|
||||
import org.hl7.fhir.r5.context.SimpleWorkerContext;
|
||||
import org.hl7.fhir.r5.context.TerminologyCache;
|
||||
import org.hl7.fhir.r5.model.Parameters;
|
||||
import org.hl7.fhir.utilities.CSFile;
|
||||
import org.hl7.fhir.utilities.TextFile;
|
||||
@ -105,8 +106,8 @@ public class TestingUtilities extends BaseTestingUtilities {
|
||||
|
||||
public static SimpleWorkerContext getWorkerContext(NpmPackage npmPackage) throws Exception {
|
||||
SimpleWorkerContext swc = SimpleWorkerContext.fromPackage(npmPackage);
|
||||
|
||||
swc.initTS(TestConstants.TX_CACHE);
|
||||
TerminologyCache.setCacheErrors(true);
|
||||
swc.setUserAgent("fhir/r5-test-cases");
|
||||
return swc;
|
||||
}
|
||||
@ -114,6 +115,7 @@ public class TestingUtilities extends BaseTestingUtilities {
|
||||
public static SimpleWorkerContext getWorkerContext(NpmPackage npmPackage, IWorkerContext.IContextResourceLoader loader) throws Exception {
|
||||
SimpleWorkerContext swc = SimpleWorkerContext.fromPackage(npmPackage, loader);
|
||||
swc.initTS(TestConstants.TX_CACHE);
|
||||
TerminologyCache.setCacheErrors(true);
|
||||
swc.setUserAgent("fhir/r5-test-cases");
|
||||
return swc;
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package org.hl7.fhir.validation.tests.utilities;
|
||||
|
||||
import org.hl7.fhir.r5.context.TerminologyCache;
|
||||
import org.hl7.fhir.r5.model.FhirPublication;
|
||||
import org.hl7.fhir.validation.ValidationEngine;
|
||||
|
||||
@ -16,6 +17,7 @@ public class TestUtilities {
|
||||
txLog = TestConstants.TX_CACHE_LOG;
|
||||
final ValidationEngine validationEngine = new ValidationEngine(src, txsrvr, txLog, version, canRunWithoutTerminologyServer, vString, userAgent);
|
||||
validationEngine.getContext().initTS(Paths.get(TestConstants.TX_CACHE, vString).toString());
|
||||
TerminologyCache.setCacheErrors(true);
|
||||
validationEngine.getContext().setUserAgent("fhir/test-cases");
|
||||
return validationEngine;
|
||||
}
|
||||
@ -24,6 +26,7 @@ public class TestUtilities {
|
||||
txLog = TestConstants.TX_CACHE_LOG;
|
||||
final ValidationEngine validationEngine = new ValidationEngine(src, txsrvr, txLog, version, vString, userAgent);
|
||||
validationEngine.getContext().initTS(Paths.get(TestConstants.TX_CACHE, vString).toString());
|
||||
TerminologyCache.setCacheErrors(true);
|
||||
validationEngine.getContext().setUserAgent("fhir/test-cases");
|
||||
return validationEngine;
|
||||
}
|
||||
|
36
pom.xml
36
pom.xml
@ -23,6 +23,7 @@
|
||||
<junit_jupiter_version>5.7.1</junit_jupiter_version>
|
||||
<junit_platform_launcher_version>1.7.1</junit_platform_launcher_version>
|
||||
<maven_surefire_version>3.0.0-M5</maven_surefire_version>
|
||||
<maven_clean_version>3.1.0</maven_clean_version>
|
||||
<jacoco_version>0.8.7</jacoco_version>
|
||||
<info_cqframework_version>1.5.1</info_cqframework_version>
|
||||
<lombok_version>1.18.22</lombok_version>
|
||||
@ -372,9 +373,6 @@
|
||||
<excludes>
|
||||
<exclude>org/hl7/fhir/validation/cli/**</exclude>
|
||||
</excludes>
|
||||
<systemPropertyVariables>
|
||||
<fhir.txcache.cacheErrors>TRUE</fhir.txcache.cacheErrors>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
@ -404,9 +402,6 @@
|
||||
<excludes>
|
||||
<exclude>org/hl7/fhir/validation/cli/**</exclude>
|
||||
</excludes>
|
||||
<systemPropertyVariables>
|
||||
<fhir.txcache.cacheErrors>TRUE</fhir.txcache.cacheErrors>
|
||||
</systemPropertyVariables>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
@ -513,5 +508,34 @@
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>cleanTxCache</id>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
<property>
|
||||
<name>fhir.txcache.clean</name>
|
||||
<value>true</value>
|
||||
</property>
|
||||
</activation>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-clean-plugin</artifactId>
|
||||
<version>${maven_clean_version}</version>
|
||||
<configuration>
|
||||
<filesets>
|
||||
<fileset>
|
||||
<directory>src/test/resources/txCache</directory>
|
||||
<includes>
|
||||
<include>**/*</include>
|
||||
</includes>
|
||||
<followSymlinks>false</followSymlinks>
|
||||
</fileset>
|
||||
</filesets>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
|
Loading…
x
Reference in New Issue
Block a user