Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
2 changes: 1 addition & 1 deletion boat-engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>backbase-openapi-tools</artifactId>
<version>0.15.0</version>
<version>0.15.1-SNAPSHOT</version>
</parent>
<artifactId>boat-engine</artifactId>
<packaging>jar</packaging>
Expand Down
34 changes: 18 additions & 16 deletions boat-maven-plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion boat-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>backbase-openapi-tools</artifactId>
<version>0.15.0</version>
<version>0.15.1-SNAPSHOT</version>
</parent>
<artifactId>boat-maven-plugin</artifactId>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

/**
Expand All @@ -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.
Expand All @@ -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;

/**
* <p>
Expand Down Expand Up @@ -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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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()));

Expand Down Expand Up @@ -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";
Expand All @@ -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()));
Expand Down
2 changes: 1 addition & 1 deletion boat-quay/boat-quay-lint/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>boat-quay</artifactId>
<version>0.15.0</version>
<version>0.15.1-SNAPSHOT</version>
</parent>
<artifactId>boat-quay-lint</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion boat-quay/boat-quay-rules/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>boat-quay</artifactId>
<version>0.15.0</version>
<version>0.15.1-SNAPSHOT</version>
</parent>
<artifactId>boat-quay-rules</artifactId>
<packaging>jar</packaging>
Expand Down
2 changes: 1 addition & 1 deletion boat-quay/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>backbase-openapi-tools</artifactId>
<version>0.15.0</version>
<version>0.15.1-SNAPSHOT</version>
</parent>


Expand Down
4 changes: 2 additions & 2 deletions boat-scaffold/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>backbase-openapi-tools</artifactId>
<version>0.15.0</version>
<version>0.15.1-SNAPSHOT</version>
</parent>
<artifactId>boat-scaffold</artifactId>

Expand Down Expand Up @@ -86,7 +86,7 @@
<dependency>
<groupId>com.backbase.oss</groupId>
<artifactId>boat-trail-resources</artifactId>
<version>0.15.0</version>
<version>0.15.1-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down
2 changes: 1 addition & 1 deletion boat-terminal/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>backbase-openapi-tools</artifactId>
<version>0.15.0</version>
<version>0.15.1-SNAPSHOT</version>
</parent>

<artifactId>boat-terminal</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion boat-trail-resources/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>backbase-openapi-tools</artifactId>
<version>0.15.0</version>
<version>0.15.1-SNAPSHOT</version>
</parent>
<artifactId>boat-trail-resources</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.backbase.oss</groupId>
<artifactId>backbase-openapi-tools</artifactId>
<version>0.15.0</version>
<version>0.15.1-SNAPSHOT</version>
<packaging>pom</packaging>
<description>Backbase Open Api Tools will help you converting RAML to OpenAPI plus many more</description>

Expand Down
2 changes: 1 addition & 1 deletion tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.backbase.oss</groupId>
<artifactId>backbase-openapi-tools</artifactId>
<version>0.15.0</version>
<version>0.15.1-SNAPSHOT</version>
</parent>

<artifactId>tests</artifactId>
Expand Down