Skip to content

Commit

Permalink
swagger to OpenAPI, update AutoConfiguration, fix docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
jianmingtu committed Jan 11, 2024
1 parent 4e01b9f commit 67d3547
Show file tree
Hide file tree
Showing 32 changed files with 170 additions and 219 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
### Stage where Docker is caching the dependencies spring boot app using maven ###
#############################################################################################
#FROM image-registry.apps.silver.devops.gov.bc.ca/043918-tools/maven:3.8.6-eclipse-temurin-8 as dependencies
FROM maven:3.8.6-eclipse-temurin-8 as dependencies
FROM maven:3.8.6-eclipse-temurin-17 as dependencies

## Defining Arguments and env vars
ARG NEXUS_URL=https://nexus-043918-tools.apps.silver.devops.gov.bc.ca
Expand Down Expand Up @@ -79,7 +79,7 @@ RUN mvn clean package \
#### Stage where Docker is running a java process to run a service built in previous stage ###
##############################################################################################
#FROM image-registry.apps.silver.devops.gov.bc.ca/043918-tools/eclipse-temurin:8-jre-jammy
FROM eclipse-temurin:8-jre-jammy
FROM eclipse-temurin:17-jre-alpine

ARG DPS_SERVICE_NAME

Expand Down
52 changes: 26 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,33 +82,33 @@ docker-compose up --build -d

## Endpoints

| URL | Method | Description |
| --- | --- | --- |
| **Payment Service** | --- | --- |
| [http://localhost:5050/paymentservice/bamboraconfiguration](http://localhost:5050/paymentservice/bamboraconfiguration) | GET | Bambora configuration url |
| [http://localhost:5050/paymentservice/getSinglePaymentURL](http://localhost:5050/paymentservice/getSinglePaymentURL) | GET | Single Payment Url |
| [http://localhost:8081/paymentservice/actuator/health](http://localhost:8081/paymentservice/actuator/health) | GET | Payment Service Health |
| [http://localhost:8081/paymentservice/swagger-ui.html](http://localhost:8081/paymentservice/swagger-ui.html) | GET | Figaro Validator Swagger-UI |
| [http://localhost:8081/paymentservice/v2/api-docs](http://localhost:8081/paymentservice/v2/api-docs) | GET | Figaro Validator Api docs |
| **Figaro Validation** | --- | --- |
| [http://localhost:5050/figvalidationservice/locateMatchingApplicants](http://localhost:5050/figvalidationservice/locateMatchingApplicants) | GET | Locate Matching Applicants |
| [http://localhost:5050/figvalidationservice/validateApplicantService](http://localhost:5050/figvalidationservice/validateApplicantService) | GET | Validate Applicant Service |
| URL | Method | Description |
|--------------------------------------------------------------------------------------------------------------------------------------------------| --- | --- |
| **Payment Service** | --- | --- |
| [http://localhost:5050/paymentservice/bamboraconfiguration](http://localhost:5050/paymentservice/bamboraconfiguration) | GET | Bambora configuration url |
| [http://localhost:5050/paymentservice/getSinglePaymentURL](http://localhost:5050/paymentservice/getSinglePaymentURL) | GET | Single Payment Url |
| [http://localhost:8081/paymentservice/actuator/health](http://localhost:8084/paymentservice/actuator/health) | GET | Payment Service Health |
| [http://localhost:8081/paymentservice/swagger-ui.html](http://localhost:8084/paymentservice/swagger-ui.html) | GET | Figaro Validator Swagger-UI |
| [http://localhost:8081/paymentservice/v2/api-docs](http://localhost:8084/paymentservice/v3/api-docs) | GET | Figaro Validator Api docs |
| **Figaro Validation** | --- | --- |
| [http://localhost:5050/figvalidationservice/locateMatchingApplicants](http://localhost:5050/figvalidationservice/locateMatchingApplicants) | GET | Locate Matching Applicants |
| [http://localhost:5050/figvalidationservice/validateApplicantService](http://localhost:5050/figvalidationservice/validateApplicantService) | GET | Validate Applicant Service |
| [http://localhost:5050/figvalidationservice/validateApplicantForSharing](http://localhost:5050/figvalidationservice/validateApplicantForSharing) | GET | Validate Applicant Sharing |
| [http://localhost:5050/figvalidationservice/validateApplicantPartyId](http://localhost:5050/figvalidationservice/validateApplicantPartyId) | GET | Validate Applicant Party ID |
| [http://localhost:8082/figvalidationservice/actuator/health](http://localhost:8082/figvalidationservice/actuator/health) | GET | Figaro Validator Health |
| [http://localhost:8082/figvalidationservice/swagger-ui.html](http://localhost:8082/figvalidationservice/swagger-ui.html) | GET | Figaro Validator Swagger-UI |
| **DPS Validation** | --- | --- |
| [http://localhost:5050/dpsvalidationservice/getValidOpenDFCMCase](http://localhost:5050/dpsvalidationservice/getValidOpenDFCMCase) | GET | Valid Open DFCM Case |
| [http://localhost:8083/dpsvalidationservice/actuator/health](http://localhost:8083/dpsvalidationservice/actuator/health) | GET | DPS Validation Service Health |
| [http://localhost:8083/dpsvalidationservice/swagger-ui.html](http://localhost:8083/dpsvalidationservice/swagger-ui.html) | GET | DPS Validation Service Swagger-UI |
| [http://localhost:8083/dpsvalidationservice/v2/api-docs](http://localhost:8083/dpsvalidationservice/v2/api-docs) | GET | DPS Validation Service Swagger |
| **DPS Output Notification** | --- | --- |
| [http://localhost:5054/dpsnotificationservice/actuator/health](http://localhost:5054/dpsnotificationservice/actuator/health) | GET | DPS Notification Service Health |
| [http://localhost:5050/ws/dpsOutputNotification.wsdl](http://localhost:5050/ws/dpsOutputNotification.wsdl) | GET | DPS Output Notification Service WSDL |
| **CRRP Notification Worker** | --- | --- |
| [http://localhost:5055/crrpnotificationworker/actuator/health](http://localhost:5054/crrpnotificationworker/actuator/health) | GET | CRRP Notification
| **CRRP Notification Worker** | --- | --- |
| [http://localhost:5056/vipsnotificationworker/actuator/health](http://localhost:5056/vipsnotificationworker/actuator/health) | GET | CRRP Notification
| [http://localhost:5050/figvalidationservice/validateApplicantPartyId](http://localhost:5050/figvalidationservice/validateApplicantPartyId) | GET | Validate Applicant Party ID |
| [http://localhost:8082/figvalidationservice/actuator/health](http://localhost:8082/figvalidationservice/actuator/health) | GET | Figaro Validator Health |
| [http://localhost:8082/figvalidationservice/swagger-ui.html](http://localhost:8082/figvalidationservice/swagger-ui.html) | GET | Figaro Validator Swagger-UI |
| **DPS Validation** | --- | --- |
| [http://localhost:5050/dpsvalidationservice/getValidOpenDFCMCase](http://localhost:5050/dpsvalidationservice/getValidOpenDFCMCase) | GET | Valid Open DFCM Case |
| [http://localhost:8083/dpsvalidationservice/actuator/health](http://localhost:8083/dpsvalidationservice/actuator/health) | GET | DPS Validation Service Health |
| [http://localhost:8083/dpsvalidationservice/swagger-ui.html](http://localhost:8083/dpsvalidationservice/swagger-ui.html) | GET | DPS Validation Service Swagger-UI |
| [http://localhost:8083/dpsvalidationservice/v2/api-docs](http://localhost:8083/dpsvalidationservice/v3/api-docs) | GET | DPS Validation Service Swagger |
| **DPS Output Notification** | --- | --- |
| [http://localhost:5054/dpsnotificationservice/actuator/health](http://localhost:5054/dpsnotificationservice/actuator/health) | GET | DPS Notification Service Health |
| [http://localhost:5050/ws/dpsOutputNotification.wsdl](http://localhost:5050/ws/dpsOutputNotification.wsdl) | GET | DPS Output Notification Service WSDL |
| **CRRP Notification Worker** | --- | --- |
| [http://localhost:5055/crrpnotificationworker/actuator/health](http://localhost:5054/crrpnotificationworker/actuator/health) | GET | CRRP Notification
| **CRRP Notification Worker** | --- | --- |
| [http://localhost:5056/vipsnotificationworker/actuator/health](http://localhost:5056/vipsnotificationworker/actuator/health) | GET | CRRP Notification


Worker Health |
Expand Down
16 changes: 10 additions & 6 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ services:
- SPLUNK_TOKEN=${SPLUNK_TOKEN}
- SWAGGER_UI_ENABLED=true
ports:
- "8081:8080"
- "8084:8080"
networks:
- dps-net

Expand All @@ -71,9 +71,9 @@ services:
- DPS_SERVICE_NAME=figaro-validation-service
environment:
- SWAGGER_UI_ENABLED=true
- FIGCR_BASE_PATH=$FIGCR_BASE_PATH
- FIGCR_BASE_PATH=${FIGCR_BASE_PATH}
ports:
- "8082:8081"
- "8082:8080"
networks:
- dps-net

Expand All @@ -88,9 +88,10 @@ services:
- DPS_SERVICE_NAME=dps-validation-service
environment:
- SWAGGER_UI_ENABLED=true
- DFCMS_BASE_PATH=$DFCMS_BASE_PATH
- DFCMS_BASE_PATH=${DFCMS_BASE_PATH}
- DFCMS_EIGHT_DIGIT_LICENSE=${DFCMS_EIGHT_DIGIT_LICENSE}
ports:
- "8083:8081"
- "8083:8080"
networks:
- dps-net

Expand Down Expand Up @@ -136,7 +137,10 @@ services:
- "5056:8080"
environment:
- RABBITMQ_HOST=rabbitmq
- FIGCR_BASE_PATH=$FIGCR_BASE_PATH
- FIGCR_BASE_PATH=${FIGCR_BASE_PATH}
- VIPS_BASE_PATH=${VIPS_BASE_PATH}
- VIPS_USERNAME=${VIPS_USERNAME}
- VIPS_PASSWORD=${VIPS_PASSWORD}
networks:
- dps-net

Expand Down
4 changes: 2 additions & 2 deletions src/dps-email-poller/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@
</dependency>

<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;

@SpringBootApplication
@SpringBootApplication(scanBasePackages = {"ca.bc.gov.open.pssg.rsbc.dps.dpsemailpoller", "ca.bc.gov.open.pssg.rsbc.dps.cache"})
@EnableScheduling
public class DpsEmailPollerApplication {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,43 +1,22 @@
package ca.bc.gov.open.pssg.rsbc.dps.dpsemailpoller.configuration;

import ca.bc.gov.open.pssg.rsbc.dps.dpsemailpoller.DpsEmailPollerApplication;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Value("${dpsemailpoller.api.version}")
private String version;

@Value("${dpsemailpoller.api.swagger.enabled:false}")
private Boolean enabled;

ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("Email service API")
.description("Email Service API")
.version(version)
.build();
}

@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage(DpsEmailPollerApplication.class.getPackage().getName()))
.paths(PathSelectors.any())
.build()
.apiInfo(apiInfo())
.enable(enabled);
public OpenAPI apiDocConfig() {
return new OpenAPI()
.info(new Info()
.title("Email service API")
.description("Email Service API")
.version(version));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ dps.messaging.retryDelay=10
dps.messaging.type=producer

dps.tenant="${DPS_TENANT}"

dpsemailpoller.api.swagger.enabled:${SWAGGER_ENABLE:false}
springdoc.enable-native-support:${SWAGGER_ENABLE:false}
dpsemailpoller.api.version:1.0

# Exchange configuration
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@SpringBootApplication(scanBasePackages = {"ca.bc.gov.open.pssg.rsbc.dps.dpsemailworker", "ca.bc.gov.open.pssg.rsbc.dps", "ca.bc.gov.open.pssg.rsbc.dps.sftp.starter"})
public class DpsEmailWorkerApplication {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @author alexjoybc@github
*
*/
@SpringBootApplication
@SpringBootApplication(scanBasePackages = {"ca.bc.gov.open.pssg.rsbc.dps.dpsnotificationservice", "ca.bc.gov.open.pssg.rsbc.dps.messaging"})
public class DpsnotificationserviceApplication {

public static void main(String[] args) {
Expand Down
4 changes: 2 additions & 2 deletions src/dps-payment-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
<artifactId>springfox-swagger2</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,20 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Info;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
*
* @author smillar
*
*/
@Configuration
@EnableSwagger2
@PropertySource("classpath:application.properties")
public class SwaggerConfig {

@Value("${payment.service.api.version}")
private String version;

@Value("${payment.service.swagger.enabled:false}")
private Boolean enabled;

ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("DPS Payment service API")
.description("A Payment Service API")
.license("")
.licenseUrl("")
.termsOfServiceUrl("")
.version(version)
.build();
@Value("${payment.service.api.version}")
private String version;

@Bean
public OpenAPI apiDocConfig() {
return new OpenAPI()
.info(new Info()
.title("DPS Payment service API")
.description("A Payment Service API")
.version(version));
}

@Bean
public Docket customImplementation(){

// Note: Enable of service based on application configuration.

return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("ca.bc.gov.open.pssg.rsbc.dps.paymentservice"))
.paths(PathSelectors.any())
.build()
.apiInfo(apiInfo())
.enable(enabled);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ server.tomcat.accesslog.enabled=true
payment.service.api.version=0.0.1

# Swagger-UI visibility
payment.service.swagger.enabled=true
springdoc.enable-native-support=true

# Hosted Payment url should be placed in configMap.
bambora.hostedpaymentendpoint=https://web.na.bambora.com/scripts/payment/payment.asp
Expand Down
4 changes: 2 additions & 2 deletions src/dps-validation-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
<artifactId>springfox-swagger2</artifactId>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,19 @@
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import io.swagger.v3.oas.models.info.Info;
import io.swagger.v3.oas.models.OpenAPI;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
@Value("${dpsvalidation.service.api.version}")
private String version;

@Value("${dpsvalidation.service.swagger.enabled:false}")
private Boolean enabled;

ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("DPS Validation service API")
.description("A DPS Validation Service API")
.license("")
.licenseUrl("")
.termsOfServiceUrl("")
.version(version)
.build();
}

@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("ca.bc.gov.open.pssg.rsbc.dps.dpsvalidationservice"))
.paths(PathSelectors.any())
.build();
public OpenAPI apiDocConfig() {
return new OpenAPI()
.info(new Info()
.title("DPS Validation service API")
.description("A DPS Validation Service API")
.version(version));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ server.port=${PORT:8080}

# Swagger Ui
dpsvalidation.service.api.version=0.0.1
dpsvalidation.service.swagger.enabled=true
springdoc.enable-native-support=true

# ORDS DFCMS client configuration
dpsvalidation.service.ords.dfcms.client.base-path=${DFCMS_BASE_PATH}
Expand Down
5 changes: 2 additions & 3 deletions src/figaro-validation-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,8 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<scope>compile</scope>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
</dependency>

<dependency>
Expand Down
Loading

0 comments on commit 67d3547

Please sign in to comment.