Skip to content

Commit

Permalink
Upgrade Gradle and Spring Boot
Browse files Browse the repository at this point in the history
  • Loading branch information
zapek committed Nov 21, 2024
1 parent 78c1e6c commit 505c917
Show file tree
Hide file tree
Showing 10 changed files with 32 additions and 27 deletions.
10 changes: 2 additions & 8 deletions app/src/main/java/io/xeres/app/api/DefaultHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import io.swagger.v3.oas.annotations.info.License;
import io.xeres.app.api.exception.UnprocessableEntityException;
import io.xeres.common.AppName;
import jakarta.annotation.Nonnull;
import jakarta.persistence.EntityNotFoundException;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
Expand All @@ -36,7 +37,6 @@
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.context.request.WebRequest;
import org.springframework.web.context.request.async.AsyncRequestNotUsableException;
import org.springframework.web.server.ResponseStatusException;
import org.springframework.web.servlet.mvc.method.annotation.ResponseEntityExceptionHandler;

Expand Down Expand Up @@ -111,15 +111,9 @@ public ResponseEntity<Void> handleResponseStatusException(ResponseStatusExceptio
return new ResponseEntity<>(e.getStatusCode());
}

@ExceptionHandler(AsyncRequestNotUsableException.class)
public void handleAsyncRequestNotUsableException(AsyncRequestNotUsableException ignored)
{
// We ignore those because they happen when scrolling images (we abort useless loads when scrolling quickly).
}

// This one has to use an override
@Override
protected ResponseEntity<Object> handleMethodArgumentNotValid(MethodArgumentNotValidException ex, HttpHeaders headers, HttpStatusCode status, WebRequest request)
protected ResponseEntity<Object> handleMethodArgumentNotValid(@Nonnull MethodArgumentNotValidException ex, @Nonnull HttpHeaders headers, HttpStatusCode status, @Nonnull WebRequest request)
{
var problemDetail = handleValidationException(ex);
return ResponseEntity.status(status.value()).body(problemDetail);
Expand Down
5 changes: 1 addition & 4 deletions app/src/main/resources/application-dev.properties
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,13 @@ logging.level.io.xeres.app.xrs.service.turtle=DEBUG

### Other settings

## Flyway
spring.flyway.clean-on-validation-error=false

## Swagger UI
springdoc.swagger-ui.tags-sorter=alpha

## Actuator
info.java.vm.vendor=${java.vm.vendor}
info.java.version=${java.version}
management.endpoint.shutdown.enabled=true
management.endpoint.shutdown.access=unrestricted
management.endpoints.web.exposure.include=*
management.endpoints.web.base-path=/api/v1/actuator
management.info.java.enabled=true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,14 @@ public static Location createLocation(String name, Profile profile)
return createLocation(name, profile, new LocationId(getRandomArray()));
}

public static Location createFreshLocation(String name, Profile profile)
{
var location = new Location(0L, name, profile, new LocationId(getRandomArray()));
location.setNetMode(NetMode.UPNP);
location.setVersion("Xeres 0.1.1");
return location;
}

public static Location createLocation(String name, Profile profile, LocationId locationId)
{
var location = new Location(getUniqueId(), name, profile, locationId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public static Profile createProfile()
return createProfile(StringFakes.createNickname(), ThreadLocalRandom.current().nextLong());
}

public static Profile createFreshProfile(String name, long pgpIdentifier)
{
return new Profile(0L, name, pgpIdentifier, Instant.now(), new ProfileFingerprint(getRandomArray(20)), getRandomArray(200));
}

public static Profile createProfile(String name, long pgpIdentifier)
{
return createProfile(name, pgpIdentifier, new ProfileFingerprint(getRandomArray(20)), getRandomArray(200));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ class GxsClientUpdateRepositoryTest
@Test
void CRUD_Success()
{
var profile = ProfileFakes.createProfile("profile1", 1);
var profile = ProfileFakes.createFreshProfile("profile1", 1);
profile = profileRepository.save(profile);
var location = LocationFakes.createLocation("location1", profile);
var location = LocationFakes.createFreshLocation("location1", profile);

profile.addLocation(location);
profile = profileRepository.save(profile);
Expand Down Expand Up @@ -89,9 +89,9 @@ void CRUD_Success()
@Test
void CRUD_Messages_Success()
{
var profile = ProfileFakes.createProfile("profile1", 1);
var profile = ProfileFakes.createFreshProfile("profile1", 1);
profile = profileRepository.save(profile);
var location = LocationFakes.createLocation("location1", profile);
var location = LocationFakes.createFreshLocation("location1", profile);

profile.addLocation(location);
profile = profileRepository.save(profile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,13 @@ class LocationRepositoryTest
@Test
void CRUD_Success()
{
var profile = ProfileFakes.createProfile("test", 1);
var profile = ProfileFakes.createFreshProfile("test", 1);

profile = profileRepository.save(profile);

var location1 = LocationFakes.createLocation("test1", profile);
var location2 = LocationFakes.createLocation("test2", profile);
var location3 = LocationFakes.createLocation("test3", profile);
var location1 = LocationFakes.createFreshLocation("test1", profile);
var location2 = LocationFakes.createFreshLocation("test2", profile);
var location3 = LocationFakes.createFreshLocation("test3", profile);

profile.addLocation(location1);
profile.addLocation(location2);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ class ProfileRepositoryTest
@Test
void CRUD_Success()
{
var profile1 = ProfileFakes.createProfile("test1", 1);
var profile2 = ProfileFakes.createProfile("test2", 2);
var profile3 = ProfileFakes.createProfile("test3", 3);
var profile1 = ProfileFakes.createFreshProfile("test1", 1);
var profile2 = ProfileFakes.createFreshProfile("test2", 2);
var profile3 = ProfileFakes.createFreshProfile("test3", 3);

var savedProfile = profileRepository.save(profile1);
profileRepository.save(profile2);
Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,15 @@ buildscript {
}

plugins {
id 'org.springframework.boot' version '3.3.5' apply false
id 'org.flywaydb.flyway' version '10.10.0' apply false // Keep the version in sync with spring-boot from time to time
id 'org.springframework.boot' version '3.4.0' apply false
id 'org.flywaydb.flyway' version '10.20.0' apply false // Keep the version in sync with spring-boot from time to time
id 'org.panteleyev.jpackageplugin' version '1.6.0' apply false
id 'org.sonarqube' version '6.0.0.5145'
}

// To upgrade Gradle, change the version here, refresh, then run the 'build setup/wrapper' task
wrapper {
gradleVersion = '8.10.2'
gradleVersion = '8.11.1'
}

// This gives a git-like version for git builds but a proper version
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@
#
org.gradle.parallel=true
org.gradle.configuration-cache=true
org.gradle.configuration-cache.parallel=true
org.gradle.caching=true
org.gradle.configureondemand=true
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.11.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down

0 comments on commit 505c917

Please sign in to comment.