Correct issue with CLI
This commit is contained in:
parent
d9d47bb419
commit
96003a44cc
|
@ -134,7 +134,7 @@ public class UploadTerminologyCommand extends BaseCommand {
|
|||
for (String nextDataFile : theDatafile) {
|
||||
|
||||
try (FileInputStream fileInputStream = new FileInputStream(nextDataFile)) {
|
||||
if (nextDataFile.endsWith(".csv")) {
|
||||
if (nextDataFile.endsWith(".csv") || nextDataFile.endsWith(".properties")) {
|
||||
|
||||
ourLog.info("Compressing and adding file: {}", nextDataFile);
|
||||
ZipEntry nextEntry = new ZipEntry(stripPath(nextDataFile));
|
||||
|
|
|
@ -64,6 +64,8 @@ public class UploadTerminologyCommandTest extends BaseTest {
|
|||
private File myTextFile = new File(myTextFileName);
|
||||
private File myArchiveFile;
|
||||
private String myArchiveFileName;
|
||||
private String myPropertiesFileName = "target/hello.properties";
|
||||
private File myPropertiesFile = new File(myTextFileName);
|
||||
|
||||
@Test
|
||||
public void testDeltaAdd() throws IOException {
|
||||
|
@ -238,6 +240,8 @@ public class UploadTerminologyCommandTest extends BaseTest {
|
|||
@Test
|
||||
public void testSnapshot() throws IOException {
|
||||
|
||||
|
||||
|
||||
writeConceptAndHierarchyFiles();
|
||||
|
||||
when(myTermLoaderSvc.loadCustom(any(), anyList(), any())).thenReturn(new UploadStatistics(100, new IdType("CodeSystem/101")));
|
||||
|
@ -260,6 +264,33 @@ public class UploadTerminologyCommandTest extends BaseTest {
|
|||
assertThat(IOUtils.toByteArray(listOfDescriptors.get(0).getInputStream()).length, greaterThan(100));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPropertiesFile() throws IOException {
|
||||
try (FileWriter w = new FileWriter(myPropertiesFileName, false)) {
|
||||
w.append("a=b\n");
|
||||
}
|
||||
|
||||
when(myTermLoaderSvc.loadCustom(any(), anyList(), any())).thenReturn(new UploadStatistics(100, new IdType("CodeSystem/101")));
|
||||
|
||||
App.main(new String[]{
|
||||
UploadTerminologyCommand.UPLOAD_TERMINOLOGY,
|
||||
"-v", "r4",
|
||||
"-m", "SNAPSHOT",
|
||||
"-t", "http://localhost:" + myPort,
|
||||
"-u", "http://foo",
|
||||
"-d", myPropertiesFileName,
|
||||
});
|
||||
|
||||
verify(myTermLoaderSvc, times(1)).loadCustom(any(), myDescriptorListCaptor.capture(), any());
|
||||
|
||||
List<ITermLoaderSvc.FileDescriptor> listOfDescriptors = myDescriptorListCaptor.getValue();
|
||||
assertEquals(1, listOfDescriptors.size());
|
||||
assertThat(listOfDescriptors.get(0).getFilename(), matchesPattern(".*\\.zip$"));
|
||||
assertThat(IOUtils.toByteArray(listOfDescriptors.get(0).getInputStream()).length, greaterThan(100));
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* When transferring large files, we use a local file to store the binary instead of
|
||||
* using HTTP to transfer a giant base 64 encoded attachment. Hopefully we can
|
||||
|
@ -342,6 +373,7 @@ public class UploadTerminologyCommandTest extends BaseTest {
|
|||
FileUtils.deleteQuietly(myArchiveFile);
|
||||
FileUtils.deleteQuietly(myCodeSystemFile);
|
||||
FileUtils.deleteQuietly(myTextFile);
|
||||
FileUtils.deleteQuietly(myPropertiesFile);
|
||||
|
||||
UploadTerminologyCommand.setTransferSizeLimitForUnitTest(-1);
|
||||
}
|
||||
|
|
|
@ -73,6 +73,10 @@
|
|||
A missing mandatory was added to the SNOMED CT CodeSystem that is uploaded when SCT is
|
||||
uploaded to the JPA server. Thanks to Anders Havn for the pull request!
|
||||
</action>
|
||||
<action type="fix">
|
||||
An issue with the HAPI FHIR CLI was corrected that prevented the upload of LOINC due to an error
|
||||
regarding the properties file.
|
||||
</action>
|
||||
</release>
|
||||
<release version="4.1.0" date="2019-11-13" description="Jitterbug">
|
||||
<action type="add">
|
||||
|
|
Loading…
Reference in New Issue