Add some test logging
This commit is contained in:
parent
7831e8a0ed
commit
33531f9010
|
@ -36,6 +36,7 @@ import org.hl7.fhir.r4.model.ConceptMap.SourceElementComponent;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Writer;
|
import java.io.Writer;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -120,9 +121,10 @@ public class ExportConceptMapToCsvCommand extends AbstractImportExportCsvConcept
|
||||||
}
|
}
|
||||||
|
|
||||||
private void convertConceptMapToCsv(ConceptMap theConceptMap) {
|
private void convertConceptMapToCsv(ConceptMap theConceptMap) {
|
||||||
ourLog.info("Exporting ConceptMap to CSV...");
|
Path path = Paths.get(file);
|
||||||
|
ourLog.info("Exporting ConceptMap to CSV: {}", path);
|
||||||
try (
|
try (
|
||||||
Writer writer = Files.newBufferedWriter(Paths.get(file));
|
Writer writer = Files.newBufferedWriter(path);
|
||||||
CSVPrinter csvPrinter = new CSVPrinter(
|
CSVPrinter csvPrinter = new CSVPrinter(
|
||||||
writer,
|
writer,
|
||||||
CSVFormat
|
CSVFormat
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
<useJansi>true</useJansi>
|
<useJansi>true</useJansi>
|
||||||
<encoder>
|
<encoder>
|
||||||
<pattern>%green(%d{yyyy-MM-dd}) %boldGreen(%d{HH:mm:ss}) %white([%thread]) %white(%-5level) %boldBlue(%logger{20}) %boldWhite(%msg%n)
|
<pattern>%green(%d{yyyy-MM-dd}) %boldGreen(%d{HH:mm:ss.SS}) %white([%thread]) %white(%-5level) %boldBlue(%logger{20}) %boldWhite(%msg%n)
|
||||||
</pattern>
|
</pattern>
|
||||||
</encoder>
|
</encoder>
|
||||||
</appender>
|
</appender>
|
||||||
|
|
|
@ -4,6 +4,7 @@ import ca.uhn.fhir.context.FhirContext;
|
||||||
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
import ca.uhn.fhir.rest.client.api.IGenericClient;
|
||||||
import ca.uhn.fhir.rest.server.RestfulServer;
|
import ca.uhn.fhir.rest.server.RestfulServer;
|
||||||
import ca.uhn.fhir.rest.server.interceptor.VerboseLoggingInterceptor;
|
import ca.uhn.fhir.rest.server.interceptor.VerboseLoggingInterceptor;
|
||||||
|
import ca.uhn.fhir.test.utilities.LoggingRule;
|
||||||
import ca.uhn.fhir.util.TestUtil;
|
import ca.uhn.fhir.util.TestUtil;
|
||||||
import com.google.common.base.Charsets;
|
import com.google.common.base.Charsets;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
@ -16,6 +17,7 @@ import org.hl7.fhir.dstu3.model.Enumerations.ConceptMapEquivalence;
|
||||||
import org.hl7.fhir.dstu3.model.UriType;
|
import org.hl7.fhir.dstu3.model.UriType;
|
||||||
import org.junit.AfterClass;
|
import org.junit.AfterClass;
|
||||||
import org.junit.BeforeClass;
|
import org.junit.BeforeClass;
|
||||||
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
@ -42,6 +44,8 @@ public class ExportConceptMapToCsvCommandDstu3Test {
|
||||||
private static int ourPort;
|
private static int ourPort;
|
||||||
private static Server ourServer;
|
private static Server ourServer;
|
||||||
private static String ourVersion = "dstu3";
|
private static String ourVersion = "dstu3";
|
||||||
|
@Rule
|
||||||
|
public LoggingRule myLoggingRule = new LoggingRule();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
System.setProperty("test", "true");
|
System.setProperty("test", "true");
|
||||||
|
@ -79,7 +83,7 @@ public class ExportConceptMapToCsvCommandDstu3Test {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testExportConceptMapToCsvCommand() throws IOException {
|
public void testExportConceptMapToCsvCommand() throws IOException {
|
||||||
ourLog.info("ConceptMap:\n" + ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(createConceptMap()));
|
ourLog.debug("ConceptMap:\n" + ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(createConceptMap()));
|
||||||
|
|
||||||
App.main(new String[] {"export-conceptmap-to-csv",
|
App.main(new String[] {"export-conceptmap-to-csv",
|
||||||
"-v", ourVersion,
|
"-v", ourVersion,
|
||||||
|
@ -101,6 +105,8 @@ public class ExportConceptMapToCsvCommandDstu3Test {
|
||||||
"\"http://example.com/codesystem/2\",\"Version 2s\",\"http://example.com/codesystem/3\",\"Version 3t\",\"Code 2b\",\"Display 2b\",\"Code 3b\",\"Display 3b\",\"equal\",\"3b This is a comment.\"\n" +
|
"\"http://example.com/codesystem/2\",\"Version 2s\",\"http://example.com/codesystem/3\",\"Version 3t\",\"Code 2b\",\"Display 2b\",\"Code 3b\",\"Display 3b\",\"equal\",\"3b This is a comment.\"\n" +
|
||||||
"\"http://example.com/codesystem/2\",\"Version 2s\",\"http://example.com/codesystem/3\",\"Version 3t\",\"Code 2c\",\"Display 2c\",\"Code 3c\",\"Display 3c\",\"equal\",\"3c This is a comment.\"\n" +
|
"\"http://example.com/codesystem/2\",\"Version 2s\",\"http://example.com/codesystem/3\",\"Version 3t\",\"Code 2c\",\"Display 2c\",\"Code 3c\",\"Display 3c\",\"equal\",\"3c This is a comment.\"\n" +
|
||||||
"\"http://example.com/codesystem/2\",\"Version 2s\",\"http://example.com/codesystem/3\",\"Version 3t\",\"Code 2d\",\"Display 2d\",\"Code 3d\",\"Display 3d\",\"equal\",\"3d This is a comment.\"\n";
|
"\"http://example.com/codesystem/2\",\"Version 2s\",\"http://example.com/codesystem/3\",\"Version 3t\",\"Code 2d\",\"Display 2d\",\"Code 3d\",\"Display 3d\",\"equal\",\"3d This is a comment.\"\n";
|
||||||
|
|
||||||
|
ourLog.info("Going to read file: {}", FILE);
|
||||||
String result = IOUtils.toString(new FileInputStream(FILE), Charsets.UTF_8);
|
String result = IOUtils.toString(new FileInputStream(FILE), Charsets.UTF_8);
|
||||||
assertEquals(expected, result);
|
assertEquals(expected, result);
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
<configuration scan="true" scanPeriod="30 seconds">
|
||||||
|
|
||||||
|
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
|
||||||
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||||
|
<level>INFO</level>
|
||||||
|
</filter>
|
||||||
|
<encoder>
|
||||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} [%file:%line] %msg%n</pattern>
|
||||||
|
</encoder>
|
||||||
|
</appender>
|
||||||
|
|
||||||
|
<root level="INFO">
|
||||||
|
<appender-ref ref="STDOUT" />
|
||||||
|
</root>
|
||||||
|
|
||||||
|
</configuration>
|
|
@ -126,4 +126,9 @@ public class IgPackValidationSupportDstu3 implements IValidationSupport {
|
||||||
public CodeValidationResult validateCode(FhirContext theContext, String theCodeSystem, String theCode, String theDisplay) {
|
public CodeValidationResult validateCode(FhirContext theContext, String theCodeSystem, String theCode, String theDisplay) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StructureDefinition generateSnapshot(StructureDefinition theInput, String theUrl, String theName) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue