From c21490f74c432cbc85748e023475d39029eca205 Mon Sep 17 00:00:00 2001 From: mfd2007 <58845044+mfd2007@users.noreply.github.com> Date: Wed, 19 Jul 2023 16:05:16 +0200 Subject: [PATCH 01/13] Add Karate framework and some integration tests --- build.gradle | 7 + .../integration/KarateRunner.java | 17 +++ .../integration/export.feature | 90 ++++++++++++ .../integration/fullworkflow.feature | 128 ++++++++++++++++++ .../csaf_cms_backend/integration/min.json | 38 ++++++ .../integration/template.feature | 78 +++++++++++ 6 files changed, 358 insertions(+) create mode 100644 src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/KarateRunner.java create mode 100644 src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/export.feature create mode 100644 src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/fullworkflow.feature create mode 100644 src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/min.json create mode 100644 src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/template.feature diff --git a/build.gradle b/build.gradle index 55f8062e..7a70e833 100644 --- a/build.gradle +++ b/build.gradle @@ -65,6 +65,9 @@ dependencies { testImplementation 'org.testcontainers:junit-jupiter:1.18.3' testImplementation 'org.mockito:mockito-inline:5.2.0' + // used for integration tests in de.bsi.secvisogram.csaf_cms_backend.integration.KarateRunner + testImplementation 'com.intuit.karate:karate-junit5:1.4.0' + spotbugsSlf4j 'org.slf4j:slf4j-simple:2.0.7' spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.12.0' @@ -74,6 +77,10 @@ dependencies { test { useJUnitPlatform() testLogging.showStandardStreams = false + filter { + //exclude all integration tests + excludeTestsMatching "de.bsi.secvisogram.csaf_cms_backend.integration.*" + } } tasks.withType(JavaCompile) { diff --git a/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/KarateRunner.java b/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/KarateRunner.java new file mode 100644 index 00000000..c088aed8 --- /dev/null +++ b/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/KarateRunner.java @@ -0,0 +1,17 @@ +package de.bsi.secvisogram.csaf_cms_backend.integration; + +import com.intuit.karate.junit5.Karate; + + +public class KarateRunner{ + @Karate.Test + Karate testSample() { + + String[] testCases = new String[] { + //"classpath:de/bsi/secvisogram/csaf_cms_backend/integration/sample.feature", + "classpath:de/bsi/secvisogram/csaf_cms_backend/integration/fullworkflow.feature" + // "classpath:de/bsi/secvisogram/csaf_cms_backend/integration/export.feature" + }; + return Karate.run(testCases); + } +} diff --git a/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/export.feature b/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/export.feature new file mode 100644 index 00000000..c8e8944d --- /dev/null +++ b/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/export.feature @@ -0,0 +1,90 @@ +Feature: Test export of documents + + Background: + * def authUrl = 'http://localhost:9000' + * def loginPath = '/realms/csaf/protocol/openid-connect/token' + * def logoutPath = '/realms/csaf/protocol/openid-connect/logout' + + * def restUrl = 'http://localhost:8081' + * def apiBase = '/api/v1/advisories' + + * def username = 'all' + * def password = 'all' + + Scenario: Export all formats and store response in folder ./target/ + The first document in the list will be exported in all available + formats. + + # Login + Given url 'http://localhost:9000/realms/csaf/protocol/openid-connect/token' + * form field client_id = 'secvisogram' + * form field username = 'all' + * form field password = 'all' + * form field grant_type = 'password' + * form field response_type = 'code' + * form field audience = 'secvisogram' + * form field requested_token_type = 'ID' + When method post + Then status 200 + * def accessToken = response.access_token + * def refreshToken = response.refresh_token + * def session = response.session_state + + #Get advisory list and store first advisory id + Given url 'http://localhost:8081' + * path apiBase + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/json' + When method get + Then status 200 + * def advisoryId = response[0].advisoryId + + # Download advisory as JSON + * def format = 'JSON' + Given path apiBase + '/' + advisoryId + '/csaf' + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/json' + * param format = format + When method get + Then status 200 + * karate.write(response, 'advisory.json') + + # Download advisory as HTML + * def format = 'HTML' + Given path apiBase + '/' + advisoryId + '/csaf' + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/json' + * param format = format + When method get + Then status 200 + * karate.write(response, 'advisory.html') + + # Download advisory as PDF + * def format = 'PDF' + Given path apiBase + '/' + advisoryId + '/csaf' + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/json' + * param format = format + When method get + Then status 200 + * karate.write(response, 'advisory.pdf') + + # Download advisory as Markdown + * def format = 'Markdown' + Given path apiBase + '/' + advisoryId + '/csaf' + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/json' + * param format = format + When method get + Then status 200 + * karate.write(response, 'advisory.md') + + # Logout + Given url 'http://localhost:9000/realms/csaf/protocol/openid-connect/logout' + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/x-www-form-urlencoded' + * form field refresh_token = refreshToken + * form field client_id = 'secvisogram' + When method post + * status 204 + \ No newline at end of file diff --git a/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/fullworkflow.feature b/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/fullworkflow.feature new file mode 100644 index 00000000..4dddfae4 --- /dev/null +++ b/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/fullworkflow.feature @@ -0,0 +1,128 @@ +Feature: Hello World + + Background: + * url 'http://localhost:8081' + * def apiBase = '/api/v1/advisories' + + Scenario: oauth 2 flow + # Login + Given url 'http://localhost:9000/realms/csaf/protocol/openid-connect/token' + * form field client_id = 'secvisogram' + * form field username = 'all' + * form field password = 'all' + * form field grant_type = 'password' + * form field response_type = 'code' + * form field audience = 'secvisogram' + * form field requested_token_type = 'ID' + When method post + Then status 200 + * def accessToken = response.access_token + * def refreshToken = response.refresh_token + * def session = response.session_state + + ######## + #Upload + Given url 'http://localhost:8081' + * path apiBase + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/json' + * request read('min.json') + When method post + Then status 201 + * def advisoryId = response.id + * def revision = response.revision + + ######## + #Change workflow state to Review + # + # Draft, Review, Approved, RfPublication, Published + * def workflowStatus = 'Review' + Given path apiBase + '/' + advisoryId + '/workflowstate/' + workflowStatus + * param revision = revision + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/json' + When method patch + Then status 200 + + # Get new revision after workflow state change + Given path apiBase + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/json' + When method get + Then status 200 + * def filt = function(x){ return x.advisoryId == advisoryId } + * def items = get response[*] + * def revision = karate.filter(items, filt)[0].revision + + ######## + #Change workflow state to Approved + # + * def workflowStatus = 'Approved' + Given path apiBase + '/' + advisoryId + '/workflowstate/' + workflowStatus + * param revision = revision + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/json' + When method patch + Then status 200 + # Get new revision after workflow state change + Given path apiBase + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/json' + When method get + Then status 200 + * def filt = function(x){ return x.advisoryId == advisoryId } + * def items = get response[*] + * def revision = karate.filter(items, filt)[0].revision + + ######## + #Change workflow state to RfPublication + # + * def workflowStatus = 'RfPublication' + Given path apiBase + '/' + advisoryId + '/workflowstate/' + workflowStatus + * param revision = revision + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/json' + When method patch + Then status 200 + # Get new revision after workflow state change + Given path apiBase + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/json' + When method get + Then status 200 + * def filt = function(x){ return x.advisoryId == advisoryId } + * def items = get response[*] + * def revision = karate.filter(items, filt)[0].revision + + ######## + #Change workflow state to Published + # + * def workflowStatus = 'Published' + Given path apiBase + '/' + advisoryId + '/workflowstate/' + workflowStatus + * param revision = revision + # final, interim, draft + * param documentTrackingStatus = 'Final' + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/json' + When method patch + Then status 200 + + # Get new revision after workflow state change + Given path apiBase + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/json' + When method get + Then status 200 + * def filt = function(x){ return x.advisoryId == advisoryId } + * def items = get response[*] + * def revision = karate.filter(items, filt)[0].revision + + # Logout + Given url 'http://localhost:9000/realms/csaf/protocol/openid-connect/logout' + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/x-www-form-urlencoded' + * form field refresh_token = refreshToken + * form field client_id = 'secvisogram' + When method post + * status 204 + \ No newline at end of file diff --git a/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/min.json b/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/min.json new file mode 100644 index 00000000..0751f544 --- /dev/null +++ b/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/min.json @@ -0,0 +1,38 @@ +{ + "csaf": { + "document": { + "category": "csaf_base", + "csaf_version": "2.0", + "publisher": { + "category": "other", + "name": "1", + "namespace": "h:2" + }, + "title": "title", + "tracking": { + "current_release_date": "2023-07-12T10:00:00.000Z", + "generator": { + "date": "2023-07-12T07:53:29.378Z", + "engine": { + "name": "Secvisogram", + "version": "2.2.5" + } + }, + "id": "document-id", + "initial_release_date": "2023-07-12T10:00:00.000Z", + "revision_history": [ + { + "date": "2023-07-12T10:00:00.000Z", + "number": "1.0.0", + "summary": "summary" + } + ], + "status": "final", + "version": "1.0.0" + } + } + }, + "summary": "-", + "legacyVersion": "" +} + \ No newline at end of file diff --git a/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/template.feature b/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/template.feature new file mode 100644 index 00000000..b49fa903 --- /dev/null +++ b/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/template.feature @@ -0,0 +1,78 @@ +Feature: Hello World + + Background: + * url 'http://localhost:8081' + * def apiBase = '/api/v1/' + + Scenario: oauth 2 flow + + #Login + Given url 'http://localhost:9000/realms/csaf/protocol/openid-connect/token' + * form field client_id = 'secvisogram' + * form field username = 'all' + * form field password = 'all' + * form field grant_type = 'password' + * form field response_type = 'code' + * form field audience = 'secvisogram' + * form field requested_token_type = 'ID' + When method post + Then status 200 + * def accessToken = response.access_token + * def refreshToken = response.refresh_token + * def session = response.session_state + + #Upload + Given url 'http://localhost:8081' + * path apiBase + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/json' + * request read('min.json') + When method post + Then status 201 + * def advisoryId = response.id + * def revision = response.revision + + #Get advisory list + Given path apiBase + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/json' + When method get + Then status 200 + + #Get advisory + Given path apiBase + '/' + advisoryId + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/json' + When method get + Then status 200 + + #Change workflow state + + # Draft, Review, Approved, RfPublication, Published + * def workflowStatus = 'Review' + Given path apiBase + '/' + advisoryId + '/workflowstate/' + workflowStatus + * param revision = revision + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/json' + When method patch + Then status 200 + + # Get new revision after workflow state change + Given path apiBase + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/json' + When method get + Then status 200 + * def filt = function(x){ return x.advisoryId == advisoryId } + * def items = get response[*] + * def revision = karate.filter(items, filt)[0].revision + + #Logout + Given url 'http://localhost:9000/realms/csaf/protocol/openid-connect/logout' + * header Authorization = 'Bearer ' + accessToken + * header Content-Type = 'application/x-www-form-urlencoded' + * form field refresh_token = refreshToken + * form field client_id = 'secvisogram' + When method post + * status 204 + \ No newline at end of file From 7897c8c6cfa6a7d8f11672bcfd301d213b615b54 Mon Sep 17 00:00:00 2001 From: mfd2007 <58845044+mfd2007@users.noreply.github.com> Date: Thu, 20 Jul 2023 07:14:06 +0200 Subject: [PATCH 02/13] style: fix whitespace --- .../secvisogram/csaf_cms_backend/integration/KarateRunner.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/KarateRunner.java b/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/KarateRunner.java index c088aed8..04269b8e 100644 --- a/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/KarateRunner.java +++ b/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/KarateRunner.java @@ -3,7 +3,7 @@ import com.intuit.karate.junit5.Karate; -public class KarateRunner{ +public class KarateRunner { @Karate.Test Karate testSample() { From 66749fce629f284e60768e43414102c4ed83ea6f Mon Sep 17 00:00:00 2001 From: mfd2007 <58845044+mfd2007@users.noreply.github.com> Date: Tue, 8 Aug 2023 14:43:18 +0200 Subject: [PATCH 03/13] Add test case for local integration tests. --- README.md | 7 +++++++ build.gradle | 9 +++++++++ .../csaf_cms_backend/integration/KarateRunner.java | 13 +++++++++---- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c1c44eeb..06b39ab9 100644 --- a/README.md +++ b/README.md @@ -151,6 +151,13 @@ CouchDb Info (port is defined in .env): [http://localhost:5984/](http://localhost:5984/) +### Integration tests with Karate + +The folder `src/test/java/de.bsi.secvisogram.csaf_cms_backend.integration/`contains [Karate](https://github.com/karatelabs/karate) test files. + +Use `./gradlew integrationTest` to run the tests. CSAF-CMS-Backend and all other components must be up an running on localhost. Host and ports can be changed in the feature-files. `template.feature`-file contains all basic request to build that can be used to assemble futher workflow. + + ## Contributing You can find our guidelines here [CONTRIBUTING.md](https://github.com/secvisogram/secvisogram/blob/main/CONTRIBUTING.md) diff --git a/build.gradle b/build.gradle index 1ca46163..3ade65fc 100644 --- a/build.gradle +++ b/build.gradle @@ -84,6 +84,15 @@ test { } } +tasks.register('integrationTest', Test) { + useJUnitPlatform() + testLogging.showStandardStreams = false + filter { + //exclude all integration tests + includeTestsMatching("de.bsi.secvisogram.csaf_cms_backend.integration.*") + } +} + tasks.withType(JavaCompile) { options.compilerArgs += ['-Xlint:deprecation,unchecked'] } diff --git a/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/KarateRunner.java b/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/KarateRunner.java index 04269b8e..6bdf9e29 100644 --- a/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/KarateRunner.java +++ b/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/KarateRunner.java @@ -5,12 +5,17 @@ public class KarateRunner { @Karate.Test - Karate testSample() { - + Karate testExport() { + String[] testCases = new String[] { + "classpath:de/bsi/secvisogram/csaf_cms_backend/integration/export.feature" + }; + return Karate.run(testCases); + } + + @Karate.Test + Karate testFullWorkflow() { String[] testCases = new String[] { - //"classpath:de/bsi/secvisogram/csaf_cms_backend/integration/sample.feature", "classpath:de/bsi/secvisogram/csaf_cms_backend/integration/fullworkflow.feature" - // "classpath:de/bsi/secvisogram/csaf_cms_backend/integration/export.feature" }; return Karate.run(testCases); } From 23ea07fffe35520c47c8403e621b9c9790c9d8ed Mon Sep 17 00:00:00 2001 From: mfd2007 <58845044+mfd2007@users.noreply.github.com> Date: Thu, 17 Aug 2023 11:48:11 +0200 Subject: [PATCH 04/13] Move feature files to ressources --- .../bsi/secvisogram/csaf_cms_backend/integration/export.feature | 0 .../secvisogram/csaf_cms_backend/integration/fullworkflow.feature | 0 .../de/bsi/secvisogram/csaf_cms_backend/integration/min.json | 0 .../bsi/secvisogram/csaf_cms_backend/integration/template.feature | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename src/test/{java => resources}/de/bsi/secvisogram/csaf_cms_backend/integration/export.feature (100%) rename src/test/{java => resources}/de/bsi/secvisogram/csaf_cms_backend/integration/fullworkflow.feature (100%) rename src/test/{java => resources}/de/bsi/secvisogram/csaf_cms_backend/integration/min.json (100%) rename src/test/{java => resources}/de/bsi/secvisogram/csaf_cms_backend/integration/template.feature (100%) diff --git a/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/export.feature b/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/export.feature similarity index 100% rename from src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/export.feature rename to src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/export.feature diff --git a/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/fullworkflow.feature b/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/fullworkflow.feature similarity index 100% rename from src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/fullworkflow.feature rename to src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/fullworkflow.feature diff --git a/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/min.json b/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/min.json similarity index 100% rename from src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/min.json rename to src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/min.json diff --git a/src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/template.feature b/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/template.feature similarity index 100% rename from src/test/java/de/bsi/secvisogram/csaf_cms_backend/integration/template.feature rename to src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/template.feature From ba208764050f8f1c900661819416934f09fa221e Mon Sep 17 00:00:00 2001 From: mfd2007 <58845044+mfd2007@users.noreply.github.com> Date: Thu, 17 Aug 2023 11:48:24 +0200 Subject: [PATCH 05/13] Update documetation --- README.md | 6 ++++-- build.gradle | 5 ++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 06b39ab9..b87da766 100644 --- a/README.md +++ b/README.md @@ -153,9 +153,11 @@ CouchDb Info (port is defined in .env): ### Integration tests with Karate -The folder `src/test/java/de.bsi.secvisogram.csaf_cms_backend.integration/`contains [Karate](https://github.com/karatelabs/karate) test files. +The folder `src/test/java/de.bsi.secvisogram.csaf_cms_backend.integration/` & `src/test/java/de.bsi.secvisogram.csaf_cms_backend.integration/` contains [Karate](https://github.com/karatelabs/karate) test files. -Use `./gradlew integrationTest` to run the tests. CSAF-CMS-Backend and all other components must be up an running on localhost. Host and ports can be changed in the feature-files. `template.feature`-file contains all basic request to build that can be used to assemble futher workflow. +Use `./gradlew integrationTest` to run the tests. CSAF-CMS-Backend and all other components must be up an running with the development setup described above. + +Settings (like hostnames, port, user and password) can can be changed in the feature-files. `template.feature`-file contains all basic request to build that can be used to assemble futher workflow. ## Contributing diff --git a/build.gradle b/build.gradle index cc70f73e..4e4cc21f 100644 --- a/build.gradle +++ b/build.gradle @@ -86,11 +86,10 @@ test { tasks.register('integrationTest', Test) { useJUnitPlatform() - testLogging.showStandardStreams = false + testLogging.showStandardStreams = true filter { - //exclude all integration tests includeTestsMatching("de.bsi.secvisogram.csaf_cms_backend.integration.*") - } + } } tasks.withType(JavaCompile) { From ba3dbd3480a552719eba6d46ffff5a8ec4aa676c Mon Sep 17 00:00:00 2001 From: mfd2007 <58845044+mfd2007@users.noreply.github.com> Date: Mon, 23 Oct 2023 15:53:37 +0200 Subject: [PATCH 06/13] docs: Fix typo Co-authored-by: tschmidtb51 <65305130+tschmidtb51@users.noreply.github.com> --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b87da766..6d209f25 100644 --- a/README.md +++ b/README.md @@ -157,7 +157,7 @@ The folder `src/test/java/de.bsi.secvisogram.csaf_cms_backend.integration/` & `s Use `./gradlew integrationTest` to run the tests. CSAF-CMS-Backend and all other components must be up an running with the development setup described above. -Settings (like hostnames, port, user and password) can can be changed in the feature-files. `template.feature`-file contains all basic request to build that can be used to assemble futher workflow. +Settings (like hostnames, port, user and password) can be changed in the feature-files. `template.feature`-file contains all basic request to build that can be used to assemble futher workflow. ## Contributing From 4fe7c6bda7a38345e4b24328fd24b883964dd129 Mon Sep 17 00:00:00 2001 From: mfd2007 <58845044+mfd2007@users.noreply.github.com> Date: Mon, 23 Oct 2023 15:54:14 +0200 Subject: [PATCH 07/13] fix: Wrong test title Co-authored-by: tschmidtb51 <65305130+tschmidtb51@users.noreply.github.com> --- .../csaf_cms_backend/integration/fullworkflow.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/fullworkflow.feature b/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/fullworkflow.feature index 4dddfae4..6d8685ef 100644 --- a/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/fullworkflow.feature +++ b/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/fullworkflow.feature @@ -1,4 +1,4 @@ -Feature: Hello World +Feature: Full workflow Background: * url 'http://localhost:8081' From 39c7412769520e8478d297423c7809234050249a Mon Sep 17 00:00:00 2001 From: mfd2007 <58845044+mfd2007@users.noreply.github.com> Date: Mon, 23 Oct 2023 15:55:16 +0200 Subject: [PATCH 08/13] test: Improve test data Co-authored-by: tschmidtb51 <65305130+tschmidtb51@users.noreply.github.com> --- .../de/bsi/secvisogram/csaf_cms_backend/integration/min.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/min.json b/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/min.json index 0751f544..1c19bb3e 100644 --- a/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/min.json +++ b/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/min.json @@ -5,8 +5,8 @@ "csaf_version": "2.0", "publisher": { "category": "other", - "name": "1", - "namespace": "h:2" + "name": "Automated test data", + "namespace": "https://www.example.com" }, "title": "title", "tracking": { From e4634bf517cc315e43f1f31547ad51680928a634 Mon Sep 17 00:00:00 2001 From: mfd2007 <58845044+mfd2007@users.noreply.github.com> Date: Mon, 23 Oct 2023 15:55:26 +0200 Subject: [PATCH 09/13] test: Improve test data Co-authored-by: tschmidtb51 <65305130+tschmidtb51@users.noreply.github.com> --- .../de/bsi/secvisogram/csaf_cms_backend/integration/min.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/min.json b/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/min.json index 1c19bb3e..158f29d7 100644 --- a/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/min.json +++ b/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/min.json @@ -24,7 +24,7 @@ { "date": "2023-07-12T10:00:00.000Z", "number": "1.0.0", - "summary": "summary" + "summary": "Initial publication" } ], "status": "final", From 1556a14a76cf15a522d3bd6311cc72358df1eead Mon Sep 17 00:00:00 2001 From: mfd2007 <58845044+mfd2007@users.noreply.github.com> Date: Mon, 23 Oct 2023 15:55:39 +0200 Subject: [PATCH 10/13] fix: Wrong test title Co-authored-by: tschmidtb51 <65305130+tschmidtb51@users.noreply.github.com> --- .../secvisogram/csaf_cms_backend/integration/template.feature | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/template.feature b/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/template.feature index b49fa903..0cb92ea0 100644 --- a/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/template.feature +++ b/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/template.feature @@ -1,4 +1,4 @@ -Feature: Hello World +Feature: Template Background: * url 'http://localhost:8081' From 2f18434ca7af4783e402c0b5ff70be17bd4e9808 Mon Sep 17 00:00:00 2001 From: mfd2007 <58845044+mfd2007@users.noreply.github.com> Date: Thu, 26 Oct 2023 10:01:48 +0200 Subject: [PATCH 11/13] style: Fix wrong intents --- .../integration/fullworkflow.feature | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/fullworkflow.feature b/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/fullworkflow.feature index 6d8685ef..279f56d0 100644 --- a/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/fullworkflow.feature +++ b/src/test/resources/de/bsi/secvisogram/csaf_cms_backend/integration/fullworkflow.feature @@ -51,8 +51,8 @@ Feature: Full workflow When method get Then status 200 * def filt = function(x){ return x.advisoryId == advisoryId } - * def items = get response[*] - * def revision = karate.filter(items, filt)[0].revision + * def items = get response[*] + * def revision = karate.filter(items, filt)[0].revision ######## #Change workflow state to Approved @@ -71,8 +71,8 @@ Feature: Full workflow When method get Then status 200 * def filt = function(x){ return x.advisoryId == advisoryId } - * def items = get response[*] - * def revision = karate.filter(items, filt)[0].revision + * def items = get response[*] + * def revision = karate.filter(items, filt)[0].revision ######## #Change workflow state to RfPublication @@ -91,8 +91,8 @@ Feature: Full workflow When method get Then status 200 * def filt = function(x){ return x.advisoryId == advisoryId } - * def items = get response[*] - * def revision = karate.filter(items, filt)[0].revision + * def items = get response[*] + * def revision = karate.filter(items, filt)[0].revision ######## #Change workflow state to Published @@ -114,8 +114,8 @@ Feature: Full workflow When method get Then status 200 * def filt = function(x){ return x.advisoryId == advisoryId } - * def items = get response[*] - * def revision = karate.filter(items, filt)[0].revision + * def items = get response[*] + * def revision = karate.filter(items, filt)[0].revision # Logout Given url 'http://localhost:9000/realms/csaf/protocol/openid-connect/logout' From dd973c0735a701d783c08ecf247945fa9bc09769 Mon Sep 17 00:00:00 2001 From: mfd2007 <58845044+mfd2007@users.noreply.github.com> Date: Fri, 2 May 2025 06:35:52 +0200 Subject: [PATCH 12/13] chore: Update github actions --- .github/workflows/github-actions.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 7345f577..5a75a276 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -29,14 +29,14 @@ jobs: files: ${{ github.workspace }}/target/surefire-reports/**/*.xml - name: Add coverage to PR id: jacoco - uses: madrapps/jacoco-report@v1.6.1 # requires at least two pushes to a PR, see https://github.com/Madrapps/jacoco-report/issues/13 + uses: madrapps/jacoco-report@v1.7.1 # requires at least two pushes to a PR, see https://github.com/Madrapps/jacoco-report/issues/13 with: paths: ${{ github.workspace }}/target/jacoco-report/jacoco.xml token: ${{ secrets.GITHUB_TOKEN }} min-coverage-overall: 40 min-coverage-changed-files: 60 - name: Archive code coverage results - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: code-coverage-report path: target/jacoco-report/** @@ -64,7 +64,7 @@ jobs: - name: Check out code uses: actions/checkout@v3 - name: Lint markdowns - uses: nosborn/github-action-markdown-cli@v3.0.1 + uses: nosborn/github-action-markdown-cli@v3.4.0 with: files: '**/*.md' From fc7c8ed20dda14ae6317838db95ecbbe1334c92e Mon Sep 17 00:00:00 2001 From: mfd2007 <58845044+mfd2007@users.noreply.github.com> Date: Fri, 2 May 2025 07:28:58 +0200 Subject: [PATCH 13/13] chore: add karate to dependecies --- pom.xml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pom.xml b/pom.xml index 08204fa7..2ae740ed 100644 --- a/pom.xml +++ b/pom.xml @@ -32,6 +32,7 @@ 23.0.3 24.0.0 4.8.4 + 1.5.1 @@ -262,6 +263,13 @@ junit-jupiter test + + + io.karatelabs + karate-junit5 + ${dependency.version.karate} + test +