From ff7893747e6f57c3b85ab80eba5e8b5805cbd940 Mon Sep 17 00:00:00 2001 From: Laurens Debackere Date: Tue, 19 Mar 2024 16:40:35 +0100 Subject: [PATCH 1/6] ci(sigrid): update sigrid pipeline to include maven dependency tree --- bitbucket-pipelines.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index c794b1b2..cc50c1af 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -71,11 +71,13 @@ definitions: image: softwareimprovementgroup/sigridci name: Publish to Sigrid script: + - mvn dependency:tree > maven.tree - timeout 10m sigridci.py --customer $SIGRID_CI_ACCOUNT --system "Solid" --subsystem $(echo "magdamock.service"| sed -e "s/\./-/g") --source . --publish --include-history - step: &sigridCI image: softwareimprovementgroup/sigridci name: Sigrid CI script: + - mvn dependency:tree > maven.tree - timeout 10m sigridci.py --customer $SIGRID_CI_ACCOUNT --system "Solid" --subsystem $(echo "magdamock.service"| sed -e "s/\./-/g") --source . - step: &githubMirror name: Sync to Github From 5264c09b2f097b3f5ec5ae12cee08e1ad00862a8 Mon Sep 17 00:00:00 2001 From: Laurens Debackere Date: Tue, 19 Mar 2024 16:46:49 +0100 Subject: [PATCH 2/6] ci: update pipeline to only run upon PR and build dep tree --- bitbucket-pipelines.yml | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/bitbucket-pipelines.yml b/bitbucket-pipelines.yml index cc50c1af..88e58df5 100644 --- a/bitbucket-pipelines.yml +++ b/bitbucket-pipelines.yml @@ -71,13 +71,17 @@ definitions: image: softwareimprovementgroup/sigridci name: Publish to Sigrid script: - - mvn dependency:tree > maven.tree - timeout 10m sigridci.py --customer $SIGRID_CI_ACCOUNT --system "Solid" --subsystem $(echo "magdamock.service"| sed -e "s/\./-/g") --source . --publish --include-history + - step: &dependencyTree + name: Dependency tree + caches: + - maven + script: + - mvn dependency:tree > maven.tree - step: &sigridCI image: softwareimprovementgroup/sigridci name: Sigrid CI script: - - mvn dependency:tree > maven.tree - timeout 10m sigridci.py --customer $SIGRID_CI_ACCOUNT --system "Solid" --subsystem $(echo "magdamock.service"| sed -e "s/\./-/g") --source . - step: &githubMirror name: Sync to Github @@ -91,9 +95,6 @@ clone: depth: full pipelines: - default: - - step: - <<: *build branches: master: - parallel: @@ -109,6 +110,8 @@ pipelines: - mvn org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate -Dexpression=project.version -q -DforceStdout > target/pom_version artifacts: - target/pom_version + - step: + <<: *dependencyTree - step: <<: *sigridPublish - step: @@ -147,6 +150,8 @@ pipelines: artifacts: - "**/*.jar" - target/pom_version + - step: + <<: *dependencyTree - step: <<: *sigridPublish - step: @@ -200,6 +205,8 @@ pipelines: - mvn -B -U clean verify sonar:sonar -s .m2/settings.xml -Dbuild=bitbucket -Dsonar.host.url=${SONAR_HOST} -Dsonar.projectKey=${SONAR_PROJECT} -Dsonar.login=${SONAR_USERNAME} -Dsonar.password=${SONAR_PASSWORD} -Dsonar.branch.name="$BITBUCKET_BRANCH" artifacts: - "**/*.jar" + - step: + <<: *dependencyTree - step: <<: *sigridCI custom: From bc38b59a8c778e485fe65131095b5f6d0bb1ccb3 Mon Sep 17 00:00:00 2001 From: bitbucket-pipelines Date: Wed, 20 Mar 2024 09:17:55 +0000 Subject: [PATCH 3/6] Update for next development version --- common/pom.xml | 2 +- interfaces/pom.xml | 2 +- magdaconnector/pom.xml | 2 +- magdamock-starter/pom.xml | 2 +- magdamock/pom.xml | 2 +- magdaservice/pom.xml | 2 +- pom.xml | 2 +- signing/pom.xml | 2 +- tester/pom.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/common/pom.xml b/common/pom.xml index e2a03f1c..402b67c7 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.12.0 + 2.13.0-SNAPSHOT 4.0.0 diff --git a/interfaces/pom.xml b/interfaces/pom.xml index 101e99d4..a28e3c6b 100644 --- a/interfaces/pom.xml +++ b/interfaces/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.12.0 + 2.13.0-SNAPSHOT 4.0.0 diff --git a/magdaconnector/pom.xml b/magdaconnector/pom.xml index c887780c..287e48d6 100644 --- a/magdaconnector/pom.xml +++ b/magdaconnector/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.12.0 + 2.13.0-SNAPSHOT 4.0.0 diff --git a/magdamock-starter/pom.xml b/magdamock-starter/pom.xml index e9dc5f63..2f87a963 100644 --- a/magdamock-starter/pom.xml +++ b/magdamock-starter/pom.xml @@ -8,7 +8,7 @@ magda be.vlaanderen.vip.mock - 2.12.0 + 2.13.0-SNAPSHOT magdamock-starter diff --git a/magdamock/pom.xml b/magdamock/pom.xml index ec98b910..b5a6e352 100644 --- a/magdamock/pom.xml +++ b/magdamock/pom.xml @@ -3,7 +3,7 @@ magda be.vlaanderen.vip.mock - 2.12.0 + 2.13.0-SNAPSHOT 4.0.0 diff --git a/magdaservice/pom.xml b/magdaservice/pom.xml index d75f2c4f..95bc9c13 100644 --- a/magdaservice/pom.xml +++ b/magdaservice/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.12.0 + 2.13.0-SNAPSHOT 4.0.0 diff --git a/pom.xml b/pom.xml index 2fc7de7a..5aadf3a1 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ be.vlaanderen.vip.mock magda - 2.12.0 + 2.13.0-SNAPSHOT magdaservice MAGDA diensten Mock voor afnemers diff --git a/signing/pom.xml b/signing/pom.xml index 525d41e1..7c9596a5 100644 --- a/signing/pom.xml +++ b/signing/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.12.0 + 2.13.0-SNAPSHOT 4.0.0 diff --git a/tester/pom.xml b/tester/pom.xml index 65cf0229..e964fb30 100644 --- a/tester/pom.xml +++ b/tester/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.12.0 + 2.13.0-SNAPSHOT 4.0.0 From 3ac493f3c06108e9f2c8338439fc3ddec667f7c1 Mon Sep 17 00:00:00 2001 From: "bart.peeters2@vlaanderen.be" Date: Tue, 26 Mar 2024 11:00:56 +0100 Subject: [PATCH 4/6] feat: add statuscode in NoResponseException --- .../vlaanderen/vip/magda/exception/NoResponseException.java | 4 +++- .../be/vlaanderen/vip/magda/client/MagdaConnectorImpl.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/interfaces/src/main/java/be/vlaanderen/vip/magda/exception/NoResponseException.java b/interfaces/src/main/java/be/vlaanderen/vip/magda/exception/NoResponseException.java index 7743a02d..2dae9b91 100644 --- a/interfaces/src/main/java/be/vlaanderen/vip/magda/exception/NoResponseException.java +++ b/interfaces/src/main/java/be/vlaanderen/vip/magda/exception/NoResponseException.java @@ -17,11 +17,13 @@ public class NoResponseException extends ServerException { private final UUID transactionID; private final UUID localTransactionID; private final String serviceName; + private final int statusCode; - public NoResponseException(String bericht, Throwable oorzaak, MagdaRequest magdaRequest) { + public NoResponseException(String bericht, Throwable oorzaak, MagdaRequest magdaRequest, int statusCode) { super(bericht, oorzaak); this.transactionID = magdaRequest.getCorrelationId(); this.localTransactionID = magdaRequest.getRequestId(); this.serviceName = magdaRequest.magdaServiceIdentification().getName(); + this.statusCode = statusCode; } } diff --git a/magdaconnector/src/main/java/be/vlaanderen/vip/magda/client/MagdaConnectorImpl.java b/magdaconnector/src/main/java/be/vlaanderen/vip/magda/client/MagdaConnectorImpl.java index df18028f..41517f61 100644 --- a/magdaconnector/src/main/java/be/vlaanderen/vip/magda/client/MagdaConnectorImpl.java +++ b/magdaconnector/src/main/java/be/vlaanderen/vip/magda/client/MagdaConnectorImpl.java @@ -79,7 +79,7 @@ public MagdaResponse send(MagdaRequest magdaRequest) throws ServerException { } catch (MagdaConnectionException e) { logNoResponse(magdaRequest); - throw new NoResponseException("No response", e, magdaRequest); + throw new NoResponseException("No response", e, magdaRequest, e.getStatusCode()); } finally { CorrelationId.clear(); } From 6f2d5f2491f45ddf330e7b1e00a1cc774139eeea Mon Sep 17 00:00:00 2001 From: "bart.peeters2@vlaanderen.be" Date: Tue, 26 Mar 2024 11:21:14 +0100 Subject: [PATCH 5/6] feat: add test statucode --- .../vip/magda/client/MagdaConnectorImplTest.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/magdaconnector/src/test/java/be/vlaanderen/vip/magda/client/MagdaConnectorImplTest.java b/magdaconnector/src/test/java/be/vlaanderen/vip/magda/client/MagdaConnectorImplTest.java index dcebfb4b..8f305c76 100644 --- a/magdaconnector/src/test/java/be/vlaanderen/vip/magda/client/MagdaConnectorImplTest.java +++ b/magdaconnector/src/test/java/be/vlaanderen/vip/magda/client/MagdaConnectorImplTest.java @@ -84,36 +84,39 @@ void sendDocumentReturnsNull() { @Test void requestFails() throws MagdaConnectionException { - when(connection.sendDocument(any())).thenThrow(new MagdaConnectionException("something went wrong")); + when(connection.sendDocument(any())).thenThrow(new MagdaConnectionException("something went wrong", 500)); var req = GeefBewijsRequest.builder() .insz("test-insz") .build(); - assertThrows(NoResponseException.class, () -> connector.send(req)); + NoResponseException noResponseException = assertThrows(NoResponseException.class, () -> connector.send(req)); + assertEquals(noResponseException.getStatusCode(), 500); } @Test void logsRequest() throws MagdaConnectionException { - when(connection.sendDocument(any())).thenThrow(new MagdaConnectionException("something went wrong")); + when(connection.sendDocument(any())).thenThrow(new MagdaConnectionException("something went wrong", 500)); var req = GeefBewijsRequest.builder() .insz("test-insz") .build(); - assertThrows(NoResponseException.class, () -> connector.send(req)); + NoResponseException noResponseException = assertThrows(NoResponseException.class, () -> connector.send(req)); + assertEquals(noResponseException.getStatusCode(), 500); verify(logService).logMagdaRequest(any()); } @Test void logsNoReply() throws MagdaConnectionException { - when(connection.sendDocument(any())).thenThrow(new MagdaConnectionException("something went wrong")); + when(connection.sendDocument(any())).thenThrow(new MagdaConnectionException("something went wrong", 500)); var req = GeefBewijsRequest.builder() .insz("test-insz") .build(); - assertThrows(NoResponseException.class, () -> connector.send(req)); + NoResponseException noResponseException = assertThrows(NoResponseException.class, () -> connector.send(req)); + assertEquals(noResponseException.getStatusCode(), 500); verify(logService).logUnansweredRequest(any()); } } From 23d21fe2842a712247ccfe6a6c4e2b1cd899e968 Mon Sep 17 00:00:00 2001 From: bitbucket-pipelines Date: Tue, 26 Mar 2024 13:10:39 +0000 Subject: [PATCH 6/6] Update versions for release --- common/pom.xml | 2 +- interfaces/pom.xml | 2 +- magdaconnector/pom.xml | 2 +- magdamock-starter/pom.xml | 2 +- magdamock/pom.xml | 2 +- magdaservice/pom.xml | 2 +- pom.xml | 2 +- signing/pom.xml | 2 +- tester/pom.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/common/pom.xml b/common/pom.xml index 402b67c7..c77b2753 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.13.0-SNAPSHOT + 2.13.0 4.0.0 diff --git a/interfaces/pom.xml b/interfaces/pom.xml index a28e3c6b..cb958ad3 100644 --- a/interfaces/pom.xml +++ b/interfaces/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.13.0-SNAPSHOT + 2.13.0 4.0.0 diff --git a/magdaconnector/pom.xml b/magdaconnector/pom.xml index 287e48d6..9417cd03 100644 --- a/magdaconnector/pom.xml +++ b/magdaconnector/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.13.0-SNAPSHOT + 2.13.0 4.0.0 diff --git a/magdamock-starter/pom.xml b/magdamock-starter/pom.xml index 2f87a963..99876fe4 100644 --- a/magdamock-starter/pom.xml +++ b/magdamock-starter/pom.xml @@ -8,7 +8,7 @@ magda be.vlaanderen.vip.mock - 2.13.0-SNAPSHOT + 2.13.0 magdamock-starter diff --git a/magdamock/pom.xml b/magdamock/pom.xml index b5a6e352..f5d7806a 100644 --- a/magdamock/pom.xml +++ b/magdamock/pom.xml @@ -3,7 +3,7 @@ magda be.vlaanderen.vip.mock - 2.13.0-SNAPSHOT + 2.13.0 4.0.0 diff --git a/magdaservice/pom.xml b/magdaservice/pom.xml index 95bc9c13..65ec54ae 100644 --- a/magdaservice/pom.xml +++ b/magdaservice/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.13.0-SNAPSHOT + 2.13.0 4.0.0 diff --git a/pom.xml b/pom.xml index 5aadf3a1..de882bb5 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ be.vlaanderen.vip.mock magda - 2.13.0-SNAPSHOT + 2.13.0 magdaservice MAGDA diensten Mock voor afnemers diff --git a/signing/pom.xml b/signing/pom.xml index 7c9596a5..2277cd01 100644 --- a/signing/pom.xml +++ b/signing/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.13.0-SNAPSHOT + 2.13.0 4.0.0 diff --git a/tester/pom.xml b/tester/pom.xml index e964fb30..cf8921df 100644 --- a/tester/pom.xml +++ b/tester/pom.xml @@ -5,7 +5,7 @@ magda be.vlaanderen.vip.mock - 2.13.0-SNAPSHOT + 2.13.0 4.0.0