use of com.ibm.cohort.cql.library.CqlLibraryProvider in project quality-measure-and-cohort-service by Alvearie.
the class CqlTranslationIntegrationTest method multipleFilesInZip__translatedSuccessfully.
@Test
public void multipleFilesInZip__translatedSuccessfully() throws Exception {
Path zipFile = Paths.get("src/test/resources/cql/multiple-files/packaged-cqls.zip");
MapCqlLibraryProviderFactory providerFactory = new MapCqlLibraryProviderFactory();
CqlLibraryProvider backingLibraryProvider = providerFactory.fromZipFile(zipFile);
runMultipleFilesTest(backingLibraryProvider);
}
use of com.ibm.cohort.cql.library.CqlLibraryProvider in project quality-measure-and-cohort-service by Alvearie.
the class CqlTranslationIntegrationTest method errorCausedByInvalidContent.
@Test
public void errorCausedByInvalidContent() {
CqlLibraryProvider backingLibraryProvider = cqlResourceDescriptor -> {
CqlLibraryDescriptor descriptor = new CqlLibraryDescriptor().setLibraryId("Junk").setLibraryId("1.0.0").setFormat(Format.CQL);
String content = "this is a junk cql";
return new CqlLibrary().setContent(content).setDescriptor(descriptor);
};
CqlToElmTranslator translator = new CqlToElmTranslator();
CqlLibraryProvider translatingLibraryProvider = new TranslatingCqlLibraryProvider(backingLibraryProvider, translator, true);
CqlLibraryDescriptor descriptor = new CqlLibraryDescriptor().setLibraryId("Junk").setLibraryId("1.0.0").setFormat(Format.ELM);
boolean failed = false;
try {
translatingLibraryProvider.getLibrary(descriptor);
} catch (Exception e) {
failed = true;
Assert.assertTrue("Unexpected exception message: " + e.getMessage(), e.getMessage().startsWith("There were errors during cql translation:"));
}
if (!failed) {
Assert.fail("Did not fail translation");
}
}
Aggregations