Add test cases for wildcard versions
This commit is contained in:
parent
697b23e855
commit
0dcf64cb70
|
@ -4588,7 +4588,7 @@ public class FHIRPathEngine {
|
|||
}
|
||||
|
||||
private boolean canConvertToBoolean(Base item) {
|
||||
return (item.isBooleanPrimitive);
|
||||
return (item.isBooleanPrimitive());
|
||||
}
|
||||
|
||||
private List<Base> funcTrace(ExecutionContext context, List<Base> focus, ExpressionNode exp) throws FHIRException {
|
||||
|
|
|
@ -240,7 +240,7 @@ public class VersionUtilities {
|
|||
public static boolean isMajMinOrLaterPatch(String test, String current) {
|
||||
String t = getMajMin(test);
|
||||
String c = getMajMin(current);
|
||||
if (c.compareTo(t) == 0) {
|
||||
if (c != null && c.compareTo(t) == 0) {
|
||||
String pt = getPatch(test);
|
||||
String pc = getPatch(current);
|
||||
if (pt==null || "x".equals(pt)) {
|
||||
|
|
|
@ -311,14 +311,17 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
|
|||
String foundPackage = null;
|
||||
String foundVersion = null;
|
||||
for (String f : sorted(new File(cacheFolder).list())) {
|
||||
if (f.equals(id + "#" + version) || (Utilities.noString(version) && f.startsWith(id + "#"))) {
|
||||
return loadPackageInfo(Utilities.path(cacheFolder, f));
|
||||
}
|
||||
if (version!=null && version.endsWith(".x") && f.contains("#")) {
|
||||
String[] parts = f.split("#");
|
||||
if (parts[0].equals(id) && VersionUtilities.isMajMinOrLaterPatch((foundVersion!=null ? foundVersion : version),parts[1])) {
|
||||
foundVersion = parts[1];
|
||||
foundPackage = f;
|
||||
File cf = new File(Utilities.path(cacheFolder, f));
|
||||
if (cf.isDirectory()) {
|
||||
if (f.equals(id + "#" + version) || (Utilities.noString(version) && f.startsWith(id + "#"))) {
|
||||
return loadPackageInfo(Utilities.path(cacheFolder, f));
|
||||
}
|
||||
if (version != null && version.endsWith(".x") && f.contains("#")) {
|
||||
String[] parts = f.split("#");
|
||||
if (parts[0].equals(id) && VersionUtilities.isMajMinOrLaterPatch((foundVersion!=null ? foundVersion : version),parts[1])) {
|
||||
foundVersion = parts[1];
|
||||
foundPackage = f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,4 +37,14 @@ public class PackageCacheTests {
|
|||
list = cache.listPackages();
|
||||
Assertions.assertFalse(list.isEmpty());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPatchWildCard() throws IOException {
|
||||
FilesystemPackageCacheManager cache = new FilesystemPackageCacheManager(true, ToolsVersion.TOOLS_VERSION);
|
||||
cache.clear();
|
||||
Assertions.assertEquals(cache.loadPackage("hl7.fhir.us.core", "3.1.0").version(), "3.1.0");
|
||||
Assertions.assertEquals(cache.loadPackage("hl7.fhir.us.core", "3.1.1").version(), "3.1.1");
|
||||
Assertions.assertEquals(cache.loadPackage("hl7.fhir.us.core", "3.1.x").version(), "3.1.1");
|
||||
Assertions.assertEquals(cache.loadPackage("hl7.fhir.us.core", "3.0.x").version(), "3.0.1");
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue