Skip to content

Commit

Permalink
fix(deps): bump org.openapitools:openapi-generator-maven-plugin from …
Browse files Browse the repository at this point in the history
…7.9.0 to 7.11.0 (#95)

* fix(deps): bump org.openapitools:openapi-generator-maven-plugin

Bumps org.openapitools:openapi-generator-maven-plugin from 7.9.0 to 7.11.0.

---
updated-dependencies:
- dependency-name: org.openapitools:openapi-generator-maven-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix changed enum values

* fix sonar violations

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: PBobylev <[email protected]>
  • Loading branch information
dependabot[bot] and PBobylev authored Jan 28, 2025
1 parent f6af4db commit 8cf7016
Show file tree
Hide file tree
Showing 27 changed files with 136 additions and 123 deletions.
12 changes: 10 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
<easy-random.version>5.0.0</easy-random.version>

<!-- Plugins versions -->
<maven-openapi-generator-plugin.version>7.9.0</maven-openapi-generator-plugin.version>
<maven-openapi-generator-plugin.version>7.11.0</maven-openapi-generator-plugin.version>
<maven-copy-rename-plugin.version>1.0.1</maven-copy-rename-plugin.version>
<maven-build-helper-plugin.version>3.6.0</maven-build-helper-plugin.version>
<maven-clean-plugin.version>3.4.0</maven-clean-plugin.version>
Expand All @@ -78,36 +78,43 @@
<artifactId>folio-spring-base</artifactId>
<version>${folio-spring-base.version}</version>
</dependency>

<dependency>
<groupId>org.folio</groupId>
<artifactId>folio-service-tools-spring-dev</artifactId>
<version>${folio-service-tools.version}</version>
</dependency>

<dependency>
<groupId>org.folio</groupId>
<artifactId>lib-linked-data-dictionary</artifactId>
<version>${lib-linked-data-dictionary.version}</version>
</dependency>

<dependency>
<groupId>org.folio</groupId>
<artifactId>lib-linked-data-marc4ld</artifactId>
<version>${lib-linked-data-marc4ld.version}</version>
</dependency>

<dependency>
<groupId>org.folio</groupId>
<artifactId>lib-linked-data-fingerprint</artifactId>
<version>${lib-linked-data-fingerprint.version}</version>
</dependency>

<dependency>
<groupId>org.folio</groupId>
<artifactId>mod-source-record-storage-client</artifactId>
<version>${mod-source-record-storage-client.version}</version>
</dependency>

<dependency>
<groupId>org.folio</groupId>
<artifactId>mod-record-specifications-dto</artifactId>
<version>${mod-record-specifications-dto.version}</version>
</dependency>

<dependency>
<groupId>org.folio</groupId>
<artifactId>folio-kafka-wrapper</artifactId>
Expand Down Expand Up @@ -261,7 +268,6 @@
<version>${easy-random.version}</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand Down Expand Up @@ -585,6 +591,7 @@
<name>FOLIO Maven repository</name>
<url>https://repository.folio.org/repository/maven-folio</url>
</repository>

<repository>
<id>index-data-nexus</id>
<name>FOLIO Maven repository</name>
Expand All @@ -600,6 +607,7 @@
<uniqueVersion>false</uniqueVersion>
<layout>default</layout>
</repository>

<snapshotRepository>
<id>folio-nexus</id>
<name>FOLIO Snapshot Repository</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import static java.util.Objects.isNull;
import static org.apache.commons.lang3.ObjectUtils.isEmpty;
import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.CREATED;
import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.UPDATED;
import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.SOURCE_RECORD_CREATED;
import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.SOURCE_RECORD_UPDATED;
import static org.folio.linked.data.domain.dto.SourceRecordType.MARC_AUTHORITY;
import static org.folio.linked.data.domain.dto.SourceRecordType.MARC_BIB;
import static org.folio.linked.data.util.Constants.STANDALONE_PROFILE;
Expand Down Expand Up @@ -32,7 +32,8 @@ public class SourceRecordDomainEventHandler {
private static final String NO_MARC_EVENT = "SourceRecordDomainEvent [id {}] has no Marc record inside";
private static final String UNSUPPORTED_TYPE = "Ignoring unsupported {} type [{}] in SourceRecordDomainEvent [id {}]";
private static final Set<SourceRecordType> SUPPORTED_RECORD_TYPES = Set.of(MARC_BIB, MARC_AUTHORITY);
private static final Set<SourceRecordDomainEvent.EventTypeEnum> SUPPORTED_EVENT_TYPES = Set.of(CREATED, UPDATED);
private static final Set<SourceRecordDomainEvent.EventTypeEnum> SUPPORTED_EVENT_TYPES =
Set.of(SOURCE_RECORD_CREATED, SOURCE_RECORD_UPDATED);
private final ResourceMarcAuthorityService resourceMarcAuthorityService;
private final ResourceMarcBibService resourceMarcBibService;
private final MarcAuthority2ldMapper marcAuthority2ldMapper;
Expand All @@ -45,7 +46,7 @@ public void handle(SourceRecordDomainEvent event, SourceRecordType recordType) {
}
if (recordType == MARC_AUTHORITY) {
saveAuthorities(event);
} else if (recordType == MARC_BIB && event.getEventType() == CREATED) {
} else if (recordType == MARC_BIB && event.getEventType() == SOURCE_RECORD_CREATED) {
saveAdminMetadata(event);
}
}
Expand Down Expand Up @@ -78,7 +79,7 @@ private void saveAuthorities(SourceRecordDomainEvent event) {
}

private void saveAuthority(Resource resource, SourceRecordDomainEvent event) {
if (CREATED == event.getEventType() || UPDATED == event.getEventType()) {
if (SOURCE_RECORD_CREATED == event.getEventType() || SOURCE_RECORD_UPDATED == event.getEventType()) {
var id = resourceMarcAuthorityService.saveMarcAuthority(resource);
log.info(EVENT_SAVED, event.getId(), MARC_AUTHORITY, id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.core.env.Environment;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.web.servlet.MockMvc;

@IntegrationTest
Expand All @@ -35,7 +35,7 @@ class ProfileControllerIT {
private ProfileRepository profileRepository;
@Autowired
private Environment env;
@MockBean
@MockitoBean
private KafkaAdminService kafkaAdminService;

@Order(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.bean.override.mockito.MockitoBean;

abstract class DatabaseITBase {

Expand All @@ -26,7 +26,7 @@ abstract class DatabaseITBase {

@Autowired
private JdbcTemplate jdbcTemplate;
@MockBean
@MockitoBean
private KafkaAdminService kafkaAdminService;

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import org.junit.jupiter.params.provider.EnumSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.jdbc.JdbcTestUtils;

abstract class PredicateDictionaryITBase {
Expand All @@ -29,7 +29,7 @@ abstract class PredicateDictionaryITBase {

@Autowired
private JdbcTemplate jdbcTemplate;
@MockBean
@MockitoBean
private KafkaAdminService kafkaAdminService;

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
import org.junit.jupiter.params.provider.EnumSource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.test.context.bean.override.mockito.MockitoBean;
import org.springframework.test.jdbc.JdbcTestUtils;

abstract class ResourceTypeDictionaryITBase {
Expand All @@ -28,7 +28,7 @@ abstract class ResourceTypeDictionaryITBase {
private String schema;
@Autowired
private JdbcTemplate jdbcTemplate;
@MockBean
@MockitoBean
private KafkaAdminService kafkaAdminService;

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import static org.folio.ld.dictionary.ResourceTypeDictionary.CONCEPT;
import static org.folio.ld.dictionary.ResourceTypeDictionary.PERSON;
import static org.folio.ld.dictionary.ResourceTypeDictionary.WORK;
import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.CREATED;
import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.UPDATED;
import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.SOURCE_RECORD_CREATED;
import static org.folio.linked.data.domain.dto.SourceRecordDomainEvent.EventTypeEnum.SOURCE_RECORD_UPDATED;
import static org.folio.linked.data.domain.dto.SourceRecordType.MARC_AUTHORITY;
import static org.folio.linked.data.e2e.resource.ResourceControllerITBase.RESOURCE_URL;
import static org.folio.linked.data.test.TestUtil.TENANT_ID;
Expand Down Expand Up @@ -45,10 +45,10 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.SpyBean;
import org.springframework.core.env.Environment;
import org.springframework.data.domain.Pageable;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.test.context.bean.override.mockito.MockitoSpyBean;
import org.springframework.test.web.servlet.MockMvc;

@IntegrationTest
Expand All @@ -64,7 +64,7 @@ class AuthorityUpdateAndReadWorkIT {
private KafkaSearchWorkIndexTopicListener kafkaSearchWorkIndexTopicListener;
@Autowired
private ResourceTestRepository resourceTestRepository;
@SpyBean
@MockitoSpyBean
@Autowired
private ResourceMarcAuthorityService resourceMarcService;
@Autowired
Expand Down Expand Up @@ -94,13 +94,13 @@ void authorityUpdate_withNewFingerprint_shouldLinkItToPreviousAndReturnAsWorkAct
var authority = createAuthority();
var work = createWorkAndLinkToAuthority(authority);
var authorityUpdateJson = getAuthorityJson().replace("aValue", "newAValue");
var updateAuthorityEvent =
getSrsDomainEventProducerRecord(randomUUID().toString(), authorityUpdateJson, UPDATED, MARC_AUTHORITY);
var updateAuthorityEvent = getSrsDomainEventProducerRecord(randomUUID().toString(), authorityUpdateJson,
SOURCE_RECORD_UPDATED, MARC_AUTHORITY);

// when
eventKafkaTemplate.send(updateAuthorityEvent);
awaitAndAssert(() -> verify(resourceMarcService, times(2))
.saveMarcAuthority(any(org.folio.ld.dictionary.model.Resource.class)));
.saveMarcAuthority(any(org.folio.ld.dictionary.model.Resource.class)));

// then
var authoritiesFromDb = readAndAssertAuthoritiesInTheDb();
Expand All @@ -110,25 +110,25 @@ void authorityUpdate_withNewFingerprint_shouldLinkItToPreviousAndReturnAsWorkAct

private void assertGetWorkWithActiveAuthority(Long workId, List<Resource> authorities) throws Exception {
var requestBuilder = get(RESOURCE_URL + "/" + workId)
.contentType(APPLICATION_JSON)
.headers(defaultHeaders(env));
.contentType(APPLICATION_JSON)
.headers(defaultHeaders(env));
var resultActions = mockMvc.perform(requestBuilder);
var response = resultActions
.andExpect(status().isOk())
.andExpect(content().contentType(APPLICATION_JSON))
.andReturn().getResponse().getContentAsString();
.andExpect(status().isOk())
.andExpect(content().contentType(APPLICATION_JSON))
.andReturn().getResponse().getContentAsString();
assertThat(response)
.isNotEmpty()
.contains(authorities.get(1).getId().toString())
.contains(authorities.get(1).getLabel())
.doesNotContain(authorities.get(0).getId().toString())
.doesNotContain(authorities.get(0).getLabel());
.isNotEmpty()
.contains(authorities.get(1).getId().toString())
.contains(authorities.get(1).getLabel())
.doesNotContain(authorities.get(0).getId().toString())
.doesNotContain(authorities.get(0).getLabel());
}

private void assertWorkIsStillLinkedToObsoleteAuthorityInTheDb(Resource work, Resource obsoleteAuthority) {
var workFromDb = tenantScopedExecutionService.execute(
TENANT_ID,
() -> resourceTestRepository.findByIdWithEdgesLoaded(work.getId()).orElseThrow()
TENANT_ID,
() -> resourceTestRepository.findByIdWithEdgesLoaded(work.getId()).orElseThrow()
);
assertThat(workFromDb.getOutgoingEdges()).hasSize(3);
assertThat(workFromDb.getOutgoingEdges()).contains(new ResourceEdge(workFromDb, obsoleteAuthority, AUTHOR));
Expand All @@ -137,12 +137,12 @@ private void assertWorkIsStillLinkedToObsoleteAuthorityInTheDb(Resource work, Re

private List<Resource> readAndAssertAuthoritiesInTheDb() {
var authoritiesFromDb = tenantScopedExecutionService.execute(
TENANT_ID,
() -> resourceTestRepository.findAllByTypeWithEdgesLoaded(Set.of(CONCEPT.getUri(), PERSON.getUri()), 2,
Pageable.ofSize(10))
.stream()
.sorted(comparing(Resource::getLabel))
.toList()
TENANT_ID,
() -> resourceTestRepository.findAllByTypeWithEdgesLoaded(Set.of(CONCEPT.getUri(), PERSON.getUri()), 2,
Pageable.ofSize(10))
.stream()
.sorted(comparing(Resource::getLabel))
.toList()
);
assertThat(authoritiesFromDb).hasSize(2);
var expectedLabelCreated = "bValue, aValue, cValue, qValue, dValue -- vValue -- xValue -- yValue -- zValue";
Expand All @@ -153,16 +153,16 @@ private List<Resource> readAndAssertAuthoritiesInTheDb() {
}

private Resource createAuthority() {
var authorityCreateEvent =
getSrsDomainEventProducerRecord(randomUUID().toString(), getAuthorityJson(), CREATED, MARC_AUTHORITY);
var authorityCreateEvent = getSrsDomainEventProducerRecord(randomUUID().toString(), getAuthorityJson(),
SOURCE_RECORD_CREATED, MARC_AUTHORITY);
eventKafkaTemplate.send(authorityCreateEvent);
awaitAndAssert(() -> verify(resourceMarcService)
.saveMarcAuthority(any(org.folio.ld.dictionary.model.Resource.class)));
.saveMarcAuthority(any(org.folio.ld.dictionary.model.Resource.class)));
return tenantScopedExecutionService.execute(TENANT_ID,
() -> resourceTestRepository.findById(- 6897633277634168127L)
.stream()
.findFirst()
.orElseThrow()
() -> resourceTestRepository.findById(- 6897633277634168127L)
.stream()
.findFirst()
.orElseThrow()
);
}

Expand All @@ -184,13 +184,13 @@ private Resource createWorkAndLinkToAuthority(Resource authority) {
reCreator.computeId();
work.addOutgoingEdge(reCreator);
tenantScopedExecutionService.execute(TENANT_ID,
() -> {
resourceTestRepository.save(work);
resourceTestRepository.save(title);
resourceEdgeRepository.save(reTitle);
resourceEdgeRepository.save(reAuthor);
resourceEdgeRepository.save(reCreator);
}
() -> {
resourceTestRepository.save(work);
resourceTestRepository.save(title);
resourceEdgeRepository.save(reTitle);
resourceEdgeRepository.save(reAuthor);
resourceEdgeRepository.save(reCreator);
}
);
return work;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.bean.override.mockito.MockitoBean;

@IntegrationTest
class MergeResourcesIT {
Expand All @@ -41,7 +41,7 @@ class MergeResourcesIT {
private ObjectMapper objectMapper;
@Autowired
private TenantScopedExecutionService tenantScopedExecutionService;
@MockBean
@MockitoBean
private KafkaAdminService kafkaAdminService;

@BeforeEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
import org.folio.spring.tools.kafka.KafkaAdminService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.test.context.bean.override.mockito.MockitoBean;

@IntegrationTest
class ResourceControllerBaseValidationIT extends AbstractResourceControllerIT {

@Autowired
private ObjectMapper objectMapper;
@MockBean
@MockitoBean
private KafkaAdminService kafkaAdminService;

@Test
Expand Down
Loading

0 comments on commit 8cf7016

Please sign in to comment.