Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaconsalvi committed Dec 6, 2024
2 parents 737b31d + a2af931 commit 1865073
Show file tree
Hide file tree
Showing 13 changed files with 56 additions and 46 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ on:
- 'src/*'
- '*gradle*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
scan-sonar:
runs-on: ubuntu-22.04
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/post-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,9 @@ jobs:
run: |
docker pull ghcr.io/${{ github.repository }}:${{ needs.versioning.outputs.new_version }}-RC
docker image tag ghcr.io/${{ github.repository }}:${{ needs.versioning.outputs.new_version }}-RC ghcr.io/${{ github.repository }}:${{ needs.versioning.outputs.new_version }}
docker image tag ghcr.io/${{ github.repository }}:${{ needs.versioning.outputs.new_version }}-RC ghcr.io/${{ github.repository }}:latest
docker rmi ghcr.io/${{ github.repository }}:${{ needs.versioning.outputs.new_version }}-RC
docker image push --all-tags ghcr.io/${{ github.repository }}:${{ needs.versioning.outputs.new_version }}
docker image push --all-tags ghcr.io/${{ github.repository }}
- name: "STABLE - Update Container App"
shell: bash
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
- edited
- synchronize

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
pr-validation:
runs-on: ubuntu-22.04
Expand Down
21 changes: 12 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import org.openapitools.generator.gradle.plugin.tasks.GenerateTask

plugins {
id 'java'
id 'org.springframework.boot' version '3.3.5'
Expand Down Expand Up @@ -80,7 +82,7 @@ sourceSets {
}
}

task generateOpenAPIActivate(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
tasks.register('generateOpenAPIActivate', GenerateTask) {
generatorName.set("spring")
inputSpec.set("$rootDir/openapi/activation.openapi.yaml")
outputDir.set("$projectDir/build/generated")
Expand Down Expand Up @@ -110,7 +112,7 @@ task generateOpenAPIActivate(type: org.openapitools.generator.gradle.plugin.task
}


task generateOpenAPISend(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
tasks.register('generateOpenAPISend', GenerateTask) {
generatorName.set("spring")
inputSpec.set("$rootDir/openapi/send.openapi.yaml")
outputDir.set("$projectDir/build/generated")
Expand Down Expand Up @@ -139,21 +141,22 @@ task generateOpenAPISend(type: org.openapitools.generator.gradle.plugin.tasks.Ge
])
}

task generateOpenAPIEPC(type: org.openapitools.generator.gradle.plugin.tasks.GenerateTask) {
generatorName.set("spring")
tasks.register('generateOpenAPIEPC', GenerateTask) {
generatorName.set("java")
inputSpec.set("$rootDir/openapi/EPC133-22 v3.1 - SRTP scheme rulebook v3.1 related API specifications_optimized.yaml")
outputDir.set("$projectDir/build/generated")
apiPackage.set("it.gov.pagopa.rtp.activator.controller.generated.epc")
modelPackage.set("it.gov.pagopa.rtp.activator.model.generated.epc")
apiPackage.set("it.gov.pagopa.rtp.activator.client.epc.api")
modelPackage.set("it.gov.pagopa.rtp.activator.client.epc.model")
invokerPackage.set("it.gov.pagopa.rtp.activator.client.epc.invoker")
modelNameSuffix.set("Dto")
generateApiTests.set(false)
generateApiDocumentation.set(false)
generateApiTests.set(false)
generateModelTests.set(false)
library.set("spring-boot")
library.set("webclient")
configOptions.set([
"dateLibrary" : "java8",
"useSpringBoot3" : "true",
"useJakartaEe" : "true",
"interfaceOnly" : "true",
"useTags" : "true",
"useSwaggerUI" : "false",
Expand Down Expand Up @@ -184,7 +187,7 @@ bootRun {
]
}

tasks.withType(JavaExec) {
tasks.withType(JavaExec).configureEach {
jvmArgs += '-Djava.security.properties=src/main/resources/custom.security'
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version=1.5.0
version=1.5.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,8 @@

import org.springframework.boot.context.properties.ConfigurationProperties;

import lombok.Getter;
import lombok.Setter;

@ConfigurationProperties(prefix = "activation")
@Getter
@Setter
public class ActivationPropertiesConfig{
private String baseUrl;
public record ActivationPropertiesConfig(
String baseUrl) {

public ActivationPropertiesConfig(String baseUrl){
this.baseUrl = baseUrl;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public Mono<ResponseEntity<Void>> activate(
.flatMap(t -> activationPayerService.activatePayer(t.getPayer().getRtpSpId(),
t.getPayer().getFiscalCode()))
.<ResponseEntity<Void>>map(payer -> ResponseEntity
.created(URI.create(activationPropertiesConfig.getBaseUrl() + payer.payerID().toString()))
.created(URI.create(activationPropertiesConfig.baseUrl() + payer.payerID().toString()))
.build())
.onErrorReturn(PayerAlreadyExists.class, ResponseEntity.status(409).build());
}
Expand Down
15 changes: 0 additions & 15 deletions src/main/resources/application.properties

This file was deleted.

20 changes: 20 additions & 0 deletions src/main/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
logging.level.root: INFO

spring.application.name: rtp-activator

# enable spring boot actuator health endpoint
management:
endpoints:
enabled-by-default: false
web.exposure.include: health
endpoint:
health:
enabled: true
probes.enabled: true
#repository
health.mongo.enabled: false

spring.data.mongodb:
uri: ${COSMOS_ACCOUNT_RTP_CONNECTION_STRING:}
database: ${DB_NAME:rtp}
activation.base-url: ${BASE_URL:http://localhost}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

@ExtendWith(SpringExtension.class)
@EnableConfigurationProperties(value = ActivationPropertiesConfig.class)
@TestPropertySource("classpath:application.properties")
@TestPropertySource("classpath:application.yaml")
class ActivationPropertiesConfigTest {

@Autowired
Expand All @@ -21,6 +21,6 @@ class ActivationPropertiesConfigTest {
@Test
void testPropertiesLoaded() {
assertNotNull(activationPropertiesConfig);
assertEquals("https://example.com", activationPropertiesConfig.getBaseUrl());
assertEquals("https://example.com", activationPropertiesConfig.baseUrl());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void testActivatePayerSuccessful() {
when(activationPayerService.activatePayer(any(String.class), any(String.class)))
.thenReturn(Mono.just(payer));

when(activationPropertiesConfig.getBaseUrl()).thenReturn("http://localhost:8080/");
when(activationPropertiesConfig.baseUrl()).thenReturn("http://localhost:8080/");

webTestClient.post()
.uri("/activations")
Expand Down
6 changes: 0 additions & 6 deletions src/test/resources/application.properties

This file was deleted.

7 changes: 7 additions & 0 deletions src/test/resources/application.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
logging.level.org.springframework.security: DEBUG
activation.baseUrl: https://example.com

azure.cosmos:
uri: https://example.com/db/endpoint
key: your-primary-key
database: rtp

0 comments on commit 1865073

Please sign in to comment.