diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 000000000..00cf045b0 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,62 @@ +trigger: + branches: + include: + - '*' + +strategy: + matrix: + linux: + imageName: "ubuntu-16.04" +# mac: +# imageName: "macos-10.14" +# windows: +# imageName: "vs2017-win2016" + maxParallel: 3 + +pool: + vmImage: $(imageName) + +variables: + currentImage: $(imageName) + codecov: $(CODECOV_TOKEN) + +steps: + - task: PowerShell@2 + inputs: + targetType: 'inline' + script: | + [xml]$pomXml = Get-Content .\pom.xml + # version + Write-Host $pomXml.project.version + $version=$pomXml.project.version + Write-Host "##vso[task.setvariable variable=version]$version" + + - task: Maven@3 + inputs: + mavenPomFile: 'pom.xml' + mavenOptions: '-Xmx3072m' + javaHomeOption: 'JDKVersion' + jdkVersionOption: '1.8' + jdkArchitectureOption: 'x64' + publishJUnitResults: true + testResultsFiles: '**/surefire-reports/TEST-*.xml' + goals: 'clean package' + + - bash: echo Current version => $(version) + displayName: 'version' + + - script: bash <(curl https://codecov.io/bash) -t $(codecov) + displayName: 'codecov' + - task: PublishCodeCoverageResults@1 + inputs: + codeCoverageTool: 'JaCoCo' + summaryFileLocation: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.report/target/site/jacoco-aggregate/jacoco.xml' + reportDirectory: '$(System.DefaultWorkingDirectory)/org.hl7.fhir.report/target/site/jacoco-aggregate/' + + - task: PublishPipelineArtifact@1 + condition: eq(variables.currentImage, 'ubuntu-16.04') + inputs: + targetPath: "$(System.DefaultWorkingDirectory)/org.hl7.fhir.validation/target/org.hl7.fhir.validation-$(version).jar" + artifactName: Validator + + diff --git a/org.hl7.fhir.report/pom.xml b/org.hl7.fhir.report/pom.xml new file mode 100644 index 000000000..c3360fae7 --- /dev/null +++ b/org.hl7.fhir.report/pom.xml @@ -0,0 +1,90 @@ + + + + ca.uhn.hapi.fhir + org.hl7.fhir.core + 4.2.26-SNAPSHOT + ../pom.xml + + + 4.0.0 + + org.hl7.fhir.report + + bundle + + + true + 0.8.5 + + + + + ca.uhn.hapi.fhir + org.hl7.fhir.convertors + ${project.version} + + + ca.uhn.hapi.fhir + org.hl7.fhir.r5 + ${project.version} + + + org.antlr + ST4 + + + + + ca.uhn.hapi.fhir + org.hl7.fhir.utilities + ${project.version} + + + ca.uhn.hapi.fhir + org.hl7.fhir.validation + ${project.version} + + + + + + + org.jacoco + jacoco-maven-plugin + ${jacoco_version} + + + report-aggregate + prepare-package + + report-aggregate + + + JaCoCo +
Code Coverage Report for FHIR core libs ${project.version}
+ + + **/*.class + +
+
+
+
+ + org.basepom.maven + duplicate-finder-maven-plugin + 1.4.0 + + + true + + +
+
+ +
\ No newline at end of file diff --git a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/XhtmlNodeTest.java b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/XhtmlNodeTest.java index 341189cf5..596379f54 100644 --- a/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/XhtmlNodeTest.java +++ b/org.hl7.fhir.utilities/src/test/java/org/hl7/fhir/utilities/tests/XhtmlNodeTest.java @@ -1,6 +1,7 @@ package org.hl7.fhir.utilities.tests; import org.hl7.fhir.utilities.xhtml.XhtmlNode; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -9,8 +10,6 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; -import static org.junit.Assert.assertEquals; - public class XhtmlNodeTest { private static final Logger ourLog = LoggerFactory.getLogger(XhtmlNodeTest.class); @@ -24,12 +23,12 @@ public class XhtmlNodeTest { // Entity that appears in XHTML not not in XML XhtmlNode node = new XhtmlNode(); node.setValueAsString("
®
"); - assertEquals("
®
", node.getValueAsString()); + Assertions.assertEquals("
®
", node.getValueAsString()); // Entity that appears in both node = new XhtmlNode(); node.setValueAsString("
<
"); - assertEquals("
<
", node.getValueAsString()); + Assertions.assertEquals("
<
", node.getValueAsString()); } /** @@ -39,24 +38,24 @@ public class XhtmlNodeTest { public void testLangAttributePreserved() { XhtmlNode dt = new XhtmlNode(); dt.setValueAsString("
help i'm a bug
"); - assertEquals("
help i'm a bug
", dt.getValueAsString()); - assertEquals("
help i'm a bug
", new XhtmlNode().setValue(dt.getValue()).getValueAsString()); + Assertions.assertEquals("
help i'm a bug
", dt.getValueAsString()); + Assertions.assertEquals("
help i'm a bug
", new XhtmlNode().setValue(dt.getValue()).getValueAsString()); } @Test public void testParseRsquo() { XhtmlNode dt = new XhtmlNode(); dt.setValueAsString("It’s January again"); - assertEquals("
It’s January again
", dt.getValueAsString()); - assertEquals("
It’s January again
", new XhtmlNode().setValue(dt.getValue()).getValueAsString()); + Assertions.assertEquals("
It’s January again
", dt.getValueAsString()); + Assertions.assertEquals("
It’s January again
", new XhtmlNode().setValue(dt.getValue()).getValueAsString()); } @Test public void testProcessingInstructionNotPreserved() { XhtmlNode dt = new XhtmlNode(); dt.setValueAsString("
help i'm a bug
"); - assertEquals("
help i'm a bug
", dt.getValueAsString()); - assertEquals("
help i'm a bug
", new XhtmlNode().setValue(dt.getValue()).getValueAsString()); + Assertions.assertEquals("
help i'm a bug
", dt.getValueAsString()); + Assertions.assertEquals("
help i'm a bug
", new XhtmlNode().setValue(dt.getValue()).getValueAsString()); } @Test @@ -71,7 +70,7 @@ public class XhtmlNodeTest { String output = node.getValueAsString(); ourLog.info(output); - assertEquals("
\"Twitter@fhirabend
", output); + Assertions.assertEquals("
\"Twitter@fhirabend
", output); } @Test diff --git a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/ValidatorGui.java b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/ValidatorGui.java index 3030d0e2e..d8c0f8492 100644 --- a/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/ValidatorGui.java +++ b/org.hl7.fhir.validation/src/main/java/org/hl7/fhir/validation/cli/ValidatorGui.java @@ -13,7 +13,7 @@ import java.net.URISyntaxException; public class ValidatorGui { - private static final int GUI_FRONTEND_PORT = 8080; + private static final int GUI_FRONTEND_PORT = 8081; private static final String PAGE_ADDRESS = "http://localhost:" + GUI_FRONTEND_PORT + "/home"; private static final String WEB_APP_FILE_LOCATION = "/public"; private static Javalin app; @@ -32,6 +32,10 @@ public class ValidatorGui { start(new CliContext(), validationEngine, false); } + public static int getPort() { + return GUI_FRONTEND_PORT; + } + public static void start(CliContext currentContext, ValidationEngine validationEngine, boolean bootBrowser) { app = Javalin.create(); new RestEndpoints().initRestEndpoints(app, currentContext, validationEngine); diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/cli/ValidatorGuiTest.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/cli/ValidatorGuiTest.java index b8e88e779..a58d17b78 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/cli/ValidatorGuiTest.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/cli/ValidatorGuiTest.java @@ -24,7 +24,7 @@ class ValidatorGuiTest { options.addArguments("--headless"); options.addArguments("--disable-gpu"); WebDriver driver = new ChromeDriver(options); - driver.get("http://localhost:8080/home"); + driver.get("http://localhost:" + ValidatorGui.getPort() + "/home"); Assertions.assertTrue(driver.getPageSource().contains(HTML_TITLE_TAG)); driver.quit(); diff --git a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/cli/controller/HttpGetContextTest.java b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/cli/controller/HttpGetContextTest.java index ac10cd47a..c000d7016 100644 --- a/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/cli/controller/HttpGetContextTest.java +++ b/org.hl7.fhir.validation/src/test/java/org/hl7/fhir/validation/cli/controller/HttpGetContextTest.java @@ -7,6 +7,7 @@ import org.apache.http.client.methods.HttpUriRequest; import org.apache.http.entity.ContentType; import org.apache.http.impl.client.HttpClientBuilder; import org.hl7.fhir.validation.cli.BaseRestTest; +import org.hl7.fhir.validation.cli.ValidatorGui; import org.hl7.fhir.validation.cli.model.CliContext; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; @@ -16,7 +17,7 @@ import java.io.IOException; class HttpGetContextTest extends BaseRestTest { - private final String GET_CONTEXT_URL = "http://localhost:8080/context"; + private final String GET_CONTEXT_URL = "http://localhost:" + ValidatorGui.getPort() + "/context"; @Test @DisplayName("Testing status code on get context endpoint.") diff --git a/pom.xml b/pom.xml index 4556517cf..c1ab83a00 100644 --- a/pom.xml +++ b/pom.xml @@ -20,6 +20,7 @@ 1.1.13-SNAPSHOT 5.6.2 3.0.0-M4 + 0.8.5 org.hl7.fhir.core @@ -119,7 +120,6 @@ 0.13 - @@ -129,10 +129,11 @@ org.hl7.fhir.dstu3 org.hl7.fhir.r4 org.hl7.fhir.r5 - org.hl7.fhir.convertors org.hl7.fhir.validation org.hl7.fhir.validation.cli + + org.hl7.fhir.report @@ -160,8 +161,13 @@ false false - -Xmx4096m + + ${argLine} -Xmx4096m false + + org/hl7/fhir/validation/cli/** + @@ -272,7 +278,40 @@ true + + org.jacoco + jacoco-maven-plugin + ${jacoco_version} + + + + org/hl7/fhir/r5/formats/JsonParser + org/hl7/fhir/r5/formats/XmlParser + org/hl7/fhir/r4/formats/JsonParser + org/hl7/fhir/r4/formats/XmlParser + org/hl7/fhir/r4/**/* + org/hl7/fhir/dstu3/**/* + org/hl7/fhir/dstu2/**/* + org/hl7/fhir/dstu2016may/**/* + + + + + jacoco-initialize + + prepare-agent + + + + report + package + + report + + + + -