refactor versionutil

This commit is contained in:
Grahame Grieve 2023-11-24 06:10:38 +11:00
parent e8520b1907
commit bd98afaa09
6 changed files with 11 additions and 9 deletions

View File

@ -1,4 +1,4 @@
package org.hl7.fhir.validation.cli.utils;
package org.hl7.fhir.utilities;
import static org.apache.commons.lang3.StringUtils.defaultIfBlank;
import static org.apache.commons.lang3.StringUtils.left;
@ -34,11 +34,11 @@ import static org.apache.commons.lang3.StringUtils.left;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.time.Duration;
import java.util.Date;
import java.util.Properties;
import org.hl7.fhir.r5.model.InstantType;
import org.hl7.fhir.utilities.Utilities;
/**
@ -93,12 +93,12 @@ public class VersionUtil {
private static String getDurationSinceBuild() {
try {
InstantType dt = new InstantType(ourBuildTime);
return Utilities.describeDuration(Duration.ofMillis(new Date().getTime() - dt.getValue().getTime()))+" old";
// InstantType dt = new InstantType(ourBuildTime);
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss");
Date dt = sdf.parse(ourBuildTime.substring(0, 19));
return Utilities.describeDuration(Duration.ofMillis(new Date().getTime() - dt.getTime()))+" old";
} catch (Exception e) {
return "??";
}
}
}

View File

@ -5,10 +5,10 @@ import java.util.Date;
import java.util.List;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.VersionUtil;
import org.hl7.fhir.utilities.validation.ValidationMessage;
import org.hl7.fhir.utilities.validation.ValidationMessage.IssueSeverity;
import org.hl7.fhir.validation.ValidationRecord;
import org.hl7.fhir.validation.cli.utils.VersionUtil;
public class HTMLOutputGenerator {

View File

@ -2,6 +2,7 @@ package org.hl7.fhir.validation.cli.utils;
import org.hl7.fhir.utilities.FhirPublication;
import org.hl7.fhir.utilities.TimeTracker;
import org.hl7.fhir.utilities.VersionUtil;
import org.hl7.fhir.utilities.VersionUtilities;
import org.hl7.fhir.utilities.settings.FhirSettings;
import org.hl7.fhir.validation.ValidationEngine;

View File

@ -5,6 +5,7 @@ import java.io.InputStream;
import java.io.PrintStream;
import org.apache.commons.io.IOUtils;
import org.hl7.fhir.utilities.VersionUtil;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
/**

View File

@ -2,8 +2,8 @@ package org.hl7.fhir.validation.cli.services;
import org.hl7.fhir.r5.context.IWorkerContext;
import org.hl7.fhir.r5.terminologies.client.ITerminologyClient;
import org.hl7.fhir.utilities.VersionUtil;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.validation.cli.utils.VersionUtil;
import org.junit.Test;
import java.net.URISyntaxException;

View File

@ -30,12 +30,12 @@ import org.hl7.fhir.r5.elementmodel.Manager;
import org.hl7.fhir.r5.model.StructureDefinition;
import org.hl7.fhir.r5.test.utils.TestingUtilities;
import org.hl7.fhir.utilities.TimeTracker;
import org.hl7.fhir.utilities.VersionUtil;
import org.hl7.fhir.utilities.settings.FhirSettings;
import org.hl7.fhir.validation.ValidationEngine;
import org.hl7.fhir.validation.cli.model.CliContext;
import org.hl7.fhir.validation.cli.model.FileInfo;
import org.hl7.fhir.validation.cli.model.ValidationRequest;
import org.hl7.fhir.validation.cli.utils.VersionUtil;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;