Skip to content

Commit

Permalink
Merge pull request #1948 from ProgrammeVitam/story_11854__remove_serv…
Browse files Browse the repository at this point in the history
…er_identity

Story #11854 refactor: remove server identity
  • Loading branch information
ebernard authored Jul 24, 2024
2 parents 3482747 + 74ba588 commit d79f2dd
Show file tree
Hide file tree
Showing 132 changed files with 146 additions and 881 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import fr.gouv.vitamui.archives.search.common.rest.RestApi;
import fr.gouv.vitamui.commons.api.dtos.SearchCriteriaDto;
import fr.gouv.vitamui.commons.rest.client.ExternalHttpContext;
import fr.gouv.vitamui.commons.test.extension.ServerIdentityExtension;
import fr.gouv.vitamui.commons.vitam.api.dto.PersistentIdentifierResponseDto;
import fr.gouv.vitamui.commons.vitam.api.dto.VitamUISearchResponseDto;
import org.junit.jupiter.api.Assertions;
Expand All @@ -40,8 +39,6 @@
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.core.io.Resource;
import org.springframework.http.HttpEntity;
Expand All @@ -63,12 +60,10 @@
import static org.mockito.Mockito.when;

@ExtendWith(MockitoExtension.class)
public class ArchiveSearchExternalRestClientTest extends ServerIdentityExtension {
public class ArchiveSearchExternalRestClientTest {

ExternalHttpContext defaultContext = new ExternalHttpContext(9, "", "", "");

private static final Logger LOGGER = LoggerFactory.getLogger(ArchiveSearchExternalRestClientTest.class);

public final String ARCHIVE_UNITS_RESULTS_CSV = "data/vitam_archive_units_response.csv";

private ArchiveSearchExternalRestClient archiveSearchExternalRestClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ multipart:
spring.servlet.multipart.max-file-size: -1
spring.servlet.multipart.max-request-size: -1

server-identity:
identityName: vitamui-dev
identityRole: archive-search-external
identityServerId: 1

server:
host:
port: 8089
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

spring:
application:
name: ${server-identity.identityRole}
name: archive-search-external
api:
name: API Archive External
description: This API is used to manage Vitam's archives
Expand All @@ -18,7 +18,7 @@ spring:
management:
endpoints:
jmx:
domain: ${server-identity.identityRole}
domain: archive-search-external
unique-names: true
web.exposure.include: info,health,prometheus
endpoint:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

import fr.gouv.vitamui.archives.search.external.server.rest.ArchivesSearchExternalController;
import fr.gouv.vitamui.archives.search.external.server.rest.SearchCriteriaHistoryExternalController;
import fr.gouv.vitamui.commons.api.identity.ServerIdentityConfiguration;
import fr.gouv.vitamui.commons.rest.RestExceptionHandler;
import fr.gouv.vitamui.commons.rest.configuration.SwaggerConfiguration;
import fr.gouv.vitamui.commons.test.rest.AbstractSwaggerJsonFileGenerationJunit5;
Expand All @@ -42,7 +41,7 @@

@ExtendWith(SpringExtension.class)
@WebMvcTest
@Import(value = { ServerIdentityConfiguration.class, SwaggerConfiguration.class })
@Import(value = { SwaggerConfiguration.class })
@TestPropertySource(properties = { "spring.config.name=archive-search-external-application" })
@ActiveProfiles("test, swagger")
public class SwaggerJsonFileGenerationTest extends AbstractSwaggerJsonFileGenerationJunit5 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,13 @@

import fr.gouv.vitamui.archives.search.external.server.security.WebSecurityConfig;
import fr.gouv.vitamui.commons.api.domain.IdDto;
import fr.gouv.vitamui.commons.api.identity.ServerIdentityConfiguration;
import fr.gouv.vitamui.commons.rest.RestExceptionHandler;
import fr.gouv.vitamui.iam.security.provider.ExternalApiAuthenticationProvider;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.TestPropertySource;

@Import(value = { WebSecurityConfig.class, ServerIdentityConfiguration.class, RestExceptionHandler.class })
@Import(value = { WebSecurityConfig.class, RestExceptionHandler.class })
@TestPropertySource(properties = { "spring.config.name=archive-search-external-application" })
public abstract class ApiArchiveSearchExternalControllerTest<T extends IdDto> extends ApiControllerTest<T> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,13 @@

import fr.gouv.vitamui.archives.search.external.server.security.WebSecurityConfig;
import fr.gouv.vitamui.commons.api.domain.IdDto;
import fr.gouv.vitamui.commons.api.identity.ServerIdentityConfiguration;
import fr.gouv.vitamui.commons.rest.RestExceptionHandler;
import fr.gouv.vitamui.iam.security.provider.ExternalApiAuthenticationProvider;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.TestPropertySource;

@Import(value = { WebSecurityConfig.class, ServerIdentityConfiguration.class, RestExceptionHandler.class })
@Import(value = { WebSecurityConfig.class, RestExceptionHandler.class })
@TestPropertySource(properties = { "spring.config.name=archive-search-external-application" })
public abstract class ApiArchivesSearchExternalControllerTest<T extends IdDto>
extends ArchivesSearchApiControllerTest<IdDto> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,5 @@ archive-search-external:
server-port: 7089
secure: false

server-identity:
identityName: vitamui-test
identityRole: iam
identityServerId: 1

swagger:
layer: api-external
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import fr.gouv.vitamui.archives.search.common.rest.RestApi;
import fr.gouv.vitamui.commons.api.dtos.SearchCriteriaDto;
import fr.gouv.vitamui.commons.rest.client.InternalHttpContext;
import fr.gouv.vitamui.commons.test.extension.ServerIdentityExtension;
import fr.gouv.vitamui.commons.vitam.api.dto.PersistentIdentifierResponseDto;
import fr.gouv.vitamui.commons.vitam.api.dto.VitamUISearchResponseDto;
import org.junit.jupiter.api.Assertions;
Expand Down Expand Up @@ -59,7 +58,7 @@
import static org.mockito.Mockito.when;

@ExtendWith(MockitoExtension.class)
public class ArchiveInternalRestClientTest extends ServerIdentityExtension {
public class ArchiveInternalRestClientTest {

String baseUrl = "https://tests" + RestApi.ARCHIVE_SEARCH_PATH;
InternalHttpContext defaultContext = new InternalHttpContext(9, "", "", "", "", "", "", "");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ multipart:
spring.servlet.multipart.max-file-size: -1
spring.servlet.multipart.max-request-size: -1

server-identity:
identityName: vitamui-dev
identityRole: archive-search-internal
identityServerId: 1

server:
host:
port: 7089
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

spring:
application:
name: ${server-identity.identityRole}
name: archive-search-internal
api:
name: API Archive Search
description: This API is used to manage archives searching
Expand All @@ -18,7 +18,7 @@ spring:
management:
endpoints:
jmx:
domain: ${server-identity.identityRole}
domain: archive-search-internal
unique-names: true
web.exposure.include: info,health,prometheus
endpoint:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import fr.gouv.vitamui.archive.internal.server.searchcriteria.service.SearchCriteriaHistoryInternalService;
import fr.gouv.vitamui.archive.internal.server.service.ArchiveSearchAgenciesInternalService;
import fr.gouv.vitamui.archive.internal.server.service.ArchiveSearchInternalService;
import fr.gouv.vitamui.commons.api.identity.ServerIdentityConfiguration;
import fr.gouv.vitamui.commons.rest.RestExceptionHandler;
import fr.gouv.vitamui.commons.rest.configuration.SwaggerConfiguration;
import fr.gouv.vitamui.commons.test.rest.AbstractSwaggerJsonFileGenerationJunit5;
Expand All @@ -50,7 +49,7 @@
*/
@ExtendWith(SpringExtension.class)
@WebMvcTest
@Import(value = { ServerIdentityConfiguration.class, SwaggerConfiguration.class })
@Import(value = { SwaggerConfiguration.class })
@ActiveProfiles("test, swagger")
public class SwaggerJsonFileGenerationTest extends AbstractSwaggerJsonFileGenerationJunit5 {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ security:
host: xxx
port: 8089

server-identity:
identityName: vitamui-test
identityRole: archive
identityServerId: 1

logbook.scheduling.sendEventToVitamTasks.enabled: false

# external ontologie file path
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@
package fr.gouv.vitamui.collect.external.client;

import fr.gouv.vitamui.collect.common.rest.RestApi;
import fr.gouv.vitamui.commons.test.extension.ServerIdentityExtension;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
import org.mockito.junit.jupiter.MockitoExtension;
import org.springframework.web.client.RestTemplate;

@ExtendWith(MockitoExtension.class)
public class CollectExternalRestClientTest extends ServerIdentityExtension {
public class CollectExternalRestClientTest {

private CollectExternalRestClient collectExternalRestClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ multipart:
spring.servlet.multipart.max-file-size: -1
spring.servlet.multipart.max-request-size: -1

server-identity:
identityName: vitamui-dev
identityRole: collect-external
identityServerId: 1

server:
host:
port: 8090
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

spring:
application:
name: ${server-identity.identityRole}
name: collect-external
api:
name: API Collect External
description: This API is used to collect Vitam's archives
Expand All @@ -18,7 +18,7 @@ spring:
management:
endpoints:
jmx:
domain: ${server-identity.identityRole}
domain: collect-external
unique-names: true
web.exposure.include: info,health,prometheus
endpoint:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,13 @@

import fr.gouv.vitamui.collect.external.server.security.WebSecurityConfig;
import fr.gouv.vitamui.commons.api.domain.IdDto;
import fr.gouv.vitamui.commons.api.identity.ServerIdentityConfiguration;
import fr.gouv.vitamui.commons.rest.RestExceptionHandler;
import fr.gouv.vitamui.iam.security.provider.ExternalApiAuthenticationProvider;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Import;
import org.springframework.test.context.TestPropertySource;

@Import(value = { WebSecurityConfig.class, ServerIdentityConfiguration.class, RestExceptionHandler.class })
@Import(value = { WebSecurityConfig.class, RestExceptionHandler.class })
@TestPropertySource(properties = { "spring.config.name=collect-external-application" })
public abstract class ApiCollectExternalControllerTest<T extends IdDto> extends ApiControllerTest<T> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,5 @@ collect-external:
read-time-out: 240000 #4 minutes
write-time-out: 240000 #4 minutes

server-identity:
identityName: vitamui-test
identityRole: iam
identityServerId: 1

swagger:
layer: api-external
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import fr.gouv.vitamui.collect.common.dto.CollectTransactionDto;
import fr.gouv.vitamui.commons.api.domain.PaginatedValuesDto;
import fr.gouv.vitamui.commons.rest.client.InternalHttpContext;
import fr.gouv.vitamui.commons.test.extension.ServerIdentityExtension;
import fr.gouv.vitamui.commons.vitam.api.dto.ResultsDto;
import org.apache.commons.lang3.tuple.Pair;
import org.junit.jupiter.api.BeforeEach;
Expand Down Expand Up @@ -73,7 +72,7 @@
import static org.mockito.Mockito.when;

@ExtendWith(MockitoExtension.class)
public class CollectInternalRestClientTest extends ServerIdentityExtension {
public class CollectInternalRestClientTest {

private CollectInternalRestClient collectInternalRestClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
package fr.gouv.vitamui.collect.internal.client;

import fr.gouv.vitamui.commons.rest.client.InternalHttpContext;
import fr.gouv.vitamui.commons.test.extension.ServerIdentityExtension;
import org.apache.commons.lang3.tuple.Pair;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -58,7 +57,7 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;

@ExtendWith(MockitoExtension.class)
public class CollectInternalWebClientTest extends ServerIdentityExtension {
public class CollectInternalWebClientTest {

private static final String UNIT_ID = "UNIT_ID";
private CollectInternalWebClient collectInternalWebClient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
package fr.gouv.vitamui.collect.internal.client;

import fr.gouv.vitamui.commons.rest.client.InternalHttpContext;
import fr.gouv.vitamui.commons.test.extension.ServerIdentityExtension;
import org.apache.commons.lang3.tuple.Pair;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -64,7 +63,7 @@
import static org.mockito.Mockito.when;

@ExtendWith(MockitoExtension.class)
public class CollectStreamingInternalRestClientTest extends ServerIdentityExtension {
public class CollectStreamingInternalRestClientTest {

private static final String TRANSACTION_ID = "TRANSACTION_ID";
private static final String ORIGINAL_FILENAME = "ORIGINAL_FILENAME";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import fr.gouv.vitamui.commons.api.CommonConstants;
import fr.gouv.vitamui.commons.api.dtos.SearchCriteriaDto;
import fr.gouv.vitamui.commons.rest.client.InternalHttpContext;
import fr.gouv.vitamui.commons.test.extension.ServerIdentityExtension;
import fr.gouv.vitamui.commons.vitam.api.dto.ResultsDto;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.tuple.Pair;
Expand Down Expand Up @@ -81,7 +80,7 @@
import static org.mockito.Mockito.when;

@ExtendWith(MockitoExtension.class)
public class CollectTransactionInternalRestClientTest extends ServerIdentityExtension {
public class CollectTransactionInternalRestClientTest {

private CollectTransactionInternalRestClient collectTransactionInternalRestClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

import fr.gouv.vitamui.commons.api.dtos.SearchCriteriaHistoryDto;
import fr.gouv.vitamui.commons.rest.client.InternalHttpContext;
import fr.gouv.vitamui.commons.test.extension.ServerIdentityExtension;
import org.apache.commons.lang3.tuple.Pair;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand Down Expand Up @@ -65,7 +64,7 @@
import static org.mockito.Mockito.when;

@ExtendWith(MockitoExtension.class)
public class SearchCriteriaHistoryInternalRestClientTest extends ServerIdentityExtension {
public class SearchCriteriaHistoryInternalRestClientTest {

private SearchCriteriaHistoryInternalRestClient searchCriteriaHistoryInternalRestClient;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
package fr.gouv.vitamui.collect.internal.client;

import fr.gouv.vitamui.collect.common.rest.RestApi;
import fr.gouv.vitamui.commons.test.extension.ServerIdentityExtension;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
Expand All @@ -42,7 +41,7 @@
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;

@ExtendWith(MockitoExtension.class)
public class UpdateUnitsMetadataInternalRestClientTest extends ServerIdentityExtension {
public class UpdateUnitsMetadataInternalRestClientTest {

@Mock
private RestTemplate restTemplate;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,6 @@ multipart:
spring.servlet.multipart.max-file-size: -1
spring.servlet.multipart.max-request-size: -1

server-identity:
identityName: vitamui-dev
identityRole: collect-internal
identityServerId: 1

server:
host:
port: 7090
Expand Down
Loading

0 comments on commit d79f2dd

Please sign in to comment.