cleaning up port addresses for gui tests
This commit is contained in:
parent
17f66fd1a0
commit
7a8f84fc6c
|
@ -1,19 +1,65 @@
|
|||
# Starter pipeline
|
||||
# Start with a minimal pipeline that you can customize to build and deploy your code.
|
||||
# Add steps that build, run tests, deploy, and more:
|
||||
# https://aka.ms/yaml
|
||||
# Maven
|
||||
|
||||
trigger:
|
||||
- master
|
||||
branches:
|
||||
include:
|
||||
- '*'
|
||||
# pr:
|
||||
# - master
|
||||
# - release
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
linux:
|
||||
imageName: "ubuntu-16.04"
|
||||
mac:
|
||||
imageName: "macos-10.14"
|
||||
windows:
|
||||
imageName: "vs2017-win2016"
|
||||
maxParallel: 3
|
||||
|
||||
pool:
|
||||
vmImage: 'ubuntu-latest'
|
||||
vmImage: $(imageName)
|
||||
|
||||
variables:
|
||||
currentImage: $(imageName)
|
||||
|
||||
steps:
|
||||
- script: echo Hello, world!
|
||||
displayName: 'Run a one-line script'
|
||||
|
||||
- script: |
|
||||
echo Add other tasks to build, test, and deploy your project.
|
||||
echo See https://aka.ms/yaml
|
||||
displayName: 'Run a multi-line script'
|
||||
- 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: 'package cobertura:cobertura'
|
||||
|
||||
- bash: echo $(version)
|
||||
- bash: echo $(variables.currentImage)
|
||||
|
||||
- task: PublishCodeCoverageResults@1
|
||||
inputs:
|
||||
codeCoverageTool: "Cobertura"
|
||||
summaryFileLocation: "$(System.DefaultWorkingDirectory)/**/site/cobertura/coverage.xml"
|
||||
failIfCoverageEmpty: true
|
||||
|
||||
- task: PublishPipelineArtifact@1
|
||||
condition: eq(variables.currentImage, 'ubuntu-16.04')
|
||||
inputs:
|
||||
targetPath: "$(System.DefaultWorkingDirectory)/target/ProjectA-$(version).jar"
|
||||
artifactName: ProjectAOutput
|
||||
|
||||
|
||||
|
|
|
@ -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("<div>®</div>");
|
||||
assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\">®</div>", node.getValueAsString());
|
||||
Assertions.assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\">®</div>", node.getValueAsString());
|
||||
|
||||
// Entity that appears in both
|
||||
node = new XhtmlNode();
|
||||
node.setValueAsString("<div><</div>");
|
||||
assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\"><</div>", node.getValueAsString());
|
||||
Assertions.assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\"><</div>", node.getValueAsString());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -39,24 +38,24 @@ public class XhtmlNodeTest {
|
|||
public void testLangAttributePreserved() {
|
||||
XhtmlNode dt = new XhtmlNode();
|
||||
dt.setValueAsString("<div xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en-US\">help i'm a bug</div>");
|
||||
assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en-US\">help i'm a bug</div>", dt.getValueAsString());
|
||||
assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en-US\">help i'm a bug</div>", new XhtmlNode().setValue(dt.getValue()).getValueAsString());
|
||||
Assertions.assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en-US\">help i'm a bug</div>", dt.getValueAsString());
|
||||
Assertions.assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en-US\">help i'm a bug</div>", new XhtmlNode().setValue(dt.getValue()).getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseRsquo() {
|
||||
XhtmlNode dt = new XhtmlNode();
|
||||
dt.setValueAsString("It’s January again");
|
||||
assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\">It’s January again</div>", dt.getValueAsString());
|
||||
assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\">It’s January again</div>", new XhtmlNode().setValue(dt.getValue()).getValueAsString());
|
||||
Assertions.assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\">It’s January again</div>", dt.getValueAsString());
|
||||
Assertions.assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\">It’s January again</div>", new XhtmlNode().setValue(dt.getValue()).getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProcessingInstructionNotPreserved() {
|
||||
XhtmlNode dt = new XhtmlNode();
|
||||
dt.setValueAsString("<?xml version=\"1.0\" encoding=\"UTF-8\"?><div xmlns=\"http://www.w3.org/1999/xhtml\">help i'm a bug</div>");
|
||||
assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\">help i'm a bug</div>", dt.getValueAsString());
|
||||
assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\">help i'm a bug</div>", new XhtmlNode().setValue(dt.getValue()).getValueAsString());
|
||||
Assertions.assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\">help i'm a bug</div>", dt.getValueAsString());
|
||||
Assertions.assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\">help i'm a bug</div>", new XhtmlNode().setValue(dt.getValue()).getValueAsString());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -71,7 +70,7 @@ public class XhtmlNodeTest {
|
|||
String output = node.getValueAsString();
|
||||
ourLog.info(output);
|
||||
|
||||
assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\"><img src=\"http://pbs.twimg.com/profile_images/544507893991485440/r_vo3uj2_bigger.png\" alt=\"Twitter Avatar\"/>@fhirabend</div>", output);
|
||||
Assertions.assertEquals("<div xmlns=\"http://www.w3.org/1999/xhtml\"><img src=\"http://pbs.twimg.com/profile_images/544507893991485440/r_vo3uj2_bigger.png\" alt=\"Twitter Avatar\"/>@fhirabend</div>", output);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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.")
|
||||
|
|
Loading…
Reference in New Issue