add log4j logs, deploy service, update dependency versions, clean up properties
This commit is contained in:
parent
f437cf7cf5
commit
df0ae9fde1
63
pom.xml
63
pom.xml
|
@ -4,58 +4,49 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>eu.dnetlib</groupId>
|
||||
<artifactId>claims</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<!--<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>2.7.1</version>
|
||||
<relativePath/> <!– lookup parent from repository –>
|
||||
</parent>-->
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
<scm>
|
||||
<developerConnection>scm:git:gitea@code-repo.d4science.org:MaDgIK/uoa-claims-service.git</developerConnection>
|
||||
<tag>HEAD</tag>
|
||||
</scm>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<timestamp>${maven.build.timestamp}</timestamp>
|
||||
<maven.build.timestamp.format>E MMM dd HH:mm:ss z yyyy</maven.build.timestamp.format>
|
||||
</properties>
|
||||
<parent>
|
||||
<groupId>eu.dnetlib</groupId>
|
||||
<artifactId>uoa-spring-boot-parent</artifactId>
|
||||
<version>2.0.1</version>
|
||||
<version>2.0.3</version>
|
||||
</parent>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>eu.dnetlib</groupId>
|
||||
<artifactId>uoa-authorization-library</artifactId>
|
||||
<version>3.0.1-SNAPSHOT</version>
|
||||
<version>3.0.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-jpa</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.24</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.10.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-mongodb</artifactId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<!-- to parse xml responses from API-->
|
||||
<!-- to parse xml responses from API-->
|
||||
<dependency>
|
||||
<groupId>jakarta.xml.bind</groupId>
|
||||
<artifactId>jakarta.xml.bind-api</artifactId>
|
||||
|
@ -64,30 +55,28 @@
|
|||
<groupId>org.glassfish.jaxb</groupId>
|
||||
<artifactId>jaxb-runtime</artifactId>
|
||||
</dependency>
|
||||
<!--<dependency>
|
||||
<groupId>jakarta.mail</groupId>
|
||||
<artifactId>jakarta.mail-api</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>-->
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>jakarta.mail</artifactId>
|
||||
<version>2.0.1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>build-info</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<mainClass>eu.dnetlib.claims.Application</mainClass>
|
||||
<executable>true</executable>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-war-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<finalName>uoa-claims-service</finalName>
|
||||
</build>
|
||||
</project>
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package eu.dnetlib.claims;
|
||||
|
||||
import eu.dnetlib.claims.configuration.GlobalVars;
|
||||
import eu.dnetlib.claims.service.MetricsService;
|
||||
import eu.dnetlib.uoaauthorizationlibrary.SecurityConfiguration;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
import org.springframework.context.annotation.PropertySources;
|
||||
|
@ -19,12 +21,11 @@ import java.util.Date;
|
|||
@PropertySources({
|
||||
@PropertySource("classpath:application.properties"),
|
||||
@PropertySource("classpath:claims.properties"),
|
||||
@PropertySource("classpath:postgres.properties"),
|
||||
@PropertySource("classpath:authorization.properties"),
|
||||
@PropertySource(value = "classpath:dnet-override.properties", ignoreResourceNotFound = true)
|
||||
})
|
||||
//@Import({AuthorizationConfiguration.class}) old class
|
||||
@Import(SecurityConfiguration.class)
|
||||
@EnableConfigurationProperties({ GlobalVars.class})
|
||||
@EnableJpaRepositories(basePackages = "eu.dnetlib.claims.repository")
|
||||
public class Application {
|
||||
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
package eu.dnetlib.claims.configuration;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
@ConfigurationProperties("claims.global-vars")
|
||||
public class GlobalVars {
|
||||
public static Date date = new Date();
|
||||
private Date buildDate;
|
||||
private String version;
|
||||
|
||||
public String getBuildDate() {
|
||||
if(buildDate == null) {
|
||||
return null;
|
||||
}
|
||||
return buildDate.toString();
|
||||
}
|
||||
|
||||
public void setBuildDate(Date buildDate) {
|
||||
this.buildDate = buildDate;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
package eu.dnetlib.claims.configuration;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
|
@ -9,6 +11,8 @@ import org.springframework.context.annotation.Configuration;
|
|||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Configuration
|
||||
public class PostgresConfig {
|
||||
@Value("${services.claims.db.password}")
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
package eu.dnetlib.claims.configuration;
|
||||
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.PropertySource;
|
||||
|
||||
@Configuration
|
||||
@PropertySource("classpath:postgres.properties")
|
||||
public class PostgresPropertiesConfig {
|
||||
// This class can be empty. The annotation is enough to load the properties file.
|
||||
}
|
|
@ -1,16 +0,0 @@
|
|||
package eu.dnetlib.claims.configuration;
|
||||
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
@Configuration
|
||||
public class RestTemplateConfig {
|
||||
|
||||
@Bean
|
||||
public RestTemplate restTemplate() {
|
||||
return new RestTemplate();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,60 +1,22 @@
|
|||
/*
|
||||
package eu.dnetlib.claims.controller;
|
||||
|
||||
import eu.dnetlib.claims.service.DeployService;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.boot.info.BuildProperties;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
public class HealthController {
|
||||
private final Logger log = LogManager.getLogger(this.getClass());
|
||||
public static Instant dateInstant = Instant.now();
|
||||
|
||||
// @Autowired
|
||||
// private GlobalVars globalVars;
|
||||
|
||||
|
||||
@Value("${services.claims.orcidUrlPrefix}")
|
||||
private String orcidAPIURL;
|
||||
@Value("${services.claims.orcidUrlSuffix}")
|
||||
private String orcidURLSuffix;
|
||||
|
||||
@Value("${services.claims.dataciteUrl}")
|
||||
private String dataciteUrl;
|
||||
@Value("${services.claims.crossrefUrl}")
|
||||
private String crossrefUrl;
|
||||
@Value("${services.claims.searchAPIUrl}")
|
||||
private String searchAPIUrl;
|
||||
@Value("${services.claims.directClaimAPIUrl}")
|
||||
private String directClaimAPIUrl;
|
||||
|
||||
|
||||
@Value("${services.claims.db.url}")
|
||||
private String dbUrl;
|
||||
@Value("${services.claims.db.username}")
|
||||
private String dbUsername;
|
||||
@Value("${services.claims.db.password}")
|
||||
private String dbPwd;
|
||||
@Value("${services.claims.results.pathToSaveRecord}")
|
||||
private String pathToSaveRecord;
|
||||
@Value("${authorization.security.userInfoUrl}")
|
||||
private String userInfoUrl;
|
||||
@Value("${authorization.security.domain}")
|
||||
private String domain;
|
||||
|
||||
@Autowired
|
||||
private BuildProperties buildProperties;
|
||||
|
||||
DeployService deployService;
|
||||
@RequestMapping(value = {"", "/health_check"}, method = RequestMethod.GET)
|
||||
public String hello() {
|
||||
log.debug("Hello from Claims service!");
|
||||
|
@ -64,26 +26,7 @@ public class HealthController {
|
|||
@PreAuthorize("hasAnyAuthority('PORTAL_ADMINISTRATOR')")
|
||||
@RequestMapping(value = "/health_check/advanced", method = RequestMethod.GET)
|
||||
public Map<String, String> checkEverything() {
|
||||
Map<String, String> response = new HashMap<>();
|
||||
|
||||
response.put("Date of deploy", HealthController.dateInstant.toString());
|
||||
response.put("Date of build", buildProperties.getTime().toString());
|
||||
response.put("Version", buildProperties.getVersion());
|
||||
response.put("DB Url", dbUrl);
|
||||
response.put("DB Username", dbUsername);
|
||||
response.put("DB Pwd", dbPwd);
|
||||
|
||||
response.put("Authorization - userInfo", this.userInfoUrl);
|
||||
response.put("Authorization - domain", this.domain);
|
||||
response.put("Apis - search", this.searchAPIUrl);
|
||||
response.put("Apis - orcid", this.orcidAPIURL);
|
||||
response.put("Apis - orcid suffix", this.orcidURLSuffix);
|
||||
response.put("Apis - crossref", this.crossrefUrl);
|
||||
response.put("Apis - datacite", this.dataciteUrl);
|
||||
response.put("Apis - direct claim", this.directClaimAPIUrl);
|
||||
response.put("Path for records", this.pathToSaveRecord);
|
||||
return response;
|
||||
return deployService.getProperties();
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
|
|
|
@ -1,22 +1,36 @@
|
|||
package eu.dnetlib.claims.handler;
|
||||
|
||||
import eu.dnetlib.claims.service.ClaimService;
|
||||
import eu.dnetlib.uoaauthorizationlibrary.authorization.exceptions.ExceptionResponse;
|
||||
import eu.dnetlib.uoaauthorizationlibrary.authorization.exceptions.HttpException;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.security.access.AccessDeniedException;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.ExceptionHandler;
|
||||
|
||||
@ControllerAdvice
|
||||
public class GlobalExceptionHandler {
|
||||
|
||||
private static final Logger logger = LogManager.getLogger(ClaimService.class);
|
||||
private static final Logger log = LogManager.getLogger(ClaimService.class);
|
||||
|
||||
@ExceptionHandler(AccessDeniedException.class)
|
||||
public ResponseEntity<?> accessDenied(AccessDeniedException ex) {
|
||||
log.error( "AccessDeniedException: " +ex.getMessage());
|
||||
return new ResponseEntity<>(new ExceptionResponse(ex, HttpStatus.UNAUTHORIZED), HttpStatus.UNAUTHORIZED);
|
||||
}
|
||||
|
||||
@ExceptionHandler(HttpException.class)
|
||||
public ResponseEntity<?> http(HttpException ex) {
|
||||
log.error("HttpException: " + ex.getMessage(), ex);
|
||||
return new ResponseEntity<>(new ExceptionResponse(ex, ex.getHttpStatus()), ex.getHttpStatus());
|
||||
}
|
||||
|
||||
@ExceptionHandler(RuntimeException.class)
|
||||
public ResponseEntity<String> handleRuntimeException(RuntimeException ex) {
|
||||
// Log the exception using SLF4J
|
||||
logger.error("Caught RuntimeException: {}", ex.getMessage(), ex);
|
||||
log.error("Caught RuntimeException: {}", ex.getMessage(), ex);
|
||||
|
||||
// Return a response entity with an appropriate status and message
|
||||
return new ResponseEntity<>("An error occurred: " + ex.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
|
||||
|
|
|
@ -0,0 +1,176 @@
|
|||
package eu.dnetlib.claims.service;
|
||||
|
||||
import eu.dnetlib.claims.configuration.GlobalVars;
|
||||
import eu.dnetlib.claims.configuration.PostgresConfig;
|
||||
import eu.dnetlib.uoaauthorizationlibrary.AuthorizationConfiguration;
|
||||
import jakarta.annotation.PostConstruct;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class DeployService {
|
||||
private final Logger log = LogManager.getLogger(this.getClass());
|
||||
@Autowired
|
||||
GlobalVars globalVars;
|
||||
@Autowired
|
||||
PostgresConfig postgresConfig;
|
||||
public static Instant dateInstant = Instant.now();
|
||||
|
||||
@Autowired
|
||||
AuthorizationConfiguration authorizationConfiguration;
|
||||
|
||||
|
||||
|
||||
@Value("${services.claims.orcidUrlPrefix}")
|
||||
private String orcidAPIURL;
|
||||
@Value("${services.claims.orcidUrlSuffix}")
|
||||
private String orcidURLSuffix;
|
||||
|
||||
@Value("${services.claims.dataciteUrl}")
|
||||
private String dataciteUrl;
|
||||
@Value("${services.claims.crossrefUrl}")
|
||||
private String crossrefUrl;
|
||||
@Value("${services.claims.searchAPIUrl}")
|
||||
private String searchAPIUrl;
|
||||
@Value("${services.claims.directClaimAPIUrl}")
|
||||
private String directClaimAPIUrl;
|
||||
|
||||
@Value("${services.claims.contextsAPIUrl}")
|
||||
private String contextsAPIUrl;
|
||||
@Value("${services.claims.registryAPIForManagerEmails}")
|
||||
private String registryAPIForManagerEmails;
|
||||
//mail settings
|
||||
@Value("${services.claims.mail.host}")
|
||||
private String mailHost;
|
||||
@Value("${services.claims.mail.port}")
|
||||
private String mailPort;
|
||||
@Value("${services.claims.mail.auth}")
|
||||
private String mailAuth;
|
||||
@Value("${services.claims.mail.from}")
|
||||
private String mailFrom;
|
||||
@Value("${services.claims.mail.username}")
|
||||
private String mailUsername;
|
||||
@Value("${services.claims.mail.password}")
|
||||
private String mailPassword;
|
||||
@Value("${services.claims.mail.sslProtocols}")
|
||||
private String sslProtocols;
|
||||
@Value("${services.claims.mail.specialRecipients}")
|
||||
private String specialRecipients;
|
||||
@Value("${services.claims.mail.contactMail}")
|
||||
private String contactMail;
|
||||
@Value("${services.claims.mail.openaireCommunityClaimsPage}")
|
||||
private String openaireCommunityClaimsPage;
|
||||
@Value("${services.claims.mail.manageCommunityUserNotificationsPage}")
|
||||
private String manageCommunityUserNotificationsPage;
|
||||
@Value("${services.claims.mail.notifyCommunityManagers}")
|
||||
private String notifyCommunityManagers;
|
||||
|
||||
|
||||
@Value("${services.claims.db.url}")
|
||||
private String dbUrl;
|
||||
@Value("${services.claims.db.username}")
|
||||
private String dbUsername;
|
||||
@Value("${services.claims.db.password}")
|
||||
private String dbPwd;
|
||||
@Value("${services.claims.results.pathToSaveRecord}")
|
||||
private String pathToSaveRecord;
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
public DeployService() {
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void checkProperties() {
|
||||
log.debug("Checking properties....");
|
||||
if (dbUrl== null || dbUrl.isEmpty()) {
|
||||
throw new RuntimeException("services.claims.db.url is missing!");
|
||||
} else if (dbPwd == null || dbPwd.isEmpty()) {
|
||||
throw new RuntimeException("services.claims.db.password is missing!");
|
||||
} else if (dbUrl == null || dbUrl.isEmpty()) {
|
||||
throw new RuntimeException("services.claims.db.username is missing!");
|
||||
} else if (directClaimAPIUrl == null || directClaimAPIUrl.isEmpty()) {
|
||||
throw new RuntimeException("services.claims.directClaimAPIUrl is missing!");
|
||||
} else if (searchAPIUrl == null || searchAPIUrl.isEmpty()) {
|
||||
throw new RuntimeException("services.claims.searchAPIUrl is missing!");
|
||||
} else if (searchAPIUrl == null || searchAPIUrl.isEmpty()) {
|
||||
throw new RuntimeException("services.claims.searchAPIUrl is missing!");
|
||||
} else if (pathToSaveRecord == null || pathToSaveRecord.isEmpty()) {
|
||||
throw new RuntimeException("services.claims.results.pathToSaveRecord is missing!");
|
||||
} else if (contextsAPIUrl == null || contextsAPIUrl.isEmpty()) {
|
||||
throw new RuntimeException("services.claims.contextsAPIUrl is missing!");
|
||||
} else if (registryAPIForManagerEmails == null || registryAPIForManagerEmails.isEmpty()) {
|
||||
throw new RuntimeException("services.claims.registryAPIForManagerEmails is missing!");
|
||||
} else if (mailHost == null || mailHost.isEmpty()) {
|
||||
throw new RuntimeException("services.claims.mail.host is missing!");
|
||||
} else if (mailPort == null || mailPort.isEmpty()) {
|
||||
throw new RuntimeException("services.claims.mail.port is missing!");
|
||||
} else if (mailAuth == null || mailAuth.isEmpty()) {
|
||||
throw new RuntimeException("services.claims.mail.auth is missing!");
|
||||
} else if (mailFrom == null || mailFrom.isEmpty()) {
|
||||
throw new RuntimeException("services.claims.mail.from is missing!");
|
||||
} else if (mailUsername == null || mailUsername.isEmpty()) {
|
||||
throw new RuntimeException("services.claims.mail.username is missing!");
|
||||
} else if (mailPassword == null || mailPassword.isEmpty()) {
|
||||
throw new RuntimeException("services.claims.mail.password is missing!");
|
||||
} else if (specialRecipients == null || specialRecipients.isEmpty()) {
|
||||
throw new RuntimeException("services.claims.mail.specialRecipients is missing!");
|
||||
} else if (contactMail == null || contactMail.isEmpty()) {
|
||||
throw new RuntimeException("services.claims.mail.contactMail is missing!");
|
||||
} else if (openaireCommunityClaimsPage == null || openaireCommunityClaimsPage.isEmpty()) {
|
||||
throw new RuntimeException("services.claims.mail.openaireCommunityClaimsPage is missing!");
|
||||
} else if (manageCommunityUserNotificationsPage == null || manageCommunityUserNotificationsPage.isEmpty()) {
|
||||
throw new RuntimeException("services.claims.mail.manageCommunityUserNotificationsPage is missing!");
|
||||
} else if (notifyCommunityManagers == null || notifyCommunityManagers.isEmpty()) {
|
||||
throw new RuntimeException("services.claims.mail.notifyCommunityManagers is missing!");
|
||||
}
|
||||
log.debug("Properties ok!");
|
||||
}
|
||||
|
||||
public Map<String, String> getProperties() {
|
||||
Map<String, String> response = authorizationConfiguration.getProperties();
|
||||
//TODO try a postgres connection check
|
||||
// postgresConfig.dataSource().getConnection();
|
||||
|
||||
response.put("DB Url", dbUrl);
|
||||
response.put("DB Username", dbUsername == null ? null : "[unexposed value]");
|
||||
response.put("DB Pwd", dbPwd == null ? null : "[unexposed value]");
|
||||
response.put("Apis - search", this.searchAPIUrl);
|
||||
response.put("Apis - orcid", this.orcidAPIURL);
|
||||
response.put("Apis - orcid suffix", this.orcidURLSuffix);
|
||||
response.put("Apis - crossref", this.crossrefUrl);
|
||||
response.put("Apis - datacite", this.dataciteUrl);
|
||||
response.put("Apis - direct claim", this.directClaimAPIUrl);
|
||||
response.put("Path for records", this.pathToSaveRecord);
|
||||
response.put("Date of deploy", GlobalVars.date.toString());
|
||||
response.put("contextsAPIUrl", contextsAPIUrl);
|
||||
response.put("registryAPIForManagerEmails", registryAPIForManagerEmails);
|
||||
response.put("mailHost", mailHost);
|
||||
response.put("mailPort", mailPort);
|
||||
response.put("mailAuth", mailAuth);
|
||||
response.put("mailFrom", mailFrom);
|
||||
response.put("mailUsername", mailUsername);
|
||||
response.put("mailPassword", mailPassword);
|
||||
response.put("sslProtocols", sslProtocols);
|
||||
response.put("specialRecipients", specialRecipients);
|
||||
response.put("contactMail", contactMail);
|
||||
response.put("openaireCommunityClaimsPage", openaireCommunityClaimsPage);
|
||||
response.put("manageCommunityUserNotificationsPage", manageCommunityUserNotificationsPage);
|
||||
response.put("notifyCommunityManagers", notifyCommunityManagers);
|
||||
|
||||
if (globalVars.getBuildDate() != null) {
|
||||
response.put("Date of build", globalVars.getBuildDate());
|
||||
}
|
||||
if (globalVars.getVersion() != null) {
|
||||
response.put("Version", globalVars.getVersion());
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
|
@ -44,8 +44,6 @@ public class EmailService {
|
|||
|
||||
@Value("${services.claims.mail.manageCommunityUserNotificationsPage}")
|
||||
private String manageCommunityUserNotificationsPage;
|
||||
@Value("${services.claims.mail.openaireProjectClaimsPage}")
|
||||
private String openaireProjectClaimsPage;
|
||||
@Value("${services.claims.mail.openaireCommunityClaimsPage}")
|
||||
private String openaireCommunityClaimsPage;
|
||||
@Value("${services.claims.mail.username}")
|
||||
|
|
|
@ -46,7 +46,7 @@ public class ClaimUtils {
|
|||
return "isRelevantTo";
|
||||
}
|
||||
else if(sourceType.equals(ClaimUtils.ORGANIZATION)){
|
||||
return "resultOrganization_affiliation_hasAuthorInstitution";
|
||||
return "resultOrganization_affiliation_isAuthorInstitutionOf";
|
||||
}
|
||||
else{
|
||||
return null;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
spring.application.name=uoa-claims-service
|
||||
server.port=8181
|
||||
#debug=true
|
||||
|
||||
|
|
|
@ -1,21 +1,8 @@
|
|||
|
||||
claims.global-vars.buildDate=@timestamp@
|
||||
claims.global-vars.version=@project.version@
|
||||
|
||||
claims.global-vars.version=${project.version}
|
||||
|
||||
services.claims.crossrefUrl=https://api.crossref.org/works?filter=doi:
|
||||
services.claims.dataciteUrl=https://api.datacite.org/works/
|
||||
services.claims.orcidUrlPrefix=https://pub.orcid.org/v2.1/
|
||||
services.claims.orcidUrlSuffix=/work/
|
||||
services.claims.contextsAPIUrl=http://beta.services.openaire.eu/openaire/context
|
||||
|
||||
|
||||
|
||||
services.claims.communityAPI = https://dev-openaire.d4science.org/openaire/community/
|
||||
services.claims.registryAPIForManagerEmails = http://mpagasas.di.uoa.gr:8080/dnet-role-management/admin/community/{community}?name=false
|
||||
services.claims.searchAPIUrl=http://beta.services.openaire.eu:8480/search/
|
||||
|
||||
services.claims.results.pathToSaveRecord = /home/argirok/claims_www_last/records/
|
||||
services.claims.directClaimAPIUrl = http://beta.services.openaire.eu:8980/provision/mvc/api/results
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Configuration status="WARN" monitorInterval="30">
|
||||
<Properties>
|
||||
<Property name="LOG_PATTERN">
|
||||
%d %p %t [%c] - %m%n
|
||||
</Property>
|
||||
</Properties>
|
||||
<Appenders>
|
||||
<!-- Rolling File Appender -->
|
||||
<RollingFile name="R" fileName="/var/log/dnet/claims/claims.log"
|
||||
filePattern="/var/log/dnet/claims/claims-%d{yyyy-MM-dd}-%i.log">
|
||||
<PatternLayout>
|
||||
<Pattern>${LOG_PATTERN}</Pattern>
|
||||
</PatternLayout>
|
||||
<Policies>
|
||||
<SizeBasedTriggeringPolicy size="10MB" />
|
||||
</Policies>
|
||||
<DefaultRolloverStrategy max="10"/>
|
||||
</RollingFile>
|
||||
<RollingFile name="S" fileName="/var/log/dnet/claims/claims-spring.log"
|
||||
filePattern="/var/log/dnet/claims/claims-spring-%d{yyyy-MM-dd}-%i.log">
|
||||
<PatternLayout>
|
||||
<Pattern>${LOG_PATTERN}</Pattern>
|
||||
</PatternLayout>
|
||||
<Policies>
|
||||
<SizeBasedTriggeringPolicy size="10MB" />
|
||||
</Policies>
|
||||
<DefaultRolloverStrategy max="10"/>
|
||||
</RollingFile>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Logger name="eu.dnetlib" level="debug" additivity="false">
|
||||
<AppenderRef ref="R"/>
|
||||
</Logger>
|
||||
<Root level="info">
|
||||
<AppenderRef ref="S"/>
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
|
@ -1,3 +0,0 @@
|
|||
services.claims.db.url=
|
||||
services.claims.db.username=
|
||||
services.claims.db.password=
|
|
@ -30,14 +30,14 @@ class FetchServicesTest {
|
|||
@Autowired
|
||||
FetchFromOrcidService fetchFromOrcidService;
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void textContexts() {
|
||||
String id = "aussda";
|
||||
System.out.println(fetchContextService.fetchContextById(id));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void testProject() throws Exception {
|
||||
//100008099___::1e5e62235d094afd01cd56e65112fc63 seems to have no unidentified in code
|
||||
//corda_____he::57f3cfd748952a34935eedda47b6ffc2
|
||||
|
@ -47,7 +47,7 @@ class FetchServicesTest {
|
|||
// System.out.println(projectRepository.findByOpenaireId("100008099___::1e5e62235d094afd01cd56e65112fc63"));
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void testResult() throws Exception {
|
||||
// http://scoobydoo.di.uoa.gr:4300/search/dataset?datasetId=doi_________::170b54b50c21a3f5434a608f8654a65c
|
||||
/*"doi_dedup___::514c568aa2be7f743bb5956e8a488d9c"*/
|
||||
|
@ -56,18 +56,18 @@ class FetchServicesTest {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void getFromCrossref() {
|
||||
System.out.println(this.fetchFromCrossrefService.fetchResultfromCrossref("https://doi.org/10.1093/acref/9780195301731.013.42079", "123"));
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void getFromDatacite() throws Exception {
|
||||
//userclaim___::a3c9e70aa50547d7f844486b89dc6cd4
|
||||
System.out.println(this.fetchFromDataciteService.fetchResultfromDatacite("10.1594/PANGAEA.590924", "lala"));
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void getFromOrcid(){
|
||||
// System.out.println(this.fetchFromOrcidService.fetchResultfromOrcid());
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ public class FileTest {
|
|||
HandleRecordFileService handleRecordFileService;
|
||||
@Autowired
|
||||
FetchFromCrossrefService fetchFromCrossrefService;
|
||||
@Test
|
||||
//@Test
|
||||
void testFile(){
|
||||
Result r= this.fetchFromCrossrefService.fetchResultfromCrossref("https://doi.org/10.1093/acref/9780195301731.013.42079", "123");
|
||||
System.out.println(handleRecordFileService.exportMetadataFileForResult(r));
|
||||
|
|
|
@ -17,7 +17,7 @@ public class MetricsTest {
|
|||
MetricsService metricsService;
|
||||
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void metricsTest() {
|
||||
/* Metrics.MetricDetails metrics = new Metrics.MetricDetails();
|
||||
metrics.setClaims(this.claimRepository.count());
|
||||
|
@ -40,7 +40,7 @@ public class MetricsTest {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void metrics() {
|
||||
// metricsService.calculateMetrics();
|
||||
metricsService.calculateMetrics();
|
||||
|
|
|
@ -37,7 +37,7 @@ public class NotificationSendTest {
|
|||
@Autowired
|
||||
EmailService emailService;
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void testSaveDelete() {
|
||||
String id = "test123";
|
||||
String mail = "test123@mail";
|
||||
|
@ -53,7 +53,7 @@ public class NotificationSendTest {
|
|||
}
|
||||
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void test() {
|
||||
List<String> types = new ArrayList<String>();
|
||||
|
||||
|
@ -79,7 +79,7 @@ public class NotificationSendTest {
|
|||
//
|
||||
|
||||
}
|
||||
@Test
|
||||
//@Test
|
||||
void testGetManagers(){
|
||||
// System.out.println(managerUtilsService.getManagersByEmail("egi"));
|
||||
// System.out.println(notificationRepository.findByOpenaireIdAndUserMail("egi", "argirok@di.uoa.gr"));
|
||||
|
@ -93,7 +93,7 @@ public class NotificationSendTest {
|
|||
test = notificationRepository.save(test);
|
||||
*/
|
||||
}
|
||||
@Test
|
||||
//@Test
|
||||
void testsendMail(){
|
||||
// emailService.run();
|
||||
List<String> managers = new ArrayList<>();
|
||||
|
|
|
@ -34,7 +34,7 @@ class UoaClaimsServiceApplicationTests {
|
|||
@Autowired
|
||||
FeedInGraphService feedInGraphService;
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void testProject() {
|
||||
Project p = new Project();
|
||||
System.out.println("lala");
|
||||
|
@ -56,7 +56,7 @@ p.setContactEmails((String[]) mails.toArray(a));
|
|||
projectRepository.deleteById("123test");
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void testResult() {
|
||||
Result r = new Result();
|
||||
r.setOpenaireId("123456");
|
||||
|
@ -73,7 +73,7 @@ p.setContactEmails((String[]) mails.toArray(a));
|
|||
|
||||
}
|
||||
|
||||
@Test()
|
||||
//@Test()
|
||||
void testContext(){
|
||||
|
||||
Context c = new Context();
|
||||
|
@ -90,13 +90,13 @@ p.setContactEmails((String[]) mails.toArray(a));
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void testGetClaims(){
|
||||
// claimService.getClaimById()
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void test(){
|
||||
Result r = new Result();
|
||||
r.setEmbargoEndDate("2024-07-01");
|
||||
|
@ -106,7 +106,7 @@ p.setContactEmails((String[]) mails.toArray(a));
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void feedTest(){
|
||||
String record = "{\"originalId\":\"userclaim___::d6ecf5fd346f4ffcfc3540fcfbbe50d1\"," +
|
||||
"\"openaireId\":\"userclaim___::d6ecf5fd346f4ffcfc3540fcfbbe50d1\",\"title\":\"test test test\"," +
|
||||
|
@ -115,7 +115,7 @@ p.setContactEmails((String[]) mails.toArray(a));
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
//@Test
|
||||
void whereClauseTest(){
|
||||
List<String> types = new ArrayList<String>();
|
||||
|
||||
|
|
Loading…
Reference in New Issue