Fix missing convert task
This commit is contained in:
parent
7922a9947e
commit
8eb8787053
|
@ -119,6 +119,7 @@ public class ValidatorCli {
|
|||
return List.of(
|
||||
new CompareTask(),
|
||||
new CompileTask(),
|
||||
new ConvertTask(),
|
||||
new FhirpathTask(),
|
||||
new InstallTask(),
|
||||
new LangTransformTask(),
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
package org.hl7.fhir.validation.cli.tasks;
|
||||
|
||||
import org.hl7.fhir.utilities.TimeTracker;
|
||||
import org.hl7.fhir.validation.ValidationEngine;
|
||||
import org.hl7.fhir.validation.cli.model.CliContext;
|
||||
import org.hl7.fhir.validation.cli.services.ValidationService;
|
||||
import org.hl7.fhir.validation.cli.utils.EngineMode;
|
||||
|
||||
import java.io.PrintStream;
|
||||
|
||||
public class ConvertTask extends ValidationServiceTask {
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "convert";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldExecuteTask(CliContext cliContext, String[] args) {
|
||||
return cliContext.getMode() == EngineMode.CONVERT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void printHelp(PrintStream out) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void executeTask(ValidationService validationService, ValidationEngine validationEngine, CliContext cliContext, String[] args, TimeTracker tt, TimeTracker.Session tts) throws Exception {
|
||||
validationService.convertSources(cliContext, validationEngine);
|
||||
}
|
||||
|
||||
}
|
|
@ -29,6 +29,8 @@ public class ValidatorCliTests {
|
|||
@Mock
|
||||
ValidationEngine validationEngine;
|
||||
|
||||
@Spy
|
||||
ConvertTask convertTask;
|
||||
@Spy
|
||||
CompareTask compareTask;
|
||||
|
||||
|
@ -91,6 +93,7 @@ public class ValidatorCliTests {
|
|||
return List.of(
|
||||
compareTask,
|
||||
compileTask,
|
||||
convertTask,
|
||||
fhirpathTask,
|
||||
installTask,
|
||||
langTransformTask,
|
||||
|
@ -168,6 +171,15 @@ public class ValidatorCliTests {
|
|||
Mockito.verify(validationService).compile(same(cliContext), same(validationEngine));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void convertTest() throws Exception {
|
||||
final String[] args = new String[]{"-convert"};
|
||||
CliContext cliContext = Params.loadCliContext(args);
|
||||
ValidatorCli cli = mockValidatorCliWithService(cliContext);
|
||||
cli.readParamsAndExecuteTask(cliContext, args);
|
||||
Mockito.verify(validationService).determineVersion(same(cliContext));
|
||||
Mockito.verify(validationService).convertSources(cliContext,validationEngine);
|
||||
}
|
||||
@Test
|
||||
public void snapshotTest() throws Exception {
|
||||
final String[] args = new String[]{"-snapshot"};
|
||||
|
|
Loading…
Reference in New Issue