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()));