From 5122a77d209caea7e119f768ce315fcc3d781b98 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Mon, 27 Sep 2021 07:55:32 +0000 Subject: [PATCH 1/3] [version bump] new dev version --- boat-engine/pom.xml | 2 +- boat-maven-plugin/pom.xml | 2 +- boat-quay/boat-quay-lint/pom.xml | 2 +- boat-quay/boat-quay-rules/pom.xml | 2 +- boat-quay/pom.xml | 2 +- boat-scaffold/pom.xml | 4 ++-- boat-terminal/pom.xml | 2 +- boat-trail-resources/pom.xml | 2 +- pom.xml | 2 +- tests/pom.xml | 2 +- 10 files changed, 11 insertions(+), 11 deletions(-) diff --git a/boat-engine/pom.xml b/boat-engine/pom.xml index 80a6b02f8..cced368fe 100644 --- a/boat-engine/pom.xml +++ b/boat-engine/pom.xml @@ -5,7 +5,7 @@ com.backbase.oss backbase-openapi-tools - 0.15.0-SNAPSHOT + 0.15.1-SNAPSHOT boat-engine jar diff --git a/boat-maven-plugin/pom.xml b/boat-maven-plugin/pom.xml index 1e32e8ceb..349e6c1f6 100644 --- a/boat-maven-plugin/pom.xml +++ b/boat-maven-plugin/pom.xml @@ -5,7 +5,7 @@ com.backbase.oss backbase-openapi-tools - 0.15.0-SNAPSHOT + 0.15.1-SNAPSHOT boat-maven-plugin diff --git a/boat-quay/boat-quay-lint/pom.xml b/boat-quay/boat-quay-lint/pom.xml index 71eb784f4..5bdcbd90b 100644 --- a/boat-quay/boat-quay-lint/pom.xml +++ b/boat-quay/boat-quay-lint/pom.xml @@ -5,7 +5,7 @@ com.backbase.oss boat-quay - 0.15.0-SNAPSHOT + 0.15.1-SNAPSHOT boat-quay-lint jar diff --git a/boat-quay/boat-quay-rules/pom.xml b/boat-quay/boat-quay-rules/pom.xml index 6aa1b391e..c4b218516 100644 --- a/boat-quay/boat-quay-rules/pom.xml +++ b/boat-quay/boat-quay-rules/pom.xml @@ -5,7 +5,7 @@ com.backbase.oss boat-quay - 0.15.0-SNAPSHOT + 0.15.1-SNAPSHOT boat-quay-rules jar diff --git a/boat-quay/pom.xml b/boat-quay/pom.xml index b11807155..b6837e318 100644 --- a/boat-quay/pom.xml +++ b/boat-quay/pom.xml @@ -5,7 +5,7 @@ com.backbase.oss backbase-openapi-tools - 0.15.0-SNAPSHOT + 0.15.1-SNAPSHOT diff --git a/boat-scaffold/pom.xml b/boat-scaffold/pom.xml index 746f5b2b8..0cd8120a5 100644 --- a/boat-scaffold/pom.xml +++ b/boat-scaffold/pom.xml @@ -5,7 +5,7 @@ com.backbase.oss backbase-openapi-tools - 0.15.0-SNAPSHOT + 0.15.1-SNAPSHOT boat-scaffold @@ -86,7 +86,7 @@ com.backbase.oss boat-trail-resources - 0.15.0-SNAPSHOT + 0.15.1-SNAPSHOT test diff --git a/boat-terminal/pom.xml b/boat-terminal/pom.xml index 6d02ee95c..c72d42230 100644 --- a/boat-terminal/pom.xml +++ b/boat-terminal/pom.xml @@ -5,7 +5,7 @@ com.backbase.oss backbase-openapi-tools - 0.15.0-SNAPSHOT + 0.15.1-SNAPSHOT boat-terminal diff --git a/boat-trail-resources/pom.xml b/boat-trail-resources/pom.xml index 7adb6cfcf..5df6f372e 100644 --- a/boat-trail-resources/pom.xml +++ b/boat-trail-resources/pom.xml @@ -5,7 +5,7 @@ com.backbase.oss backbase-openapi-tools - 0.15.0-SNAPSHOT + 0.15.1-SNAPSHOT boat-trail-resources diff --git a/pom.xml b/pom.xml index 2a52649dc..7d35b9598 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ com.backbase.oss backbase-openapi-tools - 0.15.0-SNAPSHOT + 0.15.1-SNAPSHOT pom Backbase Open Api Tools will help you converting RAML to OpenAPI plus many more diff --git a/tests/pom.xml b/tests/pom.xml index 2486df527..a0b226d35 100644 --- a/tests/pom.xml +++ b/tests/pom.xml @@ -5,7 +5,7 @@ com.backbase.oss backbase-openapi-tools - 0.15.0-SNAPSHOT + 0.15.1-SNAPSHOT tests From f58e44cba58528765adf1cd5f83f48ec05b82178 Mon Sep 17 00:00:00 2001 From: Jasper Linschoten Date: Mon, 15 Nov 2021 17:30:08 +0100 Subject: [PATCH 2/3] Improve the error message. --- .../java/com/backbase/oss/boat/BundleMojo.java | 7 ++++++- .../com/backbase/oss/boat/BundleMojoTest.java | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/BundleMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/BundleMojo.java index 6345c8a33..3671d6781 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/BundleMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/BundleMojo.java @@ -144,8 +144,13 @@ String versionFileName(String originalFileName, OpenAPI openAPI) throws MojoExec if (openApiVersion == null) { throw new MojoExecutionException("Configured to use version in filename, but no version set."); } - String majorFromFileName = originalFileName.replaceAll("^(.*api-v)([0-9]+)(\\.yaml$)", "$2"); + if (!openApiVersion.matches("^\\d\\..*")) { + throw new MojoExecutionException( + "Version should be semver (or at least have a recognisable major version), but found '" + openApiVersion + + "' (string starts with number and dot: 2.0.0, 2.blabla, 2.3.4.5.6.234234)"); + } String majorFromVersion = openApiVersion.substring(0, openApiVersion.indexOf(".")); + String majorFromFileName = originalFileName.replaceAll("^(.*api-v)([0-9]+)(\\.yaml$)", "$2"); if (!majorFromFileName.equals(majorFromVersion)) { throw new MojoExecutionException("Invalid version " + openApiVersion + " in file " + originalFileName); } diff --git a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/BundleMojoTest.java b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/BundleMojoTest.java index 1d14699de..5ab40c1a8 100644 --- a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/BundleMojoTest.java +++ b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/BundleMojoTest.java @@ -12,6 +12,7 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.function.Executable; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertThrows; @@ -110,10 +111,23 @@ void testInvalidVersionInApi() { OpenAPI openAPI = new OpenAPI(); openAPI.setInfo(new Info()); - assertThrows(MojoExecutionException.class, () -> - mojo.versionFileName("payment-order-client-api-v2.yaml", createOpenApiWithVersion("3.0.0"))); + assertThrowsMojoExecutionExceptionWithMessage( + () -> mojo.versionFileName("payment-order-client-api-v2.yaml", createOpenApiWithVersion("3.0.0")), + "Invalid version 3.0.0 in file payment-order-client-api-v2.yaml"); + assertThrowsMojoExecutionExceptionWithMessage( + () -> mojo.versionFileName("payment-order-client-api-v2.yaml", createOpenApiWithVersion("v2.0")), + "Version should be semver (or at least have a recognisable major version), but found 'v2.0'"); + assertThrowsMojoExecutionExceptionWithMessage( + () -> mojo.versionFileName("payment-order-client-api-v2.yaml", createOpenApiWithVersion("2dada")), + "Version should be semver (or at least have a recognisable major version), but found '2dada'"); + } + private void assertThrowsMojoExecutionExceptionWithMessage(Executable executable, String message) { + MojoExecutionException thrown = assertThrows(MojoExecutionException.class, executable); + assertTrue(thrown.getMessage().startsWith(message), "Expected message '" + message + "' but got '" + + thrown.getMessage() + "'"); + } private OpenAPI createOpenApiWithVersion(String version) { OpenAPI openAPI = new OpenAPI(); From e66278d3a26821eb9550779ce33c301042f7c52a Mon Sep 17 00:00:00 2001 From: Dhananjay Singh Date: Mon, 22 Nov 2021 08:04:03 +0100 Subject: [PATCH 3/3] Made property unique (#244) --- README.md | 3 ++ boat-maven-plugin/README.md | 34 ++++++++++--------- .../backbase/oss/boat/radio/RadioMojo.java | 21 ++++++------ .../oss/boat/radio/RadioMojoTests.java | 7 ++-- 4 files changed, 36 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 896c95ad1..0c6942c5f 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,9 @@ The project is very much Work In Progress and will be published on maven central # Release Notes BOAT is still under development and subject to change. +## 0.15.1 +* *Maven Plugin* + * Made `boat:radio` goal properties w.r.t boat-bay server unique. ## 0.15.0 * *Maven Plugin* * Added new goal `boat:radio`; see the description in the [plugin documentation](boat-maven-plugin/README.md#boatradio). diff --git a/boat-maven-plugin/README.md b/boat-maven-plugin/README.md index a9a88130d..f8d287957 100644 --- a/boat-maven-plugin/README.md +++ b/boat-maven-plugin/README.md @@ -265,32 +265,38 @@ Available parameters: User property: artifactId Project ArtifactId in Boat-Bay. Defaults to ${project.artifactId} + boatBayPassword + User property: boat.bay.password + Defines the password of the username which can access the Boat-Bay upload + API. Required if boat-bay APIs are protected. + boatBayUrl Required: true - User property: boatBayUrl + User property: boat.bay.url Boat-Bay domain. eg. https://boatbay.mycompany.eu + boatBayUsername + User property: boat.bay.username + Defines the username which can access Boat-Bay upload API. Required if + boat-bay APIs are protected. + + failOnBoatBayErrorResponse (Default: false) + User property: failOnBoatBayErrorResponse + Fail the build if boatbay server returns an error + failOnBreakingChange (Default: false) User property: failOnBreakingChange Fail the build for breaking changes in specs failOnLintViolation (Default: false) User property: failOnLintViolation - Fail the build if the spec has lint violation (Violation with Severity.MUST) - - failOnBoatBayErrorResponse (Default: true) - User property: failOnBoatBayErrorResponse - Fail the build if boatbay server returns an error + Fail the build if the spec has lint violation (Violation with + Severity.MUST) groupId (Default: ${project.groupId}) User property: groupId Project GroupId in Boat-Bay. Defaults to ${project.groupId} - password - User property: password - Defines the password of the username which can access the Boat-Bay upload - API. Required if boat-bay APIs are protected. - portalKey Required: true User property: portalKey @@ -323,16 +329,12 @@ Available parameters: way. For instance, if the actual file is my-service-api-v3.1.4.yaml the expression could be my-service-api-v*.yaml. - username - User property: username - Defines the username which can access Boat-Bay upload API. Required if - boat-bay APIs are protected. - version (Default: ${project.version}) User property: version Project Version in Boat-Bay. Defaults to ${project.version} + Configuration example: ```$xml diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/radio/RadioMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/radio/RadioMojo.java index 3ec98cea8..75ffde6f9 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/radio/RadioMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/radio/RadioMojo.java @@ -19,6 +19,7 @@ import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringUtils; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; @@ -58,7 +59,7 @@ public class RadioMojo extends AbstractMojo { /** * Boat-Bay domain. eg. https://boatbay.mycompany.eu */ - @Parameter(property = "boatBayUrl", required = true) + @Parameter(property = "boat.bay.url", required = true) private String boatBayUrl; /** @@ -76,8 +77,8 @@ public class RadioMojo extends AbstractMojo { /** * Fail the build if boatbay server returns an error */ - @Parameter(property = "failOnBoatBayErrorResponse", defaultValue="true") - private boolean failOnBoatBayErrorResponse =true; + @Parameter(property = "failOnBoatBayErrorResponse", defaultValue="false") + private boolean failOnBoatBayErrorResponse; /** * Project portal Identifier in Boat-Bay. @@ -94,14 +95,14 @@ public class RadioMojo extends AbstractMojo { /** * Defines the username which can access Boat-Bay upload API. Required if boat-bay APIs are protected. */ - @Parameter(property = "username") - private String username; + @Parameter(property = "boat.bay.username") + private String boatBayUsername; /** * Defines the password of the username which can access the Boat-Bay upload API. Required if boat-bay APIs are protected. */ - @Parameter(property = "password") - private String password; + @Parameter(property = "boat.bay.password") + private String boatBayPassword; /** *

@@ -142,9 +143,9 @@ public void execute() throws MojoExecutionException, MojoFailureException { ObjectMapper objectMapper = new ObjectMapper(); - if (username != null && !username.isEmpty() && password != null && !password.isEmpty()) { - getLog().info("Basic Authentication set for username " + username); - basicAuthRequestInterceptor = new BasicAuthRequestInterceptor(username, password); + if (StringUtils.isNotEmpty(boatBayUsername) && StringUtils.isNotEmpty(boatBayPassword)) { + getLog().info("Basic Authentication set for username " + boatBayUsername); + basicAuthRequestInterceptor = new BasicAuthRequestInterceptor(boatBayUsername, boatBayPassword); } else { getLog().info("No Authentication set"); } diff --git a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/radio/RadioMojoTests.java b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/radio/RadioMojoTests.java index ba1f95291..110aa35cb 100644 --- a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/radio/RadioMojoTests.java +++ b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/radio/RadioMojoTests.java @@ -379,8 +379,8 @@ void test_auth() { mojo.setVersion(version); mojo.setPortalKey(portalKey); mojo.setSourceKey(sourceKey); - mojo.setUsername(username); - mojo.setPassword(password); + mojo.setBoatBayUsername(username); + mojo.setBoatBayPassword(password); mojo.setSpecs(new SpecConfig[]{specConfig}); mojo.setBoatBayUrl(String.format("http://localhost:%s", mockBackEnd.getPort())); @@ -521,7 +521,7 @@ public MockResponse dispatch(RecordedRequest request) { @SneakyThrows @Test - void test_when_boat_bay_is_unavailable() { + void test_when_boat_bay_is_unavailable_and_failOnBoatBayError_is_true() { final String portalKey = "example"; final String sourceKey = "pet-store-bom"; @@ -542,6 +542,7 @@ void test_when_boat_bay_is_unavailable() { mojo.setVersion(version); mojo.setPortalKey(portalKey); mojo.setSourceKey(sourceKey); + mojo.setFailOnBoatBayErrorResponse(true); mojo.setSpecs(new SpecConfig[]{specConfig}); //Set invalid domain mojo.setBoatBayUrl(String.format("http://invalid-domain:%s", mockBackEnd.getPort()));