Skip to content

Commit

Permalink
MODINREACH-420 Upgrading dependencies for Quesnelia (#386)
Browse files Browse the repository at this point in the history
* MODINREACH-420 Upgrading dependencies for Quesnelia
  • Loading branch information
Vignesh-kalyanasundaram authored Mar 14, 2024
1 parent 91951fc commit 18355bc
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 119 deletions.
38 changes: 20 additions & 18 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.4</version>
<version>3.2.3</version>
<relativePath />
</parent>
<groupId>org.folio</groupId>
Expand All @@ -23,32 +23,28 @@
<properties>
<!-- runtime dependencies -->
<folio-service-tools.version>3.1.0</folio-service-tools.version>
<folio-spring-base.version>7.2.0</folio-spring-base.version>
<folio-spring-system-user.version>7.2.1</folio-spring-system-user.version>
<spring-cloud-starter-openfeign.version>4.0.3</spring-cloud-starter-openfeign.version>
<folio-spring.version>8.1.0</folio-spring.version>
<spring-cloud-starter-openfeign.version>4.1.0</spring-cloud-starter-openfeign.version>
<commons-collections4.version>4.4</commons-collections4.version>
<mapstruct.version>1.5.3.Final</mapstruct.version>
<marc4j.version>2.9.2</marc4j.version>
<coffee-boots.version>3.0.0</coffee-boots.version>
<snakeyaml.version>1.33</snakeyaml.version>

<!-- test dependencies -->
<testcontainers.version>1.17.6</testcontainers.version>
<wiremock.version>2.35.0</wiremock.version>
<wiremock-standalone.version>3.4.2</wiremock-standalone.version>
<awaitility.version>4.2.0</awaitility.version>
<junit-extensions.version>2.6.0</junit-extensions.version>
<easy-random.version>5.0.0</easy-random.version>
<micrometer.version>1.10.3</micrometer.version>
<log4j2.version>2.19.0</log4j2.version>
<jetty.version>9.4.49.v20220914</jetty.version>

<!-- plugins -->
<openapi-generator.version>6.2.1</openapi-generator.version>
<openapi-generator.version>7.3.0</openapi-generator.version>
<copy-rename-maven-plugin.version>1.0.1</copy-rename-maven-plugin.version>
<build-helper-maven-plugin.version>3.3.0</build-helper-maven-plugin.version>
<maven-surefire-plugin.version>3.0.0-M7</maven-surefire-plugin.version>
<maven-release-plugin.version>3.0.0-M7</maven-release-plugin.version>
<maven-enforcer-plugin.version>3.1.0</maven-enforcer-plugin.version>
<build-helper-maven-plugin.version>3.5.0</build-helper-maven-plugin.version>
<maven-surefire-plugin.version>3.2.5</maven-surefire-plugin.version>
<maven-release-plugin.version>3.0.1</maven-release-plugin.version>
<maven-enforcer-plugin.version>3.4.1</maven-enforcer-plugin.version>

<!-- other properties -->
<java.version>17</java.version>
Expand Down Expand Up @@ -79,12 +75,12 @@
<dependency>
<groupId>org.folio</groupId>
<artifactId>folio-spring-base</artifactId>
<version>${folio-spring-base.version}</version>
<version>${folio-spring.version}</version>
</dependency>
<dependency>
<groupId>org.folio</groupId>
<artifactId>folio-spring-system-user</artifactId>
<version>${folio-spring-system-user.version}</version>
<version>${folio-spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -221,6 +217,12 @@
<groupId>org.springframework.kafka</groupId>
<artifactId>spring-kafka-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.jeasy</groupId>
Expand All @@ -229,9 +231,9 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8</artifactId>
<version>${wiremock.version}</version>
<groupId>org.wiremock</groupId>
<artifactId>wiremock-standalone</artifactId>
<version>${wiremock-standalone.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"description": "contributors",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Personal name, corporate name, meeting name"
},
"contributorTypeId": {
"type": "string",
"format": "UUID",
"description": "ID for the contributor type term defined as a referencetable in settings"
},
"contributorTypeText": {
"type": "string",
"description": "Free text element for adding contributor type terms other that defined by the MARC code list for relators"
},
"contributorNameTypeId": {
"type": "string",
"format": "UUID",
"description": "Contributor type terms defined by the MARC code list for relators"
},
"primary": {
"type": "boolean",
"description": "Whether this is the primary contributor"
}
},
"additionalProperties": false,
"required": [
"name",
"contributorNameTypeId"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -38,60 +38,15 @@
"description": "An extensible set of name-value pairs of identifiers associated with the resource",
"minItems": 0,
"items": {
"type": "object",
"properties": {
"value": {
"type": "string",
"description": "Resource identifier value"
},
"identifierTypeId": {
"description": "UUID of resource identifier type (e.g. ISBN, ISSN, LCCN, CODEN, Locally defined identifiers)",
"type": "string",
"format": "UUID"
}
},
"additionalProperties": false,
"required": [
"value",
"identifierTypeId"
]
"$ref": "instanceIdentifiers.json"
}
},
"contributors": {
"type": "array",
"description": "List of contributors",
"minItems": 0,
"items": {
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Personal name, corporate name, meeting name"
},
"contributorTypeId": {
"type": "string",
"format": "UUID",
"description": "ID for the contributor type term defined as a referencetable in settings"
},
"contributorTypeText": {
"type": "string",
"description": "Free text element for adding contributor type terms other that defined by the MARC code list for relators"
},
"contributorNameTypeId": {
"type": "string",
"format": "UUID",
"description": "Contributor type terms defined by the MARC code list for relators"
},
"primary": {
"type": "boolean",
"description": "Whether this is the primary contributor"
}
},
"additionalProperties": false,
"required": [
"name",
"contributorNameTypeId"
]
"$ref": "contributors.json"
}
},
"instanceTypeId": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"description": "An extensible set of name-value pairs of identifiers associated with the resource",
"type": "object",
"properties": {
"value": {
"type": "string",
"description": "Resource identifier value"
},
"identifierTypeId": {
"description": "UUID of resource identifier type (e.g. ISBN, ISSN, LCCN, CODEN, Locally defined identifiers)",
"type": "string",
"format": "UUID"
}
},
"additionalProperties": false,
"required": [
"value",
"identifierTypeId"
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
import static org.folio.innreach.fixture.TestUtil.circHeaders;
import static org.folio.innreach.fixture.TestUtil.readFile;

import jakarta.validation.Valid;

import java.util.Collections;
import java.util.Map;
import java.util.function.UnaryOperator;
Expand All @@ -38,57 +36,32 @@
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Profile;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.ResultActions;
import org.springframework.web.bind.annotation.RestController;

import org.folio.innreach.ModInnReachApplication;
import org.folio.innreach.domain.listener.KafkaCirculationEventListener;
import org.folio.innreach.domain.listener.KafkaInventoryEventListener;
import org.folio.innreach.util.JsonHelper;
import org.folio.spring.integration.XOkapiHeaders;
import org.folio.spring.liquibase.FolioLiquibaseConfiguration;
import org.folio.tenant.domain.dto.TenantAttributes;
import org.folio.tenant.rest.resource.TenantApi;

@MockBean(classes = {KafkaCirculationEventListener.class, KafkaInventoryEventListener.class, KafkaInitialContributionEventListener.class})
@Log4j2
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT,
classes = {ModInnReachApplication.class, BaseApiControllerTest.TestTenantController.class})
classes = {ModInnReachApplication.class})
@AutoConfigureMockMvc
@ActiveProfiles({"test", "testcontainers-pg"})
@ExtendWith(WatcherExtension.class)
public class BaseApiControllerTest {

@EnableAutoConfiguration(exclude = {FolioLiquibaseConfiguration.class})
@RestController("folioTenantController")
@Profile("test")
static class TestTenantController implements TenantApi {

@Override
public ResponseEntity<Void> deleteTenant(String operationId) {
return ResponseEntity.noContent().build();
}

@Override
public ResponseEntity<Void> postTenant(@Valid TenantAttributes tenantAttributes) {
return ResponseEntity.status(HttpStatus.CREATED).build();
}

}

protected static WireMockServer wm =
new WireMockServer(wireMockConfig()
.dynamicPort()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,10 @@
import static org.folio.innreach.domain.listener.base.BaseKafkaApiTest.INVENTORY_ITEM_TOPIC;
import static org.folio.innreach.domain.listener.base.BaseKafkaApiTest.INVENTORY_ITEM_TOPIC1;
import static org.folio.innreach.domain.listener.base.BaseKafkaApiTest.INVENTORY_ITEM_TOPIC2;
import static org.folio.innreach.domain.listener.base.BaseKafkaApiTest.TestTenantController;
import static org.folio.innreach.domain.listener.base.BaseKafkaApiTest.TestTenantScopedExecutionService;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.when;

import jakarta.validation.Valid;
import java.util.List;
import java.util.UUID;
import lombok.SneakyThrows;
Expand All @@ -24,19 +22,14 @@
import org.folio.innreach.domain.service.impl.TenantScopedExecutionService;
import org.folio.innreach.external.client.feign.InnReachAuthClient;
import org.folio.innreach.external.dto.AccessTokenDTO;
import org.folio.spring.liquibase.FolioLiquibaseConfiguration;
import org.folio.tenant.domain.dto.TenantAttributes;
import org.folio.tenant.rest.resource.TenantApi;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.TestInstance;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.context.annotation.Primary;
import org.springframework.context.annotation.Profile;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.kafka.core.DefaultKafkaProducerFactory;
import org.springframework.kafka.core.KafkaTemplate;
Expand All @@ -47,15 +40,14 @@
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.springframework.test.context.DynamicPropertySource;
import org.springframework.web.bind.annotation.RestController;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.junit.jupiter.Container;
import org.testcontainers.junit.jupiter.Testcontainers;

@ActiveProfiles("test")
@EmbeddedKafka(topics = {CIRC_LOAN_TOPIC, CIRC_REQUEST_TOPIC, INITIAL_CONTRIBUTION_TOPIC, CIRC_CHECKIN_TOPIC, INVENTORY_ITEM_TOPIC, INVENTORY_HOLDING_TOPIC, INVENTORY_INSTANCE_TOPIC, INVENTORY_ITEM_TOPIC1, INVENTORY_ITEM_TOPIC2})
@SpringBootTest(
classes = {ModInnReachApplication.class, TestTenantController.class, TestTenantScopedExecutionService.class})
classes = {ModInnReachApplication.class, TestTenantScopedExecutionService.class})
@Testcontainers
@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class BaseKafkaApiTest {
Expand Down Expand Up @@ -111,23 +103,6 @@ private KafkaTemplate<String, DomainEvent> buildKafkaTemplate() {
return new KafkaTemplate<>(new DefaultKafkaProducerFactory<>(senderProps));
}

@EnableAutoConfiguration(exclude = {FolioLiquibaseConfiguration.class})
@RestController("folioTenantController")
@Profile("test")
static class TestTenantController implements TenantApi {

@Override
public ResponseEntity<Void> deleteTenant(String operationId) {
return ResponseEntity.noContent().build();
}

@Override
public ResponseEntity<Void> postTenant(@Valid TenantAttributes tenantAttributes) {
return ResponseEntity.status(HttpStatus.CREATED).build();
}

}

@Primary
@Service
@Profile("test")
Expand Down

0 comments on commit 18355bc

Please sign in to comment.