Skip to content

Commit

Permalink
Merge branch 'release/v13'
Browse files Browse the repository at this point in the history
  • Loading branch information
jeortizquan committed Oct 29, 2024
2 parents 5af5d64 + ee05a6a commit 1d0de97
Show file tree
Hide file tree
Showing 477 changed files with 8,686 additions and 34,751 deletions.
10 changes: 0 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,6 @@ jobs:
secrets:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
docker-build_metis-core:
needs: ci
uses: europeana/metis-actions/.github/workflows/docker-build-push.yml@main
with:
docker-organization: europeana
docker-image-name: metis-core
project-path: metis-core/metis-core-rest/
secrets:
DOCKER_HUB_USERNAME: ${{ secrets.DOCKER_HUB_USERNAME }}
DOCKER_HUB_PASSWORD: ${{ secrets.DOCKER_HUB_PASSWORD }}
docker-build_metis-dereference:
needs: ci
uses: europeana/metis-actions/.github/workflows/docker-build-push.yml@main
Expand Down
15 changes: 0 additions & 15 deletions .run/metis-core-rest_Dockerfile.run.xml

This file was deleted.

42 changes: 0 additions & 42 deletions .run/metis-core.run.xml

This file was deleted.

16 changes: 16 additions & 0 deletions .run/metis-debias.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="metis-debias" type="SpringBootApplicationConfigurationType" factoryName="Spring Boot" folderName="spring-run-configuration">
<envs>
<env name="logging.config" value="file:///data/metis-configuration/k8s/common-components/log4j2-xml/log4j2.xml" />
<env name="server.servlet.context-path" value="/metis-debias" />
<env name="spring.config.location" value="file:///data/metis-configuration/metis-debias/metis-debias-rest/k8s/overlays/local/components/properties/application.properties" />
<env name="server.port" value="8081" />
<env name="truststore.path" value="/data/metis-configuration/k8s/common-components/custom-truststore-jks/custom-truststore.jks" />
</envs>
<module name="metis-debias-detect-rest" />
<option name="SPRING_BOOT_MAIN_CLASS" value="eu.europeana.metis.debias.detect.rest.Application" />
<method v="2">
<option name="Make" enabled="true" />
</method>
</configuration>
</component>
2 changes: 1 addition & 1 deletion metis-authentication/metis-authentication-common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>metis-authentication</artifactId>
<groupId>eu.europeana.metis</groupId>
<version>12.2</version>
<version>13</version>
</parent>
<artifactId>metis-authentication-common</artifactId>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@

/**
* The Role of an account.
*
* @author Simon Tzanakis ([email protected])
* @since 2017-10-31
*/
public enum AccountRole {
METIS_ADMIN, EUROPEANA_DATA_OFFICER, PROVIDER_VIEWER;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
/**
* Contains the email and password of a user temporarily.
* <p>Used mostly after decoding the Authorization Header in an HTTP request.</p>
* @author Simon Tzanakis ([email protected])
* @since 2018-02-14
*/
public class Credentials {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
* Contains the email parameter.
* <p>This class is used for passing parameters as json to a http request body. It contains the
* email parameter</p>
*
* @author Simon Tzanakis ([email protected])
* @since 2019-02-07
*/
public class EmailParameter {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,6 @@
/**
* The Metis user containing all parameters.
* <p>This class is used as a JPA class to the postgresql database</p>
*
* @author Simon Tzanakis ([email protected])
* @since 2017-10-27
*/
@Entity
@Table(name = "metis_users")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,6 @@

/**
* The token of a user, which related to an email of that user.
*
* @author Simon Tzanakis ([email protected])
* @since 2017-10-30
*/
@Entity
@Table(name = "metis_user_access_tokens")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
* Contains the old and new password parameters.
* <p>This class is used for passing parameters as json to a http request body. It contains the old
* password to be changed with the new provided password</p>
*
* @author Simon Tzanakis ([email protected])
* @since 2019-02-07
*/
public class OldNewPasswordParameters {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
import java.util.Date;
import org.junit.jupiter.api.Test;

/**
* @author Simon Tzanakis
* @since 2020-09-11
*/
class MetisUserAccessTokenTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
import java.util.Date;
import org.junit.jupiter.api.Test;

/**
* @author Simon Tzanakis
* @since 2020-09-11
*/
class MetisUserTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
import java.util.Date;
import org.junit.jupiter.api.Test;

/**
* @author Simon Tzanakis
* @since 2020-09-11
*/
class MetisUserViewTest {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@
import eu.europeana.metis.exception.BadContentException;
import org.junit.jupiter.api.Test;

/**
* @author Simon Tzanakis ([email protected])
* @since 2017-11-03
*/
class TestAccountRole {

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>metis-authentication</artifactId>
<groupId>eu.europeana.metis</groupId>
<version>12.2</version>
<version>13</version>
</parent>
<artifactId>metis-authentication-rest-client</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion metis-authentication/metis-authentication-rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>metis-authentication</artifactId>
<groupId>eu.europeana.metis</groupId>
<version>12.2</version>
<version>13</version>
</parent>
<artifactId>metis-authentication-rest</artifactId>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package eu.europeana.metis.authentication.rest.controller;

import static eu.europeana.metis.utils.CommonStringValues.CRLF_PATTERN;
import static eu.europeana.metis.utils.CommonStringValues.sanitizeCRLF;

import eu.europeana.metis.authentication.service.AuthenticationService;
import eu.europeana.metis.authentication.user.AccountRole;
Expand Down Expand Up @@ -181,8 +181,7 @@ public void deleteUser(@RequestHeader("Authorization") String authorization,
}
authenticationService.deleteUser(emailParameter.getEmail());
if (LOGGER.isInfoEnabled()) {
LOGGER.info("User with email: {} deleted",
CRLF_PATTERN.matcher(emailParameter.getEmail()).replaceAll(""));
LOGGER.info("User with email: {} deleted", sanitizeCRLF(emailParameter.getEmail()));
}
}

Expand All @@ -208,15 +207,13 @@ public void updateUserToMakeAdmin(@RequestHeader("Authorization") String authori
if (emailParameter == null || StringUtils.isBlank(emailParameter.getEmail())) {
throw new BadContentException("userEmailToMakeAdmin is empty");
}
String accessToken = authenticationService
.validateAuthorizationHeaderWithAccessToken(authorization);
final String accessToken = authenticationService.validateAuthorizationHeaderWithAccessToken(authorization);
if (!authenticationService.isUserAdmin(accessToken)) {
throw new UserUnauthorizedException(ACTION_NOT_ALLOWED_FOR_USER);
}
authenticationService.updateUserMakeAdmin(emailParameter.getEmail());
if (LOGGER.isInfoEnabled()) {
LOGGER.info("User with email: {} made admin",
CRLF_PATTERN.matcher(emailParameter.getEmail()).replaceAll(""));
LOGGER.info("User with email: {} made admin", sanitizeCRLF(emailParameter.getEmail()));
}
}

Expand Down
2 changes: 1 addition & 1 deletion metis-authentication/metis-authentication-service/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>metis-authentication</artifactId>
<groupId>eu.europeana.metis</groupId>
<version>12.2</version>
<version>13</version>
</parent>
<artifactId>metis-authentication-service</artifactId>

Expand Down
2 changes: 1 addition & 1 deletion metis-authentication/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>metis-framework</artifactId>
<groupId>eu.europeana.metis</groupId>
<version>12.2</version>
<version>13</version>
</parent>
<artifactId>metis-authentication</artifactId>
<packaging>pom</packaging>
Expand Down
4 changes: 1 addition & 3 deletions metis-common/metis-common-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
<parent>
<groupId>eu.europeana.metis</groupId>
<artifactId>metis-common</artifactId>
<version>12.2</version>
<version>13</version>
</parent>
<artifactId>metis-common-base</artifactId>

<name>metis-common-base</name>
</project>
2 changes: 1 addition & 1 deletion metis-common/metis-common-mongo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>metis-common</artifactId>
<groupId>eu.europeana.metis</groupId>
<version>12.2</version>
<version>13</version>
</parent>
<artifactId>metis-common-mongo</artifactId>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import eu.europeana.corelib.solr.entity.AgentImpl;
import eu.europeana.corelib.solr.entity.AggregationImpl;
import eu.europeana.corelib.solr.entity.BasicProxyImpl;
import eu.europeana.corelib.solr.entity.ChangeLogImpl;
import eu.europeana.corelib.solr.entity.ConceptImpl;
import eu.europeana.corelib.solr.entity.ConceptSchemeImpl;
import eu.europeana.corelib.solr.entity.DatasetImpl;
Expand Down Expand Up @@ -95,6 +96,7 @@ private Datastore createDatastore(MongoClient mongoClient, String databaseName)
mapper.getEntityModel(TimespanImpl.class);
mapper.getEntityModel(WebResourceImpl.class);
mapper.getEntityModel(EuropeanaAggregationImpl.class);
mapper.getEntityModel(ChangeLogImpl.class);
mapper.getEntityModel(EventImpl.class);
mapper.getEntityModel(PhysicalThingImpl.class);
mapper.getEntityModel(ConceptSchemeImpl.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ public static <T, R> List<R> getListOfAggregationRetryable(Aggregation<T> aggreg
* @param <T> the type of class that the {@link Query} represents
* @return the morphia cursor
*/
@SuppressWarnings("resource")
private static <T> BiFunction<Query<T>, FindOptions, MorphiaCursor<T>> getMorphiaCursorFromQuery() {
return (querySupplied, findOptionsSupplied) -> Optional.ofNullable(findOptionsSupplied)
.map(querySupplied::iterator).orElseGet(querySupplied::iterator);
Expand All @@ -114,7 +113,6 @@ private static <T> BiFunction<Query<T>, FindOptions, MorphiaCursor<T>> getMorphi
* @param <R> the type of class that the result of the {@link Aggregation} represents
* @return the morphia cursor
*/
@SuppressWarnings("resource")
private static <T, R> BiFunction<Aggregation<T>, AggregationOptions, MorphiaCursor<R>> getMorphiaCursorFromAggregation(
Class<R> resultObjectClass) {
return (aggregationSupplied, aggregationOptionsSupplied) -> Optional
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertInstanceOf;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;

import com.mongodb.MongoClientSettings;
import com.mongodb.ReadPreference;
Expand All @@ -24,7 +24,7 @@
*/
class MongoClientProviderTest {

private final static String DATABASE_NAME = "dbTest";
private static final String DATABASE_NAME = "dbTest";

private static EmbeddedLocalhostMongo embeddedLocalhostMongo;

Expand All @@ -39,7 +39,7 @@ static void tearDown() {
embeddedLocalhostMongo.stop();
}

private static MongoProperties getMongoProperties() {
private static MongoProperties<IllegalArgumentException> getMongoProperties() {
final String mongoHost = embeddedLocalhostMongo.getMongoHost();
final int mongoPort = embeddedLocalhostMongo.getMongoPort();
final MongoProperties<IllegalArgumentException> mongoProperties = new MongoProperties<>(
Expand Down Expand Up @@ -79,7 +79,7 @@ void createAsSupplier() {

final Supplier<MongoClient> mongoClientSupplier = MongoClientProvider.createAsSupplier(String.format("mongodb://%s:%s", mongoHost, mongoPort));

assertTrue(mongoClientSupplier.get() instanceof MongoClient);
assertInstanceOf(MongoClient.class, mongoClientSupplier.get());
}

@Test
Expand All @@ -95,7 +95,7 @@ void createMongoClient() {
final MongoClient mongoClient = new MongoClientProvider<IllegalArgumentException>(getMongoProperties()).createMongoClient();

assertNotNull(mongoClient);
assertTrue(mongoClient instanceof MongoClient);
assertInstanceOf(MongoClient.class, mongoClient);
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,15 @@ void addMongoHost() throws Exception {
}

private static void assertMongoPropertiesOnlyWithAuthentication(MongoProperties mongoProperties) throws Exception {
assertEquals("localhost:8521", mongoProperties.getMongoHosts().get(0).toString());
assertEquals("localhost:8521", mongoProperties.getMongoHosts().getFirst().toString());
assertNotNull(mongoProperties.getMongoCredentials());
assertEquals("authenticationdb", mongoProperties.getMongoCredentials().getSource());
assertEquals("userName", mongoProperties.getMongoCredentials().getUserName());
assertEquals("password", new String(mongoProperties.getMongoCredentials().getPassword()));
}

private static void assertMongoPropertiesWithoutAuthentication(MongoProperties mongoProperties) throws Exception {
assertEquals("localhost:8521", mongoProperties.getMongoHosts().get(0).toString());
assertEquals("localhost:8521", mongoProperties.getMongoHosts().getFirst().toString());
assertNull(mongoProperties.getMongoCredentials());
}

Expand Down
Loading

0 comments on commit 1d0de97

Please sign in to comment.