Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): update dependency ubuntu to v24 #238

Merged
merged 5 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/api-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ concurrency:
jobs:
verify-api:
name: Verify TEST
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
package: [ test, prod ]
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ concurrency:
jobs:
deploy-test:
name: TEST Deployment
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
outputs:
tag: ${{ steps.changelog.outputs.tag }}
permissions:
Expand Down Expand Up @@ -87,7 +87,7 @@ jobs:
image-promotions:
name: Image Promotions
needs: [deploy-test]
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
strategy:
matrix:
tag: [prod, "${{ needs.deploy-test.outputs.tag }}"]
Expand All @@ -108,7 +108,7 @@ jobs:
deploy-prod:
name: PROD Deployment
needs: [image-promotions]
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
environment:
name: prod
steps:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pr-close.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
# Clean up OpenShift when PR closed, no conditions
cleanup-openshift:
name: Cleanup OpenShift
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
environment:
name: dev
steps:
Expand All @@ -33,7 +33,7 @@ jobs:
image-promotions:
name: Image Promotions
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- name: Promoting API
uses: shrink/actions-docker-registry-tag@v4
Expand All @@ -47,7 +47,7 @@ jobs:
# Notify when PR merged and branch = main
merge-notification:
name: Merge Notification
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'main'
steps:
- name: Pre-merge update
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ concurrency:
jobs:
pr-validation:
name: Pull Request Validation
runs-on: ubuntu-latest
runs-on: ubuntu-22.04
permissions:
contents: read
pull-requests: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/reusable-tests-be.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
tests-java:
name: Backend Tests
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: bcgov-nr/action-test-and-analyse-java@v1.0.2
name: Backend Coverage
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reusable-tests-repo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
trivy:
name: Repository Report
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: Run Trivy vulnerability scanner in repo mode
Expand All @@ -27,7 +27,7 @@ jobs:

codeql:
name: Semantic Code Analysis
runs-on: ubuntu-22.04
runs-on: ubuntu-24.04
permissions:
actions: read
contents: read
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
* MetricConfiguration sets up custom metrics and configuration for the application's meter
* registry using Micrometer.
*

Check warning on line 17 in src/main/java/ca/bc/gov/api/oracle/legacy/configuration/MetricConfiguration.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.JavadocParagraphCheck

