This repository has been archived by the owner on Nov 27, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
227 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,13 +38,21 @@ | |
<swagger.version>1.5.12</swagger.version> | ||
<resteasy-spring-boot-starter.version>2.3.0-RELEASE</resteasy-spring-boot-starter.version> | ||
<jackson.version>2.8.7</jackson.version> | ||
<redhat-ipaas-connector.version>0.3.7</redhat-ipaas-connector.version> | ||
|
||
<fabric8-maven-plugin.version>3.3.0</fabric8-maven-plugin.version> | ||
<docker-maven-plugin.version>0.20.1</docker-maven-plugin.version> | ||
<license-maven-plugin.version>3.0</license-maven-plugin.version> | ||
<redhat-ipaas-connector.version>0.3.7</redhat-ipaas-connector.version> | ||
<swagger-maven-plugin.version>1.0.0</swagger-maven-plugin.version> | ||
<swagger2markup-maven-plugin.version>1.1.0</swagger2markup-maven-plugin.version> | ||
|
||
<apidocs.dir>${project.build.directory}/api-docs</apidocs.dir> | ||
<apidocs.schema.dir>${project.build.outputDirectory}/static</apidocs.schema.dir> | ||
|
||
<!-- Base image to use for Docker images. Pinned to 1.2.3 since 1.2.4 has issues because | ||
of Java 1.8.0_121 (1.2.3 is running 1.8.0_111) --> | ||
<java-image>fabric8/java-jboss-openjdk8-jdk:1.2.3</java-image> | ||
|
||
<verifier-image>rhipaas/ipaas-verifier:%l</verifier-image> | ||
</properties> | ||
|
||
<inceptionYear>2017</inceptionYear> | ||
|
@@ -312,17 +320,103 @@ | |
<artifactId>fabric8-maven-plugin</artifactId> | ||
<version>${fabric8-maven-plugin.version}</version> | ||
<configuration> | ||
<mode>kubernetes</mode> | ||
<generator> | ||
<config> | ||
<spring-boot> | ||
<name>rhipaas/ipaas-verifier:%l</name> | ||
<name>${verifier-image}</name> | ||
<from>${java-image}</from> | ||
</spring-boot> | ||
</config> | ||
</generator> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>io.fabric8</groupId> | ||
<artifactId>docker-maven-plugin</artifactId> | ||
<version>${docker-maven-plugin.version}</version> | ||
<configuration> | ||
<images> | ||
<image> | ||
<name>${verifier-image}</name> | ||
<alias>verfier</alias> | ||
<run> | ||
<ports> | ||
<port>8080:8080</port> | ||
</ports> | ||
</run> | ||
</image> | ||
</images> | ||
</configuration> | ||
</plugin> | ||
|
||
<plugin> | ||
<groupId>dk.nykredit.swagger</groupId> | ||
<artifactId>swagger-maven-plugin</artifactId> | ||
<version>${swagger-maven-plugin.version}</version> | ||
<configuration> | ||
<outputDirectory>${apidocs.schema.dir}</outputDirectory> | ||
<outputFormats> | ||
<outputFormat>JSON</outputFormat> | ||
<outputFormat>YAML</outputFormat> | ||
</outputFormats> | ||
<attachSwaggerArtifact>true</attachSwaggerArtifact> | ||
<resourcePackages> | ||
<resourcePackage>com.redhat.ipaas.verifier.v1</resourcePackage> | ||
</resourcePackages> | ||
<swaggerConfig> | ||
<info> | ||
<title>Red Hat iPaaS Verifier API</title> | ||
<version>v1</version> | ||
<description> | ||
The Red Hat iPaaS Verifier API sole purpose is to verify connection parameters for the endpoints of certain connectors. | ||
</description> | ||
<license> | ||
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url> | ||
<name>Apache 2.0</name> | ||
</license> | ||
<contact> | ||
<email>[email protected]</email> | ||
<name>The Red Hat iPaaS Developers</name> | ||
<url>https://redhat-ipaas.github.io</url> | ||
</contact> | ||
</info> | ||
<schemes>http,https</schemes> | ||
<host>localhost:8080</host> | ||
<basePath>/api/v1</basePath> | ||
</swaggerConfig> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>generate</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>io.github.swagger2markup</groupId> | ||
<artifactId>swagger2markup-maven-plugin</artifactId> | ||
<version>${swagger2markup-maven-plugin.version}</version> | ||
<configuration> | ||
<swaggerInput>${apidocs.schema.dir}/swagger.json</swaggerInput> | ||
<outputDir>${apidocs.dir}/asciidoc</outputDir> | ||
<config> | ||
<swagger2markup.markupLanguage>ASCIIDOC</swagger2markup.markupLanguage> | ||
</config> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<phase>compile</phase> | ||
<goals> | ||
<goal>convertSwagger2markup</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
|
||
</plugins> | ||
</build> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
src/main/java/com/redhat/ipaas/verifier/config/CorsConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/** | ||
* Copyright (C) 2016 Red Hat, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.redhat.ipaas.verifier.config; | ||
|
||
import java.util.Arrays; | ||
import java.util.List; | ||
|
||
import org.springframework.boot.context.properties.ConfigurationProperties; | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
import org.springframework.web.filter.CorsFilter; | ||
|
||
@Configuration | ||
@EnableConfigurationProperties | ||
@ConfigurationProperties("cors") | ||
public class CorsConfiguration { | ||
|
||
private List<String> allowedOrigins = Arrays.asList(org.springframework.web.cors.CorsConfiguration.ALL); | ||
|
||
public List<String> getAllowedOrigins() { | ||
return allowedOrigins; | ||
} | ||
|
||
public void setAllowedOrigins(List<String> allowedOrigins) { | ||
this.allowedOrigins = allowedOrigins; | ||
} | ||
|
||
@Bean | ||
public CorsFilter corsFilter() { | ||
return new CorsFilter(request -> { | ||
if (request.getPathInfo().endsWith("/swagger.json") || request.getPathInfo().endsWith("/swagger.yaml")) { | ||
return new org.springframework.web.cors.CorsConfiguration().applyPermitDefaultValues(); | ||
} | ||
|
||
org.springframework.web.cors.CorsConfiguration config = new org.springframework.web.cors.CorsConfiguration(); | ||
config.setAllowedOrigins(allowedOrigins); | ||
config.setAllowedMethods(Arrays.asList("HEAD", "GET", "POST", "PUT", "DELETE", "PATCH")); | ||
config.applyPermitDefaultValues(); | ||
return config; | ||
}); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/com/redhat/ipaas/verifier/config/SwaggerConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/** | ||
* Copyright (C) 2016 Red Hat, Inc. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package com.redhat.ipaas.verifier.config; | ||
|
||
import io.swagger.jaxrs.listing.ApiListingResource; | ||
import io.swagger.jaxrs.listing.SwaggerSerializers; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
@Configuration | ||
public class SwaggerConfiguration { | ||
|
||
@Bean | ||
public ApiListingResource apiListingResource() { | ||
return new ApiListingResource(); | ||
} | ||
|
||
@Bean | ||
public SwaggerSerializers swaggerSerializers() { | ||
return new SwaggerSerializers(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters