- In case the provided "datasourceID" is not found inside the "datasourcesWithNumOfPayloads" map (but does not appear to have invalid form), add an explanatory message in the HTTP-404 response, to be able to distinguish it from a non-existent endpoint.
- Improve the UX of the "installAndRun.sh" script. - Update dependencies.
This commit is contained in:
parent
8175f9cd77
commit
cbaa1cc621
|
@ -1,6 +1,6 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
id 'org.springframework.boot' version '2.7.16'
|
||||
id 'org.springframework.boot' version '2.7.17'
|
||||
id 'io.spring.dependency-management' version '1.1.3'
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ dependencies {
|
|||
implementation 'com.fasterxml.woodstox:woodstox-core:6.5.1'
|
||||
|
||||
// https://mvnrepository.com/artifact/io.micrometer/micrometer-registry-prometheus
|
||||
runtimeOnly 'io.micrometer:micrometer-registry-prometheus:1.11.4'
|
||||
runtimeOnly 'io.micrometer:micrometer-registry-prometheus:1.11.5'
|
||||
|
||||
testImplementation 'org.springframework.security:spring-security-test'
|
||||
testImplementation "org.springframework.boot:spring-boot-starter-test"
|
||||
|
|
|
@ -58,11 +58,13 @@ if [[ justInstall -eq 0 ]]; then
|
|||
# Run in "detached mode" -d (in the background).
|
||||
(sudo docker compose up --build -d && echo -e "\nThe pdf_aggregation_statistics docker-container started running.\n") || handle_error "Could not build and/or run the 'pdf_aggregation_statistics' docker container!" 4
|
||||
|
||||
echo -e "Waiting 60 seconds before getting the status..\n"
|
||||
sleep 60
|
||||
echo -e "Waiting 20 seconds before getting the status..\n"
|
||||
sleep 20
|
||||
sudo docker ps -a || handle_error "Could not get the status of docker-containers!" 6 # Using -a to get the status of failed containers as well.
|
||||
echo -e "\n\nGetting the logs of docker-container \"pdf_aggregation_statistics\":\n"
|
||||
sudo docker logs "$(sudo docker ps -aqf "name=^pdf_aggregation_statistics$")" || handle_error "Could not get the logs of docker-container \"pdf_aggregation_statistics\"!" 7 # Using "regex anchors" to avoid false-positives. Works even if the container is not running, thus showing the error-log.
|
||||
sudo docker logs -f pdf_aggregation_statistics || handle_error "Could not get the logs of docker-container \"pdf_aggregation_statistics\"!" 7 # Using "regex anchors" to avoid false-positives. Works even if the container is not running, thus showing the error-log.
|
||||
# Use just the container-name and the "-f" parameter to indicate that we want to follow on logs updates, until we specify to unfollow them (with ctrl+c).
|
||||
# This way we do not need to run the "docker logs" again and again, not checking the the container-id each time.
|
||||
fi
|
||||
else
|
||||
export PATH=/opt/gradle/gradle-${gradleVersion}/bin:$PATH # Make sure the gradle is still accessible (it usually isn't without the "export").
|
||||
|
|
|
@ -4,6 +4,7 @@ package eu.openaire.pdf_aggregation_statistics.controllers;
|
|||
import eu.openaire.pdf_aggregation_statistics.services.StatsServiceImpl;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.web.bind.MissingServletRequestParameterException;
|
||||
|
@ -60,7 +61,7 @@ public class StatsController {
|
|||
|
||||
Integer numPayloads = StatsServiceImpl.datasourcesWithNumOfPayloads.get(datasourceId);
|
||||
if ( numPayloads == null )
|
||||
return ResponseEntity.notFound().build();
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).body("The given \"datasourceID\": \"" + datasourceId + "\" does not exist in the OpenAIRE Graph.");
|
||||
else
|
||||
return ResponseEntity.ok(Integer.toString(numPayloads));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue