Compare commits

..

No commits in common. "1a14d2e19e920771cf636121b409f99df8124524" and "9146b79b14cdd47de9d64714cda3bfc48554d977" have entirely different histories.

8 changed files with 20 additions and 68 deletions

3
Jenkinsfile vendored
View File

@ -47,7 +47,8 @@ pipeline {
// archive scenario-test reports in HTML format // archive scenario-test reports in HTML format
sh ''' sh '''
gw convertMarkdownToHtml cd doc/scenarios
./to-html
''' '''
archiveArtifacts artifacts: 'doc/scenarios/*.html', allowEmptyArchive: true archiveArtifacts artifacts: 'doc/scenarios/*.html', allowEmptyArchive: true

View File

@ -391,45 +391,3 @@ tasks.named("dependencyUpdates").configure {
isNonStable(it.candidate.version) isNonStable(it.candidate.version)
} }
} }
// Generate HTML from Markdown scenario-test-reports using Pandoc:
tasks.register('convertMarkdownToHtml') {
description = 'Generates HTML from Markdown scenario-test-reports using Pandoc.'
group = 'Conversion'
// Define the template file and input directory
def templateFile = file('doc/scenarios/template.html')
// Task configuration and execution
doFirst {
// Check if pandoc is installed
try {
exec {
commandLine 'pandoc', '--version'
}
} catch (Exception) {
throw new GradleException("Pandoc is not installed or not found in the system path.")
}
// Check if the template file exists
if (!templateFile.exists()) {
throw new GradleException("Template file 'doc/scenarios/template.html' not found.")
}
}
doLast {
// Gather all Markdown files in the current directory
fileTree(dir: '.', include: 'doc/scenarios/*.md').each { file ->
// Corrected way to create the output file path
def outputFile = new File(file.parent, file.name.replaceAll(/\.md$/, '.html'))
// Execute pandoc for each markdown file
exec {
commandLine 'pandoc', file.absolutePath, '--template', templateFile.absolutePath, '-o', outputFile.absolutePath
}
println "Converted ${file.name} to ${outputFile.name}"
}
}
}

11
doc/scenarios/to-html Executable file
View File

@ -0,0 +1,11 @@
#!/bin/bash
# This script loops over all markdown (.md) files in the current directory
# and converts each to an HTML file using pandoc using template.html.
# Origin of the template (GPL v3.0):
# https://github.com/ryangrose/easy-pandoc-templates/blob/master/html/easy_template.html
for file in *.md; do
pandoc "$file" --template template.html -o "${file%.md}.html"
done

View File

@ -196,10 +196,10 @@ public abstract class UseCase<T extends UseCase<?>> {
protected void verify( protected void verify(
final String title, final String title,
final Supplier<UseCase.HttpResponse> http, final Supplier<UseCase.HttpResponse> http,
final Consumer<UseCase.HttpResponse>... assertions) { final Consumer<UseCase.HttpResponse> assertion) {
withTitle(ScenarioTest.resolve(title), () -> { withTitle(ScenarioTest.resolve(title), () -> {
final var response = http.get(); final var response = http.get();
Arrays.stream(assertions).forEach(assertion -> assertion.accept(response)); assertion.accept(response);
return response; return response;
}); });
} }

View File

@ -64,15 +64,4 @@ public class AddOperationsContactToPartner extends UseCase<AddOperationsContactT
""")) """))
.expecting(CREATED).expecting(JSON); .expecting(CREATED).expecting(JSON);
} }
@Override
protected void verify() {
verify(
"Verify the New OPERATIONS Relation",
() -> httpGet("/api/hs/office/relations?relationType=OPERATIONS&personData=" + uriEncoded(
"%{operationsContactFamilyName}"))
.expecting(OK).expecting(JSON).expectArrayElements(1),
path("[0].contact.caption").contains("%{operationsContactGivenName} %{operationsContactFamilyName}")
);
}
} }

View File

@ -69,7 +69,7 @@ public class AddRepresentativeToPartner extends UseCase<AddRepresentativeToPartn
@Override @Override
protected void verify() { protected void verify() {
verify( verify(
"Verify the REPRESENTATIVE Relation Got Removed", "Verify the New REPRESENTATIVE Relation",
() -> httpGet("/api/hs/office/relations?relationType=REPRESENTATIVE&personData=" + uriEncoded("%{representativeFamilyName}")) () -> httpGet("/api/hs/office/relations?relationType=REPRESENTATIVE&personData=" + uriEncoded("%{representativeFamilyName}"))
.expecting(OK).expecting(JSON).expectArrayElements(1), .expecting(OK).expecting(JSON).expectArrayElements(1),
path("[0].contact.caption").contains("%{representativeGivenName} %{representativeFamilyName}") path("[0].contact.caption").contains("%{representativeGivenName} %{representativeFamilyName}")

View File

@ -78,7 +78,8 @@ public class CreatePartner extends UseCase<CreatePartner> {
verify( verify(
"Verify the New Partner Relation", "Verify the New Partner Relation",
() -> httpGet("/api/hs/office/relations?relationType=PARTNER&personData=" + uriEncoded("%{%{tradeName???}???%{givenName???} %{familyName???}}")) () -> httpGet("/api/hs/office/relations?relationType=PARTNER&personData=" + uriEncoded("%{%{tradeName???}???%{givenName???} %{familyName???}}"))
.expecting(OK).expecting(JSON).expectArrayElements(1) .expecting(OK).expecting(JSON).expectArrayElements(1),
path("[0].contact.caption").contains("%{contactCaption}")
); );
} }
} }

View File

@ -25,19 +25,11 @@ public class RemoveOperationsContactFromPartner extends UseCase<RemoveOperations
"In production, data this query could result in multiple outputs. In that case, you have to find out which is the right one." "In production, data this query could result in multiple outputs. In that case, you have to find out which is the right one."
); );
return withTitle("Delete the Contact", () -> withTitle("Delete the Contact", () ->
httpDelete("/api/hs/office/relations/&{Operations-Contact: %{operationsContactPerson}}") httpDelete("/api/hs/office/relations/&{Operations-Contact: %{operationsContactPerson}}")
.expecting(NO_CONTENT) .expecting(NO_CONTENT)
); );
}
@Override return null;
protected void verify() {
verify(
"Verify the New OPERATIONS Relation",
() -> httpGet("/api/hs/office/relations?relationType=OPERATIONS&personData=" + uriEncoded(
"%{operationsContactFamilyName}"))
.expecting(OK).expecting(JSON).expectArrayElements(0)
);
} }
} }