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

Spring Boot 2.7.3 #1369

Merged
merged 9 commits into from
Sep 28, 2022
Merged
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
* [Developer]: Added description and metadata to create & update project sample endpoints. See [PR 1359](https://github.com/phac-nml/irida/pull/1359)
* [UI]: Fix issue where year is displayed incorrectly when the last day of the week for the date is in another year. See [PR 1364](https://github.com/phac-nml/irida/pull/1364)
* [Developer]: Fix issue where large downloads silent failed due to async request timeout. See [PR 1368](https://github.com/phac-nml/irida/pull/1368)
* [Developer]: Update to Spring Boot 2.7.3 and update various other dependencies. See [PR 1369](https://github.com/phac-nml/irida/pull/1369)

## [22.05.5] - 2022/06/28
* [UI]: Fixed bug preventing export of project samples table due to invalid url. [PR 1331](https://github.com/phac-nml/irida/pull/1331)
Expand Down
20 changes: 10 additions & 10 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ dependencies {
implementation("org.springframework.boot:spring-boot-starter-validation")
implementation("org.springframework.boot:spring-boot-starter-security")
implementation("org.springframework.security:spring-security-oauth2-authorization-server:0.3.1")
implementation("org.springframework.security:spring-security-oauth2-resource-server:5.7.2")
implementation("org.springframework.security:spring-security-oauth2-resource-server:5.7.3")
implementation("org.apache.oltu.oauth2:org.apache.oltu.oauth2.client:1.0.0") {
exclude(group = "org.slf4j")
}
Expand All @@ -136,11 +136,11 @@ dependencies {
exclude(group = "commons-logging", module = "commons-logging")
}
implementation("commons-net:commons-net:3.8.0")
implementation("org.apache.jena:jena-tdb:4.3.2") {
implementation("org.apache.jena:jena-tdb:4.6.1") {
exclude(group = "xml-apis")
exclude(group = "org.slf4j")
}
implementation("org.apache.jena:jena-text:4.3.2") {
implementation("org.apache.jena:jena-text:4.6.1") {
exclude(group = "xml-apis")
exclude(group = "org.slf4j")
exclude(group = "log4j")
Expand All @@ -163,15 +163,15 @@ dependencies {
implementation("org.apache.logging.log4j:log4j-api")
implementation("org.apache.logging.log4j:log4j-to-slf4j")
implementation("com.google.guava:guava:31.0.1-jre")
implementation("commons-cli:commons-cli:1.2")
implementation("commons-cli:commons-cli:1.5.0")
implementation("org.aspectj:aspectjweaver")
implementation("org.apache.commons:commons-csv:1.8")
implementation("org.apache.commons:commons-csv:1.9.0")
implementation("com.sksamuel.diff:diff:1.1.11")
implementation("org.pf4j:pf4j:2.4.0")
implementation("org.biojava:biojava3-core:3.0")
implementation("com.google.code.gson:gson")
implementation("com.github.pjfanning:excel-streaming-reader:3.6.1")
implementation("org.springdoc:springdoc-openapi-webmvc-core:1.5.6") {
implementation("org.springdoc:springdoc-openapi-webmvc-core:1.6.11") {
exclude(group = "jakarta.xml.bind", module = "jakarta.xml.bind-api")
exclude(group = "jakarta.validation", module = "jakarta.validation-api")
}
Expand Down Expand Up @@ -206,12 +206,12 @@ dependencies {
testImplementation("io.rest-assured:rest-assured")
testImplementation("io.rest-assured:json-path")
testImplementation("com.github.springtestdbunit:spring-test-dbunit:1.3.0")
testImplementation("org.dbunit:dbunit:2.7.2") {
testImplementation("org.dbunit:dbunit:2.7.3") {
exclude(group = "org.slf4j")
}
testImplementation("org.seleniumhq.selenium:selenium-support:3.141.59")
testImplementation("org.seleniumhq.selenium:selenium-chrome-driver:3.141.59")
testImplementation("org.mockftpserver:MockFtpServer:2.6")
testImplementation("org.seleniumhq.selenium:selenium-support:4.4.0")
testImplementation("org.seleniumhq.selenium:selenium-chrome-driver:4.4.0")
testImplementation("org.mockftpserver:MockFtpServer:3.0.0")
}

tasks.register<Zip>("packageDistribution") {
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pluginManagement {
id("com.github.node-gradle.node") version "3.4.0"
id("io.spring.dependency-management") version "1.0.11.RELEASE"
id("org.gradle.test-retry") version "1.4.0"
id("org.springframework.boot") version "2.6.6"
id("org.springframework.boot") version "2.7.3"
id("org.springdoc.openapi-gradle-plugin") version "1.3.4"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
import org.springframework.security.oauth2.server.resource.authentication.JwtGrantedAuthoritiesConverter;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
import org.springframework.security.web.context.SecurityContextPersistenceFilter;
import org.springframework.security.web.context.SecurityContextHolderFilter;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.security.web.util.matcher.RequestMatcher;
import org.springframework.util.ResourceUtils;
Expand Down Expand Up @@ -116,7 +116,7 @@ public SecurityFilterChain resourceServerSecurityFilterChain(HttpSecurity http)
// user filter into the filter chain after that.
http.antMatcher("/api/**")
.addFilterAfter(new UnauthenticatedAnonymousAuthenticationFilter("anonymousTokenAuthProvider"),
SecurityContextPersistenceFilter.class);
SecurityContextHolderFilter.class);

return http.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import javax.persistence.*;
import javax.validation.constraints.NotNull;

import org.apache.commons.io.FilenameUtils;
import org.hibernate.envers.Audited;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -16,7 +17,6 @@

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.google.common.collect.ImmutableSet;
import liquibase.util.file.FilenameUtils;

/**
* {@link SequencingObject} implementation for storing .fast5 files.
Expand Down Expand Up @@ -57,8 +57,7 @@ public Set<SequenceFile> getFiles() {
}

/**
* Throws {@link UnsupportedOperationException} because you should not be
* able to update a file.
* Throws {@link UnsupportedOperationException} because you should not be able to update a file.
*/
@JsonIgnore
@Override
Expand All @@ -68,15 +67,13 @@ public void setModifiedDate(Date modifiedDate) {

@Override
public String getLabel() {
return file.getFileName()
.toString();
return file.getFileName().toString();
}

public SequenceFile getFile() {
return file;
}


public Fast5Type getFast5Type() {
return fast5Type;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,6 @@ public interface ProjectSampleJoinRepository
* @param sampleIds {@link Sample} ids
* @return A List of {@link Tuple}s with first entry as the sample id and second entry as the coverage
*/
@Query("SELECT ps.sample.id, ROUND(SUM(qc.totalBases)/ps.project.genomeSize) FROM ProjectSampleJoin ps join SampleSequencingObjectJoin sso on sso.sample = ps.sample join CoverageQCEntry qc on qc.sequencingObject = sso.sequencingObject where ps.project=?1 and ps.sample.id in ?2 group by ps.sample.id")
@Query("SELECT ps.sample.id, ROUND(SUM(qc.totalBases)/ps.project.genomeSize) FROM ProjectSampleJoin ps join SampleSequencingObjectJoin sso on sso.sample = ps.sample join CoverageQCEntry qc on qc.sequencingObject = sso.sequencingObject where ps.project=?1 and ps.sample.id in ?2 group by ps.sample.id, ps.project.genomeSize")
public List<Tuple> calculateCoverageForSamplesInProject(Project project, List<Long> sampleIds);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@

import javax.servlet.http.HttpServletResponse;

import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVPrinter;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import liquibase.util.csv.CSVWriter;

/**
* Used to export datatables to either excel or csv formatted files.
*/
Expand All @@ -22,19 +22,12 @@ public class DataTablesExportToFile {
/**
* Write data within datatable to an excel formatted file.
*
* @param type
* {@link DataTablesExportTypes} type of file to create (either
* excel or csv)
* @param response
* {@link HttpServletResponse}
* @param filename
* {@link String} name of the file to download.
* @param models
* Data to download in the table
* @param headers
* for the table
* @throws IOException
* thrown if file cannot be written
* @param type {@link DataTablesExportTypes} type of file to create (either excel or csv)
* @param response {@link HttpServletResponse}
* @param filename {@link String} name of the file to download.
* @param models Data to download in the table
* @param headers for the table
* @throws IOException thrown if file cannot be written
*/
public static void writeFile(DataTablesExportTypes type, HttpServletResponse response, String filename,
List<? extends DataTablesExportable> models, List<String> headers) throws IOException {
Expand All @@ -50,16 +43,11 @@ public static void writeFile(DataTablesExportTypes type, HttpServletResponse res
/**
* Write data within datatable to an excel formatted file.
*
* @param response
* {@link HttpServletResponse}
* @param filename
* {@link String} name of the file to download.
* @param models
* Data to download in the table
* @param headers
* for the table
* @throws IOException
* thrown if file cannot be written
* @param response {@link HttpServletResponse}
* @param filename {@link String} name of the file to download.
* @param models Data to download in the table
* @param headers for the table
* @throws IOException thrown if file cannot be written
*/
private static void writeToExcel(HttpServletResponse response, String filename,
List<? extends DataTablesExportable> models, List<String> headers) throws IOException {
Expand Down Expand Up @@ -95,16 +83,11 @@ private static void writeToExcel(HttpServletResponse response, String filename,
/**
* Write data within datatable to a csv formatted file.
*
* @param response
* {@link HttpServletResponse}
* @param filename
* {@link String} name of the file to download.
* @param models
* Data to download in the table
* @param headers
* for the table
* @throws IOException
* thrown if file cannot be written
* @param response {@link HttpServletResponse}
* @param filename {@link String} name of the file to download.
* @param models Data to download in the table
* @param headers for the table
* @throws IOException thrown if file cannot be written
*/
private static void writeToCSV(HttpServletResponse response, String filename,
List<? extends DataTablesExportable> models, List<String> headers) throws IOException {
Expand All @@ -117,9 +100,9 @@ private static void writeToCSV(HttpServletResponse response, String filename,
response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + ".csv\"");
response.setContentType("text/csv");
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(response.getOutputStream());
CSVWriter csvWriter = new CSVWriter(outputStreamWriter, ',');
csvWriter.writeAll(results);
csvWriter.flush();
csvWriter.close();
CSVPrinter printer = CSVFormat.DEFAULT.print(outputStreamWriter);
printer.printRecords(results);
printer.flush();
outputStreamWriter.close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import javax.servlet.http.HttpServletResponse;
import javax.validation.ConstraintViolationException;

import org.apache.commons.csv.CSVFormat;
import org.apache.commons.csv.CSVPrinter;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellStyle;
Expand Down Expand Up @@ -72,7 +74,6 @@

import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import liquibase.util.csv.CSVWriter;

/**
* UI Service for samples
Expand Down Expand Up @@ -714,9 +715,9 @@ private void writeToCSV(HttpServletResponse response, String filename, List<Proj
response.setHeader("Content-Disposition", "attachment; filename=\"" + filename + ".csv\"");
response.setContentType("text/csv");
OutputStreamWriter outputStreamWriter = new OutputStreamWriter(response.getOutputStream());
CSVWriter csvWriter = new CSVWriter(outputStreamWriter, ',');
csvWriter.writeAll(results);
csvWriter.flush();
csvWriter.close();
CSVPrinter printer = CSVFormat.DEFAULT.print(outputStreamWriter);
printer.printRecords(results);
printer.flush();
outputStreamWriter.close();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ public static void throwConstraintViolationException(TransactionSystemException
if (exception.getRootCause() instanceof ConstraintViolationException) {
constraintViolationException = (ConstraintViolationException) exception.getRootCause();
Set<ConstraintViolation<?>> constraintViolationSet = constraintViolationException.getConstraintViolations();
for (ConstraintViolation constraintViolation : constraintViolationSet) {
for (ConstraintViolation<?> constraintViolation : constraintViolationSet) {
// The constraintViolation.getMessage() returns the i18n key in this case
constraintViolationMessage +=
messageSource.getMessage(constraintViolation.getMessage(), new Object[] {}, locale) + "\n";
constraintViolationMessage += messageSource.getMessage(constraintViolation.getMessage(),
new Object[] {}, locale) + "\n";
}
}
throw new UIConstraintViolationException(constraintViolationMessage);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package ca.corefacility.bioinformatics.irida.junit5.listeners;

import static org.junit.jupiter.api.Assertions.fail;

import java.net.MalformedURLException;
import java.net.URL;
import java.util.concurrent.TimeUnit;
import java.time.Duration;

import org.junit.platform.launcher.TestExecutionListener;
import org.junit.platform.launcher.TestPlan;
Expand All @@ -15,8 +13,10 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import static org.junit.jupiter.api.Assertions.fail;

public class IntegrationUITestListener implements TestExecutionListener {

private static final Logger logger = LoggerFactory.getLogger(IntegrationUITestListener.class);
public static final int DRIVER_TIMEOUT_IN_SECONDS = 3;

Expand Down Expand Up @@ -89,7 +89,7 @@ public static void startWebDriver() {
driver = new ChromeDriver(options);
}

driver.manage().timeouts().implicitlyWait(DRIVER_TIMEOUT_IN_SECONDS, TimeUnit.SECONDS);
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(DRIVER_TIMEOUT_IN_SECONDS));
}

public static void stopWebDriver() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package ca.corefacility.bioinformatics.irida.ria.integration;

import java.time.Duration;

import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
Expand All @@ -19,14 +21,15 @@ public void openSelect2Input() {
}

public void searchByText(String text) {
WebDriverWait wait = new WebDriverWait(driver, 10L);
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10L));
WebElement input = wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector("a.select2-choice")));
input.sendKeys(text);
}

public void selectDefaultMatch() {
WebDriverWait wait = new WebDriverWait(driver, 10L);
WebElement match = wait.until(ExpectedConditions.visibilityOf(driver.findElement(By.className("select2-match"))));
WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(10L));
WebElement match = wait
.until(ExpectedConditions.visibilityOf(driver.findElement(By.className("select2-match"))));
match.click();
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ca.corefacility.bioinformatics.irida.ria.integration.components;

import java.time.Duration;
import java.util.List;

import org.openqa.selenium.By;
Expand Down Expand Up @@ -28,7 +29,7 @@ public class AddMemberButton {
private static WebDriverWait wait;

public static AddMemberButton getAddMemberButton(WebDriver driver) {
wait = new WebDriverWait(driver, 3);
wait = new WebDriverWait(driver, Duration.ofSeconds(3L));
return PageFactory.initElements(driver, AddMemberButton.class);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ca.corefacility.bioinformatics.irida.ria.integration.components;

import java.time.Duration;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

Expand All @@ -14,8 +15,7 @@
import org.openqa.selenium.support.ui.WebDriverWait;

/**
* Used to test the state of the React AnnouncementsModal component.
* This component can be found at login.
* Used to test the state of the React AnnouncementsModal component. This component can be found at login.
*/
public class Announcements {
private static final String RATIO_REGULAR_EXPRESSION = "Read: (\\d+) / (\\d+)";
Expand Down Expand Up @@ -48,7 +48,7 @@ public class Announcements {
private static Actions actions;

public static Announcements goTo(WebDriver driver) {
wait = new WebDriverWait(driver, 5);
wait = new WebDriverWait(driver, Duration.ofSeconds(5L));
actions = new Actions(driver);
return PageFactory.initElements(driver, Announcements.class);
}
Expand Down
Loading