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) {
|
private boolean canConvertToBoolean(Base item) {
|
||||||
return (item.isBooleanPrimitive);
|
return (item.isBooleanPrimitive());
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Base> funcTrace(ExecutionContext context, List<Base> focus, ExpressionNode exp) throws FHIRException {
|
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) {
|
public static boolean isMajMinOrLaterPatch(String test, String current) {
|
||||||
String t = getMajMin(test);
|
String t = getMajMin(test);
|
||||||
String c = getMajMin(current);
|
String c = getMajMin(current);
|
||||||
if (c.compareTo(t) == 0) {
|
if (c != null && c.compareTo(t) == 0) {
|
||||||
String pt = getPatch(test);
|
String pt = getPatch(test);
|
||||||
String pc = getPatch(current);
|
String pc = getPatch(current);
|
||||||
if (pt==null || "x".equals(pt)) {
|
if (pt==null || "x".equals(pt)) {
|
||||||
|
|
|
@ -311,14 +311,17 @@ public class FilesystemPackageCacheManager extends BasePackageCacheManager imple
|
||||||
String foundPackage = null;
|
String foundPackage = null;
|
||||||
String foundVersion = null;
|
String foundVersion = null;
|
||||||
for (String f : sorted(new File(cacheFolder).list())) {
|
for (String f : sorted(new File(cacheFolder).list())) {
|
||||||
if (f.equals(id + "#" + version) || (Utilities.noString(version) && f.startsWith(id + "#"))) {
|
File cf = new File(Utilities.path(cacheFolder, f));
|
||||||
return loadPackageInfo(Utilities.path(cacheFolder, f));
|
if (cf.isDirectory()) {
|
||||||
}
|
if (f.equals(id + "#" + version) || (Utilities.noString(version) && f.startsWith(id + "#"))) {
|
||||||
if (version!=null && version.endsWith(".x") && f.contains("#")) {
|
return loadPackageInfo(Utilities.path(cacheFolder, f));
|
||||||
String[] parts = f.split("#");
|
}
|
||||||
if (parts[0].equals(id) && VersionUtilities.isMajMinOrLaterPatch((foundVersion!=null ? foundVersion : version),parts[1])) {
|
if (version != null && version.endsWith(".x") && f.contains("#")) {
|
||||||
foundVersion = parts[1];
|
String[] parts = f.split("#");
|
||||||
foundPackage = f;
|
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();
|
list = cache.listPackages();
|
||||||
Assertions.assertFalse(list.isEmpty());
|
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