remove references to c:\temp

This commit is contained in:
Grahame Grieve 2022-04-20 09:59:30 +10:00
parent 9928efa0d1
commit c58516ce44
56 changed files with 112 additions and 128 deletions

View File

@ -95,7 +95,7 @@ public class SpecDifferenceEvaluator {
b.append(self.getDiffAsHtml(null));
b.append("</body>\r\n");
b.append("</html>\r\n");
TextFile.stringToFile(b.toString(), "c:\\temp\\diff.html");
TextFile.stringToFile(b.toString(), Utilities.path("[tmp]", "diff.html"));
System.out.println("done");
}

View File

@ -105,7 +105,7 @@ public class CKMImporter {
Document sxml = loadXml(ckm + "/services/ArchetypeFinderBean/getArchetypeInXML?archetypeId=" + id);
Element e = XMLUtil.getFirstChild(sxml.getDocumentElement());
String src = Utilities.path("c:\\temp", id + ".xml");
String src = Utilities.path(Utilities.path("[tmp]"), id + ".xml");
TextFile.stringToFile(e.getTextContent(), src);
}
@ -113,7 +113,7 @@ public class CKMImporter {
System.out.println("Process " + id);
String cfg = info == null ? null : Utilities.path(info, id + ".config");
String src = Utilities.path("c:\\temp", id + ".xml");
String src = Utilities.path(Utilities.path("[tmp]"), id + ".xml");
String dst = Utilities.path(dest, id + ".xml");
if (!new File(src).exists())

View File

@ -38,6 +38,7 @@ import org.hl7.fhir.dstu3.model.CodeSystem.ConceptDefinitionComponent;
import org.hl7.fhir.dstu3.model.Enumerations.PublicationStatus;
import org.hl7.fhir.dstu3.terminologies.CodeSystemUtilities;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.xml.XMLUtil;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@ -78,9 +79,9 @@ public class ICPC2Importer {
public static void main(String[] args) {
try {
ICPC2Importer r = new ICPC2Importer();
r.setSourceFileName("c:\\temp\\ICPC-2e-v5.0.xml");
r.setTargetFileNameCS("C:\\temp\\icpc2.xml");
r.setTargetFileNameVS("C:\\temp\\icpc2-vs.xml");
r.setSourceFileName(Utilities.path("[tmp]", "ICPC-2e-v5.0.xml"));
r.setTargetFileNameCS(Utilities.path("[tmp]", "icpc2.xml"));
r.setTargetFileNameVS(Utilities.path("[tmp]", "icpc2-vs.xml"));
r.go();
System.out.println("Completed OK");
} catch (Exception e) {

View File

@ -59,21 +59,21 @@ public class IGPackConverter102 extends BaseAdvisor_10_30 {
private void process() throws IOException, FHIRException {
initCSList();
for (String s : new File("C:\\temp\\igpack2").list()) {
for (String s : new File(Utilities.path("[tmp]", "igpack2")).list()) {
if (s.endsWith(".xml") && !s.startsWith("z-") && !Utilities.existsInList(s, "expansions.xml", "v3-codesystems.xml", "v2-tables.xml")) {
System.out.println("process " + s);
org.hl7.fhir.dstu2.formats.XmlParser xp = new org.hl7.fhir.dstu2.formats.XmlParser();
org.hl7.fhir.dstu2.model.Resource r10 = xp.parse(new FileInputStream("C:\\temp\\igpack2\\" + s));
org.hl7.fhir.dstu2.model.Resource r10 = xp.parse(new FileInputStream(Utilities.path("[tmp]", "igpack2\\" + s)));
org.hl7.fhir.dstu3.model.Resource r17 = VersionConvertorFactory_10_30.convertResource(r10, this);
org.hl7.fhir.dstu3.formats.XmlParser xc = new org.hl7.fhir.dstu3.formats.XmlParser();
xc.setOutputStyle(OutputStyle.PRETTY);
xc.compose(new FileOutputStream("C:\\temp\\igpack2\\" + s), r17);
xc.compose(new FileOutputStream(Utilities.path("[tmp]", "igpack2\\" + s)), r17);
}
}
System.out.println("save codesystems");
org.hl7.fhir.dstu3.formats.XmlParser xc = new org.hl7.fhir.dstu3.formats.XmlParser();
xc.setOutputStyle(OutputStyle.PRETTY);
xc.compose(new FileOutputStream("C:\\temp\\igpack2\\codesystems.xml"), cslist);
xc.compose(new FileOutputStream(Utilities.path("[tmp]", "igpack2\\codesystems.xml")), cslist);
System.out.println("done");
}

View File

@ -32,6 +32,7 @@ package org.hl7.fhir.convertors.misc;
import org.hl7.fhir.convertors.factory.VersionConvertorFactory_14_30;
import org.hl7.fhir.dstu3.formats.IParser.OutputStyle;
import org.hl7.fhir.utilities.Utilities;
import java.io.File;
import java.io.FileInputStream;
@ -40,16 +41,16 @@ import java.io.FileOutputStream;
public class IGPackConverter140 {
public static void main(String[] args) throws Exception {
for (String s : new File("C:\\temp\\igpack").list()) {
for (String s : new File(Utilities.path("[tmp]", "igpack")).list()) {
// if (s.endsWith(".xml") && !s.contains("z-")) {
if (s.equals("expansions.xml")) {
System.out.println("process " + s);
org.hl7.fhir.dstu2016may.formats.XmlParser xp = new org.hl7.fhir.dstu2016may.formats.XmlParser();
org.hl7.fhir.dstu2016may.model.Resource r14 = xp.parse(new FileInputStream("C:\\temp\\igpack\\" + s));
org.hl7.fhir.dstu2016may.model.Resource r14 = xp.parse(new FileInputStream(Utilities.path("[tmp]", "igpack\\" + s)));
org.hl7.fhir.dstu3.model.Resource r17 = VersionConvertorFactory_14_30.convertResource(r14);
org.hl7.fhir.dstu3.formats.XmlParser xc = new org.hl7.fhir.dstu3.formats.XmlParser();
xc.setOutputStyle(OutputStyle.PRETTY);
xc.compose(new FileOutputStream("C:\\temp\\igpack\\z-" + s), r17);
xc.compose(new FileOutputStream(Utilities.path("[tmp]", "igpack\\z-" + s)), r17);
}
}
System.out.println("done");

View File

@ -56,7 +56,7 @@ public class NUCCConvertor {
}
public void execute() throws IOException, FHIRException {
CSVReader csv = new CSVReader(new FileInputStream("c:\\temp\\nucc.csv"));
CSVReader csv = new CSVReader(new FileInputStream(Utilities.path("[tmp]", "nucc.csv")));
CodeSystem cs = new CodeSystem();
cs.setId("nucc-provider-taxonomy");
cs.setUrl("http://nucc.org/provider-taxonomy");
@ -79,7 +79,7 @@ public class NUCCConvertor {
}
csv.close();
cs.sort();
new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\nucc.json"), cs);
new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "nucc.json")), cs);
}
private void processLine(CodeSystem cs, String[] values) throws FHIRFormatError {

View File

@ -38,6 +38,7 @@ import org.hl7.fhir.dstu3.model.Observation.ObservationComponentComponent;
import org.hl7.fhir.dstu3.model.Observation.ObservationStatus;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.exceptions.FHIRFormatError;
import org.hl7.fhir.utilities.Utilities;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
@ -72,7 +73,7 @@ public class ObservationStatsBuilder {
vitals(b, base, 130, 95, 133, 97, 37.2);
vitals(b, base, 150, 85, 125, 98, 37.1);
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\vitals.xml"), b);
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "vitals.xml")), b);
}
private static void vitals(Bundle b, Calendar base, int minutes, int diastolic, int systolic, int sat, double temp) throws FHIRFormatError {
@ -196,7 +197,7 @@ public class ObservationStatsBuilder {
addAge(b, 10, 0, "31.9");
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\obs.xml"), b);
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "obs.xml")), b);
}
private static void addAge(Bundle b, int y, int m, String v) throws FHIRException {

View File

@ -48,7 +48,7 @@ public class PhinVadsImporter extends OIDBasedValueSetImporter {
// first thing do is split into 2
List<byte[]> parts = Utilities.splitBytes(source, "\r\n\r\n".getBytes());
if (parts.size() < 2) {
TextFile.bytesToFile(source, "c:\\temp\\phinvads.txt");
TextFile.bytesToFile(source, Utilities.path("[tmp]", "phinvads.txt"));
throw new FHIRException("Unable to parse phinvads value set: " + parts.size() + " parts found");
}
CSVReader rdr = new CSVReader(new ByteArrayInputStream(parts.get(0)));

View File

@ -121,7 +121,7 @@ public class ISO21090Importer {
addParentProperties(sd.getSnapshot().getElement(), dt.getName(), dt.getParent(), false, true);
produceProperties(sd.getSnapshot().getElement(), dt.getName(), dt.getProperties(), false, true);
ed.getBase().setPath(ed.getPath()).setMin(ed.getMin()).setMax(ed.getMax());
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\iso21090\\StructureDefinition-" + dt.getName() + ".xml"), sd);
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "iso21090\\StructureDefinition-" + dt.getName() + ".xml")), sd);
}
private void addParentProperties(List<ElementDefinition> elements, String name, String parent, boolean attrMode, boolean snapshot) throws FHIRFormatError {
@ -172,7 +172,7 @@ public class ISO21090Importer {
for (String code : evs.getCodes()) {
inc.addConcept().setCode(code);
}
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\iso21090\\ValueSet-" + evs.getName() + ".xml"), vs);
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "iso21090\\ValueSet-" + evs.getName() + ".xml")), vs);
}
private void processDataTypes() {

View File

@ -208,7 +208,7 @@ public class SearchParameterProcessor {
}
private void load4() throws FHIRFormatError, IOException {
org.hl7.fhir.r4.model.Bundle bundle = (org.hl7.fhir.r4.model.Bundle) new org.hl7.fhir.r4.formats.JsonParser().parse(new FileInputStream("c:\\temp\\sp4.json"));
org.hl7.fhir.r4.model.Bundle bundle = (org.hl7.fhir.r4.model.Bundle) new org.hl7.fhir.r4.formats.JsonParser().parse(new FileInputStream(Utilities.path("[tmp]", "sp4.json")));
for (org.hl7.fhir.r4.model.Bundle.BundleEntryComponent be : bundle.getEntry()) {
org.hl7.fhir.r4.model.SearchParameter sp = (org.hl7.fhir.r4.model.SearchParameter) be.getResource();
for (org.hl7.fhir.r4.model.CodeType br : sp.getBase()) {
@ -221,7 +221,7 @@ public class SearchParameterProcessor {
}
private void load3() throws FHIRFormatError, IOException {
org.hl7.fhir.dstu3.model.Bundle bundle = (org.hl7.fhir.dstu3.model.Bundle) new org.hl7.fhir.dstu3.formats.JsonParser().parse(new FileInputStream("c:\\temp\\sp3.json"));
org.hl7.fhir.dstu3.model.Bundle bundle = (org.hl7.fhir.dstu3.model.Bundle) new org.hl7.fhir.dstu3.formats.JsonParser().parse(new FileInputStream(Utilities.path("[tmp]", "sp3.json")));
for (org.hl7.fhir.dstu3.model.Bundle.BundleEntryComponent be : bundle.getEntry()) {
org.hl7.fhir.dstu3.model.SearchParameter sp = (org.hl7.fhir.dstu3.model.SearchParameter) be.getResource();
for (org.hl7.fhir.dstu3.model.CodeType br : sp.getBase()) {
@ -234,7 +234,7 @@ public class SearchParameterProcessor {
}
private void load2() throws FHIRFormatError, IOException {
org.hl7.fhir.dstu2.model.Bundle bundle = (org.hl7.fhir.dstu2.model.Bundle) new org.hl7.fhir.dstu2.formats.JsonParser().parse(new FileInputStream("c:\\temp\\sp2.json"));
org.hl7.fhir.dstu2.model.Bundle bundle = (org.hl7.fhir.dstu2.model.Bundle) new org.hl7.fhir.dstu2.formats.JsonParser().parse(new FileInputStream(Utilities.path("[tmp]", "sp2.json")));
for (org.hl7.fhir.dstu2.model.Bundle.BundleEntryComponent be : bundle.getEntry()) {
org.hl7.fhir.dstu2.model.SearchParameter sp = (org.hl7.fhir.dstu2.model.SearchParameter) be.getResource();
String br = sp.getBase();
@ -246,7 +246,7 @@ public class SearchParameterProcessor {
}
private void load2b() throws FHIRFormatError, IOException {
org.hl7.fhir.dstu2016may.model.Bundle bundle = (org.hl7.fhir.dstu2016may.model.Bundle) new org.hl7.fhir.dstu2016may.formats.JsonParser().parse(new FileInputStream("c:\\temp\\sp2b.json"));
org.hl7.fhir.dstu2016may.model.Bundle bundle = (org.hl7.fhir.dstu2016may.model.Bundle) new org.hl7.fhir.dstu2016may.formats.JsonParser().parse(new FileInputStream(Utilities.path("[tmp]", "sp2b.json")));
for (org.hl7.fhir.dstu2016may.model.Bundle.BundleEntryComponent be : bundle.getEntry()) {
org.hl7.fhir.dstu2016may.model.SearchParameter sp = (org.hl7.fhir.dstu2016may.model.SearchParameter) be.getResource();
String br = sp.getBase();

View File

@ -70,7 +70,7 @@ import org.xmlpull.v1.XmlPullParserException;
*/
public class LoincToDEConvertor {
// C:\temp\LOINC.xml
public static void main(String[] args) throws FHIRFormatError, IOException, XmlPullParserException, SAXException, ParserConfigurationException {
if (args.length == 0) {
System.out.println("FHIR LOINC to CDE convertor. ");

View File

@ -10,6 +10,7 @@ import org.hl7.fhir.dstu2.utils.EOperationOutcome;
import org.hl7.fhir.dstu2.utils.NarrativeGenerator;
import org.hl7.fhir.dstu2.utils.SimpleWorkerContext;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.utilities.Utilities;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
@ -39,7 +40,7 @@ public class NarrativeGeneratorTests {
XmlParser p = new XmlParser();
DomainResource r = (DomainResource) p.parse(new FileInputStream(path));
gen.generate(r);
FileOutputStream s = new FileOutputStream("c:\\temp\\gen.xml");
FileOutputStream s = new FileOutputStream(Utilities.path("[tmp]", "gen.xml"));
new XmlParser().compose(s, r, true);
s.close();
}

View File

@ -44,7 +44,7 @@ public class ProfileUtilitiesTests {
// new ProfileUtilitiesTests().execute(args);
new ProfileUtilitiesTests("C:\\work\\org.hl7.fhir\\build\\publish").testSnapshotGeneration();
// StructureDefinition p = (StructureDefinition) new XmlParser().parse(new FileInputStream("C:\\work\\org.hl7.fhir\\build\\publish\\lipid-report-cholesterol.profile.xml"));
// new ProfileUtilities(context, messages, null).generateSchematrons(new FileOutputStream("c:\\temp\\test.sch"), p);
// new ProfileUtilities(context, messages, null).generateSchematrons(new FileOutputStream(Utilities.path("[tmp]", "test.sch"), p);
}
public void execute(String[] args) throws FileNotFoundException, IOException, FHIRException {
@ -74,9 +74,9 @@ public class ProfileUtilitiesTests {
System.out.println("processing output");
for (ProfileComparison outcome : comp.getComparisons()) {
if (outcome.getSubset() != null)
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("C:\\temp\\intersection-"+outcome.getId()+".xml"), outcome.getSubset());
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "intersection-"+outcome.getId()+".xml")), outcome.getSubset());
if (outcome.getSuperset() != null)
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("C:\\temp\\union-"+outcome.getId()+".xml"), outcome.getSuperset());
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "union-"+outcome.getId()+".xml")), outcome.getSuperset());
System.out.println("\r\n"+outcome.getId()+": Comparison of "+outcome.getLeft().getUrl()+" and "+outcome.getRight().getUrl());
for (ValidationMessage vm : outcome.getMessages())
@ -870,7 +870,7 @@ public class ProfileUtilitiesTests {
command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\"");
ProcessBuilder builder = new ProcessBuilder(command);
builder.directory(new CSFile("c:\\temp"));
builder.directory(new CSFile(Utilities.path("[tmp]")));
builder.start();
}

View File

@ -11,7 +11,7 @@ import org.hl7.fhir.exceptions.FHIRException;
public class QuestionnaireBuilderTester {
private static final String TEST_PROFILE_DIR = "C:\\work\\org.hl7.fhir\\build\\publish";
private static final String TEST_DEST = "c:\\temp\\questionnaires\\";
// private static final String TEST_DEST = Utilities.path("[tmp]", "questionnaires\\");
public static void main(String[] args) {
QuestionnaireBuilder b = new QuestionnaireBuilder(null);

View File

@ -40,7 +40,7 @@ public class TestingUtilities {
command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\"");
ProcessBuilder builder = new ProcessBuilder(command);
builder.directory(new CSFile("c:\\temp"));
builder.directory(new CSFile(Utilities.path("[tmp]")));
builder.start();
}
@ -161,7 +161,7 @@ public class TestingUtilities {
command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\"");
ProcessBuilder builder = new ProcessBuilder(command);
builder.directory(new CSFile("c:\\temp"));
builder.directory(new CSFile(Utilities.path("[tmp]")));
builder.start();
}

View File

@ -63,7 +63,7 @@ public class Tester {
// String tgt = normalise(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".json")));
Element e = Manager.parse(context, new FileInputStream("C:\\work\\org.hl7.fhir\\build\\publish\\"+f), FhirFormat.XML);
Manager.compose(context, e, new FileOutputStream("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".mm.ttl")), FhirFormat.TURTLE, OutputStyle.PRETTY, null);
Manager.compose(context, e, new FileOutputStream("C:\\temp\\resource.xml"), FhirFormat.XML, OutputStyle.PRETTY, null);
Manager.compose(context, e, new FileOutputStream(Utilities.path("[tmp]", "resource.xml")), FhirFormat.XML, OutputStyle.PRETTY, null);
String src = TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".mm.ttl"));
String tgt = TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".ttl"));
t++;

View File

@ -50,6 +50,7 @@ import org.hl7.fhir.dstu2016may.model.DateTimeType;
import org.hl7.fhir.dstu2016may.model.Enumerations.ConformanceResourceStatus;
import org.hl7.fhir.dstu2016may.model.Identifier;
import org.hl7.fhir.dstu2016may.model.ValueSet;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.xml.XMLUtil;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@ -67,9 +68,9 @@ public class ICPC2Importer {
public static void main(String[] args) {
try {
ICPC2Importer r = new ICPC2Importer();
r.setSourceFileName("c:\\temp\\ICPC-2e-v5.0.xml");
r.setTargetFileNameCS("C:\\temp\\icpc2.xml");
r.setTargetFileNameVS("C:\\temp\\icpc2-vs.xml");
r.setSourceFileName(Utilities.path("[tmp]", "ICPC-2e-v5.0.xml"));
r.setTargetFileNameCS(Utilities.path("[tmp]", "icpc2.xml"));
r.setTargetFileNameVS(Utilities.path("[tmp]", "icpc2-vs.xml"));
r.go();
System.out.println("Completed OK");
} catch (Exception e) {

View File

@ -70,7 +70,6 @@ import org.xmlpull.v1.XmlPullParserException;
*/
public class LoincToDEConvertor {
// C:\temp\LOINC.xml
public static void main(String[] args) throws FHIRFormatError, IOException, XmlPullParserException, SAXException, ParserConfigurationException {
if (args.length == 0) {
System.out.println("FHIR LOINC to CDE convertor. ");

View File

@ -6,6 +6,7 @@ import org.hl7.fhir.dstu2016may.utils.EOperationOutcome;
import org.hl7.fhir.dstu2016may.utils.NarrativeGenerator;
import org.hl7.fhir.dstu2016may.utils.SimpleWorkerContext;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.utilities.Utilities;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
@ -38,7 +39,7 @@ public class NarrativeGeneratorTests {
XmlParser p = new XmlParser();
DomainResource r = (DomainResource) p.parse(new FileInputStream(path));
gen.generate(r);
FileOutputStream s = new FileOutputStream("c:\\temp\\gen.xml");
FileOutputStream s = new FileOutputStream(Utilities.path("[tmp]", "gen.xml"));
new XmlParser().compose(s, r, true);
s.close();
}

View File

@ -3,6 +3,7 @@ package org.hl7.fhir.dstu2016may.test;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import org.hl7.fhir.dstu2016may.formats.IParser.OutputStyle;
import org.hl7.fhir.dstu2016may.metamodel.Element;
@ -89,9 +90,9 @@ public class ParserTests {
}
int i = 0;
private String makeTempFilename() {
private String makeTempFilename() throws IOException {
i++;
return "c:\\temp\\fhirtests\\"+Integer.toString(i)+".tmp";
return Utilities.path("[tmp]", "fhirtests\\"+Integer.toString(i)+".tmp");
}
}

View File

@ -11,7 +11,7 @@ import org.hl7.fhir.exceptions.FHIRException;
public class QuestionnaireBuilderTester {
private static final String TEST_PROFILE_DIR = "C:\\work\\org.hl7.fhir\\build\\publish";
private static final String TEST_DEST = "c:\\temp\\questionnaires\\";
// private static final String TEST_DEST = Utilities.path("[tmp]", "questionnaires\\");
public static void main(String[] args) {
QuestionnaireBuilder b = new QuestionnaireBuilder(null);

View File

@ -97,9 +97,9 @@ public class RoundTripTest {
}
int i = 0;
private String makeTempFilename() {
private String makeTempFilename() throws IOException {
i++;
return "c:\\temp\\fhirtests\\"+Integer.toString(i)+".tmp";
return Utilities.path("[tmp]", "fhirtests\\"+Integer.toString(i)+".tmp");
}
}

View File

@ -105,7 +105,7 @@ public class StructureMapTests {
Manager.compose(TestingUtilities.context, cda, new FileOutputStream("C:\\work\\org.hl7.fhir\\build\\guides\\ccda\\Example\\ccd.out.xml"), FhirFormat.XML, OutputStyle.PRETTY, null);
Bundle bundle = new Bundle();
scu.transform(null, cda, maps.get("http://hl7.org/fhir/StructureMap/cda"), bundle);
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\bundle.xml"), bundle);
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "bundle.xml")), bundle);
}
}

View File

@ -40,7 +40,7 @@ public class TestingUtilities {
command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\"");
ProcessBuilder builder = new ProcessBuilder(command);
builder.directory(new CSFile("c:\\temp"));
builder.directory(new CSFile(Utilities.path("[tmp]")));
builder.start();
}
@ -161,7 +161,7 @@ public class TestingUtilities {
command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\"");
ProcessBuilder builder = new ProcessBuilder(command);
builder.directory(new CSFile("c:\\temp"));
builder.directory(new CSFile(Utilities.path("[tmp]")));
builder.start();
}

View File

@ -63,7 +63,7 @@ public class Tester {
// String tgt = normalise(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".json")));
Element e = Manager.parse(context, new FileInputStream("C:\\work\\org.hl7.fhir\\build\\publish\\"+f), FhirFormat.XML);
Manager.compose(context, e, new FileOutputStream("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".mm.ttl")), FhirFormat.TURTLE, OutputStyle.PRETTY, null);
Manager.compose(context, e, new FileOutputStream("C:\\temp\\resource.xml"), FhirFormat.XML, OutputStyle.PRETTY, null);
Manager.compose(context, e, new FileOutputStream(Utilities.path("[tmp]", "resource.xml")), FhirFormat.XML, OutputStyle.PRETTY, null);
String src = TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".mm.ttl"));
String tgt = TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".ttl"));
t++;

View File

@ -70,7 +70,6 @@ import org.xmlpull.v1.XmlPullParserException;
*/
public class LoincToDEConvertor {
// C:\temp\LOINC.xml
public static void main(String[] args) throws FHIRFormatError, IOException, XmlPullParserException, SAXException, ParserConfigurationException {
if (args.length == 0) {
System.out.println("FHIR LOINC to CDE convertor. ");

View File

@ -6,6 +6,7 @@ import org.hl7.fhir.dstu3.model.DomainResource;
import org.hl7.fhir.dstu3.utils.EOperationOutcome;
import org.hl7.fhir.dstu3.utils.NarrativeGenerator;
import org.hl7.fhir.exceptions.FHIRException;
import org.hl7.fhir.utilities.Utilities;
import org.junit.jupiter.api.*;
import org.xmlpull.v1.XmlPullParserException;
@ -38,7 +39,7 @@ public class NarrativeGeneratorTests {
XmlParser p = new XmlParser();
DomainResource r = (DomainResource) p.parse(new FileInputStream(path));
gen.generate(r);
FileOutputStream s = new FileOutputStream("c:\\temp\\gen.xml");
FileOutputStream s = new FileOutputStream(Utilities.path("[tmp]", "gen.xml"));
new XmlParser().compose(s, r, true);
s.close();

View File

@ -46,7 +46,7 @@ public class ProfileUtilitiesTests {
// new ProfileUtilitiesTests().execute(args);
new ProfileUtilitiesTests("C:\\work\\org.hl7.fhir\\build\\publish").testSnapshotGeneration();
// StructureDefinition p = (StructureDefinition) new XmlParser().parse(new FileInputStream("C:\\work\\org.hl7.fhir\\build\\publish\\lipid-report-cholesterol.profile.xml"));
// new ProfileUtilities(context, messages, null).generateSchematrons(new FileOutputStream("c:\\temp\\test.sch"), p);
// new ProfileUtilities(context, messages, null).generateSchematrons(new FileOutputStream(Utilities.path("[tmp]", "test.sch"), p);
}
public void execute(String[] args) throws FileNotFoundException, IOException, FHIRException {
@ -76,9 +76,9 @@ public class ProfileUtilitiesTests {
System.out.println("processing output");
for (ProfileComparison outcome : comp.getComparisons()) {
if (outcome.getSubset() != null)
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("C:\\temp\\intersection-"+outcome.getId()+".xml"), outcome.getSubset());
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "intersection-"+outcome.getId()+".xml")), outcome.getSubset());
if (outcome.getSuperset() != null)
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("C:\\temp\\union-"+outcome.getId()+".xml"), outcome.getSuperset());
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "union-"+outcome.getId()+".xml")), outcome.getSuperset());
System.out.println("\r\n"+outcome.getId()+": Comparison of "+outcome.getLeft().getUrl()+" and "+outcome.getRight().getUrl());
for (ValidationMessage vm : outcome.getMessages())
@ -900,7 +900,7 @@ public class ProfileUtilitiesTests {
command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\"");
ProcessBuilder builder = new ProcessBuilder(command);
builder.directory(new CSFile("c:\\temp"));
builder.directory(new CSFile(Utilities.path("[tmp]")));
builder.start();
}

View File

@ -11,7 +11,7 @@ import org.hl7.fhir.exceptions.FHIRException;
public class QuestionnaireBuilderTester {
private static final String TEST_PROFILE_DIR = "C:\\work\\org.hl7.fhir\\build\\publish";
private static final String TEST_DEST = "c:\\temp\\questionnaires\\";
// private static final String TEST_DEST = Utilities.path("[tmp]", "questionnaires\\");
public static void main(String[] args) {
QuestionnaireBuilder b = new QuestionnaireBuilder(null);

View File

@ -88,7 +88,7 @@ public class SnapShotGenerationTests {
context.fixtures.put(op.getResponseId(), output);
context.snapshots.put(output.getUrl(), output);
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("c:\\temp", op.getResponseId() + ".xml")), output);
new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path(Utilities.path("[tmp]"), op.getResponseId() + ".xml")), output);
//ok, now the asserts:
for (int i = 1; i < test.getAction().size(); i++) {
SetupActionAssertComponent a = test.getAction().get(i).getAssert();

View File

@ -95,7 +95,7 @@ public class StructureMapTests {
// Manager.compose(TestingUtilities.context, cda, new FileOutputStream("C:\\work\\org.hl7.fhir\\build\\guides\\ccda2\\mapping\\example\\ccd.out.xml"), FhirFormat.XML, OutputStyle.PRETTY, null);
// Bundle bundle = new Bundle();
// scu.transform(null, cda, maps.get("http://hl7.org/fhir/StructureMap/cda"), bundle);
// new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\bundle.xml"), bundle);
// new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "bundle.xml"), bundle);
// }
//
// @Test
@ -125,7 +125,7 @@ public class StructureMapTests {
//
// List<StructureDefinition> result = scu.analyse(null, maps.get("http://hl7.org/fhir/StructureMap/cda")).getProfiles();
// for (StructureDefinition sd : result)
// new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\res-"+sd.getId()+".xml"), sd);
// new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "res-"+sd.getId()+".xml"), sd);
// }
//
}

View File

@ -66,7 +66,7 @@ public class TestingUtilities extends BaseTestingUtilities {
command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\"");
ProcessBuilder builder = new ProcessBuilder(command);
builder.directory(new CSFile("c:\\temp"));
builder.directory(new CSFile(Utilities.path("[tmp]")));
builder.start();
}
@ -195,7 +195,7 @@ public class TestingUtilities extends BaseTestingUtilities {
command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\"");
ProcessBuilder builder = new ProcessBuilder(command);
builder.directory(new CSFile("c:\\temp"));
builder.directory(new CSFile(Utilities.path("[tmp]")));
builder.start();
}

View File

@ -123,7 +123,7 @@ public class ObjectConverter {
ByteArrayOutputStream bo = new ByteArrayOutputStream();
try {
new JsonParser(context).compose(element, bo, OutputStyle.NORMAL, null);
// TextFile.bytesToFile(bo.toByteArray(), "c:\\temp\\json.json");
// TextFile.bytesToFile(bo.toByteArray(), Utilities.path("[tmp]", "json.json");
return new org.hl7.fhir.r4.formats.JsonParser().parse(bo.toByteArray());
} catch (IOException e) {
// won't happen

View File

@ -63,7 +63,7 @@ public class Tester {
// String tgt = normalise(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".json")));
Element e = Manager.parse(context, new FileInputStream("C:\\work\\org.hl7.fhir\\build\\publish\\"+f), FhirFormat.XML);
Manager.compose(context, e, new FileOutputStream("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".mm.ttl")), FhirFormat.TURTLE, OutputStyle.PRETTY, null);
Manager.compose(context, e, new FileOutputStream("C:\\temp\\resource.xml"), FhirFormat.XML, OutputStyle.PRETTY, null);
Manager.compose(context, e, new FileOutputStream(Utilities.path("[tmp]", "resource.xml")), FhirFormat.XML, OutputStyle.PRETTY, null);
String src = TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".mm.ttl"));
String tgt = TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".ttl"));
t++;

View File

@ -64,7 +64,6 @@ import org.xmlpull.v1.XmlPullParserException;
*/
public class LoincToDEConvertor {
// C:\temp\LOINC.xml
public static void main(String[] args) throws FHIRFormatError, IOException, XmlPullParserException, SAXException, ParserConfigurationException {
if (args.length == 0) {
System.out.println("FHIR LOINC to CDE convertor. ");

View File

@ -136,7 +136,7 @@ public class TestingUtilities {
command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\"");
ProcessBuilder builder = new ProcessBuilder(command);
builder.directory(new CSFile("c:\\temp"));
builder.directory(new CSFile(Utilities.path("[tmp]")));
builder.start();
}
@ -302,7 +302,7 @@ public class TestingUtilities {
command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\"");
ProcessBuilder builder = new ProcessBuilder(command);
builder.directory(new CSFile("c:\\temp"));
builder.directory(new CSFile(Utilities.path("[tmp]")));
builder.start();
}
@ -389,11 +389,6 @@ public class TestingUtilities {
return null;
}
public static String temp() {
if (new File("c:\\temp").exists())
return "c:\\temp";
return System.getProperty("java.io.tmpdir");
}
public static String checkTextIsSame(String s1, String s2) throws JsonSyntaxException, FileNotFoundException, IOException {
return checkTextIsSame(s1,s2,true);

View File

@ -60,6 +60,7 @@ import javax.xml.crypto.dsig.spec.TransformParameterSpec;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.xml.XmlGenerator;
import org.w3c.dom.Document;
@ -114,7 +115,7 @@ public class DigitalSignatures {
XMLSignature signature = fac.newXMLSignature(si, ki);
signature.sign(dsc);
OutputStream os = new FileOutputStream("c:\\temp\\java-digsig.xml");
OutputStream os = new FileOutputStream(Utilities.path("[tmp]", "java-digsig.xml"));
new XmlGenerator().generate(doc.getDocumentElement(), os);
}
}

View File

@ -8,6 +8,7 @@ import org.hl7.fhir.r4.elementmodel.Element;
import org.hl7.fhir.r4.elementmodel.Manager;
import org.hl7.fhir.r4.elementmodel.Manager.FhirFormat;
import org.hl7.fhir.r4.formats.IParser.OutputStyle;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.ToolsVersion;
import org.junit.jupiter.api.BeforeAll;
@ -38,7 +39,7 @@ public class CDARoundTripTests {
public void testDCI() throws FHIRFormatError, DefinitionException, FileNotFoundException, IOException, FHIRException {
try {
Element e = Manager.parse(context, new FileInputStream("C:\\work\\org.hl7.fhir.us\\ccda-to-fhir-maps\\cda\\IAT2-Discharge_Summary-DCI.xml"), FhirFormat.XML);
Manager.compose(context, e, new FileOutputStream("C:\\temp\\ccda.xml"), FhirFormat.XML, OutputStyle.PRETTY, null);
Manager.compose(context, e, new FileOutputStream(Utilities.path("[tmp]", "ccda.xml")), FhirFormat.XML, OutputStyle.PRETTY, null);
// Manager.compose(context, e, new FileOutputStream("C:\\work\\org.hl7.fhir.test\\ccda-to-fhir-maps\\testdocuments\\IAT2-Discharge_Summary-DCI.out.json"), FhirFormat.JSON, OutputStyle.PRETTY, null);
// Manager.compose(context, e, new FileOutputStream("C:\\work\\org.hl7.fhir.test\\ccda-to-fhir-maps\\testdocuments\\IAT2-Discharge_Summary-DCI.out.ttl"), FhirFormat.TURTLE, OutputStyle.PRETTY, null);
} catch (Exception e) {

View File

@ -802,7 +802,7 @@ public class ProfileUtilitiesTests {
command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\"");
ProcessBuilder builder = new ProcessBuilder(command);
builder.directory(new CSFile("c:\\temp"));
builder.directory(new CSFile(Utilities.path("[tmp]")));
builder.start();
}

View File

@ -11,7 +11,7 @@ import java.io.FileInputStream;
public class QuestionnaireBuilderTester {
private static final String TEST_PROFILE_DIR = "C:\\work\\org.hl7.fhir\\build\\publish";
private static final String TEST_DEST = "c:\\temp\\questionnaires\\";
// private static final String TEST_DEST = Utilities.path("[tmp]", "questionnaires\\");
public static void main(String[] args) {
QuestionnaireBuilder b = new QuestionnaireBuilder(null);

View File

@ -135,7 +135,7 @@ public class StructureMapTests {
// Manager.compose(TestingUtilities.context, cda, new FileOutputStream("C:\\work\\org.hl7.fhir\\build\\guides\\ccda2\\mapping\\example\\ccd.out.xml"), FhirFormat.XML, OutputStyle.PRETTY, null);
// Bundle bundle = new Bundle();
// scu.transform(null, cda, maps.get("http://hl7.org/fhir/StructureMap/cda"), bundle);
// new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\bundle.xml"), bundle);
// new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "bundle.xml"), bundle);
// }
//
// @Test
@ -165,7 +165,7 @@ public class StructureMapTests {
//
// List<StructureDefinition> result = scu.analyse(null, maps.get("http://hl7.org/fhir/StructureMap/cda")).getProfiles();
// for (StructureDefinition sd : result)
// new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\res-"+sd.getId()+".xml"), sd);
// new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "res-"+sd.getId()+".xml"), sd);
// }
//
}

View File

@ -130,7 +130,7 @@ public class ObjectConverter {
ByteArrayOutputStream bo = new ByteArrayOutputStream();
try {
new JsonParser(context).compose(element, bo, OutputStyle.NORMAL, null);
// TextFile.bytesToFile(bo.toByteArray(), "c:\\temp\\json.json");
// TextFile.bytesToFile(bo.toByteArray(), Utilities.path("[tmp]", "json.json");
return new org.hl7.fhir.r4b.formats.JsonParser().parse(bo.toByteArray());
} catch (IOException e) {
// won't happen

View File

@ -65,7 +65,7 @@ public class Tester {
// String tgt = normalise(TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".json")));
Element e = Manager.parseSingle(context, new FileInputStream("C:\\work\\org.hl7.fhir\\build\\publish\\"+f), FhirFormat.XML);
Manager.compose(context, e, new FileOutputStream("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".mm.ttl")), FhirFormat.TURTLE, OutputStyle.PRETTY, null);
Manager.compose(context, e, new FileOutputStream("C:\\temp\\resource.xml"), FhirFormat.XML, OutputStyle.PRETTY, null);
Manager.compose(context, e, new FileOutputStream(Utilities.path("[tmp]", "resource.xml")), FhirFormat.XML, OutputStyle.PRETTY, null);
String src = TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".mm.ttl"));
String tgt = TextFile.fileToString("C:\\work\\org.hl7.fhir\\build\\publish\\"+Utilities.changeFileExt(f, ".ttl"));
t++;

View File

@ -64,7 +64,6 @@ import org.xmlpull.v1.XmlPullParserException;
*/
public class LoincToDEConvertor {
// C:\temp\LOINC.xml
public static void main(String[] args) throws FHIRFormatError, IOException, XmlPullParserException, SAXException, ParserConfigurationException {
if (args.length == 0) {
System.out.println("FHIR LOINC to CDE convertor. ");

View File

@ -156,7 +156,7 @@ public class TestingUtilities extends BaseTestingUtilities {
command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\"");
ProcessBuilder builder = new ProcessBuilder(command);
builder.directory(new CSFile("c:\\temp"));
builder.directory(new CSFile(Utilities.path("[tmp]")));
builder.start();
}
}
@ -326,7 +326,7 @@ public class TestingUtilities extends BaseTestingUtilities {
command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\"");
ProcessBuilder builder = new ProcessBuilder(command);
builder.directory(new CSFile("c:\\temp"));
builder.directory(new CSFile(Utilities.path("[tmp]")));
builder.start();
}
@ -410,12 +410,6 @@ public class TestingUtilities extends BaseTestingUtilities {
return null;
}
public static String temp() {
if (new File("c:\\temp").exists())
return "c:\\temp";
return System.getProperty("java.io.tmpdir");
}
public static String checkTextIsSame(String s1, String s2) throws JsonSyntaxException, FileNotFoundException, IOException {
return checkTextIsSame(s1, s2, true);
}
@ -471,9 +465,9 @@ public class TestingUtilities extends BaseTestingUtilities {
}
public static String tempFolder(String name) throws IOException {
File tmp = new File("C:\\temp");
File tmp = new File(Utilities.path("[tmp]"));
if (tmp.exists() && tmp.isDirectory()) {
String path = Utilities.path("C:\\temp", name);
String path = Utilities.path(Utilities.path("[tmp]"), name);
Utilities.createDirectory(path);
return path;
} else if (new File("/tmp").exists()) {

View File

@ -60,6 +60,7 @@ import javax.xml.crypto.dsig.spec.TransformParameterSpec;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.xml.XmlGenerator;
import org.w3c.dom.Document;
@ -114,7 +115,7 @@ public class DigitalSignatures {
XMLSignature signature = fac.newXMLSignature(si, ki);
signature.sign(dsc);
OutputStream os = new FileOutputStream("c:\\temp\\java-digsig.xml");
OutputStream os = new FileOutputStream(Utilities.path("[tmp]", "java-digsig.xml"));
new XmlGenerator().generate(doc.getDocumentElement(), os);
}
}

View File

@ -415,13 +415,13 @@ public class MappingSheetParser {
private static final String SFX = "<body></html>";
public static void main(String[] args) throws FileNotFoundException, IOException, FHIRException {
MappingSheetParser parser = new MappingSheetParser();
parser.parse(new FileInputStream("c:\\temp\\v2-pid.csv"), "v2-pid.csv");
parser.parse(new FileInputStream(Utilities.path("[tmp]", "v2-pid.csv")), "v2-pid.csv");
ConceptMap cm = parser.getConceptMap();
StructureMap sm = parser.getStructureMap();
new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\sm.json"), sm);
new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\cm.json"), cm);
TextFile.stringToFile(StructureMapUtilities.render(sm), "c:\\temp\\sm.txt");
TextFile.stringToFile(PFX+parser.genSheet(cm)+SFX, "c:\\temp\\map.html");
new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "sm.json")), sm);
new JsonParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "cm.json")), cm);
TextFile.stringToFile(StructureMapUtilities.render(sm), Utilities.path("[tmp]", "sm.txt"));
TextFile.stringToFile(PFX+parser.genSheet(cm)+SFX, Utilities.path("[tmp]", "map.html"));
}
}

View File

@ -136,7 +136,7 @@ public class CDARoundTripTests {
// new FileInputStream("C:\\work\\org.hl7.fhir.us\\ccda-to-fhir-maps\\cda\\IAT2-Discharge_Summary-DCI.xml"),
// FhirFormat.XML);
//
// Manager.compose(context, e, new FileOutputStream("C:\\temp\\ccda.xml"), FhirFormat.XML, OutputStyle.PRETTY, null);
// Manager.compose(context, e, new FileOutputStream(Utilities.path("[tmp]", "ccda.xml"), FhirFormat.XML, OutputStyle.PRETTY, null);
//// Manager.compose(context, e, new FileOutputStream("C:\\work\\org.hl7.fhir.test\\ccda-to-fhir-maps\\testdocuments\\IAT2-Discharge_Summary-DCI.out.json"), FhirFormat.JSON, OutputStyle.PRETTY, null);
//// Manager.compose(context, e, new FileOutputStream("C:\\work\\org.hl7.fhir.test\\ccda-to-fhir-maps\\testdocuments\\IAT2-Discharge_Summary-DCI.out.ttl"), FhirFormat.TURTLE, OutputStyle.PRETTY, null);
// } catch (Exception e) {

View File

@ -14,6 +14,7 @@ import org.hl7.fhir.r4b.formats.XmlParser;
import org.hl7.fhir.r4b.model.Resource;
import org.hl7.fhir.r4b.test.utils.TestingUtilities;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.npm.FilesystemPackageCacheManager;
import org.hl7.fhir.utilities.npm.NpmPackage;
import org.hl7.fhir.utilities.npm.ToolsVersion;
@ -54,7 +55,7 @@ public class ParsingTests {
String src = new String(b);
Resource r = new JsonParser().parse(b);
b = new XmlParser().composeBytes(r);
TextFile.bytesToFile(b, "c:\\temp\\test.xml");
TextFile.bytesToFile(b, Utilities.path("[tmp]", "test.xml"));
r = new XmlParser().parse(b);
b = new JsonParser().setOutputStyle(OutputStyle.PRETTY).composeBytes(r);
String output = new String(b);

View File

@ -11,7 +11,7 @@ import org.hl7.fhir.r4b.utils.QuestionnaireBuilder;
public class QuestionnaireBuilderTester {
private static final String TEST_PROFILE_DIR = "C:\\work\\org.hl7.fhir\\build\\publish";
private static final String TEST_DEST = "c:\\temp\\questionnaires\\";
// private static final String TEST_DEST = Utilities.path("[tmp]", "questionnaires\\");
public static void main(String[] args) {
QuestionnaireBuilder b = new QuestionnaireBuilder(null);

View File

@ -135,7 +135,7 @@ public class StructureMapTests {
// Manager.compose(TestingUtilities.context, cda, new FileOutputStream("C:\\work\\org.hl7.fhir\\build\\guides\\ccda2\\mapping\\example\\ccd.out.xml"), FhirFormat.XML, OutputStyle.PRETTY, null);
// Bundle bundle = new Bundle();
// scu.transform(null, cda, maps.get("http://hl7.org/fhir/StructureMap/cda"), bundle);
// new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\bundle.xml"), bundle);
// new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "bundle.xml"), bundle);
// }
//
// @Test
@ -165,7 +165,7 @@ public class StructureMapTests {
//
// List<StructureDefinition> result = scu.analyse(null, maps.get("http://hl7.org/fhir/StructureMap/cda")).getProfiles();
// for (StructureDefinition sd : result)
// new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream("c:\\temp\\res-"+sd.getId()+".xml"), sd);
// new XmlParser().setOutputStyle(OutputStyle.PRETTY).compose(new FileOutputStream(Utilities.path("[tmp]", "res-"+sd.getId()+".xml"), sd);
// }
//
}

View File

@ -8,6 +8,7 @@ import java.util.List;
import java.util.Set;
import org.hl7.fhir.utilities.TextFile;
import org.hl7.fhir.utilities.Utilities;
import org.hl7.fhir.utilities.json.JSONUtil;
import org.hl7.fhir.utilities.json.JsonTrackingParser;
@ -29,7 +30,7 @@ public class PackageScanner {
b.append("\r\n");
System.out.println(s);
}
TextFile.stringToFile(b.toString(), "c:\\temp\\packages.csv");
TextFile.stringToFile(b.toString(), Utilities.path("[tmp]", "packages.csv"));
}
public static void processServer(String server, List<String> output, Set<String> packages) throws IOException {

View File

@ -108,21 +108,8 @@ public class BaseTestingUtilities {
}
public static String tempFolder(String name) throws IOException {
File tmp = new File("C:\\temp");
if (tmp.exists() && tmp.isDirectory()) {
String path = Utilities.path("C:\\temp", name);
Utilities.createDirectory(path);
return path;
} else if (ToolGlobalSettings.hasTempPath()) {
return ToolGlobalSettings.getTempPath();
} else if (new File("/tmp").exists()) {
String path = Utilities.path("/tmp", name);
Utilities.createDirectory(path);
return path;
} else {
String path = Utilities.path(System.getProperty("java.io.tmpdir"), name);
Utilities.createDirectory(path);
return path;
}
String path = ToolGlobalSettings.hasTempPath() ? ToolGlobalSettings.getTempPath() : Utilities.path("[tmp]", name);
Utilities.createDirectory(path);
return path;
}
}

View File

@ -30,7 +30,6 @@ class UtilitiesTest {
public static final String LINUX_USER_DIR = System.getProperty("user.home") + "/";
public static final String LINUX_JAVA_HOME = getNormalizedJavaHomeDir() + "/";
public static final String WIN_TEMP_DIR = "c:\\temp\\";
public static final String WIN_USER_DIR = System.getProperty("user.home") + "\\";
public static final String WIN_JAVA_HOME = getNormalizedJavaHomeDir() + "\\";
@ -91,9 +90,9 @@ class UtilitiesTest {
} else if (os.contains(LINUX)) {
return LINUX_TEMP_DIR;
} else if (os.toUpperCase().contains(WINDOWS)) {
File tmp = new File("c:\\temp");
File tmp = new File(Utilities.C_TEMP_DIR);
if(tmp.exists()) {
return WIN_TEMP_DIR;
return Utilities.C_TEMP_DIR;
} else {
return System.getProperty("java.io.tmpdir");
}

View File

@ -79,7 +79,7 @@ public class XhtmlNodeTest {
@Test
public void testParseXXE() {
XhtmlNode dt = new XhtmlNode();
dt.setValueAsString("<div xmlns=\"http://www.w3.org/1999/xhtml\">\n <!DOCTYPE foo [ <!ENTITY xxe SYSTEM \"file://c:\\temp\\xxe.txt\">]>\n <p>This is some narrative &xxe;</p>\n </div>");
dt.setValueAsString("<div xmlns=\"http://www.w3.org/1999/xhtml\">\n <!DOCTYPE foo [ <!ENTITY xxe SYSTEM \"file://xxe.txt\">]>\n <p>This is some narrative &xxe;</p>\n </div>");
}
@Test

View File

@ -167,7 +167,7 @@ public class UtilitiesXTests {
command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\"");
ProcessBuilder builder = new ProcessBuilder(command);
builder.directory(new CSFile("c:\\temp"));
builder.directory(new CSFile(Utilities.path("tmp]")));
builder.start();
}
@ -333,7 +333,7 @@ public class UtilitiesXTests {
command.add("\"" + diff + "\" \"" + f1 + "\" \"" + f2 + "\"");
ProcessBuilder builder = new ProcessBuilder(command);
builder.directory(new CSFile("c:\\temp"));
builder.directory(new CSFile(Utilities.path("tmp]")));
builder.start();
}
@ -420,9 +420,9 @@ public class UtilitiesXTests {
return null;
}
public static String temp() {
if (new File("c:\\temp").exists())
return "c:\\temp";
public static String temp() throws IOException {
if (new File(Utilities.path("tmp]")).exists())
return Utilities.path("tmp]");
return System.getProperty("java.io.tmpdir");
}
@ -549,9 +549,9 @@ public class UtilitiesXTests {
}
public static String tempFolder(String name) throws IOException {
File tmp = new File("C:\\temp");
File tmp = new File(Utilities.path("tmp]"));
if (tmp.exists() && tmp.isDirectory()) {
String path = Utilities.path("C:\\temp", name);
String path = Utilities.path("[tmp]", name);
Utilities.createDirectory(path);
return path;
} else if (new File("/tmp").exists()) {