Skip to content

Commit

Permalink
Merge pull request #27 from MeasureAuthoringTool/MAT-7929_CheckInclud…
Browse files Browse the repository at this point in the history
…eVersionMatches_QDM

Mat 7929 check include version matches qdm
  • Loading branch information
gregory-akins authored Dec 12, 2024
2 parents 3bea25d + 986b6c1 commit f457b31
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/maven-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
permissions:
contents: read
packages: write
if: github.ref == 'refs/heads/1.0.1_hotfix'
if: github.ref == 'refs/heads/1.0.2_hotfix'
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>gov.cms.madie</groupId>
<artifactId>madie-translator-commons</artifactId>
<version>1.0.2</version>
<version>1.0.3-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>17</java.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public String getLibraryCql(String name, String version, String accessToken) {

UsingProperties libraryUsing = new CqlTextParser(responseEntity.getBody()).getUsing();
if (libraryUsing.getLine().equals(MadieLibrarySourceProvider.getUsingProperties().getLine())
|| supportedLibraries.contains(libraryUsing.getLibraryType())) {
&& supportedLibraries.contains(libraryUsing.getLibraryType())) {
return responseEntity.getBody();
}
log.error("Library model and version does not match the Measure model and version");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ void getLibraryCql() {
}

@Test
void getLibraryCqlThrowCqlIncludeException() {
void getLibraryCqlWrongModelThrowCqlIncludeException() {
String cql =
"library QICoreCommon version '1.3.000'\n"
+ "using QICore version '4.1.1'\n"
Expand All @@ -97,6 +97,46 @@ void getLibraryCqlThrowCqlIncludeException() {
() -> cqlLibraryService.getLibraryCql(cqlLibraryName, cqlLibraryVersion, accessToken));
}

@Test
void getLibraryCqlWrongVersionThrowCqlIncludeException() {
String cql =
"library QICoreCommon version '1.3.000'\n"
+ "using QICore version '4.1.1'\n"
+ "Response Cql String";
cqlLibraryService.setUpLibrarySourceProvider(cql, "ACCESS_TOKEN");

String wrongLibrarycql =
"library QICoreCommon version '1.3.000'\n"
+ "using QICore version '6.0.0'\n"
+ "Response Cql String";
when(restTemplate.exchange(
libraryUri, HttpMethod.GET, new HttpEntity<>(httpHeaders), String.class))
.thenReturn(new ResponseEntity<>(wrongLibrarycql, HttpStatus.OK));
assertThrows(
CqlIncludeException.class,
() -> cqlLibraryService.getLibraryCql(cqlLibraryName, cqlLibraryVersion, accessToken));
}

@Test
void getLibraryCqlWrongModelAndVersionThrowCqlIncludeException() {
String cql =
"library QICoreCommon version '1.3.000'\n"
+ "using QICore version '4.1.1'\n"
+ "Response Cql String";
cqlLibraryService.setUpLibrarySourceProvider(cql, "ACCESS_TOKEN");

String wrongLibrarycql =
"library QICoreCommon version '1.3.000'\n"
+ "using FHIR version '4.0.1'\n"
+ "Response Cql String";
when(restTemplate.exchange(
libraryUri, HttpMethod.GET, new HttpEntity<>(httpHeaders), String.class))
.thenReturn(new ResponseEntity<>(wrongLibrarycql, HttpStatus.OK));
assertThrows(
CqlIncludeException.class,
() -> cqlLibraryService.getLibraryCql(cqlLibraryName, cqlLibraryVersion, accessToken));
}

@Test
void getLibraryCqlReturnsNull() {
when(restTemplate.exchange(
Expand Down

0 comments on commit f457b31

Please sign in to comment.