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

fix(deps): update dependency com.nimbusds:nimbus-jose-jwt to v10 - abandoned #548

Closed
wants to merge 5 commits into from
Closed
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 backend/pom.xml
Original file line number Diff line number Diff line change
@@ -525,7 +525,7 @@
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
<version>9.47</version>
<version>10.0.1</version>
</dependency>
<dependency>
<groupId>org.testcontainers</groupId>
Original file line number Diff line number Diff line change
@@ -59,14 +59,19 @@ public ResponseEntity<List<OpeningsPerYearDto>> getOpeningsSubmissionTrends(
LocalDate entryDateEnd
) {

LocalDate end = getDateOrDefault(entryDateEnd,
//If we have an end date, we get it, otherwise we use the current date,
// and no matter if we have the start date or not, we add a year to the end date
getDateOrDefault(entryDateStart,LocalDate.now().minusYears(1)).plusYears(1)
);
LocalDate bgn = getDateOrDefault(entryDateEnd,LocalDate.now().minusYears(1));

log.info("AS date per request of Mr Dates {} {}", bgn, end);

List<OpeningsPerYearDto> resultList =
openingTrendsService.getOpeningSubmissionTrends(
getDateOrDefault(entryDateStart,LocalDate.now().minusYears(1)),
getDateOrDefault(entryDateEnd,
//If we have an end date, we get it, otherwise we use the current date,
// and no matter if we have the start date or not, we add a year to the end date
getDateOrDefault(entryDateStart,LocalDate.now().minusYears(1)).plusYears(1)
),
bgn,
end,
orgUnits,
statusCodes
);
Original file line number Diff line number Diff line change
@@ -8,6 +8,10 @@

import ca.bc.gov.restapi.results.extensions.AbstractTestContainerIntegrationTest;
import ca.bc.gov.restapi.results.extensions.WithMockJwt;
import ca.bc.gov.restapi.results.oracle.repository.OpeningRepository;
import java.time.LocalDate;
import java.time.LocalDateTime;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -23,6 +27,19 @@ class UserActionsEndpointIntegrationTest extends AbstractTestContainerIntegratio
@Autowired
private MockMvc mockMvc;

@Autowired
private OpeningRepository openingRepository;

@BeforeEach
public void beforeEach(){

openingRepository
.findAll()
.stream()
.map(entity -> entity.withUpdateTimestamp(LocalDateTime.now().minusMonths(2)))
.forEach(openingRepository::save);
}

@Test
@DisplayName("User recent actions requests test with data should succeed")
void getUserRecentOpeningsActions_withData_shouldSucceed() throws Exception {
@@ -65,10 +82,8 @@ void getOpeningsSubmissionTrends_happyPath_shouldSucceed() throws Exception {
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$[0].month").value("12"))
.andExpect(jsonPath("$[0].amount").value(0))
.andExpect(jsonPath("$[1].monthName").value("Jan"))
.andExpect(jsonPath("$[1].amount").value(3));
.andExpect(jsonPath("$[11].month").value(LocalDate.now().getMonthValue()))
.andExpect(jsonPath("$[11].amount").value(3));
}

@Test
@@ -93,8 +108,8 @@ void getOpeningsSubmissionTrends_withFilters_shouldSucceed() throws Exception {
.accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$[0].month").value("12"))
.andExpect(jsonPath("$[0].amount").value(0));
.andExpect(jsonPath("$[11].month").value(LocalDate.now().getMonthValue()))
.andExpect(jsonPath("$[11].amount").value(3));
}

@Test
Original file line number Diff line number Diff line change
@@ -8,6 +8,7 @@
import ca.bc.gov.restapi.results.postgres.dto.OpeningsPerYearDto;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Month;
import java.time.format.TextStyle;
import java.util.List;
import java.util.Locale;
@@ -64,8 +65,7 @@ void getOpeningSubmissionTrends_noFilters_shouldSucceed() {
null
);

String monthName = now.getMonth().name().toLowerCase();
monthName = monthName.substring(0, 1).toUpperCase() + monthName.substring(1, 3);
String monthName = now.getMonth().getDisplayName(TextStyle.SHORT, Locale.CANADA);

Assertions.assertFalse(list.isEmpty());
Assertions.assertEquals(12, list.size());
@@ -111,8 +111,7 @@ void getOpeningSubmissionTrends_statusFilter_shouldSucceed() {
List.of("APP")
);

String monthName = now.getMonth().name().toLowerCase();
monthName = monthName.substring(0, 1).toUpperCase() + monthName.substring(1, 3);
String monthName = now.getMonth().getDisplayName(TextStyle.SHORT, Locale.CANADA);

Assertions.assertFalse(list.isEmpty());
Assertions.assertEquals(12, list.size());
@@ -206,4 +205,8 @@ class TestOpeningTrendsProjection implements OpeningTrendsProjection {

}

private String getMonthName(int month) {
return Month.of(month).getDisplayName(TextStyle.SHORT, Locale.CANADA);
}

}
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ void getStartIndexTest() {
}

@Test
@DisplayName("")
@DisplayName("End index test")
void getEndIndexTest() {
Assertions.assertEquals(40, PaginationUtil.getEndIndex(30, 10, 47));
Assertions.assertEquals(47, PaginationUtil.getEndIndex(40, 10, 47));