Empty line should be followed by <p> tag on the next line.
* It applies common tags to all metrics, configures percentile distribution statistics,
* and manages Prometheus meter registry configuration. This class also provides a
* {@link TimedAspect} bean to support @Timed annotations for methods.
*/
@Configuration
public class MetricConfiguration {

Expand All @@ -23,32 +31,60 @@
@Value("${info.app.zone}")
private String appZone;

/**
* Creates a {@link TimedAspect} bean for timing method executions using the @Timed annotation.
*
* @param registry the {@link MeterRegistry} to register the aspect with.
* @return a {@link TimedAspect} configured to record method execution times.
*/
@Bean
public TimedAspect timedAspect(MeterRegistry registry) {
return new TimedAspect(registry);
}

/**
* Adds common tags like version, app name, and zone to all metrics registered with the
* {@link MeterRegistry}.
*
* @return a {@link MeterRegistryCustomizer} to configure common tags and filters for metrics.
*/
@Bean
public MeterRegistryCustomizer<MeterRegistry> metricsCommonTags() {
return registry -> registry.config()
.commonTags(
"version", appVersion,
"app", appName,
"zone",appZone
"zone", appZone
)
.meterFilter(ignoreTag())
.meterFilter(distribution());
}

/**
* Configures the {@link PrometheusMeterRegistry} for use with Prometheus metrics.
*
* @return a {@link MeterRegistryCustomizer} for Prometheus meter registry configuration.
*/
@Bean
public MeterRegistryCustomizer<PrometheusMeterRegistry> prometheusConfiguration() {
return MeterRegistry::config;
}

/**
* Creates a meter filter that ignores the "type" tag in all registered metrics.
*
* @return a {@link MeterFilter} that ignores the "type" tag.
*/
public MeterFilter ignoreTag() {
return MeterFilter.ignoreTags("type");
}

/**
* Configures a meter filter to enable percentile histograms and track percentiles (0.5, 0.95,
* 0.99) for distribution statistics.
*
* @return a {@link MeterFilter} that configures percentile statistics and enables histograms.
*/
public MeterFilter distribution() {
return new MeterFilter() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@
*/
@RestController
@Slf4j
@Tag(
name = "Client API",
description = "Deals with client data checks and validation"
)
@Tag(name = "Client API",
description = "Deals with client data checks and validation")
@RequestMapping(value = "/api/clients", produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class ClientController {
Expand Down Expand Up @@ -107,8 +105,8 @@ public Mono<ClientPublicViewDto> findByClientNumber(
*/
@GetMapping("/findByClientNumberOrName/{clientNumberOrName}")
@Operation(
summary = "Search clients by client number or client name."
+ " It will return active and inactive",
summary = "Search clients by client number or client name."
+ " It will return active and inactive",
responses = {
@ApiResponse(
responseCode = "200",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package ca.bc.gov.api.oracle.legacy.entity;

import static ca.bc.gov.api.oracle.legacy.ApplicationConstants.ORACLE_ATTRIBUTE_SCHEMA;

import java.time.LocalDateTime;
import lombok.AllArgsConstructor;
import lombok.Builder;
Expand All @@ -10,7 +11,7 @@
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;

@Data

Check warning on line 14 in src/main/java/ca/bc/gov/api/oracle/legacy/entity/ClientLocationEntity.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck

Missing a Javadoc comment.
@NoArgsConstructor
@AllArgsConstructor
@With
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
package ca.bc.gov.api.oracle.legacy.entity;

import static ca.bc.gov.api.oracle.legacy.ApplicationConstants.ORACLE_ATTRIBUTE_SCHEMA;
import static ca.bc.gov.api.oracle.legacy.ApplicationConstants.INDIVIDUAL;
import static ca.bc.gov.api.oracle.legacy.ApplicationConstants.ORACLE_ATTRIBUTE_SCHEMA;

import java.util.Objects;
import java.util.stream.Collectors;
import java.util.stream.Stream;
Expand All @@ -15,7 +16,7 @@
import org.springframework.data.relational.core.mapping.Column;
import org.springframework.data.relational.core.mapping.Table;

@Data

Check warning on line 19 in src/main/java/ca/bc/gov/api/oracle/legacy/entity/ForestClientEntity.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck

Missing a Javadoc comment.
@With
@Builder
@NoArgsConstructor
Expand Down Expand Up @@ -66,14 +67,13 @@
@Column("CLIENT_COMMENT")
private String clientComment;

@Transient

Check warning on line 70 in src/main/java/ca/bc/gov/api/oracle/legacy/entity/ForestClientEntity.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocMethodCheck

Missing a Javadoc comment.
public String getName() {
if (Objects.equals(this.clientTypeCode, INDIVIDUAL)) {
return Stream.of(this.legalFirstName, this.legalMiddleName, this.clientName)
.filter(Objects::nonNull)
.collect(Collectors.joining(" "));
}
else {
.filter(Objects::nonNull)
.collect(Collectors.joining(" "));
} else {
return this.clientName;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,31 @@
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

@Service

Check warning on line 16 in src/main/java/ca/bc/gov/api/oracle/legacy/service/ClientLocationService.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck

Missing a Javadoc comment.
@Slf4j
@RequiredArgsConstructor
public class ClientLocationService {

private final ClientLocationRepository repository;

/**
* Counts the number of locations associated with a given client.
*
* @param clientNumber the client number for which to count locations
* @return a {@link Mono} emitting the count of locations
*/
public Mono<Long> countClientLocations(String clientNumber) {
return repository.countByClientNumber(clientNumber);
}

/**
* Retrieves a paginated list of client locations.
*
* @param clientNumber the client number for which to retrieve locations
* @param page the page number (0-based) to retrieve
* @param size the number of items per page
* @return a {@link Flux} emitting a list of {@link ClientLocationDto} objects
*/
public Flux<ClientLocationDto> listClientLocations(
String clientNumber,
Integer page,
Expand Down Expand Up @@ -58,10 +72,18 @@
);
}

/**
* Retrieves the details of a specific client location based on client number and location code.
*
* @param clientNumber the client number associated with the location
* @param locationNumber the location code for the specific location
* @return a {@link Mono} emitting a {@link ClientLocationDto} object containing the location details,

Check warning on line 80 in src/main/java/ca/bc/gov/api/oracle/legacy/service/ClientLocationService.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck

Line is longer than 100 characters (found 104).
* or an error if the location is not found
*/
public Mono<ClientLocationDto> getClientLocationDetails(String clientNumber,
String locationNumber) {
return repository
.findByClientNumberAndLocationCode(clientNumber,locationNumber)
.findByClientNumberAndLocationCode(clientNumber, locationNumber)
.map(entity -> new ClientLocationDto(
entity.getClientNumber(),
entity.getLocationCode(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import org.springframework.stereotype.Service;
import reactor.core.publisher.Flux;

@Service

Check warning on line 19 in src/main/java/ca/bc/gov/api/oracle/legacy/service/ClientSearchService.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.javadoc.MissingJavadocTypeCheck

Missing a Javadoc comment.
@RequiredArgsConstructor
@Slf4j
public class ClientSearchService {
Expand All @@ -38,7 +38,8 @@
// Create an empty query criteria.
Criteria queryCriteria = Criteria.empty();

// If the ids list is not empty, add a query criteria to search for clients with client numbers in the ids list.
/* If the list of IDs is not empty, add a query criterion to search for clients
with client numbers in the list of IDs.*/
if (ids != null && !ids.isEmpty()) {
queryCriteria = queryCriteria
.and(where("clientNumber").in(ids));
Expand Down Expand Up @@ -75,7 +76,7 @@
queryCriteria.isEmpty()
);

if(queryCriteria.isEmpty()) {
if (queryCriteria.isEmpty()) {
return Flux.empty();
}

Expand Down
29 changes: 18 additions & 11 deletions src/main/java/ca/bc/gov/api/oracle/legacy/util/ClientMapper.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,22 @@
import lombok.NoArgsConstructor;

/**
* This is a utility class that provides methods to map ForestClientEntity objects to ClientPublicViewDto and ClientViewDto objects.
* It is annotated with @NoArgsConstructor(access = AccessLevel.PRIVATE) to prevent instantiation of this utility class.
* This is a utility class that provides methods to map ForestClientEntity objects
* to ClientPublicViewDto and ClientViewDto objects.
* It is annotated with @NoArgsConstructor(access = AccessLevel.PRIVATE) to
* prevent instantiation of this utility class.
*/
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class ClientMapper {

/**
* This method maps a ForestClientEntity object to a ClientPublicViewDto object.
* It takes in a ForestClientEntity object and returns a ClientPublicViewDto object with the same client details.
* Maps a {@link ForestClientEntity} object to a {@link ClientPublicViewDto} object.
* This method converts the provided {@link ForestClientEntity} into a {@link ClientPublicViewDto},

Check warning on line 20 in src/main/java/ca/bc/gov/api/oracle/legacy/util/ClientMapper.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck

Line is longer than 100 characters (found 102).
* transferring the relevant client details.
*
* @param clientEntity The ForestClientEntity object to be mapped.
* @return A ClientPublicViewDto object with the same client details as the provided ForestClientEntity object.
* @param clientEntity the {@link ForestClientEntity} object to be mapped.
* @return a {@link ClientPublicViewDto} object containing the same client details
* as the provided {@link ForestClientEntity}.
*/
public static ClientPublicViewDto mapEntityToDto(ForestClientEntity clientEntity) {
return ClientPublicViewDto
Expand All @@ -34,12 +38,15 @@
}

/**
* This method maps a ForestClientEntity object to a ClientPublicViewDto object and sets the count of total matching clients.
* It takes in a ForestClientEntity object and a count of total matching clients and returns a ClientPublicViewDto object with the same client details and the count.
* Maps a {@link ForestClientEntity} object to a {@link ClientPublicViewDto} object and sets the
* count of total matching clients. This method converts the provided {@link ForestClientEntity}
* into a {@link ClientPublicViewDto}, transferring the relevant client details and adding the
* count of total matching clients.
*
* @param clientEntity The ForestClientEntity object to be mapped.
* @param count The count of total matching clients.
* @return A ClientPublicViewDto object with the same client details as the provided ForestClientEntity object and the count of total matching clients.
* @param clientEntity the {@link ForestClientEntity} object to be mapped.
* @param count the count of total matching clients.
* @return a {@link ClientPublicViewDto} object containing the same client details as the provided
* {@link ForestClientEntity} and the count of total matching clients.
*/
public static ClientPublicViewDto mapEntityToDto(ForestClientEntity clientEntity, Long count) {
return ClientPublicViewDto
Expand All @@ -57,10 +64,10 @@

/**
* This method maps a ForestClientEntity object to a ClientViewDto object.
* It takes in a ForestClientEntity object and returns a ClientViewDto object with the same client details.

Check warning on line 67 in src/main/java/ca/bc/gov/api/oracle/legacy/util/ClientMapper.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck

Line is longer than 100 characters (found 109).
*
* @param clientEntity The ForestClientEntity object to be mapped.
* @return A ClientViewDto object with the same client details as the provided ForestClientEntity object.

Check warning on line 70 in src/main/java/ca/bc/gov/api/oracle/legacy/util/ClientMapper.java

View workflow job for this annotation

GitHub Actions / Checkstyle

com.puppycrawl.tools.checkstyle.checks.sizes.LineLengthCheck

Line is longer than 100 characters (found 107).
*/
public static ClientViewDto mapEntityToClientViewDto(ForestClientEntity clientEntity) {
return ClientViewDto
Expand Down
Loading