From 8a66c7db849a92e41eb19d57ae8747214b3ee9bd Mon Sep 17 00:00:00 2001 From: Sophie Janssens Date: Mon, 26 Apr 2021 10:30:46 +0200 Subject: [PATCH 1/9] Feature: maven artifact input for generate and lint goals --- .../it/example/boat-artifact-input/pom.xml | 82 ++++++++ .../src/it/example/boat-generate/pom.xml | 2 +- .../example/boat-multiple-executions/pom.xml | 60 ++++++ .../oss/boat/AbstractGenerateMojo.java | 3 +- .../backbase/oss/boat/AbstractLintMojo.java | 21 +- .../oss/boat/AbstractRamlToOpenApi.java | 17 -- .../oss/boat/ArtifactRepositoryResolver.java | 44 +++++ .../com/backbase/oss/boat/ExportBomMojo.java | 4 +- .../backbase/oss/boat/GenerateDocMojo.java | 3 +- .../boat/GenerateFromDirectoryDocMojo.java | 24 ++- .../com/backbase/oss/boat/GenerateMojo.java | 28 +-- .../GenerateRestTemplateEmbeddedMojo.java | 3 +- .../boat/GenerateSpringBootEmbeddedMojo.java | 3 +- .../boat/GenerateWebClientEmbeddedMojo.java | 3 +- .../com/backbase/oss/boat/InputArtifact.java | 42 ++++ .../oss/boat/InputMavenArtifactMojo.java | 181 ++++++++++++++++++ .../backbase/oss/boat/GenerateMojoTests.java | 13 +- .../com/backbase/oss/boat/GeneratorTests.java | 8 +- 18 files changed, 466 insertions(+), 75 deletions(-) create mode 100644 boat-maven-plugin/src/it/example/boat-artifact-input/pom.xml create mode 100644 boat-maven-plugin/src/it/example/boat-multiple-executions/pom.xml create mode 100644 boat-maven-plugin/src/main/java/com/backbase/oss/boat/ArtifactRepositoryResolver.java create mode 100644 boat-maven-plugin/src/main/java/com/backbase/oss/boat/InputArtifact.java create mode 100644 boat-maven-plugin/src/main/java/com/backbase/oss/boat/InputMavenArtifactMojo.java diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/pom.xml b/boat-maven-plugin/src/it/example/boat-artifact-input/pom.xml new file mode 100644 index 000000000..9ed0670e4 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/pom.xml @@ -0,0 +1,82 @@ + + + 4.0.0 + + + com.backbase.oss.boat.example + example + 1.0.0-SNAPSHOT + + + boat-artifact-input + pom + + BOAT :: DOCandLint + + + + + com.backbase.oss + boat-maven-plugin + + + generate-rest-template-embedded + generate-sources + + doc + + + + com.backbase.dbs + banking-services-bom + 2.20.1.1 + api + zip + access-control-client-api-v2.4.0.yaml + + + + + lint + verify + + lint + + + + com.backbase.dbs + banking-services-bom + 2.20.1.1 + api + zip + access-control-client-api-v2.4.0.yaml + + + + + generate-docs + generate-sources + + doc + + + + com.backbase.dbs.contact + contact-manager + 1.2.38.3 + api + zip + contact-manager-service-api-v2.3.0.yaml + + + + + + + + + + + diff --git a/boat-maven-plugin/src/it/example/boat-generate/pom.xml b/boat-maven-plugin/src/it/example/boat-generate/pom.xml index 63fbcf268..e74c5d361 100644 --- a/boat-maven-plugin/src/it/example/boat-generate/pom.xml +++ b/boat-maven-plugin/src/it/example/boat-generate/pom.xml @@ -22,7 +22,7 @@ angular - java-clients + java-server diff --git a/boat-maven-plugin/src/it/example/boat-multiple-executions/pom.xml b/boat-maven-plugin/src/it/example/boat-multiple-executions/pom.xml new file mode 100644 index 000000000..d30137b1d --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-multiple-executions/pom.xml @@ -0,0 +1,60 @@ + + + 4.0.0 + + + com.backbase.oss.boat.example + example + 1.0.0-SNAPSHOT + + + boat-artifact-input + pom + + BOAT :: DOCandLint + + + + + com.backbase.oss + boat-maven-plugin + + + generate-rest-template-embedded + generate-sources + + doc + + + https://raw.githubusercontent.com/OAI/OpenAPI-Specification/master/examples/v3.0/api-with-examples.yaml + + + + lint + verify + + lint + + + ${project.basedir}/src/main/resources/openapi.yaml + + + + generate-docs + generate-sources + + doc + + + ${project.basedir}/src/main/resources/contact-manager_contact-manager-service-api-v2.3.0.yaml + + + + + + + + + \ No newline at end of file diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractGenerateMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractGenerateMojo.java index bab59ae21..1d7385642 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractGenerateMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractGenerateMojo.java @@ -3,11 +3,12 @@ import java.util.HashMap; import java.util.Map; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; public abstract class AbstractGenerateMojo extends GenerateMojo { public void execute(String generatorName, String library, boolean isEmbedded, boolean reactive, boolean generateSupportingFiles) - throws MojoExecutionException { + throws MojoExecutionException, MojoFailureException { Map options = new HashMap<>(); options.put("library", library); options.put("java8", "true"); diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractLintMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractLintMojo.java index 867000785..9f327bb4c 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractLintMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractLintMojo.java @@ -11,6 +11,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Parameter; @SuppressWarnings("FieldMayBeFinal") @@ -18,13 +19,8 @@ /* Lint Specification */ -public abstract class AbstractLintMojo extends AbstractMojo { +public abstract class AbstractLintMojo extends InputMavenArtifactMojo { - /** - * Input spec directory or file. - */ - @Parameter(name = "inputSpec", property = "inputSpec", required = true) - protected File inputSpec; /** * Set this to true to fail in case a warning is found. @@ -47,18 +43,21 @@ public abstract class AbstractLintMojo extends AbstractMojo { "151","129","146","147","172","145","115","132","120", "134","183","154","105","104","130","118","110","153", "101","176","116","M009","H002","M010","H001","M008","S005","S006","S007","M011"}; - protected List lint() throws MojoExecutionException { + protected List lint() throws MojoExecutionException, MojoFailureException { + + super.execute(); + List boatLintReports = new ArrayList<>(); File[] inputFiles; - if (inputSpec.isDirectory()) { - inputFiles = inputSpec.listFiles(pathname -> pathname.getName().endsWith(".yaml")); + if (input.isDirectory()) { + inputFiles = input.listFiles(pathname -> pathname.getName().endsWith(".yaml")); if (inputFiles == null || inputFiles.length == 0) { throw new MojoExecutionException("No OpenAPI specs found in: " + inputSpec); } log.info("Found " + inputFiles.length + " specs to lint."); } else { - inputFiles = new File[]{inputSpec}; + inputFiles = new File[]{input}; } for (File inputFile : inputFiles) { @@ -83,7 +82,7 @@ private BoatLintReport lintOpenAPI(File inputFile) throws MojoExecutionException } public void setInput(File input) { - this.inputSpec = input; + this.input = input; } public void setFailOnWarning(boolean failOnWarning) { diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractRamlToOpenApi.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractRamlToOpenApi.java index 522451aa9..89bc9670b 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractRamlToOpenApi.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractRamlToOpenApi.java @@ -467,23 +467,6 @@ public void setServers(List servers) { this.servers = servers; } - public ArtifactResult resolveArtifactFromRepositories(org.eclipse.aether.artifact.Artifact artifact) { - ArtifactRequest artifactRequest = getArtifactRequest(artifact); - - ArtifactResult artifactResult = null; - try { - artifactResult = artifactResolver.resolveArtifact(repositorySession, artifactRequest); - } catch (ArtifactResolutionException e) { - throw new IllegalArgumentException("Cannot resolve artifact: " + artifact); - } - return artifactResult; - - } - - private ArtifactRequest getArtifactRequest(org.eclipse.aether.artifact.Artifact artifact) { - return new ArtifactRequest(artifact, remoteRepositories, null); - } - protected DefaultArtifact createNewDefaultArtifact(Dependency dependency) { return new DefaultArtifact(dependency.getGroupId() , dependency.getArtifactId() diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ArtifactRepositoryResolver.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ArtifactRepositoryResolver.java new file mode 100644 index 000000000..4af7bf88b --- /dev/null +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ArtifactRepositoryResolver.java @@ -0,0 +1,44 @@ +package com.backbase.oss.boat; + +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.impl.ArtifactResolver; +import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.resolution.ArtifactRequest; +import org.eclipse.aether.resolution.ArtifactResolutionException; +import org.eclipse.aether.resolution.ArtifactResult; + +import java.util.List; + +public class ArtifactRepositoryResolver { + + private ArtifactResolver artifactResolver; + private RepositorySystemSession repositorySession; + private List remoteRepositories; + + public ArtifactRepositoryResolver(ArtifactResolver artifactResolver, RepositorySystemSession repositorySession, List remoteRepositories) { + this.artifactResolver = artifactResolver; + this.repositorySession = repositorySession; + this.remoteRepositories = remoteRepositories; + } + + + public ArtifactResult resolveArtifactFromRepositories(org.eclipse.aether.artifact.Artifact artifact) { + ArtifactRequest artifactRequest = getArtifactRequest(artifact); + + ArtifactResult artifactResult = null; + try { + artifactResult = artifactResolver.resolveArtifact(repositorySession, artifactRequest); + } catch (ArtifactResolutionException e) { + throw new IllegalArgumentException("Cannot resolve artifact: " + artifact); + } + return artifactResult; + + } + + + private ArtifactRequest getArtifactRequest(org.eclipse.aether.artifact.Artifact artifact) { + + return new ArtifactRequest(artifact, remoteRepositories, null); + } + +} diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ExportBomMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ExportBomMojo.java index e64536660..f5cc354c8 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ExportBomMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ExportBomMojo.java @@ -113,7 +113,7 @@ public void execute() throws MojoExecutionException { .filter(versionRange::containsVersion) .distinct() .map(this::convertToArtifact) - .map(this::resolveArtifactFromRepositories) + .map(defaultArtifact -> new ArtifactRepositoryResolver(artifactResolver,repositorySession,remoteRepositories).resolveArtifactFromRepositories(defaultArtifact)) .map(this::parsePomFile) .map(this::groupArtifactsPerVersionAndCapability) .collect(Collectors.toList()); @@ -147,7 +147,7 @@ private Pair>> groupArtifactsPerVers .filter(this::isIncludedSpec) .map(this::createNewDefaultArtifact) .distinct() - .map(this::resolveArtifactFromRepositories) + .map(defaultArtifact -> new ArtifactRepositoryResolver(artifactResolver,repositorySession,remoteRepositories).resolveArtifactFromRepositories(defaultArtifact)) .collect(Collectors .groupingBy(artifactResult -> artifactResult.getArtifact().getGroupId(), TreeMap::new, Collectors.toSet())); diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateDocMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateDocMojo.java index 0f26649c6..1b16ae73b 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateDocMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateDocMojo.java @@ -2,6 +2,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; @Mojo(name = "doc", threadSafe = true) @@ -9,7 +10,7 @@ public class GenerateDocMojo extends GenerateFromDirectoryDocMojo { @Override - public void execute() throws MojoExecutionException { + public void execute() throws MojoExecutionException, MojoFailureException { getLog().info("Generating Boat Docs"); generatorName = "boat-docs"; super.execute(); diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateFromDirectoryDocMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateFromDirectoryDocMojo.java index e2f2aa957..dbb31e553 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateFromDirectoryDocMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateFromDirectoryDocMojo.java @@ -2,6 +2,7 @@ import lombok.extern.slf4j.Slf4j; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; import java.io.File; @@ -12,12 +13,21 @@ @Slf4j public class GenerateFromDirectoryDocMojo extends GenerateMojo { + @Override - public void execute() throws MojoExecutionException { + public void execute() throws MojoExecutionException, MojoFailureException { + if (inputSpec != null) { + File inputSpecFile = new File(inputSpec); + fileInputExecute(inputSpecFile); + } else { + log.info("Input read as Artifact"); + super.execute(); + } + } - File inputSpecFile = new File(inputSpec); + private void fileInputExecute(File inputSpecFile) throws MojoExecutionException, MojoFailureException { - if (inputSpecFile.isDirectory()){ + if (inputSpecFile.isDirectory()) { log.info("inputSpec is being read as a directory"); File[] inputSpecs; @@ -29,11 +39,11 @@ public void execute() throws MojoExecutionException { throw new MojoExecutionException("No OpenAPI specs found in: " + inputSpec); } - for(File f : inputSpecs){ + for (File f : inputSpecs) { inputSpec = f.getPath(); - output = new File(outPutDirectory.getPath(),f.getName().substring(0,f.getName().lastIndexOf(".")).concat("-docs")); + output = new File(outPutDirectory.getPath(), f.getName().substring(0, f.getName().lastIndexOf(".")).concat("-docs")); - if(!output.exists()){ + if (!output.exists()) { output.mkdir(); } @@ -41,7 +51,7 @@ public void execute() throws MojoExecutionException { super.execute(); } - }else { + } else { log.info("inputSpec being read as a single file"); super.execute(); diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateMojo.java index bb7191f1d..a847eceaf 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateMojo.java @@ -35,6 +35,7 @@ import org.apache.commons.lang3.StringUtils; import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; @@ -77,7 +78,7 @@ @SuppressWarnings({"DefaultAnnotationParam", "java:S3776", "java:S5411"}) @Mojo(name = "generate", defaultPhase = LifecyclePhase.GENERATE_SOURCES, threadSafe = true) @Slf4j -public class GenerateMojo extends AbstractMojo { +public class GenerateMojo extends InputMavenArtifactMojo { private static String trimCSV(String text) { if (isNotEmpty(text)) { @@ -136,21 +137,6 @@ private static String trimCSV(String text) { protected File copyTo; - /** - * Location of the OpenAPI spec, as URL or local file glob pattern. - *

- * If the input is a local file, the value of this property is considered a glob pattern that must - * resolve to a unique file. - *

- *

- * The glob pattern allows to express the input specification in a version neutral way. For - * instance, if the actual file is {@code my-service-api-v3.1.4.yaml} the expression could be - * {@code my-service-api-v*.yaml}. - *

- */ - @Parameter(name = "inputSpec", property = "openapi.generator.maven.plugin.inputSpec", required = true) - protected String inputSpec; - /** * Git host, e.g. gitlab.com. */ @@ -486,11 +472,7 @@ private static String trimCSV(String text) { @Parameter(name = "writeDebugFiles") protected boolean writeDebugFiles = false; - /** - * The project being built. - */ - @Parameter(readonly = true, required = true, defaultValue = "${project}") - protected MavenProject project; + public void setBuildContext(BuildContext buildContext) { this.buildContext = buildContext; @@ -498,13 +480,15 @@ public void setBuildContext(BuildContext buildContext) { @Override @SuppressWarnings({"java:S3776", "java:S1874"}) - public void execute() throws MojoExecutionException { + public void execute() throws MojoExecutionException, MojoFailureException { + if (skip) { getLog().info("Code generation is skipped."); return; } + super.execute(); File inputSpecFile = new File(inputSpec); File inputParent = inputSpecFile.getParentFile(); diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateRestTemplateEmbeddedMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateRestTemplateEmbeddedMojo.java index f21a705a4..53eb60342 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateRestTemplateEmbeddedMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateRestTemplateEmbeddedMojo.java @@ -1,6 +1,7 @@ package com.backbase.oss.boat; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; /** @@ -10,7 +11,7 @@ public class GenerateRestTemplateEmbeddedMojo extends AbstractGenerateMojo { @Override - public void execute() throws MojoExecutionException { + public void execute() throws MojoExecutionException, MojoFailureException { getLog().info("Generating Client using Spring Rest Template"); execute("java", "resttemplate", true, false, true); } diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateSpringBootEmbeddedMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateSpringBootEmbeddedMojo.java index 15f17d5d2..f4bd2a569 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateSpringBootEmbeddedMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateSpringBootEmbeddedMojo.java @@ -1,6 +1,7 @@ package com.backbase.oss.boat; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; /** @@ -10,7 +11,7 @@ public class GenerateSpringBootEmbeddedMojo extends AbstractGenerateMojo { @Override - public void execute() throws MojoExecutionException { + public void execute() throws MojoExecutionException, MojoFailureException { getLog().info("Generating Server Stubs using Spring Boot"); execute("spring", "spring-boot", true, false, false); } diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateWebClientEmbeddedMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateWebClientEmbeddedMojo.java index 76bdc7c50..bf8ad91fc 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateWebClientEmbeddedMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateWebClientEmbeddedMojo.java @@ -1,6 +1,7 @@ package com.backbase.oss.boat; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Mojo; /** @@ -10,7 +11,7 @@ public class GenerateWebClientEmbeddedMojo extends AbstractGenerateMojo { @Override - public void execute() throws MojoExecutionException { + public void execute() throws MojoExecutionException, MojoFailureException { getLog().info("Generating Server Stubs using Web Client Boot"); execute("java", "webclient", true, true, true); } diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/InputArtifact.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/InputArtifact.java new file mode 100644 index 000000000..da7e17a27 --- /dev/null +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/InputArtifact.java @@ -0,0 +1,42 @@ +package com.backbase.oss.boat; + +import lombok.Getter; +import lombok.Setter; +import lombok.extern.slf4j.Slf4j; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; + + +@Getter +@Setter +@Slf4j +public class InputArtifact { + private String groupId; + private String artifactId; + private String version; + private String type; + private String classifier; + private String fileName; + private boolean overWrite; + private boolean overWriteIfNewer; + private boolean needsProcessing; + + public boolean isNeedsProcessing(File destFile, File originFile){ + needsProcessing = overWrite || !destFile.exists() || (overWriteIfNewer && isNewer(destFile,originFile)); + return needsProcessing; + } + + private boolean isNewer( File destFile, File originFile ) { + try { + long destMod = Files.getLastModifiedTime( destFile.toPath() ).toMillis(); + long originMod = Files.getLastModifiedTime( originFile.toPath() ).toMillis(); + return originMod > destMod; + } catch (IOException e) { + log.debug("Assuming artifact was not modified since artifact was last downloaded, cannot last read modified time"); + return false; + } + + } +} diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/InputMavenArtifactMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/InputMavenArtifactMojo.java new file mode 100644 index 000000000..579c1d310 --- /dev/null +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/InputMavenArtifactMojo.java @@ -0,0 +1,181 @@ +package com.backbase.oss.boat; + + +import lombok.extern.slf4j.Slf4j; +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugins.annotations.Component; +import org.apache.maven.plugins.annotations.Parameter; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.util.Expand; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.DefaultArtifact; +import org.eclipse.aether.impl.ArtifactResolver; +import org.eclipse.aether.repository.RemoteRepository; +import org.eclipse.aether.resolution.ArtifactResult; + +import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.List; +import java.util.concurrent.locks.ReentrantLock; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +@Slf4j +public class InputMavenArtifactMojo extends AbstractMojo { + + /** + * A maven artifact containing a spec, or multiple to be processed + */ + @Parameter(name = "inputMavenArtifact", property = "inputMavenArtifact", required = false) + protected InputArtifact inputMavenArtifact; + + /** + * File input used for Linting and Validating + * Can be directory or file + */ + @Parameter(name = "input", required = false) + protected File input; + + /** + * Location of the OpenAPI spec, as URL or local file glob pattern. + *

+ * If the input is a local file, the value of this property is considered a glob pattern that must + * resolve to a unique file. + *

+ *

+ * The glob pattern allows to express the input specification in a version neutral way. For + * instance, if the actual file is {@code my-service-api-v3.1.4.yaml} the expression could be + * {@code my-service-api-v*.yaml}. + *

+ */ + @Parameter(name = "inputSpec", property = "openapi.generator.maven.plugin.inputSpec", required = false) + protected String inputSpec; + + /** + * The project being built. + */ + @Parameter(readonly = true, required = true, defaultValue = "${project}") + protected MavenProject project; + + /** + * Used to set up artifact request + */ + @Parameter(defaultValue = "${repositorySystemSession}", readonly = true) + protected RepositorySystemSession repositorySession; + + /** + * Used to look up Artifacts in the remote repository. + */ + @Component + protected ArtifactResolver artifactResolver; + + /** + * List of Remote Repositories used by the resolver. + */ + @Parameter(defaultValue = "${project.remoteProjectRepositories}", readonly = true) + protected List remoteRepositories; + + private final ReentrantLock reLock = new ReentrantLock(true); + + @Override + public void execute() throws MojoExecutionException, MojoFailureException { + + if (inputMavenArtifact != null && inputMavenArtifact.getArtifactId() != null) { + getArtifact(); + } + + if (input == null && inputSpec == null && inputMavenArtifact == null) { + throw new MojoExecutionException("Missing input from plugin, input options are: inputMavenArtifact, input, inputSpec"); + } + + if (input == null) { + input = new File(inputSpec); + } + + } + + + private void getArtifact() throws MojoExecutionException { + ArtifactResult result; + + File specUnzipDirectory = new File(project.getBuild().getDirectory() + + File.separator + "input-artifact" + File.separator + + inputMavenArtifact.getArtifactId(), inputMavenArtifact.getVersion()); + + + + + + // The artifact will be downloaded to the local repository if necessary. An artifact that is already resolved will + // be skipped and is not re-resolved. + result = new ArtifactRepositoryResolver(artifactResolver, repositorySession, remoteRepositories).resolveArtifactFromRepositories(new DefaultArtifact(inputMavenArtifact.getGroupId() + , inputMavenArtifact.getArtifactId() + , inputMavenArtifact.getClassifier() + , inputMavenArtifact.getType() + , inputMavenArtifact.getVersion())); + + if (inputMavenArtifact.isNeedsProcessing(specUnzipDirectory,result.getArtifact().getFile())) { + + unzipSpec(result.getArtifact().getFile(), specUnzipDirectory); + + } + + try (Stream walk = Files.walk(specUnzipDirectory.toPath())) { + + List paths = walk + .filter(Files::isRegularFile) + .filter(path -> path.endsWith(inputMavenArtifact.getFileName())) + .map(Path::toString) + .collect(Collectors.toList()); + + if (paths.size() > 1) { + log.info("found multiple files of matching {} in zip, using {}", inputMavenArtifact.getFileName(), paths.get(0)); + } else if (paths.isEmpty()) { + throw new MojoExecutionException("no file matching " + inputMavenArtifact.getFileName() + " was found in artifact zip"); + } + + inputSpec = paths.get(0); + input = new File(paths.get(0)); + + } catch (IOException e) { + log.debug(e.getMessage()); + throw new MojoExecutionException("Could not search unzipped artifact directory"); + } + + } + + + private void unzipSpec(File inputFile, File specUnzipDirectory) throws MojoExecutionException { + reLock.lock(); + try { + specUnzipDirectory.mkdirs(); + unzip(inputFile, specUnzipDirectory); + } catch (Exception e) { + reLock.unlock(); + throw new MojoExecutionException("Error extracting spec: " + inputFile, e); + }finally { + reLock.unlock(); + } + } + + private void unzip(File source, File out) throws Exception { + Expand expand = new Expand(); + expand.setSrc(source); + expand.setDest(out); + expand.setOverwrite(true); + expand.execute(); + } + + public void setInput(File input) { + this.input = input; + } + +} + + + + diff --git a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/GenerateMojoTests.java b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/GenerateMojoTests.java index 955725894..31457400a 100644 --- a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/GenerateMojoTests.java +++ b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/GenerateMojoTests.java @@ -4,6 +4,7 @@ import com.backbase.oss.codegen.java.BoatSpringCodeGen; import java.io.File; import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.logging.console.ConsoleLogger; import org.junit.jupiter.api.BeforeEach; @@ -27,7 +28,7 @@ void setUp() { } @Test - void addTestCompileSourceRoot() throws MojoExecutionException { + void addTestCompileSourceRoot() throws MojoExecutionException, MojoFailureException { GenerateMojo mojo = configure(new GenerateMojo(), DefaultCodegen.class.getName()); mojo.addCompileSourceRoot = false; @@ -46,7 +47,7 @@ void addTestCompileSourceRoot() throws MojoExecutionException { } @Test - void useJavaBoat() throws MojoExecutionException { + void useJavaBoat() throws MojoExecutionException, MojoFailureException { GenerateMojo mojo = configure(new GenerateMojo(), "java"); mojo.execute(); @@ -55,7 +56,7 @@ void useJavaBoat() throws MojoExecutionException { } @Test - void useSpringBoat() throws MojoExecutionException { + void useSpringBoat() throws MojoExecutionException, MojoFailureException { GenerateMojo mojo = configure(new GenerateMojo(), "spring"); mojo.execute(); @@ -64,7 +65,7 @@ void useSpringBoat() throws MojoExecutionException { } @Test - void useJavaBoatForRestTemplateEmbedded() throws MojoExecutionException { + void useJavaBoatForRestTemplateEmbedded() throws MojoExecutionException, MojoFailureException { GenerateMojo mojo = configure(new GenerateRestTemplateEmbeddedMojo(), null); mojo.execute(); @@ -73,7 +74,7 @@ void useJavaBoatForRestTemplateEmbedded() throws MojoExecutionException { } @Test - void useSpringBoatForSpringBootEmbedded() throws MojoExecutionException { + void useSpringBoatForSpringBootEmbedded() throws MojoExecutionException, MojoFailureException { GenerateMojo mojo = configure(new GenerateSpringBootEmbeddedMojo(), null); mojo.execute(); @@ -82,7 +83,7 @@ void useSpringBoatForSpringBootEmbedded() throws MojoExecutionException { } @Test - void useJavaBoatForWebClientEmbedded() throws MojoExecutionException { + void useJavaBoatForWebClientEmbedded() throws MojoExecutionException, MojoFailureException { GenerateMojo mojo = configure(new GenerateWebClientEmbeddedMojo(), null); mojo.execute(); diff --git a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/GeneratorTests.java b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/GeneratorTests.java index 4aa024d51..ed8cbd38f 100644 --- a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/GeneratorTests.java +++ b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/GeneratorTests.java @@ -28,7 +28,7 @@ static void setupLocale() { } @Test - void testHtml2() throws MojoExecutionException { + void testHtml2() throws MojoExecutionException, MojoFailureException { String spec = System.getProperty("spec", getClass().getResource("/oas-examples/petstore.yaml").getFile()); GenerateMojo mojo = new GenerateMojo(); @@ -55,7 +55,7 @@ void testHtml2() throws MojoExecutionException { } @Test - void testBoatDocs() throws MojoExecutionException { + void testBoatDocs() throws MojoExecutionException, MojoFailureException { String spec = System.getProperty("spec", getClass().getResource("/oas-examples/petstore.yaml").getFile()); @@ -86,7 +86,7 @@ void testBoatDocs() throws MojoExecutionException { } @Test - void testBoatDocsWithDirectory() throws MojoExecutionException { + void testBoatDocsWithDirectory() throws MojoExecutionException, MojoFailureException { String spec = System.getProperty("spec", getClass().getResource("/boat-doc-oas-examples").getFile()); @@ -235,7 +235,7 @@ void testAngularExamplesInComponents() { } @Test - void testBeanValidation() throws MojoExecutionException { + void testBeanValidation() throws MojoExecutionException, MojoFailureException { GenerateMojo mojo = new GenerateMojo(); String inputFile = getClass().getResource("/oas-examples/petstore.yaml").getFile(); From aea6d22360c9f8ef283990bff4c814ffc4be6516 Mon Sep 17 00:00:00 2001 From: Sophie Janssens Date: Wed, 28 Apr 2021 17:13:18 +0200 Subject: [PATCH 2/9] Fix: added tests for artifact input --- .../artifact-input/pom.xml | 49 ++++++++ .../openapi-specs/openapi-spec-bom/pom.xml | 32 +++++ .../openapi-specs/openapi-zips/pom.xml | 40 +++++++ .../openapi-zips/src/assembly/build.xml | 18 +++ .../boat-artifact-input/openapi-specs/pom.xml | 23 ++++ .../it/example/boat-artifact-input/pom.xml | 71 ++--------- boat-maven-plugin/src/it/example/pom.xml | 1 + .../oss/boat/ArtifactRepositoryResolver.java | 6 +- .../backbase/oss/boat/ArtifactMojoTests.java | 112 ++++++++++++++++++ .../org.mockito.plugins.MockMaker | 1 + .../openapi-zips-1.0.0-SNAPSHOT-api.zip | Bin 0 -> 11974 bytes 11 files changed, 289 insertions(+), 64 deletions(-) create mode 100644 boat-maven-plugin/src/it/example/boat-artifact-input/artifact-input/pom.xml create mode 100644 boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-spec-bom/pom.xml create mode 100644 boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/pom.xml create mode 100644 boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/assembly/build.xml create mode 100644 boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/pom.xml create mode 100644 boat-maven-plugin/src/test/java/com/backbase/oss/boat/ArtifactMojoTests.java create mode 100644 boat-maven-plugin/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker create mode 100644 boat-maven-plugin/src/test/resources/oas-examples/openapi-zips-1.0.0-SNAPSHOT-api.zip diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/artifact-input/pom.xml b/boat-maven-plugin/src/it/example/boat-artifact-input/artifact-input/pom.xml new file mode 100644 index 000000000..9e4491ffe --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/artifact-input/pom.xml @@ -0,0 +1,49 @@ + + + 4.0.0 + + + com.backbase.oss.boat.example + boat-artifact-input + 1.0.0-SNAPSHOT + + + artifact-input + pom + + BOAT :: Input artifact + + + + + com.backbase.oss + boat-maven-plugin + + + generate-docs-from-zip + generate-sources + + doc + + + + com.backbase.oss.boat.example + openapi-zips + 1.0.0-SNAPSHOT + api + zip + presentation-client-api/openapi.yaml + + + + + + + + + + + + diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-spec-bom/pom.xml b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-spec-bom/pom.xml new file mode 100644 index 000000000..e213c287b --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-spec-bom/pom.xml @@ -0,0 +1,32 @@ + + + 4.0.0 + + com.backbase.oss.boat.example + openapi-spec-bom + 1.0.0-SNAPSHOT + + + 1.0.0-SNAPSHOT + + + pom + + BOAT :: OpenAPI Bill-Of-Materials + + + + + com.backbase.oss.boat.example + openapi-zips + ${openapi-spec.version} + + + + + + + + diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/pom.xml b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/pom.xml new file mode 100644 index 000000000..391981bc0 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/pom.xml @@ -0,0 +1,40 @@ + + + 4.0.0 + + com.backbase.oss.boat.example + + + openapi-zips + 1.0.0-SNAPSHOT + + + BOAT :: OpenAPI Example + + + + + maven-assembly-plugin + 3.1.0 + + + create-archive + package + + single + + + + + + src/assembly/build.xml + + + + + + + + diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/assembly/build.xml b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/assembly/build.xml new file mode 100644 index 000000000..8a0b62203 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/assembly/build.xml @@ -0,0 +1,18 @@ + + api + + zip + + false + + + src/main/resources/ + ${artifactId} + + **/** + + + + \ No newline at end of file diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/pom.xml b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/pom.xml new file mode 100644 index 000000000..b9cd10ba3 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/pom.xml @@ -0,0 +1,23 @@ + + + 4.0.0 + + + com.backbase.oss.boat.example + boat-artifact-input + 1.0.0-SNAPSHOT + + + openapi-specs + pom + + + + openapi-zips + openapi-spec-bom + + + + diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/pom.xml b/boat-maven-plugin/src/it/example/boat-artifact-input/pom.xml index 9ed0670e4..073f0b85d 100644 --- a/boat-maven-plugin/src/it/example/boat-artifact-input/pom.xml +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/pom.xml @@ -15,67 +15,16 @@ BOAT :: DOCandLint - - - - com.backbase.oss - boat-maven-plugin - - - generate-rest-template-embedded - generate-sources - - doc - - - - com.backbase.dbs - banking-services-bom - 2.20.1.1 - api - zip - access-control-client-api-v2.4.0.yaml - - - - - lint - verify - - lint - - - - com.backbase.dbs - banking-services-bom - 2.20.1.1 - api - zip - access-control-client-api-v2.4.0.yaml - - - - - generate-docs - generate-sources - - doc - - - - com.backbase.dbs.contact - contact-manager - 1.2.38.3 - api - zip - contact-manager-service-api-v2.3.0.yaml - - - - - - - + + Example projects showing exporting RAML to OpenAPI from source files. + Specs can be in source files, or retrieved from dependencies + + + + + openapi-specs + artifact-input + diff --git a/boat-maven-plugin/src/it/example/pom.xml b/boat-maven-plugin/src/it/example/pom.xml index 4c8001a69..53915c9f3 100644 --- a/boat-maven-plugin/src/it/example/pom.xml +++ b/boat-maven-plugin/src/it/example/pom.xml @@ -40,6 +40,7 @@ BOAT :: Examples + boat-artifact-input boat-doc boat-export boat-generate diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ArtifactRepositoryResolver.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ArtifactRepositoryResolver.java index 4af7bf88b..090b7010d 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ArtifactRepositoryResolver.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ArtifactRepositoryResolver.java @@ -11,9 +11,9 @@ public class ArtifactRepositoryResolver { - private ArtifactResolver artifactResolver; - private RepositorySystemSession repositorySession; - private List remoteRepositories; + private final ArtifactResolver artifactResolver; + private final RepositorySystemSession repositorySession; + private final List remoteRepositories; public ArtifactRepositoryResolver(ArtifactResolver artifactResolver, RepositorySystemSession repositorySession, List remoteRepositories) { this.artifactResolver = artifactResolver; diff --git a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ArtifactMojoTests.java b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ArtifactMojoTests.java new file mode 100644 index 000000000..947be7b74 --- /dev/null +++ b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ArtifactMojoTests.java @@ -0,0 +1,112 @@ +package com.backbase.oss.boat; + +import org.apache.maven.model.Build; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.logging.console.ConsoleLogger; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.impl.ArtifactResolver; +import org.eclipse.aether.resolution.ArtifactResolutionException; +import org.eclipse.aether.resolution.ArtifactResult; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.junit.jupiter.MockitoExtension; +import org.sonatype.plexus.build.incremental.DefaultBuildContext; + +import java.io.File; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.junit.jupiter.api.Assertions.assertThrows; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +@ExtendWith(MockitoExtension.class) +public class ArtifactMojoTests { + + ArtifactResolver artifactResolver; + ArtifactResult artifactResult; + + @Test + void testArtifactResolver(){ + + GenerateDocMojo mojo = new GenerateDocMojo(); + File output = new File("target/boat-docs"); + if (!output.exists()) { + output.mkdirs(); + } + + DefaultBuildContext defaultBuildContext = new DefaultBuildContext(); + defaultBuildContext.enableLogging(new ConsoleLogger()); + + mojo.getLog(); + mojo.buildContext = defaultBuildContext; + mojo.project = new MavenProject(); + mojo.output = output; + mojo.skip = false; + mojo.skipIfSpecIsUnchanged = false; + mojo.bundleSpecs = true; + mojo.dereferenceComponents = true; + + assertThrows(MojoExecutionException.class, mojo::execute); + + } + + @Test + void testArtifactInputMojo() throws ArtifactResolutionException, MojoFailureException, MojoExecutionException { + File file = getFile("/oas-examples/openapi-zips-1.0.0-SNAPSHOT-api.zip"); + artifactResolver = mock(ArtifactResolver.class); + artifactResult = mock( ArtifactResult.class); + org.eclipse.aether.artifact.Artifact artifact = mock(org.eclipse.aether.artifact.Artifact.class); + + when(artifactResolver.resolveArtifact(any(),any())).thenReturn(artifactResult); + when(artifactResult.getArtifact()).thenReturn(artifact); + when(artifact.getFile()).thenReturn(file); + + GenerateDocMojo mojo = new GenerateDocMojo(); + File output = new File("target/boat-docs"); + if (!output.exists()) { + output.mkdirs(); + } + + DefaultBuildContext defaultBuildContext = new DefaultBuildContext(); + defaultBuildContext.enableLogging(new ConsoleLogger()); + InputArtifact inputArtifact = new InputArtifact(); + inputArtifact.setVersion("1.0.0-SNAPSHOT"); + inputArtifact.setGroupId("test.groupId"); + inputArtifact.setArtifactId("openapi-zips"); + inputArtifact.setClassifier("api"); + inputArtifact.setType("zip"); + inputArtifact.setFileName("presentation-integration-api/openapi.yaml"); + + mojo.inputMavenArtifact=inputArtifact; + mojo.getLog(); + mojo.buildContext = defaultBuildContext; + mojo.artifactResolver = artifactResolver; + Build build = new Build(); + build.setDirectory("target"); + + + MavenProject project = new MavenProject(); + + project.setBuild(build); + mojo.project = project; + mojo.repositorySession = mock(RepositorySystemSession.class); + mojo.output = output; + mojo.skip = false; + mojo.skipIfSpecIsUnchanged = false; + mojo.bundleSpecs = true; + mojo.dereferenceComponents = true; + mojo.execute(); + + assertThat(output.list()).containsExactlyInAnyOrder("index.html", ".openapi-generator-ignore", ".openapi-generator"); + + } + private File getFile(String fileName) { + return new File(getClass().getResource(fileName).getFile()); + } + + + +} diff --git a/boat-maven-plugin/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker b/boat-maven-plugin/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker new file mode 100644 index 000000000..ca6ee9cea --- /dev/null +++ b/boat-maven-plugin/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker @@ -0,0 +1 @@ +mock-maker-inline \ No newline at end of file diff --git a/boat-maven-plugin/src/test/resources/oas-examples/openapi-zips-1.0.0-SNAPSHOT-api.zip b/boat-maven-plugin/src/test/resources/oas-examples/openapi-zips-1.0.0-SNAPSHOT-api.zip new file mode 100644 index 0000000000000000000000000000000000000000..c12e5d4f7b8a6f9c6701f5756afe2432341d9340 GIT binary patch literal 11974 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 literal 0 HcmV?d00001 From e38f5f6250e7d01799bfbb09a4f79d762c10a78d Mon Sep 17 00:00:00 2001 From: Sophie Janssens Date: Thu, 29 Apr 2021 07:46:57 +0200 Subject: [PATCH 3/9] Fix: added tests for artifact input --- .../boat-artifact-input/openapi-specs/openapi-zips/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/pom.xml b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/pom.xml index 391981bc0..1c62eb68d 100644 --- a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/pom.xml +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/pom.xml @@ -29,7 +29,7 @@ - src/assembly/build.xml + ${project.basedir}/src/assembly/build.xml From efec6fd9321440e35bacc370289465089563c6fc Mon Sep 17 00:00:00 2001 From: Sophie Janssens Date: Thu, 29 Apr 2021 12:44:20 +0200 Subject: [PATCH 4/9] Fix: added apis for it tests --- .../openapi-specs/openapi-zips/pom.xml | 10 +- .../presentation-client-api/index.html | 24 + .../presentation-client-api/openapi.yaml | 1223 +++++++++++++++++ .../presentation-integration-api/index.html | 24 + .../presentation-integration-api/openapi.yaml | 48 + .../presentation-service-api/index.html | 24 + .../presentation-service-api/openapi.yaml | 885 ++++++++++++ 7 files changed, 2233 insertions(+), 5 deletions(-) create mode 100644 boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-client-api/index.html create mode 100644 boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-client-api/openapi.yaml create mode 100644 boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-integration-api/index.html create mode 100644 boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-integration-api/openapi.yaml create mode 100644 boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-service-api/index.html create mode 100644 boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-service-api/openapi.yaml diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/pom.xml b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/pom.xml index 1c62eb68d..8a0113446 100644 --- a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/pom.xml +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/pom.xml @@ -25,13 +25,13 @@ single + + + src/assembly/build.xml + + - - - ${project.basedir}/src/assembly/build.xml - - diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-client-api/index.html b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-client-api/index.html new file mode 100644 index 000000000..80aa61995 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-client-api/index.html @@ -0,0 +1,24 @@ + + + + Wallet Test Client API + + + + + + + + + + + + + \ No newline at end of file diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-client-api/openapi.yaml b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-client-api/openapi.yaml new file mode 100644 index 000000000..eed41ab6d --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-client-api/openapi.yaml @@ -0,0 +1,1223 @@ +openapi: 3.0.3 +info: + title: Wallet Test Client API + description: No description available + version: 2.19.0 +servers: +- url: /artifact-service/ + description: The server +tags: +- name: wallet test client api +paths: + /client-api/v1/wallet/paymentcards: + summary: Payment Cards + description: No description available + get: + tags: + - wallet + summary: "Returns available payment card details for user, optionally filtered\ + \ by nameOnCard." + description: "Returns available payment card details for user, optionally filtered\ + \ by nameOnCard" + operationId: getPaymentCards + parameters: + - name: nameOnCard + in: query + description: "Filter by the cardholder's name (case-insensitive), can be the\ + \ first one or more characters of one of the words/names" + required: false + schema: + type: string + examples: + example: + summary: example + value: Smi + - name: dateTimeOnly + in: query + description: Creation date in datetime-only format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36 + - name: dateTime + in: query + description: Creation date in Zoned RFC3339 Date-time format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36Z + - name: dateTime2616 + in: query + description: Zoned RFC2616 Date-time param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: "Wed, 4 Jul 2001 12:08:56 PDT" + - name: date + in: query + description: Date-only param example + required: false + schema: + type: string + format: date + examples: + example: + summary: example + value: 2017-10-04 + - name: time + in: query + description: time-only param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 14:54:36 + - name: orderBy + in: query + description: "Order by field: nameOnCard\n" + required: false + schema: + type: string + examples: + example: + summary: example + - name: direction + in: query + description: Direction + required: false + schema: + type: string + default: DESC + enum: + - ASC + - DESC + examples: + example: + summary: example + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCards' + examples: + example: + value: "[ {\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\"\ + ,\n \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \ + \ \"startDate\" : \"0116\",\n \"expiryDate\" : \"1219\",\n \"\ + nameOnCard\" : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"2001\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}, {\n \"id\" : \"d593c212-70ad-41a6-a547-d5d9232414cb\"\ + ,\n \"pan\" : \"5434111122224444\",\n \"cvc\" : \"101\",\n \ + \ \"startDate\" : \"0216\",\n \"expiryDate\" : \"0120\",\n \"\ + nameOnCard\" : \"Mr Timmothy Tester\",\n \"creationDate\" : \"\ + 2011-05-30T12:13:14+03:00\",\n \"balance\" : {\n \"amount\"\ + \ : \"4.4399999999999995\",\n \"currencyCode\" : \"GBP\"\n\ + \ },\n \"apr\" : 12.75\n}, {\n \"id\" : \"9635966b-28e9-4479-8121-bb7bc9beeb62\"\ + ,\n \"pan\" : \"5434121212121212\",\n \"cvc\" : \"121\",\n \ + \ \"startDate\" : \"0115\",\n \"expiryDate\" : \"1218\",\n \"\ + nameOnCard\" : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1981\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n} ]" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "406": + description: NotAcceptable + content: + application/json: + schema: + $ref: '#/components/schemas/NotAcceptableError' + examples: + example: + value: "{\n \"message\" : \"Could not find acceptable representation\"\ + ,\n \"supportedMediaTypes\" : [ \"application/json\" ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + x-bb-access-control-resource: WALLET + x-bb-access-control-function: MANAGE_PAYMENT_CARDS + x-bb-access-control-privilege: READ_PAYMENT_CARD + post: + tags: + - wallet + summary: Adds a payment card to the user's wallet. + description: Adds a payment card to the user's wallet + operationId: postPaymentCards + parameters: + - name: X-Request-Id + in: header + description: Correlates HTTP requests between a client and server. + required: false + schema: + type: string + examples: + example: + summary: example + value: f058ebd6-02f7-4d3f-942e-904344e8cde5 + requestBody: + description: Adds a payment card to the user's wallet + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCard' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\",\n\ + \ \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \"startDate\"\ + \ : \"0116\",\n \"expiryDate\" : \"1219\",\n \"nameOnCard\" :\ + \ \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1000\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}" + responses: + "201": + description: request to create payment card accepted + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCardsPostResponseBody' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\"\n\ + }" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + x-bb-access-control-resource: WALLET + x-bb-access-control-function: MANAGE_PAYMENT_CARDS + x-bb-access-control-privilege: WRITE_PAYMENT_CARD + /client-api/v1/wallet/paymentcards/{cardId}: + summary: Payment Card + description: No description available + get: + tags: + - wallet + summary: Returns details of a specific payment card. + description: Returns details of a specific payment card + operationId: getPaymentCard + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCard' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\",\n\ + \ \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \"\ + startDate\" : \"0116\",\n \"expiryDate\" : \"1219\",\n \"nameOnCard\"\ + \ : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1000\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + x-bb-access-control-resource: WALLET + x-bb-access-control-function: MANAGE_PAYMENT_CARDS + x-bb-access-control-privilege: READ_PAYMENT_CARD + delete: + tags: + - wallet + summary: Deletes a payment card with a given id. + description: Deletes a payment card with a given id + operationId: deletePaymentCard + responses: + "204": + description: Payment card is succesfully deleted + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + x-bb-access-control-resource: WALLET + x-bb-access-control-function: MANAGE_PAYMENT_CARDS + x-bb-access-control-privilege: DELETE_PAYMENT_CARD + parameters: + - name: cardId + in: path + description: No description available + required: true + schema: + type: string + examples: + example: + summary: example + /client-api/v1/bbt/build-info: + summary: /build-info + description: No description available + get: + tags: + - bbt + summary: Build Information. + description: Build Information + operationId: getBuildinfo + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/BbtBuild-infoGetGetResponseBody' + examples: + example: + value: "{\n \"build-info\" : {\n \"build.version\" : \"1.1.111-SNAPSHOT\"\ + \n }\n}" + /client-api/v1/patch: + summary: patch + description: PATCH endpoint for test operations + patch: + tags: + - patch + summary: patch + description: Patch Test + operationId: patchpatch + parameters: + - name: X-Request-Id + in: header + description: Correlates HTTP requests between a client and server. + required: false + schema: + type: string + examples: + example: + summary: example + value: f058ebd6-02f7-4d3f-942e-904344e8cde5 + responses: + "200": + description: No description available + content: {} + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + /client-api/v1/test/required-boolean-query-param: + summary: required boolean query param + description: arbitrary tests + get: + tags: + - test + description: No description available + operationId: getrequiredBooleanQueryParam + parameters: + - name: bool + in: query + description: Required boolean parameter with no default value + required: true + schema: + type: boolean + examples: + example: + summary: example + value: false + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/RequiredbooleanqueryparamGetResponseBody' + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + /client-api/v1/test/values: + summary: Test Values + description: Test Values + get: + tags: + - test + description: No description available + operationId: getTestValues + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/TestValuesGetResponseBody' + examples: + example: + value: "{\n \"message\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\"\ + ,\n \"number\" : \"102.4\"\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + /client-api/v1/test/headers: + summary: Test header propagation + description: Test header propagation + get: + tags: + - test + description: No description available + operationId: getTestHeaderPropagation + parameters: + - name: addHops + in: query + description: number of additional hops to perform + required: false + schema: + type: integer + format: int32 + examples: + example: + summary: example + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/TestHeadersResponseBody' + examples: + example: + value: "{\n \"requests\" : [ {\n \"name\" : \"building-blocks-test-wallet-presentation-service\"\ + ,\n \"url\" : \"/client-api/v1/test/headers\",\n \"headers\"\ + \ : {\n \"correlation-id\" : [ \"2ed475b714a3945a\" ],\n\ + \ \"accept\" : [ \"application/json\" ],\n \"x-bbt-test\"\ + \ : [ \"X-BBT-contentVal2\" ],\n \"connection\" : [ \"keep-alive\"\ + \ ]\n }\n }, {\n \"name\" : \"building-blocks-test-wallet-pandp-service\"\ + ,\n \"url\" : \"/service-api/v1/test/headers\",\n \"headers\"\ + \ : {\n \"authorization\" : [ \"Bearer eyJh\" ],\n \"\ + accept\" : [ \"application/xml, text/xml, application/json, application/*+xml,\ + \ application/*+json\" ],\n \"content-type\" : [ \"application/json\"\ + \ ],\n \"x-cxt-user-token\" : [ \"Bearer ey\" ],\n \"\ + x-cxt-remote-user\" : [ \"admin\" ],\n \"x-cxt-requestuuid\"\ + \ : [ \"72002652-131a-4f28-bd00-16b8080932f5\" ],\n \"correlation-id\"\ + \ : [ \"2ed475b714a3945a\" ],\n \"x-bbt-test\" : [ \"X-BBT-contentVal2\"\ + \ ]\n }\n }, {\n \"name\" : \"building-blocks-test-wallet-pandp-service\"\ + ,\n \"url\" : \"/service-api/v1/test/headers\",\n \"headers\"\ + \ : {\n \"authorization\" : [ \"Bearer eyJh\" ],\n \"\ + accept\" : [ \"application/xml, text/xml, application/json, application/*+xml,\ + \ application/*+json\" ],\n \"content-type\" : [ \"application/json\"\ + \ ],\n \"x-cxt-user-token\" : [ \"Bearer ey\" ],\n \"\ + x-cxt-remote-user\" : [ \"admin\" ],\n \"x-cxt-requestuuid\"\ + \ : [ \"72002652-131a-4f28-bd00-16b8080932f5\" ],\n \"correlation-id\"\ + \ : [ \"2ed475b714a3945a\" ],\n \"x-bbt-test\" : [ \"X-BBT-contentVal2\"\ + \ ]\n }\n } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + /client-api/v1/test/date-query-params: + summary: dateQueryParam + description: | + Tests for date/time query parameters in service-apis. Sends the same query parameters to the equivalent endpoint + in the pandp service which echoes the given values back in the response body. Values echoed by the pandp service + are then returned in the response to this request. + get: + tags: + - test + description: No description available + operationId: getdateQueryParam + parameters: + - name: dateTimeOnly + in: query + description: Creation date in datetime-only format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36 + - name: dateTime + in: query + description: Creation date in Zoned RFC3339 Date-time format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36Z + - name: dateTime2616 + in: query + description: Zoned RFC2616 Date-time param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: "Wed, 4 Jul 2001 12:08:56 PDT" + - name: date + in: query + description: Date-only param example + required: false + schema: + type: string + format: date + examples: + example: + summary: example + value: 2017-10-04 + - name: time + in: query + description: time-only param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 14:54:36 + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/DateQueryParamGetResponseBody' +components: + schemas: + BadRequestError: + required: + - message + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + BbAccessControl: + required: + - function + - privilege + - resource + type: object + properties: + resource: + type: string + description: "Resource being protected, e.g. 'User'" + function: + type: string + description: "Business function, e.g. 'Manage Users'" + privilege: + type: string + description: "The privilege required, e.g. 'view'" + BbApiDeprecation: + required: + - deprecatedFromVersion + - description + - reason + - removedFromVersion + type: object + properties: + deprecatedFromVersion: + type: string + description: Version of the product from which the endpoint has been deprecated + and should no longer be used + deprecated: true + removedFromVersion: + type: string + description: Version of the product from which the API endpoint will be + removed + reason: + type: string + description: The reason the API endpoint was deprecated + deprecated: true + description: + type: string + description: "Any further information, e.g. migration information" + BbtBuild-infoGetGetResponseBody: + type: object + properties: + build-info: + type: object + example: + build-info: + build.version: 1.1.111-SNAPSHOT + BbtbuildInfogetgetresponsebody: + type: object + properties: + build-info: + type: object + example: + build-info: + build.version: 1.1.111-SNAPSHOT + Currency: + title: Monetary Amount + required: + - amount + - currencyCode + type: object + properties: + amount: + type: string + description: The amount in the specified currency + currencyCode: + pattern: "^[A-Z]{3}$" + type: string + description: The alpha-3 code (complying with ISO 4217) of the currency + that qualifies the amount + description: Schema defining monetary amount in given currency. + DateQueryParamGetResponseBody: + type: object + properties: + dateTimeOnly: + type: string + dateTimeOnlyParsedValue: + type: string + dateTime: + type: string + dateTimeParsedValue: + type: string + dateTime2616: + type: string + dateTime2616ParsedValue: + type: string + date: + type: string + dateParsedValue: + type: string + time: + type: string + timeParsedValue: + type: string + formatDateTime: + type: string + description: "The dateTime parameter formatted as 'date-time', java.util.Date\ + \ or java.time.ZoneDateTime" + format: date-time + formatDate: + type: string + description: "The date parameter formatted as 'date', String or java.time.LocalDate" + format: date + formatTime: + type: string + description: "The time parameter formatted as 'time', String or java.time.LocalTime" + formatUtcMillisec: + type: string + description: "The dateTime parameter formatted as 'date', long" + ErrorItem: + type: object + properties: + message: + type: string + description: Default Message. Any further information. + key: + type: string + description: "{capability-name}.api.{api-key-name}. For generated validation\ + \ errors this is the path in the document the error resolves to. e.g.\ + \ object name + '.' + field" + context: + type: object + description: Context can be anything used to construct localised messages. + description: A validation error + ForbiddenError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + InternalServerError: + required: + - message + type: object + properties: + message: + type: string + description: Further Information + description: Represents HTTP 500 Internal Server Error + NotAcceptableError: + type: object + properties: + message: + type: string + supportedMediaTypes: + type: array + description: List of supported media types for this endpoint + items: + type: string + NotFoundError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + ObjectWrappingException: + type: object + properties: + message: + type: string + data: + type: object + PaymentCard: + required: + - cvc + - expiryDate + - id + - nameOnCard + - pan + - startDate + type: object + properties: + id: + type: string + pan: + maxLength: 19 + type: string + description: "Must be sixteen digits, optionally in blocks of 4 separated\ + \ by a dash" + cvc: + maxLength: 3 + minLength: 3 + type: string + description: Card Verification Code + startDate: + pattern: "^(0[1-9]|1[0-2])/?([0-9]{4}|[0-9]{2})$" + type: string + description: "Must be in one of these four formats: MM/YY MMYY MMYYYY MM/YYYY" + expiryDate: + pattern: "^(0[1-9]|1[0-2])/?([0-9]{4}|[0-9]{2})$" + type: string + description: "Must be in one of these four formats: MM/YY MMYY MMYYYY MM/YYYY" + nameOnCard: + type: string + creationDate: + type: string + format: date-time + balance: + $ref: '#/components/schemas/Currency' + apr: + type: number + cardtype: + type: string + enum: + - CREDIT + - DEBIT + - PREPAID + PaymentCards: + type: array + items: + $ref: '#/components/schemas/PaymentCard' + PaymentCardsPostResponseBody: + type: object + properties: + id: + type: string + example: + id: a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1 + RequiredbooleanqueryparamGetResponseBody: + type: object + properties: + message: + type: string + TestHeadersResponseBody: + type: object + properties: + requests: + type: array + items: + type: object + properties: + name: + type: string + url: + type: string + headers: + type: object + TestValuesGetResponseBody: + type: object + properties: + message: + type: string + number: + type: string + example: + message: a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1 + number: "102.4" + UnauthorizedAltError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + UnauthorizedError: + required: + - message + type: object + properties: + message: + type: string + UnsupportedMediaTypeError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-integration-api/index.html b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-integration-api/index.html new file mode 100644 index 000000000..ef9076b62 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-integration-api/index.html @@ -0,0 +1,24 @@ + + + + Example + + + + + + + + + + + + + \ No newline at end of file diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-integration-api/openapi.yaml b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-integration-api/openapi.yaml new file mode 100644 index 000000000..bf69079bf --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-integration-api/openapi.yaml @@ -0,0 +1,48 @@ +openapi: 3.0.3 +info: + title: Example + description: | + # Example + Test Schema to test an integration-api + version: 2.19.0 +servers: +- url: /artifact-service/ + description: The server +tags: +- name: example +paths: + /integration-api/v1/items: + summary: items + description: Retrieve all items. + get: + tags: + - items + summary: Retrieve list of all items. + description: Retrieve list of all items. + operationId: getitems + responses: + "200": + description: Test Schema + content: + application/json: + schema: + $ref: '#/components/schemas/ItemsGetResponseBody' + examples: + example: + value: "{\n \"name\" : \"Example\",\n \"description\" : \"Example\ + \ description\"\n}" +components: + schemas: + ItemsGetResponseBody: + required: + - name + type: object + properties: + name: + type: string + description: + type: string + description: this models a simple item. + example: + name: Example + description: Example description diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-service-api/index.html b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-service-api/index.html new file mode 100644 index 000000000..c9863ec40 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-service-api/index.html @@ -0,0 +1,24 @@ + + + + Wallet Test Service API + + + + + + + + + + + + + \ No newline at end of file diff --git a/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-service-api/openapi.yaml b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-service-api/openapi.yaml new file mode 100644 index 000000000..5a2175c02 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-artifact-input/openapi-specs/openapi-zips/src/main/resources/presentation-service-api/openapi.yaml @@ -0,0 +1,885 @@ +openapi: 3.0.3 +info: + title: Wallet Test Service API + description: No description available + version: 2.19.0 +servers: +- url: /artifact-service/ + description: The server +tags: +- name: wallet test service api +paths: + /service-api/v1/wallet/admin/{userId}/paymentcards: + summary: Payment Cards + description: No description available + get: + tags: + - wallet + summary: "Returns available payment card details for user, optionally filtered\ + \ by nameOnCard." + description: "Returns available payment card details for user, optionally filtered\ + \ by nameOnCard" + operationId: getPaymentCards + parameters: + - name: nameOnCard + in: query + description: "Filter by the cardholder's name (case-insensitive), can be the\ + \ first one or more characters of one of the words/names" + required: false + schema: + type: string + examples: + example: + summary: example + value: Smi + - name: dateTimeOnly + in: query + description: Creation date in datetime-only format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36 + - name: dateTime + in: query + description: Creation date in Zoned RFC3339 Date-time format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36Z + - name: dateTime2616 + in: query + description: Zoned RFC2616 Date-time param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: "Wed, 4 Jul 2001 12:08:56 PDT" + - name: date + in: query + description: Date-only param example + required: false + schema: + type: string + format: date + examples: + example: + summary: example + value: 2017-10-04 + - name: time + in: query + description: time-only param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 14:54:36 + - name: orderBy + in: query + description: "Order by field: nameOnCard\n" + required: false + schema: + type: string + examples: + example: + summary: example + - name: direction + in: query + description: Direction + required: false + schema: + type: string + default: DESC + enum: + - ASC + - DESC + examples: + example: + summary: example + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCards' + examples: + example: + value: "[ {\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\"\ + ,\n \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \ + \ \"startDate\" : \"0116\",\n \"expiryDate\" : \"1219\",\n \"\ + nameOnCard\" : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"2001\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}, {\n \"id\" : \"d593c212-70ad-41a6-a547-d5d9232414cb\"\ + ,\n \"pan\" : \"5434111122224444\",\n \"cvc\" : \"101\",\n \ + \ \"startDate\" : \"0216\",\n \"expiryDate\" : \"0120\",\n \"\ + nameOnCard\" : \"Mr Timmothy Tester\",\n \"creationDate\" : \"\ + 2011-05-30T12:13:14+03:00\",\n \"balance\" : {\n \"amount\"\ + \ : \"4.4399999999999995\",\n \"currencyCode\" : \"GBP\"\n\ + \ },\n \"apr\" : 12.75\n}, {\n \"id\" : \"9635966b-28e9-4479-8121-bb7bc9beeb62\"\ + ,\n \"pan\" : \"5434121212121212\",\n \"cvc\" : \"121\",\n \ + \ \"startDate\" : \"0115\",\n \"expiryDate\" : \"1218\",\n \"\ + nameOnCard\" : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1981\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n} ]" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "406": + description: NotAcceptable + content: + application/json: + schema: + $ref: '#/components/schemas/NotAcceptableError' + examples: + example: + value: "{\n \"message\" : \"Could not find acceptable representation\"\ + ,\n \"supportedMediaTypes\" : [ \"application/json\" ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + post: + tags: + - wallet + summary: Adds a payment card to the user's wallet. + description: Adds a payment card to the user's wallet + operationId: postPaymentCards + parameters: + - name: X-Request-Id + in: header + description: Correlates HTTP requests between a client and server. + required: false + schema: + type: string + examples: + example: + summary: example + value: f058ebd6-02f7-4d3f-942e-904344e8cde5 + requestBody: + description: Adds a payment card to the user's wallet + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCard' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\",\n\ + \ \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \"startDate\"\ + \ : \"0116\",\n \"expiryDate\" : \"1219\",\n \"nameOnCard\" :\ + \ \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1000\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}" + responses: + "201": + description: request to create payment card accepted + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCardsPostResponseBody' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\"\n\ + }" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + parameters: + - name: userId + in: path + description: No description available + required: true + schema: + type: string + examples: + example: + summary: example + /service-api/v1/wallet/admin/{userId}/paymentcards/{cardId}: + summary: Payment Card + description: No description available + get: + tags: + - wallet + summary: Returns details of a specific payment card. + description: Returns details of a specific payment card + operationId: getPaymentCard + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCard' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\",\n\ + \ \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \"\ + startDate\" : \"0116\",\n \"expiryDate\" : \"1219\",\n \"nameOnCard\"\ + \ : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1000\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + delete: + tags: + - wallet + summary: Deletes a payment card with a given id. + description: Deletes a payment card with a given id + operationId: deletePaymentCard + responses: + "204": + description: Payment card is succesfully deleted + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + parameters: + - name: cardId + in: path + description: No description available + required: true + schema: + type: string + examples: + example: + summary: example + - name: userId + in: path + description: No description available + required: true + schema: + type: string + examples: + example: + summary: example + /service-api/v1/testQuery/required-boolean-query-param: + summary: required boolean query param + description: arbitrary tests + get: + tags: + - testQuery + description: No description available + operationId: getrequiredBooleanQueryParam + parameters: + - name: bool + in: query + description: Required boolean parameter with no default value + required: true + schema: + type: boolean + examples: + example: + summary: example + value: false + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/RequiredbooleanqueryparamGetResponseBody' + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" +components: + schemas: + BadRequestError: + required: + - message + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + BbAccessControl: + required: + - function + - privilege + - resource + type: object + properties: + resource: + type: string + description: "Resource being protected, e.g. 'User'" + function: + type: string + description: "Business function, e.g. 'Manage Users'" + privilege: + type: string + description: "The privilege required, e.g. 'view'" + BbApiDeprecation: + required: + - deprecatedFromVersion + - description + - reason + - removedFromVersion + type: object + properties: + deprecatedFromVersion: + type: string + description: Version of the product from which the endpoint has been deprecated + and should no longer be used + deprecated: true + removedFromVersion: + type: string + description: Version of the product from which the API endpoint will be + removed + reason: + type: string + description: The reason the API endpoint was deprecated + deprecated: true + description: + type: string + description: "Any further information, e.g. migration information" + Currency: + title: Monetary Amount + required: + - amount + - currencyCode + type: object + properties: + amount: + type: string + description: The amount in the specified currency + currencyCode: + pattern: "^[A-Z]{3}$" + type: string + description: The alpha-3 code (complying with ISO 4217) of the currency + that qualifies the amount + description: Schema defining monetary amount in given currency. + ErrorItem: + type: object + properties: + message: + type: string + description: Default Message. Any further information. + key: + type: string + description: "{capability-name}.api.{api-key-name}. For generated validation\ + \ errors this is the path in the document the error resolves to. e.g.\ + \ object name + '.' + field" + context: + type: object + description: Context can be anything used to construct localised messages. + description: A validation error + ForbiddenError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + InternalServerError: + required: + - message + type: object + properties: + message: + type: string + description: Further Information + description: Represents HTTP 500 Internal Server Error + NotAcceptableError: + type: object + properties: + message: + type: string + supportedMediaTypes: + type: array + description: List of supported media types for this endpoint + items: + type: string + NotFoundError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + ObjectWrappingException: + type: object + properties: + message: + type: string + data: + type: object + PaymentCard: + required: + - cvc + - expiryDate + - id + - nameOnCard + - pan + - startDate + type: object + properties: + id: + type: string + pan: + maxLength: 19 + type: string + description: "Must be sixteen digits, optionally in blocks of 4 separated\ + \ by a dash" + cvc: + maxLength: 3 + minLength: 3 + type: string + description: Card Verification Code + startDate: + pattern: "^(0[1-9]|1[0-2])/?([0-9]{4}|[0-9]{2})$" + type: string + description: "Must be in one of these four formats: MM/YY MMYY MMYYYY MM/YYYY" + expiryDate: + pattern: "^(0[1-9]|1[0-2])/?([0-9]{4}|[0-9]{2})$" + type: string + description: "Must be in one of these four formats: MM/YY MMYY MMYYYY MM/YYYY" + nameOnCard: + type: string + creationDate: + type: string + format: date-time + balance: + $ref: '#/components/schemas/Currency' + apr: + type: number + cardtype: + type: string + enum: + - CREDIT + - DEBIT + - PREPAID + PaymentCards: + type: array + items: + $ref: '#/components/schemas/PaymentCard' + PaymentCardsPostResponseBody: + type: object + properties: + id: + type: string + example: + id: a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1 + RequiredbooleanqueryparamGetResponseBody: + type: object + properties: + message: + type: string + TestHeadersResponseBody: + type: object + properties: + requests: + type: array + items: + type: object + properties: + name: + type: string + url: + type: string + headers: + type: object + UnauthorizedAltError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + UnauthorizedError: + required: + - message + type: object + properties: + message: + type: string + UnsupportedMediaTypeError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' From bb51413c59e7c23af3dfd69ecf2b1d2a605def3a Mon Sep 17 00:00:00 2001 From: Sophie Janssens Date: Fri, 30 Apr 2021 11:11:26 +0200 Subject: [PATCH 5/9] Fix: added unit tests for coverage --- .../backbase/oss/boat/ArtifactMojoTests.java | 103 ++++++++++++++++++ 1 file changed, 103 insertions(+) diff --git a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ArtifactMojoTests.java b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ArtifactMojoTests.java index 947be7b74..5424bbdab 100644 --- a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ArtifactMojoTests.java +++ b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ArtifactMojoTests.java @@ -103,6 +103,109 @@ void testArtifactInputMojo() throws ArtifactResolutionException, MojoFailureExce assertThat(output.list()).containsExactlyInAnyOrder("index.html", ".openapi-generator-ignore", ".openapi-generator"); } + @Test + void testArtifactInputMojoDuplicateFile() throws ArtifactResolutionException, MojoFailureException, MojoExecutionException { + File file = getFile("/oas-examples/openapi-zips-1.0.0-SNAPSHOT-api.zip"); + artifactResolver = mock(ArtifactResolver.class); + artifactResult = mock( ArtifactResult.class); + org.eclipse.aether.artifact.Artifact artifact = mock(org.eclipse.aether.artifact.Artifact.class); + + when(artifactResolver.resolveArtifact(any(),any())).thenReturn(artifactResult); + when(artifactResult.getArtifact()).thenReturn(artifact); + when(artifact.getFile()).thenReturn(file); + + GenerateDocMojo mojo = new GenerateDocMojo(); + File output = new File("target/boat-docs"); + if (!output.exists()) { + output.mkdirs(); + } + + DefaultBuildContext defaultBuildContext = new DefaultBuildContext(); + defaultBuildContext.enableLogging(new ConsoleLogger()); + InputArtifact inputArtifact = new InputArtifact(); + inputArtifact.setVersion("1.0.0-SNAPSHOT"); + inputArtifact.setGroupId("test.groupId"); + inputArtifact.setArtifactId("openapi-zips"); + inputArtifact.setClassifier("api"); + inputArtifact.setType("zip"); + inputArtifact.setFileName("openapi.yaml"); + + mojo.inputMavenArtifact=inputArtifact; + mojo.getLog(); + mojo.buildContext = defaultBuildContext; + mojo.artifactResolver = artifactResolver; + Build build = new Build(); + build.setDirectory("target"); + + + MavenProject project = new MavenProject(); + + project.setBuild(build); + mojo.project = project; + mojo.repositorySession = mock(RepositorySystemSession.class); + mojo.output = output; + mojo.skip = false; + mojo.skipIfSpecIsUnchanged = false; + mojo.bundleSpecs = true; + mojo.dereferenceComponents = true; + mojo.execute(); + + assertThat(output.list()).containsExactlyInAnyOrder("index.html", ".openapi-generator-ignore", ".openapi-generator"); + + } + + @Test + void testArtifactInputMojoFail() throws ArtifactResolutionException, MojoFailureException, MojoExecutionException { + File file = getFile("/oas-examples/openapi-zips-1.0.0-SNAPSHOT-api.zip"); + artifactResolver = mock(ArtifactResolver.class); + artifactResult = mock( ArtifactResult.class); + org.eclipse.aether.artifact.Artifact artifact = mock(org.eclipse.aether.artifact.Artifact.class); + + when(artifactResolver.resolveArtifact(any(),any())).thenReturn(artifactResult); + when(artifactResult.getArtifact()).thenReturn(artifact); + when(artifact.getFile()).thenReturn(file); + + GenerateDocMojo mojo = new GenerateDocMojo(); + File output = new File("target/boat-docs"); + if (!output.exists()) { + output.mkdirs(); + } + + DefaultBuildContext defaultBuildContext = new DefaultBuildContext(); + defaultBuildContext.enableLogging(new ConsoleLogger()); + InputArtifact inputArtifact = new InputArtifact(); + inputArtifact.setVersion("1.0.0-SNAPSHOT"); + inputArtifact.setGroupId("test.groupId"); + inputArtifact.setArtifactId("openapi-zips"); + inputArtifact.setClassifier("api"); + inputArtifact.setType("zip"); + inputArtifact.setFileName("file-not-present.yaml"); + + mojo.inputMavenArtifact=inputArtifact; + mojo.getLog(); + mojo.buildContext = defaultBuildContext; + mojo.artifactResolver = artifactResolver; + Build build = new Build(); + build.setDirectory("target"); + + + MavenProject project = new MavenProject(); + + project.setBuild(build); + mojo.project = project; + mojo.repositorySession = mock(RepositorySystemSession.class); + mojo.output = output; + mojo.skip = false; + mojo.skipIfSpecIsUnchanged = false; + mojo.bundleSpecs = true; + mojo.dereferenceComponents = true; + + assertThrows(MojoExecutionException.class, mojo::execute); + + } + + + private File getFile(String fileName) { return new File(getClass().getResource(fileName).getFile()); } From a3050e9c5484b5fed92810909687a0e6260f99b1 Mon Sep 17 00:00:00 2001 From: Sophie Janssens Date: Fri, 30 Apr 2021 12:42:42 +0200 Subject: [PATCH 6/9] Fix: reduced code smells --- .../backbase/oss/boat/AbstractLintMojo.java | 2 +- .../oss/boat/AbstractRamlToOpenApi.java | 3 -- .../com/backbase/oss/boat/GenerateMojo.java | 2 - .../backbase/oss/boat/ArtifactMojoTests.java | 53 ++++++++++++++++++- 4 files changed, 53 insertions(+), 7 deletions(-) diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractLintMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractLintMojo.java index 9f327bb4c..81cb645e2 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractLintMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractLintMojo.java @@ -9,7 +9,6 @@ import java.util.Arrays; import java.util.List; import lombok.extern.slf4j.Slf4j; -import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Parameter; @@ -81,6 +80,7 @@ private BoatLintReport lintOpenAPI(File inputFile) throws MojoExecutionException } } + @Override public void setInput(File input) { this.input = input; } diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractRamlToOpenApi.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractRamlToOpenApi.java index 89bc9670b..caa0fab21 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractRamlToOpenApi.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/AbstractRamlToOpenApi.java @@ -40,9 +40,6 @@ import org.eclipse.aether.impl.ArtifactResolver; import org.eclipse.aether.impl.MetadataResolver; import org.eclipse.aether.repository.RemoteRepository; -import org.eclipse.aether.resolution.ArtifactRequest; -import org.eclipse.aether.resolution.ArtifactResolutionException; -import org.eclipse.aether.resolution.ArtifactResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateMojo.java index a847eceaf..cecab8539 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/GenerateMojo.java @@ -33,14 +33,12 @@ import java.util.Set; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.StringUtils; -import org.apache.maven.plugin.AbstractMojo; import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.plugin.MojoFailureException; import org.apache.maven.plugins.annotations.Component; import org.apache.maven.plugins.annotations.LifecyclePhase; import org.apache.maven.plugins.annotations.Mojo; import org.apache.maven.plugins.annotations.Parameter; -import org.apache.maven.project.MavenProject; import org.openapitools.codegen.CliOption; import org.openapitools.codegen.ClientOptInput; import org.openapitools.codegen.CodegenConfig; diff --git a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ArtifactMojoTests.java b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ArtifactMojoTests.java index 5424bbdab..f3272fbb2 100644 --- a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ArtifactMojoTests.java +++ b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ArtifactMojoTests.java @@ -23,7 +23,7 @@ import static org.mockito.Mockito.when; @ExtendWith(MockitoExtension.class) -public class ArtifactMojoTests { +class ArtifactMojoTests { ArtifactResolver artifactResolver; ArtifactResult artifactResult; @@ -88,6 +88,57 @@ void testArtifactInputMojo() throws ArtifactResolutionException, MojoFailureExce build.setDirectory("target"); + MavenProject project = new MavenProject(); + + project.setBuild(build); + mojo.project = project; + mojo.repositorySession = mock(RepositorySystemSession.class); + mojo.output = output; + mojo.skip = false; + mojo.skipIfSpecIsUnchanged = false; + mojo.bundleSpecs = true; + mojo.dereferenceComponents = true; + mojo.execute(); + + assertThat(output.list()).containsExactlyInAnyOrder("index.html", ".openapi-generator-ignore", ".openapi-generator"); + + } + @Test + void testArtifactInputMojoOverwrite() throws ArtifactResolutionException, MojoFailureException, MojoExecutionException { + File file = getFile("/oas-examples/openapi-zips-1.0.0-SNAPSHOT-api.zip"); + artifactResolver = mock(ArtifactResolver.class); + artifactResult = mock( ArtifactResult.class); + org.eclipse.aether.artifact.Artifact artifact = mock(org.eclipse.aether.artifact.Artifact.class); + + when(artifactResolver.resolveArtifact(any(),any())).thenReturn(artifactResult); + when(artifactResult.getArtifact()).thenReturn(artifact); + when(artifact.getFile()).thenReturn(file); + + GenerateDocMojo mojo = new GenerateDocMojo(); + File output = new File("target/boat-docs"); + if (!output.exists()) { + output.mkdirs(); + } + + DefaultBuildContext defaultBuildContext = new DefaultBuildContext(); + defaultBuildContext.enableLogging(new ConsoleLogger()); + InputArtifact inputArtifact = new InputArtifact(); + inputArtifact.setVersion("1.0.0-SNAPSHOT"); + inputArtifact.setGroupId("test.groupId"); + inputArtifact.setArtifactId("openapi-zips"); + inputArtifact.setClassifier("api"); + inputArtifact.setType("zip"); + inputArtifact.setOverWriteIfNewer(true); + inputArtifact.setFileName("presentation-integration-api/openapi.yaml"); + + mojo.inputMavenArtifact=inputArtifact; + mojo.getLog(); + mojo.buildContext = defaultBuildContext; + mojo.artifactResolver = artifactResolver; + Build build = new Build(); + build.setDirectory("target"); + + MavenProject project = new MavenProject(); project.setBuild(build); From 43ce0d244608c95d3a62acd2b80379f30d5861ac Mon Sep 17 00:00:00 2001 From: Sophie Janssens Date: Mon, 3 May 2021 12:22:19 +0200 Subject: [PATCH 7/9] Fix: reduced code smells --- .../src/it/example/boat-generate/pom.xml | 2 +- .../example/boat-multiple-executions/pom.xml | 8 +- .../presentation-client-api/index.html | 24 + .../presentation-client-api/openapi.yaml | 1223 +++++++++++++++++ .../presentation-integration-api/index.html | 24 + .../presentation-integration-api/openapi.yaml | 48 + .../presentation-service-api/index.html | 24 + .../presentation-service-api/openapi.yaml | 885 ++++++++++++ boat-maven-plugin/src/it/example/pom.xml | 1 + 9 files changed, 2234 insertions(+), 5 deletions(-) create mode 100644 boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-client-api/index.html create mode 100644 boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-client-api/openapi.yaml create mode 100644 boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-integration-api/index.html create mode 100644 boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-integration-api/openapi.yaml create mode 100644 boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-service-api/index.html create mode 100644 boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-service-api/openapi.yaml diff --git a/boat-maven-plugin/src/it/example/boat-generate/pom.xml b/boat-maven-plugin/src/it/example/boat-generate/pom.xml index e74c5d361..63fbcf268 100644 --- a/boat-maven-plugin/src/it/example/boat-generate/pom.xml +++ b/boat-maven-plugin/src/it/example/boat-generate/pom.xml @@ -22,7 +22,7 @@ angular - + java-clients java-server diff --git a/boat-maven-plugin/src/it/example/boat-multiple-executions/pom.xml b/boat-maven-plugin/src/it/example/boat-multiple-executions/pom.xml index d30137b1d..97e6c0638 100644 --- a/boat-maven-plugin/src/it/example/boat-multiple-executions/pom.xml +++ b/boat-maven-plugin/src/it/example/boat-multiple-executions/pom.xml @@ -10,10 +10,10 @@ 1.0.0-SNAPSHOT - boat-artifact-input + boat-multiple-executions pom - BOAT :: DOCandLint + BOAT :: Execute multiple @@ -38,7 +38,7 @@ lint - ${project.basedir}/src/main/resources/openapi.yaml + ${project.basedir}/src/main/resources/presentation-client-api/openapi.yaml @@ -48,7 +48,7 @@ doc - ${project.basedir}/src/main/resources/contact-manager_contact-manager-service-api-v2.3.0.yaml + ${project.basedir}/src/main/resources/presentation-integration-api/openapi.yaml diff --git a/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-client-api/index.html b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-client-api/index.html new file mode 100644 index 000000000..80aa61995 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-client-api/index.html @@ -0,0 +1,24 @@ + + + + Wallet Test Client API + + + + + + + + + + + + + \ No newline at end of file diff --git a/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-client-api/openapi.yaml b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-client-api/openapi.yaml new file mode 100644 index 000000000..eed41ab6d --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-client-api/openapi.yaml @@ -0,0 +1,1223 @@ +openapi: 3.0.3 +info: + title: Wallet Test Client API + description: No description available + version: 2.19.0 +servers: +- url: /artifact-service/ + description: The server +tags: +- name: wallet test client api +paths: + /client-api/v1/wallet/paymentcards: + summary: Payment Cards + description: No description available + get: + tags: + - wallet + summary: "Returns available payment card details for user, optionally filtered\ + \ by nameOnCard." + description: "Returns available payment card details for user, optionally filtered\ + \ by nameOnCard" + operationId: getPaymentCards + parameters: + - name: nameOnCard + in: query + description: "Filter by the cardholder's name (case-insensitive), can be the\ + \ first one or more characters of one of the words/names" + required: false + schema: + type: string + examples: + example: + summary: example + value: Smi + - name: dateTimeOnly + in: query + description: Creation date in datetime-only format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36 + - name: dateTime + in: query + description: Creation date in Zoned RFC3339 Date-time format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36Z + - name: dateTime2616 + in: query + description: Zoned RFC2616 Date-time param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: "Wed, 4 Jul 2001 12:08:56 PDT" + - name: date + in: query + description: Date-only param example + required: false + schema: + type: string + format: date + examples: + example: + summary: example + value: 2017-10-04 + - name: time + in: query + description: time-only param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 14:54:36 + - name: orderBy + in: query + description: "Order by field: nameOnCard\n" + required: false + schema: + type: string + examples: + example: + summary: example + - name: direction + in: query + description: Direction + required: false + schema: + type: string + default: DESC + enum: + - ASC + - DESC + examples: + example: + summary: example + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCards' + examples: + example: + value: "[ {\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\"\ + ,\n \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \ + \ \"startDate\" : \"0116\",\n \"expiryDate\" : \"1219\",\n \"\ + nameOnCard\" : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"2001\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}, {\n \"id\" : \"d593c212-70ad-41a6-a547-d5d9232414cb\"\ + ,\n \"pan\" : \"5434111122224444\",\n \"cvc\" : \"101\",\n \ + \ \"startDate\" : \"0216\",\n \"expiryDate\" : \"0120\",\n \"\ + nameOnCard\" : \"Mr Timmothy Tester\",\n \"creationDate\" : \"\ + 2011-05-30T12:13:14+03:00\",\n \"balance\" : {\n \"amount\"\ + \ : \"4.4399999999999995\",\n \"currencyCode\" : \"GBP\"\n\ + \ },\n \"apr\" : 12.75\n}, {\n \"id\" : \"9635966b-28e9-4479-8121-bb7bc9beeb62\"\ + ,\n \"pan\" : \"5434121212121212\",\n \"cvc\" : \"121\",\n \ + \ \"startDate\" : \"0115\",\n \"expiryDate\" : \"1218\",\n \"\ + nameOnCard\" : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1981\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n} ]" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "406": + description: NotAcceptable + content: + application/json: + schema: + $ref: '#/components/schemas/NotAcceptableError' + examples: + example: + value: "{\n \"message\" : \"Could not find acceptable representation\"\ + ,\n \"supportedMediaTypes\" : [ \"application/json\" ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + x-bb-access-control-resource: WALLET + x-bb-access-control-function: MANAGE_PAYMENT_CARDS + x-bb-access-control-privilege: READ_PAYMENT_CARD + post: + tags: + - wallet + summary: Adds a payment card to the user's wallet. + description: Adds a payment card to the user's wallet + operationId: postPaymentCards + parameters: + - name: X-Request-Id + in: header + description: Correlates HTTP requests between a client and server. + required: false + schema: + type: string + examples: + example: + summary: example + value: f058ebd6-02f7-4d3f-942e-904344e8cde5 + requestBody: + description: Adds a payment card to the user's wallet + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCard' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\",\n\ + \ \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \"startDate\"\ + \ : \"0116\",\n \"expiryDate\" : \"1219\",\n \"nameOnCard\" :\ + \ \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1000\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}" + responses: + "201": + description: request to create payment card accepted + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCardsPostResponseBody' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\"\n\ + }" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + x-bb-access-control-resource: WALLET + x-bb-access-control-function: MANAGE_PAYMENT_CARDS + x-bb-access-control-privilege: WRITE_PAYMENT_CARD + /client-api/v1/wallet/paymentcards/{cardId}: + summary: Payment Card + description: No description available + get: + tags: + - wallet + summary: Returns details of a specific payment card. + description: Returns details of a specific payment card + operationId: getPaymentCard + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCard' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\",\n\ + \ \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \"\ + startDate\" : \"0116\",\n \"expiryDate\" : \"1219\",\n \"nameOnCard\"\ + \ : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1000\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + x-bb-access-control-resource: WALLET + x-bb-access-control-function: MANAGE_PAYMENT_CARDS + x-bb-access-control-privilege: READ_PAYMENT_CARD + delete: + tags: + - wallet + summary: Deletes a payment card with a given id. + description: Deletes a payment card with a given id + operationId: deletePaymentCard + responses: + "204": + description: Payment card is succesfully deleted + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + x-bb-access-control-resource: WALLET + x-bb-access-control-function: MANAGE_PAYMENT_CARDS + x-bb-access-control-privilege: DELETE_PAYMENT_CARD + parameters: + - name: cardId + in: path + description: No description available + required: true + schema: + type: string + examples: + example: + summary: example + /client-api/v1/bbt/build-info: + summary: /build-info + description: No description available + get: + tags: + - bbt + summary: Build Information. + description: Build Information + operationId: getBuildinfo + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/BbtBuild-infoGetGetResponseBody' + examples: + example: + value: "{\n \"build-info\" : {\n \"build.version\" : \"1.1.111-SNAPSHOT\"\ + \n }\n}" + /client-api/v1/patch: + summary: patch + description: PATCH endpoint for test operations + patch: + tags: + - patch + summary: patch + description: Patch Test + operationId: patchpatch + parameters: + - name: X-Request-Id + in: header + description: Correlates HTTP requests between a client and server. + required: false + schema: + type: string + examples: + example: + summary: example + value: f058ebd6-02f7-4d3f-942e-904344e8cde5 + responses: + "200": + description: No description available + content: {} + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + /client-api/v1/test/required-boolean-query-param: + summary: required boolean query param + description: arbitrary tests + get: + tags: + - test + description: No description available + operationId: getrequiredBooleanQueryParam + parameters: + - name: bool + in: query + description: Required boolean parameter with no default value + required: true + schema: + type: boolean + examples: + example: + summary: example + value: false + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/RequiredbooleanqueryparamGetResponseBody' + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + /client-api/v1/test/values: + summary: Test Values + description: Test Values + get: + tags: + - test + description: No description available + operationId: getTestValues + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/TestValuesGetResponseBody' + examples: + example: + value: "{\n \"message\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\"\ + ,\n \"number\" : \"102.4\"\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + /client-api/v1/test/headers: + summary: Test header propagation + description: Test header propagation + get: + tags: + - test + description: No description available + operationId: getTestHeaderPropagation + parameters: + - name: addHops + in: query + description: number of additional hops to perform + required: false + schema: + type: integer + format: int32 + examples: + example: + summary: example + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/TestHeadersResponseBody' + examples: + example: + value: "{\n \"requests\" : [ {\n \"name\" : \"building-blocks-test-wallet-presentation-service\"\ + ,\n \"url\" : \"/client-api/v1/test/headers\",\n \"headers\"\ + \ : {\n \"correlation-id\" : [ \"2ed475b714a3945a\" ],\n\ + \ \"accept\" : [ \"application/json\" ],\n \"x-bbt-test\"\ + \ : [ \"X-BBT-contentVal2\" ],\n \"connection\" : [ \"keep-alive\"\ + \ ]\n }\n }, {\n \"name\" : \"building-blocks-test-wallet-pandp-service\"\ + ,\n \"url\" : \"/service-api/v1/test/headers\",\n \"headers\"\ + \ : {\n \"authorization\" : [ \"Bearer eyJh\" ],\n \"\ + accept\" : [ \"application/xml, text/xml, application/json, application/*+xml,\ + \ application/*+json\" ],\n \"content-type\" : [ \"application/json\"\ + \ ],\n \"x-cxt-user-token\" : [ \"Bearer ey\" ],\n \"\ + x-cxt-remote-user\" : [ \"admin\" ],\n \"x-cxt-requestuuid\"\ + \ : [ \"72002652-131a-4f28-bd00-16b8080932f5\" ],\n \"correlation-id\"\ + \ : [ \"2ed475b714a3945a\" ],\n \"x-bbt-test\" : [ \"X-BBT-contentVal2\"\ + \ ]\n }\n }, {\n \"name\" : \"building-blocks-test-wallet-pandp-service\"\ + ,\n \"url\" : \"/service-api/v1/test/headers\",\n \"headers\"\ + \ : {\n \"authorization\" : [ \"Bearer eyJh\" ],\n \"\ + accept\" : [ \"application/xml, text/xml, application/json, application/*+xml,\ + \ application/*+json\" ],\n \"content-type\" : [ \"application/json\"\ + \ ],\n \"x-cxt-user-token\" : [ \"Bearer ey\" ],\n \"\ + x-cxt-remote-user\" : [ \"admin\" ],\n \"x-cxt-requestuuid\"\ + \ : [ \"72002652-131a-4f28-bd00-16b8080932f5\" ],\n \"correlation-id\"\ + \ : [ \"2ed475b714a3945a\" ],\n \"x-bbt-test\" : [ \"X-BBT-contentVal2\"\ + \ ]\n }\n } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + /client-api/v1/test/date-query-params: + summary: dateQueryParam + description: | + Tests for date/time query parameters in service-apis. Sends the same query parameters to the equivalent endpoint + in the pandp service which echoes the given values back in the response body. Values echoed by the pandp service + are then returned in the response to this request. + get: + tags: + - test + description: No description available + operationId: getdateQueryParam + parameters: + - name: dateTimeOnly + in: query + description: Creation date in datetime-only format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36 + - name: dateTime + in: query + description: Creation date in Zoned RFC3339 Date-time format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36Z + - name: dateTime2616 + in: query + description: Zoned RFC2616 Date-time param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: "Wed, 4 Jul 2001 12:08:56 PDT" + - name: date + in: query + description: Date-only param example + required: false + schema: + type: string + format: date + examples: + example: + summary: example + value: 2017-10-04 + - name: time + in: query + description: time-only param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 14:54:36 + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/DateQueryParamGetResponseBody' +components: + schemas: + BadRequestError: + required: + - message + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + BbAccessControl: + required: + - function + - privilege + - resource + type: object + properties: + resource: + type: string + description: "Resource being protected, e.g. 'User'" + function: + type: string + description: "Business function, e.g. 'Manage Users'" + privilege: + type: string + description: "The privilege required, e.g. 'view'" + BbApiDeprecation: + required: + - deprecatedFromVersion + - description + - reason + - removedFromVersion + type: object + properties: + deprecatedFromVersion: + type: string + description: Version of the product from which the endpoint has been deprecated + and should no longer be used + deprecated: true + removedFromVersion: + type: string + description: Version of the product from which the API endpoint will be + removed + reason: + type: string + description: The reason the API endpoint was deprecated + deprecated: true + description: + type: string + description: "Any further information, e.g. migration information" + BbtBuild-infoGetGetResponseBody: + type: object + properties: + build-info: + type: object + example: + build-info: + build.version: 1.1.111-SNAPSHOT + BbtbuildInfogetgetresponsebody: + type: object + properties: + build-info: + type: object + example: + build-info: + build.version: 1.1.111-SNAPSHOT + Currency: + title: Monetary Amount + required: + - amount + - currencyCode + type: object + properties: + amount: + type: string + description: The amount in the specified currency + currencyCode: + pattern: "^[A-Z]{3}$" + type: string + description: The alpha-3 code (complying with ISO 4217) of the currency + that qualifies the amount + description: Schema defining monetary amount in given currency. + DateQueryParamGetResponseBody: + type: object + properties: + dateTimeOnly: + type: string + dateTimeOnlyParsedValue: + type: string + dateTime: + type: string + dateTimeParsedValue: + type: string + dateTime2616: + type: string + dateTime2616ParsedValue: + type: string + date: + type: string + dateParsedValue: + type: string + time: + type: string + timeParsedValue: + type: string + formatDateTime: + type: string + description: "The dateTime parameter formatted as 'date-time', java.util.Date\ + \ or java.time.ZoneDateTime" + format: date-time + formatDate: + type: string + description: "The date parameter formatted as 'date', String or java.time.LocalDate" + format: date + formatTime: + type: string + description: "The time parameter formatted as 'time', String or java.time.LocalTime" + formatUtcMillisec: + type: string + description: "The dateTime parameter formatted as 'date', long" + ErrorItem: + type: object + properties: + message: + type: string + description: Default Message. Any further information. + key: + type: string + description: "{capability-name}.api.{api-key-name}. For generated validation\ + \ errors this is the path in the document the error resolves to. e.g.\ + \ object name + '.' + field" + context: + type: object + description: Context can be anything used to construct localised messages. + description: A validation error + ForbiddenError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + InternalServerError: + required: + - message + type: object + properties: + message: + type: string + description: Further Information + description: Represents HTTP 500 Internal Server Error + NotAcceptableError: + type: object + properties: + message: + type: string + supportedMediaTypes: + type: array + description: List of supported media types for this endpoint + items: + type: string + NotFoundError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + ObjectWrappingException: + type: object + properties: + message: + type: string + data: + type: object + PaymentCard: + required: + - cvc + - expiryDate + - id + - nameOnCard + - pan + - startDate + type: object + properties: + id: + type: string + pan: + maxLength: 19 + type: string + description: "Must be sixteen digits, optionally in blocks of 4 separated\ + \ by a dash" + cvc: + maxLength: 3 + minLength: 3 + type: string + description: Card Verification Code + startDate: + pattern: "^(0[1-9]|1[0-2])/?([0-9]{4}|[0-9]{2})$" + type: string + description: "Must be in one of these four formats: MM/YY MMYY MMYYYY MM/YYYY" + expiryDate: + pattern: "^(0[1-9]|1[0-2])/?([0-9]{4}|[0-9]{2})$" + type: string + description: "Must be in one of these four formats: MM/YY MMYY MMYYYY MM/YYYY" + nameOnCard: + type: string + creationDate: + type: string + format: date-time + balance: + $ref: '#/components/schemas/Currency' + apr: + type: number + cardtype: + type: string + enum: + - CREDIT + - DEBIT + - PREPAID + PaymentCards: + type: array + items: + $ref: '#/components/schemas/PaymentCard' + PaymentCardsPostResponseBody: + type: object + properties: + id: + type: string + example: + id: a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1 + RequiredbooleanqueryparamGetResponseBody: + type: object + properties: + message: + type: string + TestHeadersResponseBody: + type: object + properties: + requests: + type: array + items: + type: object + properties: + name: + type: string + url: + type: string + headers: + type: object + TestValuesGetResponseBody: + type: object + properties: + message: + type: string + number: + type: string + example: + message: a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1 + number: "102.4" + UnauthorizedAltError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + UnauthorizedError: + required: + - message + type: object + properties: + message: + type: string + UnsupportedMediaTypeError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' diff --git a/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-integration-api/index.html b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-integration-api/index.html new file mode 100644 index 000000000..ef9076b62 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-integration-api/index.html @@ -0,0 +1,24 @@ + + + + Example + + + + + + + + + + + + + \ No newline at end of file diff --git a/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-integration-api/openapi.yaml b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-integration-api/openapi.yaml new file mode 100644 index 000000000..bf69079bf --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-integration-api/openapi.yaml @@ -0,0 +1,48 @@ +openapi: 3.0.3 +info: + title: Example + description: | + # Example + Test Schema to test an integration-api + version: 2.19.0 +servers: +- url: /artifact-service/ + description: The server +tags: +- name: example +paths: + /integration-api/v1/items: + summary: items + description: Retrieve all items. + get: + tags: + - items + summary: Retrieve list of all items. + description: Retrieve list of all items. + operationId: getitems + responses: + "200": + description: Test Schema + content: + application/json: + schema: + $ref: '#/components/schemas/ItemsGetResponseBody' + examples: + example: + value: "{\n \"name\" : \"Example\",\n \"description\" : \"Example\ + \ description\"\n}" +components: + schemas: + ItemsGetResponseBody: + required: + - name + type: object + properties: + name: + type: string + description: + type: string + description: this models a simple item. + example: + name: Example + description: Example description diff --git a/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-service-api/index.html b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-service-api/index.html new file mode 100644 index 000000000..c9863ec40 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-service-api/index.html @@ -0,0 +1,24 @@ + + + + Wallet Test Service API + + + + + + + + + + + + + \ No newline at end of file diff --git a/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-service-api/openapi.yaml b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-service-api/openapi.yaml new file mode 100644 index 000000000..5a2175c02 --- /dev/null +++ b/boat-maven-plugin/src/it/example/boat-multiple-executions/src/main/resources/presentation-service-api/openapi.yaml @@ -0,0 +1,885 @@ +openapi: 3.0.3 +info: + title: Wallet Test Service API + description: No description available + version: 2.19.0 +servers: +- url: /artifact-service/ + description: The server +tags: +- name: wallet test service api +paths: + /service-api/v1/wallet/admin/{userId}/paymentcards: + summary: Payment Cards + description: No description available + get: + tags: + - wallet + summary: "Returns available payment card details for user, optionally filtered\ + \ by nameOnCard." + description: "Returns available payment card details for user, optionally filtered\ + \ by nameOnCard" + operationId: getPaymentCards + parameters: + - name: nameOnCard + in: query + description: "Filter by the cardholder's name (case-insensitive), can be the\ + \ first one or more characters of one of the words/names" + required: false + schema: + type: string + examples: + example: + summary: example + value: Smi + - name: dateTimeOnly + in: query + description: Creation date in datetime-only format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36 + - name: dateTime + in: query + description: Creation date in Zoned RFC3339 Date-time format + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 2017-10-04T14:54:36Z + - name: dateTime2616 + in: query + description: Zoned RFC2616 Date-time param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: "Wed, 4 Jul 2001 12:08:56 PDT" + - name: date + in: query + description: Date-only param example + required: false + schema: + type: string + format: date + examples: + example: + summary: example + value: 2017-10-04 + - name: time + in: query + description: time-only param example + required: false + schema: + type: string + format: date-time + examples: + example: + summary: example + value: 14:54:36 + - name: orderBy + in: query + description: "Order by field: nameOnCard\n" + required: false + schema: + type: string + examples: + example: + summary: example + - name: direction + in: query + description: Direction + required: false + schema: + type: string + default: DESC + enum: + - ASC + - DESC + examples: + example: + summary: example + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCards' + examples: + example: + value: "[ {\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\"\ + ,\n \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \ + \ \"startDate\" : \"0116\",\n \"expiryDate\" : \"1219\",\n \"\ + nameOnCard\" : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"2001\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}, {\n \"id\" : \"d593c212-70ad-41a6-a547-d5d9232414cb\"\ + ,\n \"pan\" : \"5434111122224444\",\n \"cvc\" : \"101\",\n \ + \ \"startDate\" : \"0216\",\n \"expiryDate\" : \"0120\",\n \"\ + nameOnCard\" : \"Mr Timmothy Tester\",\n \"creationDate\" : \"\ + 2011-05-30T12:13:14+03:00\",\n \"balance\" : {\n \"amount\"\ + \ : \"4.4399999999999995\",\n \"currencyCode\" : \"GBP\"\n\ + \ },\n \"apr\" : 12.75\n}, {\n \"id\" : \"9635966b-28e9-4479-8121-bb7bc9beeb62\"\ + ,\n \"pan\" : \"5434121212121212\",\n \"cvc\" : \"121\",\n \ + \ \"startDate\" : \"0115\",\n \"expiryDate\" : \"1218\",\n \"\ + nameOnCard\" : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1981\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n} ]" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "406": + description: NotAcceptable + content: + application/json: + schema: + $ref: '#/components/schemas/NotAcceptableError' + examples: + example: + value: "{\n \"message\" : \"Could not find acceptable representation\"\ + ,\n \"supportedMediaTypes\" : [ \"application/json\" ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + post: + tags: + - wallet + summary: Adds a payment card to the user's wallet. + description: Adds a payment card to the user's wallet + operationId: postPaymentCards + parameters: + - name: X-Request-Id + in: header + description: Correlates HTTP requests between a client and server. + required: false + schema: + type: string + examples: + example: + summary: example + value: f058ebd6-02f7-4d3f-942e-904344e8cde5 + requestBody: + description: Adds a payment card to the user's wallet + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCard' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\",\n\ + \ \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \"startDate\"\ + \ : \"0116\",\n \"expiryDate\" : \"1219\",\n \"nameOnCard\" :\ + \ \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1000\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}" + responses: + "201": + description: request to create payment card accepted + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCardsPostResponseBody' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\"\n\ + }" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + parameters: + - name: userId + in: path + description: No description available + required: true + schema: + type: string + examples: + example: + summary: example + /service-api/v1/wallet/admin/{userId}/paymentcards/{cardId}: + summary: Payment Card + description: No description available + get: + tags: + - wallet + summary: Returns details of a specific payment card. + description: Returns details of a specific payment card + operationId: getPaymentCard + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/PaymentCard' + examples: + example: + value: "{\n \"id\" : \"a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1\",\n\ + \ \"pan\" : \"5434111122223333\",\n \"cvc\" : \"123\",\n \"\ + startDate\" : \"0116\",\n \"expiryDate\" : \"1219\",\n \"nameOnCard\"\ + \ : \"Mr Timmy Tester\",\n \"creationDate\" : \"2011-05-30T12:13:14+03:00\"\ + ,\n \"balance\" : {\n \"amount\" : \"1000\",\n \"currencyCode\"\ + \ : \"EUR\"\n },\n \"apr\" : 12.75\n}" + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + delete: + tags: + - wallet + summary: Deletes a payment card with a given id. + description: Deletes a payment card with a given id + operationId: deletePaymentCard + responses: + "204": + description: Payment card is succesfully deleted + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" + parameters: + - name: cardId + in: path + description: No description available + required: true + schema: + type: string + examples: + example: + summary: example + - name: userId + in: path + description: No description available + required: true + schema: + type: string + examples: + example: + summary: example + /service-api/v1/testQuery/required-boolean-query-param: + summary: required boolean query param + description: arbitrary tests + get: + tags: + - testQuery + description: No description available + operationId: getrequiredBooleanQueryParam + parameters: + - name: bool + in: query + description: Required boolean parameter with no default value + required: true + schema: + type: boolean + examples: + example: + summary: example + value: false + responses: + "200": + description: No description available + content: + application/json: + schema: + $ref: '#/components/schemas/RequiredbooleanqueryparamGetResponseBody' + "400": + description: BadRequest + content: + application/json: + schema: + $ref: '#/components/schemas/BadRequestError' + examples: + example: + value: "{\n \"message\" : \"Bad Request\",\n \"errors\" : [ {\n\ + \ \"message\" : \"Value Exceeded. Must be between {min} and\ + \ {max}.\",\n \"key\" : \"common.api.shoesize\",\n \"context\"\ + \ : {\n \"max\" : \"50\",\n \"min\" : \"1\"\n }\n\ + \ } ]\n}" + "500": + description: InternalServerError + content: + application/json: + schema: + $ref: '#/components/schemas/InternalServerError' + examples: + example: + value: "{\n \"message\" : \"Description of error\"\n}" + "403": + description: Forbidden + content: + application/json: + schema: + $ref: '#/components/schemas/ForbiddenError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to an insufficient user quota of {quota}.\",\n \"key\"\ + \ : \"common.api.quota\",\n \"context\" : {\n \"quota\"\ + \ : \"someQuota\"\n }\n } ]\n}" + "415": + description: UnsupportedMediaType + content: + application/json: + schema: + $ref: '#/components/schemas/UnsupportedMediaTypeError' + examples: + example: + value: "{\n \"message\" : \"Unsupported media type.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"The request entity has a media type\ + \ {mediaType} which the resource does not support.\",\n \"\ + key\" : \"common.api.mediaType\",\n \"context\" : {\n \ + \ \"mediaType\" : \"application/javascript\"\n }\n } ]\n}" + "404": + description: NotFound + content: + application/json: + schema: + $ref: '#/components/schemas/NotFoundError' + examples: + example: + value: "{\n \"message\" : \"Resource not found.\",\n \"errors\"\ + \ : [ {\n \"message\" : \"Unable to find the resource requested\ + \ resource: {resource}.\",\n \"key\" : \"common.api.resource\"\ + ,\n \"context\" : {\n \"resource\" : \"aResource\"\n \ + \ }\n } ]\n}" + "401": + description: Unauthorized + content: + application/json: + schema: + $ref: '#/components/schemas/UnauthorizedAltError' + examples: + example: + value: "{\n \"message\" : \"Access to requested resource denied.\"\ + ,\n \"errors\" : [ {\n \"message\" : \"Resource access denied\ + \ due to invalid credentials.\",\n \"key\" : \"common.api.token\"\ + ,\n \"context\" : {\n \"accessToken\" : \"expired\"\n\ + \ }\n } ]\n}" +components: + schemas: + BadRequestError: + required: + - message + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + BbAccessControl: + required: + - function + - privilege + - resource + type: object + properties: + resource: + type: string + description: "Resource being protected, e.g. 'User'" + function: + type: string + description: "Business function, e.g. 'Manage Users'" + privilege: + type: string + description: "The privilege required, e.g. 'view'" + BbApiDeprecation: + required: + - deprecatedFromVersion + - description + - reason + - removedFromVersion + type: object + properties: + deprecatedFromVersion: + type: string + description: Version of the product from which the endpoint has been deprecated + and should no longer be used + deprecated: true + removedFromVersion: + type: string + description: Version of the product from which the API endpoint will be + removed + reason: + type: string + description: The reason the API endpoint was deprecated + deprecated: true + description: + type: string + description: "Any further information, e.g. migration information" + Currency: + title: Monetary Amount + required: + - amount + - currencyCode + type: object + properties: + amount: + type: string + description: The amount in the specified currency + currencyCode: + pattern: "^[A-Z]{3}$" + type: string + description: The alpha-3 code (complying with ISO 4217) of the currency + that qualifies the amount + description: Schema defining monetary amount in given currency. + ErrorItem: + type: object + properties: + message: + type: string + description: Default Message. Any further information. + key: + type: string + description: "{capability-name}.api.{api-key-name}. For generated validation\ + \ errors this is the path in the document the error resolves to. e.g.\ + \ object name + '.' + field" + context: + type: object + description: Context can be anything used to construct localised messages. + description: A validation error + ForbiddenError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + InternalServerError: + required: + - message + type: object + properties: + message: + type: string + description: Further Information + description: Represents HTTP 500 Internal Server Error + NotAcceptableError: + type: object + properties: + message: + type: string + supportedMediaTypes: + type: array + description: List of supported media types for this endpoint + items: + type: string + NotFoundError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + ObjectWrappingException: + type: object + properties: + message: + type: string + data: + type: object + PaymentCard: + required: + - cvc + - expiryDate + - id + - nameOnCard + - pan + - startDate + type: object + properties: + id: + type: string + pan: + maxLength: 19 + type: string + description: "Must be sixteen digits, optionally in blocks of 4 separated\ + \ by a dash" + cvc: + maxLength: 3 + minLength: 3 + type: string + description: Card Verification Code + startDate: + pattern: "^(0[1-9]|1[0-2])/?([0-9]{4}|[0-9]{2})$" + type: string + description: "Must be in one of these four formats: MM/YY MMYY MMYYYY MM/YYYY" + expiryDate: + pattern: "^(0[1-9]|1[0-2])/?([0-9]{4}|[0-9]{2})$" + type: string + description: "Must be in one of these four formats: MM/YY MMYY MMYYYY MM/YYYY" + nameOnCard: + type: string + creationDate: + type: string + format: date-time + balance: + $ref: '#/components/schemas/Currency' + apr: + type: number + cardtype: + type: string + enum: + - CREDIT + - DEBIT + - PREPAID + PaymentCards: + type: array + items: + $ref: '#/components/schemas/PaymentCard' + PaymentCardsPostResponseBody: + type: object + properties: + id: + type: string + example: + id: a5b0fe7d-c4dd-40a7-bd80-dfc7869327e1 + RequiredbooleanqueryparamGetResponseBody: + type: object + properties: + message: + type: string + TestHeadersResponseBody: + type: object + properties: + requests: + type: array + items: + type: object + properties: + name: + type: string + url: + type: string + headers: + type: object + UnauthorizedAltError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' + UnauthorizedError: + required: + - message + type: object + properties: + message: + type: string + UnsupportedMediaTypeError: + type: object + properties: + message: + type: string + description: Any further information + errors: + type: array + description: Detailed error information + items: + $ref: '#/components/schemas/ErrorItem' diff --git a/boat-maven-plugin/src/it/example/pom.xml b/boat-maven-plugin/src/it/example/pom.xml index 53915c9f3..58f0aa68f 100644 --- a/boat-maven-plugin/src/it/example/pom.xml +++ b/boat-maven-plugin/src/it/example/pom.xml @@ -40,6 +40,7 @@ BOAT :: Examples + boat-multiple-executions boat-artifact-input boat-doc boat-export From 7d6c72b540386426f8401ddf0b786654d7a1a2a0 Mon Sep 17 00:00:00 2001 From: Sophie Janssens Date: Mon, 10 May 2021 10:33:49 +0200 Subject: [PATCH 8/9] Fix: created test for ExportBom's use of artifact resolver --- .../com/backbase/oss/boat/ExportBomMojo.java | 2 + .../backbase/oss/boat/ExportBomMojoTests.java | 155 ++++++++++++++++++ .../backbase/oss/boat/ExportMojoTests.java | 1 - .../maven-metadata-test-example.xml | 15 ++ .../export-bom/raml-spec-bom/pom.xml | 32 ++++ 5 files changed, 204 insertions(+), 1 deletion(-) create mode 100644 boat-maven-plugin/src/test/java/com/backbase/oss/boat/ExportBomMojoTests.java create mode 100644 boat-maven-plugin/src/test/resources/export-bom/maven-metadata-test-example.xml create mode 100644 boat-maven-plugin/src/test/resources/export-bom/raml-spec-bom/pom.xml diff --git a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ExportBomMojo.java b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ExportBomMojo.java index f5cc354c8..94a6a149c 100644 --- a/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ExportBomMojo.java +++ b/boat-maven-plugin/src/main/java/com/backbase/oss/boat/ExportBomMojo.java @@ -64,6 +64,8 @@ public class ExportBomMojo extends AbstractRamlToOpenApi { @Parameter(name = "addChangeLog", defaultValue = "true") private boolean addChangeLog; + public void setSpecBom(Dependency specBom){this.specBom = specBom;} + @Override public void execute() throws MojoExecutionException { diff --git a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ExportBomMojoTests.java b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ExportBomMojoTests.java new file mode 100644 index 000000000..f2e9ee70d --- /dev/null +++ b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ExportBomMojoTests.java @@ -0,0 +1,155 @@ +package com.backbase.oss.boat; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + +import java.io.File; +import java.util.Collections; +import java.util.List; +import org.apache.maven.model.Build; +import org.apache.maven.model.Dependency; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.project.MavenProject; +import org.codehaus.plexus.logging.console.ConsoleLogger; +import org.eclipse.aether.RepositorySystemSession; +import org.eclipse.aether.artifact.DefaultArtifact; +import org.eclipse.aether.impl.ArtifactResolver; +import org.eclipse.aether.impl.MetadataResolver; +import org.eclipse.aether.metadata.Metadata; +import org.eclipse.aether.resolution.ArtifactResolutionException; +import org.eclipse.aether.resolution.ArtifactResult; +import org.eclipse.aether.resolution.MetadataResult; +import org.junit.jupiter.api.Test; +import org.junit.jupiter.api.extension.ExtendWith; +import org.mockito.ArgumentCaptor; +import org.mockito.Captor; +import org.mockito.Mock; +import org.mockito.junit.jupiter.MockitoExtension; +import org.sonatype.plexus.build.incremental.DefaultBuildContext; + +@ExtendWith(MockitoExtension.class) +public class ExportBomMojoTests { + @Mock + ArtifactResolver artifactResolver; + @Mock + ArtifactResult artifactResult; + @Mock + MetadataResolver metadataResolver; + + @Mock + MetadataResult metadataResult; + @Mock + Metadata metadatamock; + + @Captor + ArgumentCaptor argCaptor; + + + @Test + void testExportBomEmptyMeta() throws MojoFailureException, MojoExecutionException, ArtifactResolutionException { + artifactResolver = mock(ArtifactResolver.class); + artifactResult = mock( ArtifactResult.class); + metadataResolver = mock(MetadataResolver.class); + org.eclipse.aether.artifact.Artifact artifact = mock(org.eclipse.aether.artifact.Artifact.class); + + when(metadataResolver.resolveMetadata(any(),any())).thenReturn(Collections.singletonList(metadataResult)); + + ExportBomMojo mojo = new ExportBomMojo(); + File output = new File("target/boat-bom-export"); + if (!output.exists()) { + output.mkdirs(); + } + + DefaultBuildContext defaultBuildContext = new DefaultBuildContext(); + defaultBuildContext.enableLogging(new ConsoleLogger()); + + mojo.getLog(); + mojo.artifactResolver = artifactResolver; + mojo.metadataResolver = metadataResolver; + mojo.setSpecBom(new Dependency()); + + + Build build = new Build(); + build.setDirectory("target"); + + MavenProject project = new MavenProject(); + mojo.remoteRepositories = Collections.EMPTY_LIST; + project.setBuild(build); + mojo.project = project; + mojo.repositorySession = mock(RepositorySystemSession.class); + mojo.execute(); + + assertThat(output.list().length).isZero(); + } + + @Test + void testExportBomUseOfArtifactResolver() throws MojoFailureException, MojoExecutionException, ArtifactResolutionException { + File versionFile = getFile("/export-bom/maven-metadata-test-example.xml"); + String groupId="test.groupId"; + String artifactId = "raml-bom"; + String type = "pom"; + String version= "[1.0.0,)"; + + File pomFile = getFile("/export-bom/raml-spec-bom/pom.xml"); + artifactResolver = mock(ArtifactResolver.class); + artifactResult = mock( ArtifactResult.class); + org.eclipse.aether.artifact.Artifact artifact; //= mock(org.eclipse.aether.artifact.Artifact.class); + artifact = new DefaultArtifact(groupId, artifactId, "", type, version,Collections.EMPTY_MAP, pomFile); + + + when(artifactResolver.resolveArtifact(any(),any())).thenReturn(artifactResult); + when(artifactResult.getArtifact()).thenReturn(artifact); + //when(artifact.getFile()).thenReturn(pomFile); + + + when(metadataResolver.resolveMetadata(any(),any())).thenReturn(Collections.singletonList(metadataResult)); + + ExportBomMojo mojo = new ExportBomMojo(); + File output = new File("target/boat-bom-export"); + if (!output.exists()) { + output.mkdirs(); + } + when(metadataResult.isResolved()).thenReturn(true); + + + doReturn(metadatamock).when(metadataResult).getMetadata(); + doReturn(versionFile).when(metadatamock).getFile(); + + DefaultBuildContext defaultBuildContext = new DefaultBuildContext(); + defaultBuildContext.enableLogging(new ConsoleLogger()); + + mojo.getLog(); + mojo.artifactResolver = artifactResolver; + mojo.metadataResolver = metadataResolver; + Dependency dependency = new Dependency(); + + dependency.setType(type); + dependency.setGroupId(groupId); + dependency.setArtifactId(artifactId); + dependency.setVersion(version); + mojo.setSpecBom(dependency); + + + Build build = new Build(); + build.setDirectory("target"); + + MavenProject project = new MavenProject(); + mojo.remoteRepositories = Collections.EMPTY_LIST; + + project.setBuild(build); + mojo.project = project; + mojo.repositorySession = mock(RepositorySystemSession.class); + mojo.execute(); + + assertThat(output.list().length).isZero(); + + } + private File getFile(String fileName) { + return new File(getClass().getResource(fileName).getFile()); + } + +} diff --git a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ExportMojoTests.java b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ExportMojoTests.java index b01164bc1..4a467063b 100644 --- a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ExportMojoTests.java +++ b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ExportMojoTests.java @@ -11,7 +11,6 @@ import org.apache.maven.plugin.MojoExecutionException; import org.apache.maven.project.MavenProject; import org.codehaus.plexus.logging.console.ConsoleLogger; -import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.BeforeAll; import org.junit.jupiter.api.Test; import org.sonatype.plexus.build.incremental.DefaultBuildContext; diff --git a/boat-maven-plugin/src/test/resources/export-bom/maven-metadata-test-example.xml b/boat-maven-plugin/src/test/resources/export-bom/maven-metadata-test-example.xml new file mode 100644 index 000000000..971aae3d4 --- /dev/null +++ b/boat-maven-plugin/src/test/resources/export-bom/maven-metadata-test-example.xml @@ -0,0 +1,15 @@ + + test.groupId + openapi-zips + [1.0.0,) + + 1.0.0 + 1.0.0 + + 1.0.0 + + 20150509185437 + + diff --git a/boat-maven-plugin/src/test/resources/export-bom/raml-spec-bom/pom.xml b/boat-maven-plugin/src/test/resources/export-bom/raml-spec-bom/pom.xml new file mode 100644 index 000000000..51b78d2fd --- /dev/null +++ b/boat-maven-plugin/src/test/resources/export-bom/raml-spec-bom/pom.xml @@ -0,0 +1,32 @@ + + + 4.0.0 + + com.backbase.oss.boat.example + raml-spec-bom + 1.0.0-SNAPSHOT + + + 1.0.0-SNAPSHOT + + + pom + + BOAT :: RAML Bill-Of-Materials + + + + + com.backbase.oss.boat.example + raml-spec + ${raml-spec.version} + + + + + + + + From 7824ca8e14e8e196d6aa0e1188b48bd598a360e3 Mon Sep 17 00:00:00 2001 From: Sophie Janssens Date: Mon, 10 May 2021 10:44:29 +0200 Subject: [PATCH 9/9] Fix: code smells --- .../test/java/com/backbase/oss/boat/ExportBomMojoTests.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ExportBomMojoTests.java b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ExportBomMojoTests.java index f2e9ee70d..9b800a078 100644 --- a/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ExportBomMojoTests.java +++ b/boat-maven-plugin/src/test/java/com/backbase/oss/boat/ExportBomMojoTests.java @@ -32,7 +32,7 @@ import org.sonatype.plexus.build.incremental.DefaultBuildContext; @ExtendWith(MockitoExtension.class) -public class ExportBomMojoTests { +class ExportBomMojoTests { @Mock ArtifactResolver artifactResolver; @Mock @@ -83,7 +83,7 @@ void testExportBomEmptyMeta() throws MojoFailureException, MojoExecutionExceptio mojo.repositorySession = mock(RepositorySystemSession.class); mojo.execute(); - assertThat(output.list().length).isZero(); + assertThat(output.list()).isEmpty(); } @Test @@ -145,7 +145,7 @@ void testExportBomUseOfArtifactResolver() throws MojoFailureException, MojoExecu mojo.repositorySession = mock(RepositorySystemSession.class); mojo.execute(); - assertThat(output.list().length).isZero(); + assertThat(output.list()).isEmpty(); } private File getFile(String fileName) {