From e9ed3965501b7051bbe2d55892d3b3aa0947dab6 Mon Sep 17 00:00:00 2001 From: Aleksei Pronichev Date: Wed, 3 Jul 2024 19:14:55 +0500 Subject: [PATCH] refactor (linked-data-search) Use consistent names for Work and Authority Indexes - Replace all references of 'bibframe' with 'linked-data' - Use consistent index names for linked-data Work and Authority Indexes - Use consistent API URIs for linked-data Work and Authority Indexes - Use consistent Kafka topic names for linked-data Work and Authority Indexes - Use consistent permission names for linked-data Work and Authority Indexes Closes MSEARCH-786 --- NEWS.md | 4 +- README.md | 20 +++---- descriptors/ModuleDescriptor-template.json | 19 +++--- .../search/controller/SearchController.java | 30 +++++----- .../integration/KafkaMessageListener.java | 14 ++--- .../ResourceEventBatchInterceptor.java | 4 +- .../BibframeContributorProcessor.java | 34 ----------- .../bibframe/BibframeSortTitleProcessor.java | 31 ---------- .../bibframe/BibframeTitleProcessor.java | 34 ----------- .../LinkedDataAuthorityLccnProcessor.java} | 18 +++--- .../LinkedDataWorkContributorProcessor.java | 34 +++++++++++ .../work/LinkedDataWorkIsbnProcessor.java} | 16 ++--- .../work/LinkedDataWorkLccnProcessor.java} | 16 ++--- .../LinkedDataWorkSortTitleProcessor.java | 31 ++++++++++ .../work/LinkedDataWorkTitleProcessor.java | 37 ++++++++++++ .../folio/search/utils/KafkaConstants.java | 2 +- .../org/folio/search/utils/SearchUtils.java | 4 +- src/main/resources/application.yml | 8 +-- ...hority.json => linked-data-authority.json} | 0 .../{bibframe.json => linked-data-work.json} | 0 ...hority.json => linked_data_authority.json} | 6 +- .../{bibframe.json => linked_data_work.json} | 14 ++--- ...l => linkedDataSearchAuthorityResult.yaml} | 0 ...t.yaml => linkedDataWorkSearchResult.yaml} | 0 .../resources/swagger.api/mod-search.yaml | 8 +-- ...aram.yaml => linked-data-limit-param.yaml} | 0 .../search-linked-data-authorities.yaml} | 14 ++--- .../search-linked-data-works.yaml} | 14 ++--- .../linkedDataAuthority.yaml} | 4 +- .../linkedDataWork.yaml} | 2 +- ...l => linkedDataAuthoritySearchResult.yaml} | 6 +- ...t.yaml => linkedDataWorkSearchResult.yaml} | 6 +- .../controller/SearchControllerTest.java | 20 +++---- ....java => SearchLinkedDataAuthorityIT.java} | 16 ++--- ...ameIT.java => SearchLinkedDataWorkIT.java} | 28 ++++----- .../integration/KafkaMessageListenerTest.java | 59 ++++++++++--------- .../folio/search/sample/SampleBibframe.java | 40 ------------- .../folio/search/sample/SampleLinkedData.java | 40 +++++++++++++ .../search/support/base/ApiEndpoints.java | 8 +-- .../support/base/BaseIntegrationTest.java | 38 ++++++------ .../org/folio/search/utils/TestConstants.java | 12 ++-- src/test/resources/application.yml | 10 ++-- .../authority_concept.json | 0 .../authority_person.json | 0 .../bibframe.json => linked-data/work.json} | 0 .../bibframe2.json => linked-data/work2.json} | 0 46 files changed, 358 insertions(+), 343 deletions(-) delete mode 100644 src/main/java/org/folio/search/service/setter/bibframe/BibframeContributorProcessor.java delete mode 100644 src/main/java/org/folio/search/service/setter/bibframe/BibframeSortTitleProcessor.java delete mode 100644 src/main/java/org/folio/search/service/setter/bibframe/BibframeTitleProcessor.java rename src/main/java/org/folio/search/service/setter/{bibframe/authority/BibframeAuthorityLccnProcessor.java => linkeddata/authority/LinkedDataAuthorityLccnProcessor.java} (54%) create mode 100644 src/main/java/org/folio/search/service/setter/linkeddata/work/LinkedDataWorkContributorProcessor.java rename src/main/java/org/folio/search/service/setter/{bibframe/BibframeIsbnProcessor.java => linkeddata/work/LinkedDataWorkIsbnProcessor.java} (60%) rename src/main/java/org/folio/search/service/setter/{bibframe/BibframeLccnProcessor.java => linkeddata/work/LinkedDataWorkLccnProcessor.java} (63%) create mode 100644 src/main/java/org/folio/search/service/setter/linkeddata/work/LinkedDataWorkSortTitleProcessor.java create mode 100644 src/main/java/org/folio/search/service/setter/linkeddata/work/LinkedDataWorkTitleProcessor.java rename src/main/resources/elasticsearch/index/{bibframe-authority.json => linked-data-authority.json} (100%) rename src/main/resources/elasticsearch/index/{bibframe.json => linked-data-work.json} (100%) rename src/main/resources/model/{bibframe_authority.json => linked_data_authority.json} (75%) rename src/main/resources/model/{bibframe.json => linked_data_work.json} (89%) rename src/main/resources/swagger.api/examples/result/{bibframeSearchAuthorityResult.yaml => linkedDataSearchAuthorityResult.yaml} (100%) rename src/main/resources/swagger.api/examples/result/{bibframeSearchResult.yaml => linkedDataWorkSearchResult.yaml} (100%) rename src/main/resources/swagger.api/parameters/{bibframe-limit-param.yaml => linked-data-limit-param.yaml} (100%) rename src/main/resources/swagger.api/paths/{search-bibframe/search-bibframe-authorities.yaml => search-linked-data/search-linked-data-authorities.yaml} (51%) rename src/main/resources/swagger.api/paths/{search-bibframe/search-bibframe.yaml => search-linked-data/search-linked-data-works.yaml} (53%) rename src/main/resources/swagger.api/schemas/dto/{bibframe/bibframeAuthority.yaml => linked-data/linkedDataAuthority.yaml} (75%) rename src/main/resources/swagger.api/schemas/dto/{bibframe/bibframe.yaml => linked-data/linkedDataWork.yaml} (98%) rename src/main/resources/swagger.api/schemas/response/{bibframeSearchAuthorityResult.yaml => linkedDataAuthoritySearchResult.yaml} (66%) rename src/main/resources/swagger.api/schemas/response/{bibframeSearchResult.yaml => linkedDataWorkSearchResult.yaml} (69%) rename src/test/java/org/folio/search/controller/{SearchBibframeAuthorityIT.java => SearchLinkedDataAuthorityIT.java} (72%) rename src/test/java/org/folio/search/controller/{SearchBibframeIT.java => SearchLinkedDataWorkIT.java} (91%) delete mode 100644 src/test/java/org/folio/search/sample/SampleBibframe.java create mode 100644 src/test/java/org/folio/search/sample/SampleLinkedData.java rename src/test/resources/samples/{bibframe => linked-data}/authority_concept.json (100%) rename src/test/resources/samples/{bibframe => linked-data}/authority_person.json (100%) rename src/test/resources/samples/{bibframe/bibframe.json => linked-data/work.json} (100%) rename src/test/resources/samples/{bibframe/bibframe2.json => linked-data/work2.json} (100%) diff --git a/NEWS.md b/NEWS.md index e0d5c60c0..068356f7e 100644 --- a/NEWS.md +++ b/NEWS.md @@ -18,8 +18,8 @@ * Return Unified List of Inventory Locations in a Consortium ([MSEARCH-681](https://folio-org.atlassian.net/browse/MSEARCH-681)) * Remove ability to match on LCCN searches without a prefix ([MSEARCH-752](https://folio-org.atlassian.net/browse/MSEARCH-752)) * Search consolidated items/holdings data in consortium ([MSEARCH-759](https://folio-org.atlassian.net/browse/MSEARCH-759)) -* Create bibframe index and process bibframe events ([MSEARCH-781](https://folio-org.atlassian.net/browse/MSEARCH-781)) -* Create bibframe authority index and process bibframe authority events ([MSEARCH-784](https://folio-org.atlassian.net/browse/MSEARCH-784)) +* Create linked data work index and process linked data work events ([MSEARCH-781](https://folio-org.atlassian.net/browse/MSEARCH-781)) +* Create linked data authority index and process linked data authority events ([MSEARCH-784](https://folio-org.atlassian.net/browse/MSEARCH-784)) * Allow Unified List of Inventory Locations in a Consortium to be fetched by member tenants ([MSEARCH-660](https://folio-org.atlassian.net/browse/MSEARCH-660)) * Implement Indexing of Campuses from Kafka ([MSEARCH-770](https://issues.folio.org/browse/MSEARCH-770)) * Extend response with additional Location fields for Inventory Locations in a Consortium endpoint ([MSEARCH-775](https://folio-org.atlassian.net/browse/MSEARCH-775)) diff --git a/README.md b/README.md index 1acce7523..ac79888c0 100644 --- a/README.md +++ b/README.md @@ -244,7 +244,7 @@ and [Cross-cluster replication](https://docs.aws.amazon.com/opensearch-service/l | KAFKA_CONTRIBUTORS_TOPIC_REPLICATION_FACTOR | - | Replication factor for `search.instance-contributor` topic. | | KAFKA_CONSORTIUM_INSTANCE_CONCURRENCY | 2 | Custom number of kafka concurrent threads for consortium.instance message consuming. | | KAFKA_LOCATION_CONCURRENCY | 1 | Custom number of kafka concurrent threads for inventory.location, inventory.campus, inventory.institution and inventory.library message consuming. | -| KAFKA_BIBFRAME_CONCURRENCY | 1 | Custom number of kafka concurrent threads for bibframe message consuming. | +| KAFKA_LINKED_DATA_CONCURRENCY | 1 | Custom number of kafka concurrent threads for linked data message consuming. | | KAFKA_CONSORTIUM_INSTANCE_TOPIC_PARTITIONS | 50 | Amount of partitions for `search.consortium.instance` topic. | | KAFKA_CONSORTIUM_INSTANCE_TOPIC_REPLICATION_FACTOR | - | Replication factor for `search.consortium.instance` topic. | | KAFKA_SUBJECTS_CONCURRENCY | 2 | Custom number of kafka concurrent threads for subject message consuming. | @@ -415,15 +415,15 @@ Consortium feature on module enable is defined by 'centralTenantId' tenant param ### Search API -| METHOD | URL | DESCRIPTION | -|:-------|:------------------------------------------|:-------------------------------------------------------------------------------------| -| GET | `/search/instances` | Search by instances and to this instance items and holding-records | -| GET | `/search/authorities` | Search by authority records | -| GET | `/search/bibframe` | Search linked data graph resource descriptions | -| GET | `/search/bibframe/authorities` | Search linked data graph authority resource descriptions | -| GET | `/search/{recordType}/facets` | Get facets where recordType could be: instances, authorities, contributors, subjects | -| GET | ~~`/search/instances/ids`~~ | (DEPRECATED) Stream instance ids as JSON or plain text | -| GET | ~~`/search/holdings/ids`~~ | (DEPRECATED) Stream holding record ids as JSON or plain text | +| METHOD | URL | DESCRIPTION | +|:-------|:----------------------------------|:-------------------------------------------------------------------------------------| +| GET | `/search/instances` | Search by instances and to this instance items and holding-records | +| GET | `/search/authorities` | Search by authority records | +| GET | `/search/linked-data/works` | Search linked data graph work resource descriptions | +| GET | `/search/linked-data/authorities` | Search linked data graph authority resource descriptions | +| GET | `/search/{recordType}/facets` | Get facets where recordType could be: instances, authorities, contributors, subjects | +| GET | ~~`/search/instances/ids`~~ | (DEPRECATED) Stream instance ids as JSON or plain text | +| GET | ~~`/search/holdings/ids`~~ | (DEPRECATED) Stream holding record ids as JSON or plain text | #### Searching and filtering diff --git a/descriptors/ModuleDescriptor-template.json b/descriptors/ModuleDescriptor-template.json index f58caa3fa..7114ac3f6 100644 --- a/descriptors/ModuleDescriptor-template.json +++ b/descriptors/ModuleDescriptor-template.json @@ -106,18 +106,18 @@ "methods": [ "GET" ], - "pathPattern": "/search/bibframe", + "pathPattern": "/search/linked-data/works", "permissionsRequired": [ - "search.bibframe.collection.get" + "search.linked-data.work.collection.get" ] }, { "methods": [ "GET" ], - "pathPattern": "/search/bibframe/authorities", + "pathPattern": "/search/linked-data/authorities", "permissionsRequired": [ - "search.bibframe.authority.collection.get" + "search.linked-data.authority.collection.get" ] }, { @@ -616,9 +616,14 @@ "description": "Searches authorities by given query" }, { - "permissionName": "search.bibframe.collection.get", - "displayName": "Search - searches bibframe by given query", - "description": "Searches bibframe by given query" + "permissionName": "search.linked-data.work.collection.get", + "displayName": "Search - searches linked data works by given query", + "description": "Searches linked data works by given query" + }, + { + "permissionName": "search.linked-data.authority.collection.get", + "displayName": "Search - searches linked data authorities by given query", + "description": "Searches linked data authorities by given query" }, { "permissionName": "browse.call-numbers.instances.collection.get", diff --git a/src/main/java/org/folio/search/controller/SearchController.java b/src/main/java/org/folio/search/controller/SearchController.java index a8c9b8ac2..ae3e3e7c3 100644 --- a/src/main/java/org/folio/search/controller/SearchController.java +++ b/src/main/java/org/folio/search/controller/SearchController.java @@ -3,12 +3,12 @@ import lombok.RequiredArgsConstructor; import org.folio.search.domain.dto.Authority; import org.folio.search.domain.dto.AuthoritySearchResult; -import org.folio.search.domain.dto.Bibframe; -import org.folio.search.domain.dto.BibframeAuthority; -import org.folio.search.domain.dto.BibframeSearchAuthorityResult; -import org.folio.search.domain.dto.BibframeSearchResult; import org.folio.search.domain.dto.Instance; import org.folio.search.domain.dto.InstanceSearchResult; +import org.folio.search.domain.dto.LinkedDataAuthority; +import org.folio.search.domain.dto.LinkedDataAuthoritySearchResult; +import org.folio.search.domain.dto.LinkedDataWork; +import org.folio.search.domain.dto.LinkedDataWorkSearchResult; import org.folio.search.model.service.CqlSearchRequest; import org.folio.search.rest.resource.SearchApi; import org.folio.search.service.SearchService; @@ -53,12 +53,14 @@ public ResponseEntity searchInstances(String tenantId, Str } @Override - public ResponseEntity searchBibframe(String tenant, String query, Integer limit, - Integer offset) { + public ResponseEntity searchLinkedDataWorks(String tenantId, + String query, + Integer limit, + Integer offset) { var searchRequest = CqlSearchRequest.of( - Bibframe.class, tenant, query, limit, offset, true); + LinkedDataWork.class, tenantId, query, limit, offset, true); var result = searchService.search(searchRequest); - return ResponseEntity.ok(new BibframeSearchResult() + return ResponseEntity.ok(new LinkedDataWorkSearchResult() .searchQuery(query) .content(result.getRecords()) .pageNumber(divPlusOneIfRemainder(offset, limit)) @@ -68,14 +70,14 @@ public ResponseEntity searchBibframe(String tenant, String } @Override - public ResponseEntity searchBibframeAuthorities(String tenant, - String query, - Integer limit, - Integer offset) { + public ResponseEntity searchLinkedDataAuthorities(String tenantId, + String query, + Integer limit, + Integer offset) { var searchRequest = CqlSearchRequest.of( - BibframeAuthority.class, tenant, query, limit, offset, true); + LinkedDataAuthority.class, tenantId, query, limit, offset, true); var result = searchService.search(searchRequest); - return ResponseEntity.ok(new BibframeSearchAuthorityResult() + return ResponseEntity.ok(new LinkedDataAuthoritySearchResult() .searchQuery(query) .content(result.getRecords()) .pageNumber(divPlusOneIfRemainder(offset, limit)) diff --git a/src/main/java/org/folio/search/integration/KafkaMessageListener.java b/src/main/java/org/folio/search/integration/KafkaMessageListener.java index d33016a18..3fa4a9f72 100644 --- a/src/main/java/org/folio/search/integration/KafkaMessageListener.java +++ b/src/main/java/org/folio/search/integration/KafkaMessageListener.java @@ -196,16 +196,16 @@ public void handleLocationEvents(List> con } @KafkaListener( - id = KafkaConstants.BIBFRAME_LISTENER_ID, + id = KafkaConstants.LINKED_DATA_LISTENER_ID, containerFactory = "standardListenerContainerFactory", - groupId = "#{folioKafkaProperties.listener['bibframe'].groupId}", - concurrency = "#{folioKafkaProperties.listener['bibframe'].concurrency}", - topicPattern = "#{folioKafkaProperties.listener['bibframe'].topicPattern}") - public void handleBibframeEvents(List> consumerRecords) { - log.info("Processing bibframe events from Kafka [number of events: {}]", consumerRecords.size()); + groupId = "#{folioKafkaProperties.listener['linked-data'].groupId}", + concurrency = "#{folioKafkaProperties.listener['linked-data'].concurrency}", + topicPattern = "#{folioKafkaProperties.listener['linked-data'].topicPattern}") + public void handleLinkedDataEvents(List> consumerRecords) { + log.info("Processing linked data events from Kafka [number of events: {}]", consumerRecords.size()); var batch = consumerRecords.stream() .map(ConsumerRecord::value) - .map(bibframe -> bibframe.id(getResourceEventId(bibframe))) + .map(ld -> ld.id(getResourceEventId(ld))) .toList(); indexResources(batch, resourceService::indexResources); diff --git a/src/main/java/org/folio/search/integration/interceptor/ResourceEventBatchInterceptor.java b/src/main/java/org/folio/search/integration/interceptor/ResourceEventBatchInterceptor.java index 38ac4d886..e9f376ff4 100644 --- a/src/main/java/org/folio/search/integration/interceptor/ResourceEventBatchInterceptor.java +++ b/src/main/java/org/folio/search/integration/interceptor/ResourceEventBatchInterceptor.java @@ -26,8 +26,8 @@ public class ResourceEventBatchInterceptor implements BatchInterceptor> { - - @Override - public Set getFieldValue(Bibframe bibframe) { - var workContributors = ofNullable(bibframe.getContributors()).stream().flatMap(Collection::stream); - var instanceContributors = ofNullable(bibframe.getInstances()).stream().flatMap(Collection::stream) - .map(BibframeInstancesInner::getContributors).filter(Objects::nonNull).flatMap(Collection::stream); - return Stream.concat(workContributors, instanceContributors) - .filter(Objects::nonNull) - .map(BibframeContributorsInner::getName) - .filter(StringUtils::isNotBlank) - .map(String::trim) - .collect(toCollection(LinkedHashSet::new)); - } - -} diff --git a/src/main/java/org/folio/search/service/setter/bibframe/BibframeSortTitleProcessor.java b/src/main/java/org/folio/search/service/setter/bibframe/BibframeSortTitleProcessor.java deleted file mode 100644 index 0a3930f42..000000000 --- a/src/main/java/org/folio/search/service/setter/bibframe/BibframeSortTitleProcessor.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.folio.search.service.setter.bibframe; - -import static java.util.Optional.ofNullable; - -import java.util.Collection; -import java.util.Objects; -import java.util.stream.Collectors; -import java.util.stream.Stream; -import org.apache.commons.lang3.StringUtils; -import org.folio.search.domain.dto.Bibframe; -import org.folio.search.domain.dto.BibframeInstancesInner; -import org.folio.search.domain.dto.BibframeTitlesInner; -import org.folio.search.service.setter.FieldProcessor; -import org.springframework.stereotype.Component; - -@Component -public class BibframeSortTitleProcessor implements FieldProcessor { - - @Override - public String getFieldValue(Bibframe bibframe) { - var workTitles = ofNullable(bibframe.getTitles()).stream().flatMap(Collection::stream); - var instanceTitles = ofNullable(bibframe.getInstances()).stream().flatMap(Collection::stream) - .map(BibframeInstancesInner::getTitles).filter(Objects::nonNull).flatMap(Collection::stream); - return Stream.concat(workTitles, instanceTitles) - .filter(Objects::nonNull) - .map(BibframeTitlesInner::getValue) - .filter(StringUtils::isNotBlank) - .collect(Collectors.joining()); - } - -} diff --git a/src/main/java/org/folio/search/service/setter/bibframe/BibframeTitleProcessor.java b/src/main/java/org/folio/search/service/setter/bibframe/BibframeTitleProcessor.java deleted file mode 100644 index 488f6340f..000000000 --- a/src/main/java/org/folio/search/service/setter/bibframe/BibframeTitleProcessor.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.folio.search.service.setter.bibframe; - -import static java.util.Optional.ofNullable; -import static java.util.stream.Collectors.toCollection; - -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.Objects; -import java.util.Set; -import java.util.stream.Stream; -import org.apache.commons.lang3.StringUtils; -import org.folio.search.domain.dto.Bibframe; -import org.folio.search.domain.dto.BibframeInstancesInner; -import org.folio.search.domain.dto.BibframeTitlesInner; -import org.folio.search.service.setter.FieldProcessor; -import org.springframework.stereotype.Component; - -@Component -public class BibframeTitleProcessor implements FieldProcessor> { - - @Override - public Set getFieldValue(Bibframe bibframe) { - var workTitles = ofNullable(bibframe.getTitles()).stream().flatMap(Collection::stream); - var instTitles = ofNullable(bibframe.getInstances()).stream().flatMap(Collection::stream).filter(Objects::nonNull) - .map(BibframeInstancesInner::getTitles).filter(Objects::nonNull).flatMap(Collection::stream); - return Stream.concat(workTitles, instTitles) - .filter(Objects::nonNull) - .map(BibframeTitlesInner::getValue) - .filter(StringUtils::isNotBlank) - .map(String::trim) - .collect(toCollection(LinkedHashSet::new)); - } - -} diff --git a/src/main/java/org/folio/search/service/setter/bibframe/authority/BibframeAuthorityLccnProcessor.java b/src/main/java/org/folio/search/service/setter/linkeddata/authority/LinkedDataAuthorityLccnProcessor.java similarity index 54% rename from src/main/java/org/folio/search/service/setter/bibframe/authority/BibframeAuthorityLccnProcessor.java rename to src/main/java/org/folio/search/service/setter/linkeddata/authority/LinkedDataAuthorityLccnProcessor.java index 8c910e5e3..b8c6c47bc 100644 --- a/src/main/java/org/folio/search/service/setter/bibframe/authority/BibframeAuthorityLccnProcessor.java +++ b/src/main/java/org/folio/search/service/setter/linkeddata/authority/LinkedDataAuthorityLccnProcessor.java @@ -1,7 +1,7 @@ -package org.folio.search.service.setter.bibframe.authority; +package org.folio.search.service.setter.linkeddata.authority; import static java.util.stream.Collectors.toCollection; -import static org.folio.search.domain.dto.BibframeAuthorityIdentifiersInner.TypeEnum.LCCN; +import static org.folio.search.domain.dto.LinkedDataAuthorityIdentifiersInner.TypeEnum.LCCN; import java.util.Collections; import java.util.LinkedHashSet; @@ -9,26 +9,26 @@ import java.util.Optional; import java.util.Set; import lombok.RequiredArgsConstructor; -import org.folio.search.domain.dto.BibframeAuthority; -import org.folio.search.domain.dto.BibframeAuthorityIdentifiersInner; +import org.folio.search.domain.dto.LinkedDataAuthority; +import org.folio.search.domain.dto.LinkedDataAuthorityIdentifiersInner; import org.folio.search.service.lccn.LccnNormalizer; import org.folio.search.service.setter.FieldProcessor; import org.springframework.stereotype.Component; @Component @RequiredArgsConstructor -public class BibframeAuthorityLccnProcessor implements FieldProcessor> { +public class LinkedDataAuthorityLccnProcessor implements FieldProcessor> { private final LccnNormalizer lccnNormalizer; @Override - public Set getFieldValue(BibframeAuthority bibframe) { - return Optional.of(bibframe) - .map(BibframeAuthority::getIdentifiers) + public Set getFieldValue(LinkedDataAuthority linkedDataAuthority) { + return Optional.of(linkedDataAuthority) + .map(LinkedDataAuthority::getIdentifiers) .orElseGet(Collections::emptyList) .stream() .filter(i -> LCCN.equals(i.getType())) - .map(BibframeAuthorityIdentifiersInner::getValue) + .map(LinkedDataAuthorityIdentifiersInner::getValue) .filter(Objects::nonNull) .map(lccnNormalizer) .flatMap(Optional::stream) diff --git a/src/main/java/org/folio/search/service/setter/linkeddata/work/LinkedDataWorkContributorProcessor.java b/src/main/java/org/folio/search/service/setter/linkeddata/work/LinkedDataWorkContributorProcessor.java new file mode 100644 index 000000000..b649c417d --- /dev/null +++ b/src/main/java/org/folio/search/service/setter/linkeddata/work/LinkedDataWorkContributorProcessor.java @@ -0,0 +1,34 @@ +package org.folio.search.service.setter.linkeddata.work; + +import static java.util.Optional.ofNullable; +import static java.util.stream.Collectors.toCollection; + +import java.util.Collection; +import java.util.LinkedHashSet; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Stream; +import org.apache.commons.lang3.StringUtils; +import org.folio.search.domain.dto.LinkedDataWork; +import org.folio.search.domain.dto.LinkedDataWorkContributorsInner; +import org.folio.search.domain.dto.LinkedDataWorkInstancesInner; +import org.folio.search.service.setter.FieldProcessor; +import org.springframework.stereotype.Component; + +@Component +public class LinkedDataWorkContributorProcessor implements FieldProcessor> { + + @Override + public Set getFieldValue(LinkedDataWork linkedDataWork) { + var workContributors = ofNullable(linkedDataWork.getContributors()).stream().flatMap(Collection::stream); + var instanceContributors = ofNullable(linkedDataWork.getInstances()).stream().flatMap(Collection::stream) + .map(LinkedDataWorkInstancesInner::getContributors).filter(Objects::nonNull).flatMap(Collection::stream); + return Stream.concat(workContributors, instanceContributors) + .filter(Objects::nonNull) + .map(LinkedDataWorkContributorsInner::getName) + .filter(StringUtils::isNotBlank) + .map(String::trim) + .collect(toCollection(LinkedHashSet::new)); + } + +} diff --git a/src/main/java/org/folio/search/service/setter/bibframe/BibframeIsbnProcessor.java b/src/main/java/org/folio/search/service/setter/linkeddata/work/LinkedDataWorkIsbnProcessor.java similarity index 60% rename from src/main/java/org/folio/search/service/setter/bibframe/BibframeIsbnProcessor.java rename to src/main/java/org/folio/search/service/setter/linkeddata/work/LinkedDataWorkIsbnProcessor.java index 493240fcf..84181672a 100644 --- a/src/main/java/org/folio/search/service/setter/bibframe/BibframeIsbnProcessor.java +++ b/src/main/java/org/folio/search/service/setter/linkeddata/work/LinkedDataWorkIsbnProcessor.java @@ -1,35 +1,35 @@ -package org.folio.search.service.setter.bibframe; +package org.folio.search.service.setter.linkeddata.work; import static java.util.Objects.nonNull; import static java.util.Optional.ofNullable; import static java.util.stream.Collectors.toCollection; -import static org.folio.search.domain.dto.BibframeInstancesInnerIdentifiersInner.TypeEnum.ISBN; +import static org.folio.search.domain.dto.LinkedDataWorkInstancesInnerIdentifiersInner.TypeEnum.ISBN; import java.util.Collection; import java.util.LinkedHashSet; import java.util.Objects; import java.util.Set; import lombok.RequiredArgsConstructor; -import org.folio.search.domain.dto.Bibframe; -import org.folio.search.domain.dto.BibframeInstancesInnerIdentifiersInner; +import org.folio.search.domain.dto.LinkedDataWork; +import org.folio.search.domain.dto.LinkedDataWorkInstancesInnerIdentifiersInner; import org.folio.search.service.setter.FieldProcessor; import org.folio.search.service.setter.instance.IsbnProcessor; import org.springframework.stereotype.Component; @Component @RequiredArgsConstructor -public class BibframeIsbnProcessor implements FieldProcessor> { +public class LinkedDataWorkIsbnProcessor implements FieldProcessor> { private final IsbnProcessor isbnProcessor; @Override - public Set getFieldValue(Bibframe bibframe) { - return ofNullable(bibframe.getInstances()).stream() + public Set getFieldValue(LinkedDataWork linkedDataWork) { + return ofNullable(linkedDataWork.getInstances()).stream() .flatMap(Collection::stream) .filter(i -> nonNull(i.getIdentifiers())) .flatMap(i -> i.getIdentifiers().stream()) .filter(i -> ISBN.equals(i.getType())) - .map(BibframeInstancesInnerIdentifiersInner::getValue) + .map(LinkedDataWorkInstancesInnerIdentifiersInner::getValue) .filter(Objects::nonNull) .map(isbnProcessor::normalizeIsbn) .flatMap(Collection::stream) diff --git a/src/main/java/org/folio/search/service/setter/bibframe/BibframeLccnProcessor.java b/src/main/java/org/folio/search/service/setter/linkeddata/work/LinkedDataWorkLccnProcessor.java similarity index 63% rename from src/main/java/org/folio/search/service/setter/bibframe/BibframeLccnProcessor.java rename to src/main/java/org/folio/search/service/setter/linkeddata/work/LinkedDataWorkLccnProcessor.java index 814229c13..072907662 100644 --- a/src/main/java/org/folio/search/service/setter/bibframe/BibframeLccnProcessor.java +++ b/src/main/java/org/folio/search/service/setter/linkeddata/work/LinkedDataWorkLccnProcessor.java @@ -1,9 +1,9 @@ -package org.folio.search.service.setter.bibframe; +package org.folio.search.service.setter.linkeddata.work; import static java.util.Objects.nonNull; import static java.util.Optional.ofNullable; import static java.util.stream.Collectors.toCollection; -import static org.folio.search.domain.dto.BibframeInstancesInnerIdentifiersInner.TypeEnum.LCCN; +import static org.folio.search.domain.dto.LinkedDataWorkInstancesInnerIdentifiersInner.TypeEnum.LCCN; import java.util.Collection; import java.util.LinkedHashSet; @@ -11,8 +11,8 @@ import java.util.Optional; import java.util.Set; import lombok.RequiredArgsConstructor; -import org.folio.search.domain.dto.Bibframe; -import org.folio.search.domain.dto.BibframeInstancesInnerIdentifiersInner; +import org.folio.search.domain.dto.LinkedDataWork; +import org.folio.search.domain.dto.LinkedDataWorkInstancesInnerIdentifiersInner; import org.folio.search.service.lccn.LccnNormalizer; import org.folio.search.service.setter.FieldProcessor; import org.springframework.beans.factory.annotation.Qualifier; @@ -20,19 +20,19 @@ @Component @RequiredArgsConstructor -public class BibframeLccnProcessor implements FieldProcessor> { +public class LinkedDataWorkLccnProcessor implements FieldProcessor> { @Qualifier("lccnNormalizerStructureB") private final LccnNormalizer lccnNormalizer; @Override - public Set getFieldValue(Bibframe bibframe) { - return ofNullable(bibframe.getInstances()).stream() + public Set getFieldValue(LinkedDataWork linkedDataWork) { + return ofNullable(linkedDataWork.getInstances()).stream() .flatMap(Collection::stream) .filter(i -> nonNull(i.getIdentifiers())) .flatMap(i -> i.getIdentifiers().stream()) .filter(i -> LCCN.equals(i.getType())) - .map(BibframeInstancesInnerIdentifiersInner::getValue) + .map(LinkedDataWorkInstancesInnerIdentifiersInner::getValue) .filter(Objects::nonNull) .map(lccnNormalizer) .flatMap(Optional::stream) diff --git a/src/main/java/org/folio/search/service/setter/linkeddata/work/LinkedDataWorkSortTitleProcessor.java b/src/main/java/org/folio/search/service/setter/linkeddata/work/LinkedDataWorkSortTitleProcessor.java new file mode 100644 index 000000000..620c8d7c0 --- /dev/null +++ b/src/main/java/org/folio/search/service/setter/linkeddata/work/LinkedDataWorkSortTitleProcessor.java @@ -0,0 +1,31 @@ +package org.folio.search.service.setter.linkeddata.work; + +import static java.util.Optional.ofNullable; + +import java.util.Collection; +import java.util.Objects; +import java.util.stream.Collectors; +import java.util.stream.Stream; +import org.apache.commons.lang3.StringUtils; +import org.folio.search.domain.dto.LinkedDataWork; +import org.folio.search.domain.dto.LinkedDataWorkInstancesInner; +import org.folio.search.domain.dto.LinkedDataWorkTitlesInner; +import org.folio.search.service.setter.FieldProcessor; +import org.springframework.stereotype.Component; + +@Component +public class LinkedDataWorkSortTitleProcessor implements FieldProcessor { + + @Override + public String getFieldValue(LinkedDataWork linkedDataWork) { + var workTitles = ofNullable(linkedDataWork.getTitles()).stream().flatMap(Collection::stream); + var instanceTitles = ofNullable(linkedDataWork.getInstances()).stream().flatMap(Collection::stream) + .map(LinkedDataWorkInstancesInner::getTitles).filter(Objects::nonNull).flatMap(Collection::stream); + return Stream.concat(workTitles, instanceTitles) + .filter(Objects::nonNull) + .map(LinkedDataWorkTitlesInner::getValue) + .filter(StringUtils::isNotBlank) + .collect(Collectors.joining()); + } + +} diff --git a/src/main/java/org/folio/search/service/setter/linkeddata/work/LinkedDataWorkTitleProcessor.java b/src/main/java/org/folio/search/service/setter/linkeddata/work/LinkedDataWorkTitleProcessor.java new file mode 100644 index 000000000..4e2373fd2 --- /dev/null +++ b/src/main/java/org/folio/search/service/setter/linkeddata/work/LinkedDataWorkTitleProcessor.java @@ -0,0 +1,37 @@ +package org.folio.search.service.setter.linkeddata.work; + +import static java.util.Optional.ofNullable; +import static java.util.stream.Collectors.toCollection; + +import java.util.Collection; +import java.util.LinkedHashSet; +import java.util.Objects; +import java.util.Set; +import java.util.stream.Stream; +import org.apache.commons.lang3.StringUtils; +import org.folio.search.domain.dto.LinkedDataWork; +import org.folio.search.domain.dto.LinkedDataWorkInstancesInner; +import org.folio.search.domain.dto.LinkedDataWorkTitlesInner; +import org.folio.search.service.setter.FieldProcessor; +import org.springframework.stereotype.Component; + +@Component +public class LinkedDataWorkTitleProcessor implements FieldProcessor> { + + @Override + public Set getFieldValue(LinkedDataWork linkedDataWork) { + var workTitles = ofNullable(linkedDataWork.getTitles()).stream().flatMap(Collection::stream); + var instTitles = ofNullable(linkedDataWork.getInstances()).stream().flatMap(Collection::stream) + .filter(Objects::nonNull) + .map(LinkedDataWorkInstancesInner::getTitles) + .filter(Objects::nonNull) + .flatMap(Collection::stream); + return Stream.concat(workTitles, instTitles) + .filter(Objects::nonNull) + .map(LinkedDataWorkTitlesInner::getValue) + .filter(StringUtils::isNotBlank) + .map(String::trim) + .collect(toCollection(LinkedHashSet::new)); + } + +} diff --git a/src/main/java/org/folio/search/utils/KafkaConstants.java b/src/main/java/org/folio/search/utils/KafkaConstants.java index d192c4245..d7cf318c5 100644 --- a/src/main/java/org/folio/search/utils/KafkaConstants.java +++ b/src/main/java/org/folio/search/utils/KafkaConstants.java @@ -8,7 +8,7 @@ public final class KafkaConstants { public static final String CONSORTIUM_INSTANCE_LISTENER_ID = "mod-search-consortium-instance-listener"; public static final String CLASSIFICATION_TYPE_LISTENER_ID = "mod-search-classification-type-listener"; public static final String LOCATION_LISTENER_ID = "mod-search-location-listener"; - public static final String BIBFRAME_LISTENER_ID = "mod-search-bibframe-listener"; + public static final String LINKED_DATA_LISTENER_ID = "mod-search-linked-data-listener"; private KafkaConstants() {} } diff --git a/src/main/java/org/folio/search/utils/SearchUtils.java b/src/main/java/org/folio/search/utils/SearchUtils.java index b6a02a406..cd6faa19f 100644 --- a/src/main/java/org/folio/search/utils/SearchUtils.java +++ b/src/main/java/org/folio/search/utils/SearchUtils.java @@ -38,8 +38,8 @@ public class SearchUtils { public static final String CONTRIBUTOR_RESOURCE = getResourceName(Contributor.class); public static final String LOCATION_RESOURCE = "location"; public static final String CLASSIFICATION_TYPE_RESOURCE = "classification-type"; - public static final String BIBFRAME_RESOURCE = "bibframe"; - public static final String BIBFRAME_AUTHORITY_RESOURCE = "bibframe-authority"; + public static final String LINKED_DATA_WORK_RESOURCE = "linked-data-work"; + public static final String LINKED_DATA_AUTHORITY_RESOURCE = "linked-data-authority"; public static final String CAMPUS_RESOURCE = "campus"; public static final String INSTITUTION_RESOURCE = "institution"; public static final String LIBRARY_RESOURCE = "library"; diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index fabf0d0f7..3a2cdf70d 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -137,10 +137,10 @@ folio: concurrency: ${KAFKA_LOCATION_CONCURRENCY:1} topic-pattern: (${folio.environment}\.)(.*\.)inventory\.(location|campus|institution|library) group-id: ${folio.environment}-mod-search-location-type-group - bibframe: - concurrency: ${KAFKA_BIBFRAME_CONCURRENCY:1} - topic-pattern: (${folio.environment}\.)(.*\.)search\.(bibframe|bibframe-authorities) - group-id: ${folio.environment}-mod-search-bibframe-group + linked-data: + concurrency: ${KAFKA_LINKED_DATA_CONCURRENCY:1} + topic-pattern: (${folio.environment}\.)(.*\.)linked-data\.(work|authority) + group-id: ${folio.environment}-mod-search-linked-data-group okapiUrl: ${okapi.url} logging: request: diff --git a/src/main/resources/elasticsearch/index/bibframe-authority.json b/src/main/resources/elasticsearch/index/linked-data-authority.json similarity index 100% rename from src/main/resources/elasticsearch/index/bibframe-authority.json rename to src/main/resources/elasticsearch/index/linked-data-authority.json diff --git a/src/main/resources/elasticsearch/index/bibframe.json b/src/main/resources/elasticsearch/index/linked-data-work.json similarity index 100% rename from src/main/resources/elasticsearch/index/bibframe.json rename to src/main/resources/elasticsearch/index/linked-data-work.json diff --git a/src/main/resources/model/bibframe_authority.json b/src/main/resources/model/linked_data_authority.json similarity index 75% rename from src/main/resources/model/bibframe_authority.json rename to src/main/resources/model/linked_data_authority.json index 10eb0bd15..c3fe1b075 100644 --- a/src/main/resources/model/bibframe_authority.json +++ b/src/main/resources/model/linked_data_authority.json @@ -1,6 +1,6 @@ { - "name": "bibframe-authority", - "eventBodyJavaClass": "org.folio.search.domain.dto.BibframeAuthority", + "name": "linked-data-authority", + "eventBodyJavaClass": "org.folio.search.domain.dto.LinkedDataAuthority", "reindexSupported": false, "fields": { "id": { @@ -28,7 +28,7 @@ "lccn": { "type": "search", "index": "keyword", - "processor": "bibframeAuthorityLccnProcessor" + "processor": "linkedDataAuthorityLccnProcessor" } }, "indexMappings": { } diff --git a/src/main/resources/model/bibframe.json b/src/main/resources/model/linked_data_work.json similarity index 89% rename from src/main/resources/model/bibframe.json rename to src/main/resources/model/linked_data_work.json index a58546f9c..55858d59f 100644 --- a/src/main/resources/model/bibframe.json +++ b/src/main/resources/model/linked_data_work.json @@ -1,6 +1,6 @@ { - "name": "bibframe", - "eventBodyJavaClass": "org.folio.search.domain.dto.Bibframe", + "name": "linked-data-work", + "eventBodyJavaClass": "org.folio.search.domain.dto.LinkedDataWork", "languageSourcePaths": [ "$.languages" ], "fields": { "id": { @@ -125,7 +125,7 @@ "searchFields": { "isbn": { "type": "search", - "processor": "bibframeIsbnProcessor", + "processor": "linkedDataWorkIsbnProcessor", "searchTermProcessor": "isbnSearchTermProcessor", "index": "standard", "indexPlainValue": false @@ -133,23 +133,23 @@ "lccn": { "type": "search", "index": "standard", - "processor": "bibframeLccnProcessor" + "processor": "linkedDataWorkLccnProcessor" }, "title": { "type": "search", "index": "multilang", - "processor": "bibframeTitleProcessor" + "processor": "linkedDataWorkTitleProcessor" }, "sort_title": { "searchTypes": "sort", "type": "search", "index": "keyword_lowercase", - "processor": "bibframeSortTitleProcessor" + "processor": "linkedDataWorkSortTitleProcessor" }, "contributor": { "type": "search", "index": "multilang", - "processor": "bibframeContributorProcessor" + "processor": "linkedDataWorkContributorProcessor" } }, "indexMappings": { } diff --git a/src/main/resources/swagger.api/examples/result/bibframeSearchAuthorityResult.yaml b/src/main/resources/swagger.api/examples/result/linkedDataSearchAuthorityResult.yaml similarity index 100% rename from src/main/resources/swagger.api/examples/result/bibframeSearchAuthorityResult.yaml rename to src/main/resources/swagger.api/examples/result/linkedDataSearchAuthorityResult.yaml diff --git a/src/main/resources/swagger.api/examples/result/bibframeSearchResult.yaml b/src/main/resources/swagger.api/examples/result/linkedDataWorkSearchResult.yaml similarity index 100% rename from src/main/resources/swagger.api/examples/result/bibframeSearchResult.yaml rename to src/main/resources/swagger.api/examples/result/linkedDataWorkSearchResult.yaml diff --git a/src/main/resources/swagger.api/mod-search.yaml b/src/main/resources/swagger.api/mod-search.yaml index 82244abec..ff6a32d79 100644 --- a/src/main/resources/swagger.api/mod-search.yaml +++ b/src/main/resources/swagger.api/mod-search.yaml @@ -121,11 +121,11 @@ paths: /search/config/features/{featureId}: $ref: 'paths/search-config/search-config-features-feature-id.yaml' - /search/bibframe: - $ref: 'paths/search-bibframe/search-bibframe.yaml' + /search/linked-data/works: + $ref: 'paths/search-linked-data/search-linked-data-works.yaml' - /search/bibframe/authorities: - $ref: 'paths/search-bibframe/search-bibframe-authorities.yaml' + /search/linked-data/authorities: + $ref: 'paths/search-linked-data/search-linked-data-authorities.yaml' /browse/call-numbers/instances: $ref: 'paths/browse-call-numbers/browse-call-numbers-instances.yaml' diff --git a/src/main/resources/swagger.api/parameters/bibframe-limit-param.yaml b/src/main/resources/swagger.api/parameters/linked-data-limit-param.yaml similarity index 100% rename from src/main/resources/swagger.api/parameters/bibframe-limit-param.yaml rename to src/main/resources/swagger.api/parameters/linked-data-limit-param.yaml diff --git a/src/main/resources/swagger.api/paths/search-bibframe/search-bibframe-authorities.yaml b/src/main/resources/swagger.api/paths/search-linked-data/search-linked-data-authorities.yaml similarity index 51% rename from src/main/resources/swagger.api/paths/search-bibframe/search-bibframe-authorities.yaml rename to src/main/resources/swagger.api/paths/search-linked-data/search-linked-data-authorities.yaml index 3035a98b6..3fb9ecfe9 100644 --- a/src/main/resources/swagger.api/paths/search-bibframe/search-bibframe-authorities.yaml +++ b/src/main/resources/swagger.api/paths/search-linked-data/search-linked-data-authorities.yaml @@ -1,24 +1,24 @@ get: - operationId: searchBibframeAuthorities - summary: Search Bibframe Authorities - description: Get a list of bibframe authorities records for CQL query + operationId: searchLinkedDataAuthorities + summary: Search Linked Data Authorities + description: Get a list of linked data authorities records for CQL query tags: - search parameters: - $ref: '../../parameters/x-okapi-tenant-header.yaml' - $ref: '../../parameters/cql-query.yaml' - - $ref: '../../parameters/bibframe-limit-param.yaml' + - $ref: '../../parameters/linked-data-limit-param.yaml' - $ref: '../../parameters/offset-param.yaml' responses: '200': - description: 'Bibframe authorities search result' + description: 'Linked data authorities search result' content: application/json: schema: - $ref: '../../schemas/response/bibframeSearchAuthorityResult.yaml' + $ref: '../../schemas/response/linkedDataAuthoritySearchResult.yaml' examples: searchResult: - $ref: '../../examples/result/bibframeSearchAuthorityResult.yaml' + $ref: '../../examples/result/linkedDataSearchAuthorityResult.yaml' '400': $ref: '../../responses/badRequestResponse.yaml' '500': diff --git a/src/main/resources/swagger.api/paths/search-bibframe/search-bibframe.yaml b/src/main/resources/swagger.api/paths/search-linked-data/search-linked-data-works.yaml similarity index 53% rename from src/main/resources/swagger.api/paths/search-bibframe/search-bibframe.yaml rename to src/main/resources/swagger.api/paths/search-linked-data/search-linked-data-works.yaml index 91191d6dd..e2aa30b91 100644 --- a/src/main/resources/swagger.api/paths/search-bibframe/search-bibframe.yaml +++ b/src/main/resources/swagger.api/paths/search-linked-data/search-linked-data-works.yaml @@ -1,24 +1,24 @@ get: - operationId: searchBibframe - summary: Search Bibframe - description: Get a list of bibframe records for CQL query + operationId: searchLinkedDataWorks + summary: Search Linked Data Works + description: Get a list of linked data records for CQL query tags: - search parameters: - $ref: '../../parameters/x-okapi-tenant-header.yaml' - $ref: '../../parameters/cql-query.yaml' - - $ref: '../../parameters/bibframe-limit-param.yaml' + - $ref: '../../parameters/linked-data-limit-param.yaml' - $ref: '../../parameters/offset-param.yaml' responses: '200': - description: 'Bibframe search result' + description: 'Linked data works search result' content: application/json: schema: - $ref: '../../schemas/response/bibframeSearchResult.yaml' + $ref: '../../schemas/response/linkedDataWorkSearchResult.yaml' examples: searchResult: - $ref: '../../examples/result/bibframeSearchResult.yaml' + $ref: '../../examples/result/linkedDataWorkSearchResult.yaml' '400': $ref: '../../responses/badRequestResponse.yaml' '500': diff --git a/src/main/resources/swagger.api/schemas/dto/bibframe/bibframeAuthority.yaml b/src/main/resources/swagger.api/schemas/dto/linked-data/linkedDataAuthority.yaml similarity index 75% rename from src/main/resources/swagger.api/schemas/dto/bibframe/bibframeAuthority.yaml rename to src/main/resources/swagger.api/schemas/dto/linked-data/linkedDataAuthority.yaml index 8e39d0e11..bd652010f 100644 --- a/src/main/resources/swagger.api/schemas/dto/bibframe/bibframeAuthority.yaml +++ b/src/main/resources/swagger.api/schemas/dto/linked-data/linkedDataAuthority.yaml @@ -1,4 +1,4 @@ -description: "Bibframe authority search dto, contains Authority and Identifiers" +description: "Linked data authority search dto, contains Authority and Identifiers" type: "object" properties: id: @@ -11,7 +11,7 @@ properties: type: "string" identifiers: type: "array" - description: "Authority identifier array" + description: "Linked data authority identifier array" items: properties: value: diff --git a/src/main/resources/swagger.api/schemas/dto/bibframe/bibframe.yaml b/src/main/resources/swagger.api/schemas/dto/linked-data/linkedDataWork.yaml similarity index 98% rename from src/main/resources/swagger.api/schemas/dto/bibframe/bibframe.yaml rename to src/main/resources/swagger.api/schemas/dto/linked-data/linkedDataWork.yaml index df2dc34b5..5423522fd 100644 --- a/src/main/resources/swagger.api/schemas/dto/bibframe/bibframe.yaml +++ b/src/main/resources/swagger.api/schemas/dto/linked-data/linkedDataWork.yaml @@ -1,4 +1,4 @@ -description: "Bibframe search dto, contains Work and linked Instances" +description: "Linked data work search dto, contains Work and linked Instances" type: "object" properties: id: diff --git a/src/main/resources/swagger.api/schemas/response/bibframeSearchAuthorityResult.yaml b/src/main/resources/swagger.api/schemas/response/linkedDataAuthoritySearchResult.yaml similarity index 66% rename from src/main/resources/swagger.api/schemas/response/bibframeSearchAuthorityResult.yaml rename to src/main/resources/swagger.api/schemas/response/linkedDataAuthoritySearchResult.yaml index dbb62830d..34fa1830d 100644 --- a/src/main/resources/swagger.api/schemas/response/bibframeSearchAuthorityResult.yaml +++ b/src/main/resources/swagger.api/schemas/response/linkedDataAuthoritySearchResult.yaml @@ -1,4 +1,4 @@ -description: "Bibframe authority search result response" +description: "Linked data authority search result response" type: "object" properties: searchQuery: @@ -6,9 +6,9 @@ properties: description: "Initial search query" content: type: "array" - description: "List of bibframe authority records found" + description: "List of linked data authority records found" items: - $ref: "../../schemas/dto/bibframe/bibframeAuthority.yaml" + $ref: "../../schemas/dto/linked-data/linkedDataAuthority.yaml" pageNumber: type: "integer" description: "Current results page number, 0 by default" diff --git a/src/main/resources/swagger.api/schemas/response/bibframeSearchResult.yaml b/src/main/resources/swagger.api/schemas/response/linkedDataWorkSearchResult.yaml similarity index 69% rename from src/main/resources/swagger.api/schemas/response/bibframeSearchResult.yaml rename to src/main/resources/swagger.api/schemas/response/linkedDataWorkSearchResult.yaml index dcc4203fa..a0eb0f6ad 100644 --- a/src/main/resources/swagger.api/schemas/response/bibframeSearchResult.yaml +++ b/src/main/resources/swagger.api/schemas/response/linkedDataWorkSearchResult.yaml @@ -1,4 +1,4 @@ -description: "Bibframe search result response" +description: "Linked data search result response" type: "object" properties: searchQuery: @@ -6,9 +6,9 @@ properties: description: "Initial search query" content: type: "array" - description: "List of bibframe records found" + description: "List of linked data records found" items: - $ref: "../../schemas/dto/bibframe/bibframe.yaml" + $ref: "../../schemas/dto/linked-data/linkedDataWork.yaml" pageNumber: type: "integer" description: "Current results page number, 0 by default" diff --git a/src/test/java/org/folio/search/controller/SearchControllerTest.java b/src/test/java/org/folio/search/controller/SearchControllerTest.java index 264b9856f..c0abe04ab 100644 --- a/src/test/java/org/folio/search/controller/SearchControllerTest.java +++ b/src/test/java/org/folio/search/controller/SearchControllerTest.java @@ -16,9 +16,9 @@ import java.util.stream.Stream; import org.folio.search.domain.dto.Authority; -import org.folio.search.domain.dto.Bibframe; -import org.folio.search.domain.dto.BibframeAuthority; import org.folio.search.domain.dto.Instance; +import org.folio.search.domain.dto.LinkedDataAuthority; +import org.folio.search.domain.dto.LinkedDataWork; import org.folio.search.exception.SearchOperationException; import org.folio.search.exception.SearchServiceException; import org.folio.search.service.SearchService; @@ -86,8 +86,8 @@ void search_positive(Class requestClass, @ValueSource(strings = { "/search/instances", "/search/authorities", - "/search/bibframe", - "/search/bibframe/authorities", + "/search/linked-data/works", + "/search/linked-data/authorities", }) void search_offset_limit_10k(String searchPath) throws Exception { @@ -137,10 +137,10 @@ void search_negative_indexNotFound(Class requestClass, @ParameterizedTest @CsvSource(value = { - "Instances , 500 , /search/instances", - "Authorities , 500 , /search/authorities", - "Bibframe , 100 , /search/bibframe", - "BibframeAuthorities , 100 , /search/bibframe/authorities", + "Instances , 500 , /search/instances", + "Authorities , 500 , /search/authorities", + "LinkedDataWorks , 100 , /search/linked-data/works", + "LinkedDataAuthorities , 100 , /search/linked-data/authorities", }) void search_negative_invalidLimitParameter(String classMessagePart, int limit, String searchPass) throws Exception { var expectedMessage = String.format("search%s.limit must be less than or equal to %s", classMessagePart, limit); @@ -211,8 +211,8 @@ private static Stream provideSearchPaths() { return Stream.of( Arguments.of(Instance.class, "/search/instances", false, 100, "$.instances"), Arguments.of(Authority.class, "/search/authorities", false, 100, "$.authorities"), - Arguments.of(Bibframe.class, "/search/bibframe", true, 10, "$.content"), - Arguments.of(BibframeAuthority.class, "/search/bibframe/authorities", true, 10, "$.content") + Arguments.of(LinkedDataWork.class, "/search/linked-data/works", true, 10, "$.content"), + Arguments.of(LinkedDataAuthority.class, "/search/linked-data/authorities", true, 10, "$.content") ); } } diff --git a/src/test/java/org/folio/search/controller/SearchBibframeAuthorityIT.java b/src/test/java/org/folio/search/controller/SearchLinkedDataAuthorityIT.java similarity index 72% rename from src/test/java/org/folio/search/controller/SearchBibframeAuthorityIT.java rename to src/test/java/org/folio/search/controller/SearchLinkedDataAuthorityIT.java index d220dd276..60fde3291 100644 --- a/src/test/java/org/folio/search/controller/SearchBibframeAuthorityIT.java +++ b/src/test/java/org/folio/search/controller/SearchLinkedDataAuthorityIT.java @@ -3,8 +3,8 @@ import static org.hamcrest.Matchers.is; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; -import org.folio.search.domain.dto.BibframeAuthority; -import org.folio.search.sample.SampleBibframe; +import org.folio.search.domain.dto.LinkedDataAuthority; +import org.folio.search.sample.SampleLinkedData; import org.folio.search.support.base.BaseIntegrationTest; import org.folio.spring.testing.type.IntegrationTest; import org.junit.jupiter.api.AfterAll; @@ -14,12 +14,12 @@ import org.junit.jupiter.params.provider.CsvSource; @IntegrationTest -class SearchBibframeAuthorityIT extends BaseIntegrationTest { +class SearchLinkedDataAuthorityIT extends BaseIntegrationTest { @BeforeAll static void prepare() { - setUpTenant(BibframeAuthority.class, 2, - SampleBibframe.getBibframeAuthorityConceptSampleAsMap(), SampleBibframe.getBibframeAuthorityPersonSampleAsMap() + setUpTenant(LinkedDataAuthority.class, 2, + SampleLinkedData.getAuthorityConceptSampleAsMap(), SampleLinkedData.getAuthorityPersonSampleAsMap() ); } @@ -28,7 +28,7 @@ static void cleanUp() { removeTenant(); } - @DisplayName("search by authority bibframe (all authorities are found)") + @DisplayName("search by linked data authority (all authorities are found)") @ParameterizedTest(name = "[{0}] {2}") @CsvSource({ " 1, 2, label any \"*\"", @@ -51,8 +51,8 @@ static void cleanUp() { "18, 1, lccn any \"*0123456789\" AND type = \"PERSON\"", "19, 1, lccn any \"*0123456789\" AND type = \"CONCEPT\"" }) - void searchByBibframe_parameterized_singleResult(int index, int size, String query) throws Throwable { - doSearchByBibframeAuthority(query) + void searchByLinkedDataAuthority_parameterized_singleResult(int index, int size, String query) throws Throwable { + doSearchByLinkedDataAuthority(query) .andExpect(jsonPath("$.totalRecords", is(size))); } } diff --git a/src/test/java/org/folio/search/controller/SearchBibframeIT.java b/src/test/java/org/folio/search/controller/SearchLinkedDataWorkIT.java similarity index 91% rename from src/test/java/org/folio/search/controller/SearchBibframeIT.java rename to src/test/java/org/folio/search/controller/SearchLinkedDataWorkIT.java index 48fa0a74c..878176fc2 100644 --- a/src/test/java/org/folio/search/controller/SearchBibframeIT.java +++ b/src/test/java/org/folio/search/controller/SearchLinkedDataWorkIT.java @@ -2,12 +2,12 @@ import static java.lang.String.format; import static java.lang.String.join; -import static org.folio.search.sample.SampleBibframe.getBibframe2SampleAsMap; -import static org.folio.search.sample.SampleBibframe.getBibframeSampleAsMap; +import static org.folio.search.sample.SampleLinkedData.getWork2SampleAsMap; +import static org.folio.search.sample.SampleLinkedData.getWorkSampleAsMap; import static org.hamcrest.Matchers.is; import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; -import org.folio.search.domain.dto.Bibframe; +import org.folio.search.domain.dto.LinkedDataWork; import org.folio.search.support.base.BaseIntegrationTest; import org.folio.spring.testing.type.IntegrationTest; import org.junit.jupiter.api.AfterAll; @@ -17,11 +17,11 @@ import org.junit.jupiter.params.provider.CsvSource; @IntegrationTest -class SearchBibframeIT extends BaseIntegrationTest { +class SearchLinkedDataWorkIT extends BaseIntegrationTest { @BeforeAll static void prepare() { - setUpTenant(Bibframe.class, 2, getBibframeSampleAsMap(), getBibframe2SampleAsMap()); + setUpTenant(LinkedDataWork.class, 2, getWorkSampleAsMap(), getWork2SampleAsMap()); } @AfterAll @@ -29,7 +29,7 @@ static void cleanUp() { removeTenant(); } - @DisplayName("search by bibframe (all 2 bibframe are found)") + @DisplayName("search by linked data works (all 2 works are found)") @ParameterizedTest(name = "[{0}] {1}") @CsvSource({ "1, cql.allRecords = 1", @@ -54,15 +54,15 @@ static void cleanUp() { "20, title all \"titleAbc\" sortBy title/sort.ascending", "21, title all \"titleAbc\" sortBy title/sort.descending", }) - void searchByBibframe_parameterized_allResults(int index, String query) throws Throwable { + void searchByLinkedDataWork_parameterized_allResults(int index, String query) throws Throwable { var asc = query.contains("titleAbc def") || query.contains("sortBy") && !query.contains("descending"); - doSearchByBibframe(query) + doSearchByLinkedDataWork(query) .andExpect(jsonPath("$.totalRecords", is(2))) .andExpect(jsonPath("$.content[0].titles[0].value", is(asc ? "titleAbc def" : "titleAbc xyz"))) .andExpect(jsonPath("$.content[1].titles[0].value", is(asc ? "titleAbc xyz" : "titleAbc def"))); } - @DisplayName("search by bibframe (single bibframe is found)") + @DisplayName("search by linked data work (single work is found)") @ParameterizedTest(name = "[{0}] {1}") @CsvSource({ "1, title any \"def\"", @@ -91,8 +91,8 @@ void searchByBibframe_parameterized_allResults(int index, String query) throws T "24, contributor any Person", "25, contributor all Family" }) - void searchByBibframe_parameterized_singleResult(int index, String query) throws Throwable { - doSearchByBibframe(query) + void searchByLinkedDataWork_parameterized_singleResult(int index, String query) throws Throwable { + doSearchByLinkedDataWork(query) .andExpect(jsonPath("$.totalRecords", is(1))) .andExpect(jsonPath(toId(toWork()), is("123456123456"))) .andExpect(jsonPath(toTitleValue(toWork(), 0), is("titleAbc def"))) @@ -152,7 +152,7 @@ void searchByBibframe_parameterized_singleResult(int index, String query) throws ; } - @DisplayName("search by bibframe (nothing is found)") + @DisplayName("search by liked data work (nothing is found)") @ParameterizedTest(name = "[{0}] {1}") @CsvSource({ "1, title ==/string \"titleAbc\"", @@ -186,8 +186,8 @@ void searchByBibframe_parameterized_singleResult(int index, String query) throws "29, contributor = \"comm\"", "30, contributor <> \"common\"", }) - void searchByBibframe_parameterized_zeroResults(int index, String query) throws Throwable { - doSearchByBibframe(query) + void searchByLinkedDataWork_parameterized_zeroResults(int index, String query) throws Throwable { + doSearchByLinkedDataWork(query) .andExpect(jsonPath("$.totalRecords", is(0))); } diff --git a/src/test/java/org/folio/search/integration/KafkaMessageListenerTest.java b/src/test/java/org/folio/search/integration/KafkaMessageListenerTest.java index af2ba5f01..711e59575 100644 --- a/src/test/java/org/folio/search/integration/KafkaMessageListenerTest.java +++ b/src/test/java/org/folio/search/integration/KafkaMessageListenerTest.java @@ -8,15 +8,13 @@ import static org.folio.search.domain.dto.ResourceEventType.REINDEX; import static org.folio.search.domain.dto.ResourceEventType.UPDATE; import static org.folio.search.utils.SearchUtils.AUTHORITY_RESOURCE; -import static org.folio.search.utils.SearchUtils.BIBFRAME_AUTHORITY_RESOURCE; -import static org.folio.search.utils.SearchUtils.BIBFRAME_RESOURCE; import static org.folio.search.utils.SearchUtils.CONTRIBUTOR_RESOURCE; import static org.folio.search.utils.SearchUtils.INSTANCE_RESOURCE; +import static org.folio.search.utils.SearchUtils.LINKED_DATA_AUTHORITY_RESOURCE; +import static org.folio.search.utils.SearchUtils.LINKED_DATA_WORK_RESOURCE; import static org.folio.search.utils.TestConstants.INVENTORY_INSTANCE_TOPIC; import static org.folio.search.utils.TestConstants.RESOURCE_ID; import static org.folio.search.utils.TestConstants.TENANT_ID; -import static org.folio.search.utils.TestConstants.bibframeAuthorityTopic; -import static org.folio.search.utils.TestConstants.bibframeTopic; import static org.folio.search.utils.TestConstants.consortiumInstanceTopic; import static org.folio.search.utils.TestConstants.inventoryAuthorityTopic; import static org.folio.search.utils.TestConstants.inventoryBoundWithTopic; @@ -25,6 +23,8 @@ import static org.folio.search.utils.TestConstants.inventoryHoldingTopic; import static org.folio.search.utils.TestConstants.inventoryInstanceTopic; import static org.folio.search.utils.TestConstants.inventoryItemTopic; +import static org.folio.search.utils.TestConstants.linkedDataAuthorityTopic; +import static org.folio.search.utils.TestConstants.linkedDataWorkTopic; import static org.folio.search.utils.TestUtils.OBJECT_MAPPER; import static org.folio.search.utils.TestUtils.mapOf; import static org.folio.search.utils.TestUtils.randomId; @@ -46,8 +46,8 @@ import java.util.function.BiConsumer; import org.apache.kafka.clients.consumer.ConsumerRecord; import org.folio.search.domain.dto.Authority; -import org.folio.search.domain.dto.Bibframe; -import org.folio.search.domain.dto.BibframeAuthority; +import org.folio.search.domain.dto.LinkedDataAuthority; +import org.folio.search.domain.dto.LinkedDataWork; import org.folio.search.domain.dto.ResourceEvent; import org.folio.search.domain.dto.ResourceEventType; import org.folio.search.model.event.ConsortiumInstanceEvent; @@ -292,59 +292,62 @@ void handleConsortiumInstanceEvents_negative() { } @Test - void handleBibframeEvent_positive() { - var payload = toMap(new Bibframe().id(RESOURCE_ID)); + void handleLinkedDataWorkEvent_positive() { + var payload = toMap(new LinkedDataWork().id(RESOURCE_ID)); - messageListener.handleBibframeEvents(List.of(new ConsumerRecord<>( - bibframeTopic(TENANT_ID), 0, 0, RESOURCE_ID, resourceEvent(null, BIBFRAME_RESOURCE, CREATE, payload, null)))); + var consumerRecord = new ConsumerRecord<>(linkedDataWorkTopic(TENANT_ID), 0, 0, RESOURCE_ID, + resourceEvent(null, LINKED_DATA_WORK_RESOURCE, CREATE, payload, null)); + messageListener.handleLinkedDataEvents(List.of(consumerRecord)); - var expectedEvents = singletonList(resourceEvent(RESOURCE_ID, BIBFRAME_RESOURCE, CREATE, payload, null)); + var expectedEvents = singletonList(resourceEvent(RESOURCE_ID, LINKED_DATA_WORK_RESOURCE, CREATE, payload, null)); verify(resourceService).indexResources(expectedEvents); verify(batchProcessor).consumeBatchWithFallback(eq(expectedEvents), eq(KAFKA_RETRY_TEMPLATE_NAME), any(), any()); } @Test - void handleBibframeEvent_negative_logFailedEvent() { - var payload = toMap(new Bibframe().id(RESOURCE_ID)); - var expectedEvents = List.of(resourceEvent(RESOURCE_ID, BIBFRAME_RESOURCE, UPDATE, payload, null)); + void handleLinkedDataWorkEvent_negative_logFailedEvent() { + var payload = toMap(new LinkedDataWork().id(RESOURCE_ID)); + var expectedEvents = List.of(resourceEvent(RESOURCE_ID, LINKED_DATA_WORK_RESOURCE, UPDATE, payload, null)); doAnswer(inv -> { inv.>getArgument(3).accept(expectedEvents.get(0), new Exception("error")); return null; }).when(batchProcessor).consumeBatchWithFallback(eq(expectedEvents), eq(KAFKA_RETRY_TEMPLATE_NAME), any(), any()); - messageListener.handleBibframeEvents(List.of(new ConsumerRecord<>( - bibframeTopic(TENANT_ID), 0, 0, RESOURCE_ID, resourceEvent(null, BIBFRAME_RESOURCE, UPDATE, payload, null)))); + var consumerRecord = new ConsumerRecord<>(linkedDataWorkTopic(TENANT_ID), 0, 0, RESOURCE_ID, + resourceEvent(null, LINKED_DATA_WORK_RESOURCE, UPDATE, payload, null)); + messageListener.handleLinkedDataEvents(List.of(consumerRecord)); verify(batchProcessor).consumeBatchWithFallback(eq(expectedEvents), eq(KAFKA_RETRY_TEMPLATE_NAME), any(), any()); } @Test - void handleBibframeAuthorityEvent_positive() { - var payload = toMap(new BibframeAuthority().id(RESOURCE_ID)); + void handleLinkedDataAuthorityEvent_positive() { + var payload = toMap(new LinkedDataAuthority().id(RESOURCE_ID)); - messageListener.handleBibframeEvents(List.of(new ConsumerRecord<>( - bibframeAuthorityTopic(TENANT_ID), 0, 0, RESOURCE_ID, - resourceEvent(null, BIBFRAME_AUTHORITY_RESOURCE, CREATE, payload, null)))); + messageListener.handleLinkedDataEvents(List.of(new ConsumerRecord<>( + linkedDataAuthorityTopic(TENANT_ID), 0, 0, RESOURCE_ID, + resourceEvent(null, LINKED_DATA_AUTHORITY_RESOURCE, CREATE, payload, null)))); - var expectedEvents = singletonList(resourceEvent(RESOURCE_ID, BIBFRAME_AUTHORITY_RESOURCE, CREATE, payload, null)); + var expectedEvents = singletonList( + resourceEvent(RESOURCE_ID, LINKED_DATA_AUTHORITY_RESOURCE, CREATE, payload, null)); verify(resourceService).indexResources(expectedEvents); verify(batchProcessor).consumeBatchWithFallback(eq(expectedEvents), eq(KAFKA_RETRY_TEMPLATE_NAME), any(), any()); } @Test - void handleBibframeAuthorityEvent_negative_logFailedEvent() { - var payload = toMap(new BibframeAuthority().id(RESOURCE_ID)); - var expectedEvents = List.of(resourceEvent(RESOURCE_ID, BIBFRAME_AUTHORITY_RESOURCE, UPDATE, payload, null)); + void handleLinkedDataAuthorityEvent_negative_logFailedEvent() { + var payload = toMap(new LinkedDataAuthority().id(RESOURCE_ID)); + var expectedEvents = List.of(resourceEvent(RESOURCE_ID, LINKED_DATA_AUTHORITY_RESOURCE, UPDATE, payload, null)); doAnswer(inv -> { inv.>getArgument(3).accept(expectedEvents.get(0), new Exception("error")); return null; }).when(batchProcessor).consumeBatchWithFallback(eq(expectedEvents), eq(KAFKA_RETRY_TEMPLATE_NAME), any(), any()); - messageListener.handleBibframeEvents(List.of(new ConsumerRecord<>( - bibframeAuthorityTopic(TENANT_ID), 0, 0, RESOURCE_ID, - resourceEvent(null, BIBFRAME_AUTHORITY_RESOURCE, UPDATE, payload, null)))); + messageListener.handleLinkedDataEvents(List.of(new ConsumerRecord<>( + linkedDataAuthorityTopic(TENANT_ID), 0, 0, RESOURCE_ID, + resourceEvent(null, LINKED_DATA_AUTHORITY_RESOURCE, UPDATE, payload, null)))); verify(batchProcessor).consumeBatchWithFallback(eq(expectedEvents), eq(KAFKA_RETRY_TEMPLATE_NAME), any(), any()); } diff --git a/src/test/java/org/folio/search/sample/SampleBibframe.java b/src/test/java/org/folio/search/sample/SampleBibframe.java deleted file mode 100644 index 0fc0355b6..000000000 --- a/src/test/java/org/folio/search/sample/SampleBibframe.java +++ /dev/null @@ -1,40 +0,0 @@ -package org.folio.search.sample; - -import static org.folio.search.utils.JsonConverter.MAP_TYPE_REFERENCE; -import static org.folio.search.utils.TestUtils.readJsonFromFile; - -import java.util.Map; -import lombok.AccessLevel; -import lombok.NoArgsConstructor; - -@NoArgsConstructor(access = AccessLevel.PRIVATE) -public class SampleBibframe { - - private static final Map BIBFRAME_AS_MAP = - readJsonFromFile("/samples/bibframe/bibframe.json", MAP_TYPE_REFERENCE); - - private static final Map BIBFRAME_2_AS_MAP = - readJsonFromFile("/samples/bibframe/bibframe2.json", MAP_TYPE_REFERENCE); - - private static final Map BIBFRAME_AUTHORITY_CONCEPT_AS_MAP = - readJsonFromFile("/samples/bibframe/authority_concept.json", MAP_TYPE_REFERENCE); - - private static final Map BIBFRAME_AUTHORITY_PERSON_AS_MAP = - readJsonFromFile("/samples/bibframe/authority_person.json", MAP_TYPE_REFERENCE); - - public static Map getBibframeSampleAsMap() { - return BIBFRAME_AS_MAP; - } - - public static Map getBibframe2SampleAsMap() { - return BIBFRAME_2_AS_MAP; - } - - public static Map getBibframeAuthorityConceptSampleAsMap() { - return BIBFRAME_AUTHORITY_CONCEPT_AS_MAP; - } - - public static Map getBibframeAuthorityPersonSampleAsMap() { - return BIBFRAME_AUTHORITY_PERSON_AS_MAP; - } -} diff --git a/src/test/java/org/folio/search/sample/SampleLinkedData.java b/src/test/java/org/folio/search/sample/SampleLinkedData.java new file mode 100644 index 000000000..0d92c1c2b --- /dev/null +++ b/src/test/java/org/folio/search/sample/SampleLinkedData.java @@ -0,0 +1,40 @@ +package org.folio.search.sample; + +import static org.folio.search.utils.JsonConverter.MAP_TYPE_REFERENCE; +import static org.folio.search.utils.TestUtils.readJsonFromFile; + +import java.util.Map; +import lombok.AccessLevel; +import lombok.NoArgsConstructor; + +@NoArgsConstructor(access = AccessLevel.PRIVATE) +public class SampleLinkedData { + + private static final Map WORK_AS_MAP = + readJsonFromFile("/samples/linked-data/work.json", MAP_TYPE_REFERENCE); + + private static final Map WORK_2_AS_MAP = + readJsonFromFile("/samples/linked-data/work2.json", MAP_TYPE_REFERENCE); + + private static final Map AUTHORITY_CONCEPT_AS_MAP = + readJsonFromFile("/samples/linked-data/authority_concept.json", MAP_TYPE_REFERENCE); + + private static final Map AUTHORITY_PERSON_AS_MAP = + readJsonFromFile("/samples/linked-data/authority_person.json", MAP_TYPE_REFERENCE); + + public static Map getWorkSampleAsMap() { + return WORK_AS_MAP; + } + + public static Map getWork2SampleAsMap() { + return WORK_2_AS_MAP; + } + + public static Map getAuthorityConceptSampleAsMap() { + return AUTHORITY_CONCEPT_AS_MAP; + } + + public static Map getAuthorityPersonSampleAsMap() { + return AUTHORITY_PERSON_AS_MAP; + } +} diff --git a/src/test/java/org/folio/search/support/base/ApiEndpoints.java b/src/test/java/org/folio/search/support/base/ApiEndpoints.java index dd5c2aa9a..c5ae66b00 100644 --- a/src/test/java/org/folio/search/support/base/ApiEndpoints.java +++ b/src/test/java/org/folio/search/support/base/ApiEndpoints.java @@ -93,12 +93,12 @@ public static String instanceClassificationBrowsePath(BrowseOptionType optionTyp return "/browse/classification-numbers/" + optionType.getValue() + "/instances"; } - public static String bibframeSearchPath() { - return "/search/bibframe"; + public static String linkedDataSearchPath() { + return "/search/linked-data/works"; } - public static String bibframeAuthoritySearchPath() { - return "/search/bibframe/authorities"; + public static String linkedDataAuthoritySearchPath() { + return "/search/linked-data/authorities"; } public static String authorityBrowsePath() { diff --git a/src/test/java/org/folio/search/support/base/BaseIntegrationTest.java b/src/test/java/org/folio/search/support/base/BaseIntegrationTest.java index 5059a9888..71ff2b924 100644 --- a/src/test/java/org/folio/search/support/base/BaseIntegrationTest.java +++ b/src/test/java/org/folio/search/support/base/BaseIntegrationTest.java @@ -5,14 +5,14 @@ import static org.awaitility.Durations.TWO_HUNDRED_MILLISECONDS; import static org.awaitility.Durations.TWO_MINUTES; import static org.folio.search.support.base.ApiEndpoints.authoritySearchPath; -import static org.folio.search.support.base.ApiEndpoints.bibframeAuthoritySearchPath; -import static org.folio.search.support.base.ApiEndpoints.bibframeSearchPath; import static org.folio.search.support.base.ApiEndpoints.instanceSearchPath; +import static org.folio.search.support.base.ApiEndpoints.linkedDataAuthoritySearchPath; +import static org.folio.search.support.base.ApiEndpoints.linkedDataSearchPath; import static org.folio.search.utils.SearchUtils.getIndexName; import static org.folio.search.utils.TestConstants.TENANT_ID; -import static org.folio.search.utils.TestConstants.bibframeAuthorityTopic; -import static org.folio.search.utils.TestConstants.bibframeTopic; import static org.folio.search.utils.TestConstants.inventoryAuthorityTopic; +import static org.folio.search.utils.TestConstants.linkedDataAuthorityTopic; +import static org.folio.search.utils.TestConstants.linkedDataWorkTopic; import static org.folio.search.utils.TestUtils.asJsonString; import static org.folio.search.utils.TestUtils.doIfNotNull; import static org.folio.search.utils.TestUtils.randomId; @@ -41,10 +41,10 @@ import lombok.SneakyThrows; import lombok.extern.log4j.Log4j2; import org.folio.search.domain.dto.Authority; -import org.folio.search.domain.dto.Bibframe; -import org.folio.search.domain.dto.BibframeAuthority; import org.folio.search.domain.dto.FeatureConfig; import org.folio.search.domain.dto.Instance; +import org.folio.search.domain.dto.LinkedDataAuthority; +import org.folio.search.domain.dto.LinkedDataWork; import org.folio.search.domain.dto.ResourceEvent; import org.folio.search.domain.dto.TenantConfiguredFeature; import org.folio.search.support.api.InventoryApi; @@ -163,13 +163,13 @@ protected static ResultActions doSearchByAuthorities(String query) { } @SneakyThrows - protected static ResultActions doSearchByBibframe(String query) { - return doSearch(bibframeSearchPath(), TENANT_ID, query, null, null, null); + protected static ResultActions doSearchByLinkedDataWork(String query) { + return doSearch(linkedDataSearchPath(), TENANT_ID, query, null, null, null); } @SneakyThrows - protected static ResultActions doSearchByBibframeAuthority(String query) { - return doSearch(bibframeAuthoritySearchPath(), TENANT_ID, query, null, null, null); + protected static ResultActions doSearchByLinkedDataAuthority(String query) { + return doSearch(linkedDataAuthoritySearchPath(), TENANT_ID, query, null, null, null); } @SneakyThrows @@ -265,13 +265,15 @@ record -> kafkaTemplate.send(inventoryAuthorityTopic(tenant), resourceEvent(null @SafeVarargs @SneakyThrows protected static void setUpTenant(Class type, String tenant, Map... rawRecords) { - setUpTenant(type, tenant, () -> { }, rawRecords.length, rawRecords); + setUpTenant(type, tenant, () -> { + }, rawRecords.length, rawRecords); } @SafeVarargs @SneakyThrows protected static void setUpTenant(Class type, Integer expectedCount, Map... rawRecords) { - setUpTenant(type, TENANT_ID, () -> { }, expectedCount, rawRecords); + setUpTenant(type, TENANT_ID, () -> { + }, expectedCount, rawRecords); } @SafeVarargs @@ -294,14 +296,14 @@ protected static void setUpTenant(Class type, String tenant, Runnable postIni authority -> kafkaTemplate.send(inventoryAuthorityTopic(tenant), resourceEvent(null, null, authority))); } - if (type.equals(Bibframe.class)) { - setUpTenant(tenant, bibframeSearchPath(), postInitAction, asList(records), expectedCount, - bibframe -> kafkaTemplate.send(bibframeTopic(tenant), resourceEvent(null, null, bibframe))); + if (type.equals(LinkedDataWork.class)) { + setUpTenant(tenant, linkedDataSearchPath(), postInitAction, asList(records), expectedCount, + ldWork -> kafkaTemplate.send(linkedDataWorkTopic(tenant), resourceEvent(null, null, ldWork))); } - if (type.equals(BibframeAuthority.class)) { - setUpTenant(tenant, bibframeAuthoritySearchPath(), postInitAction, asList(records), expectedCount, - bibAuth -> kafkaTemplate.send(bibframeAuthorityTopic(tenant), resourceEvent(null, null, bibAuth))); + if (type.equals(LinkedDataAuthority.class)) { + setUpTenant(tenant, linkedDataAuthoritySearchPath(), postInitAction, asList(records), expectedCount, + ldAuthority -> kafkaTemplate.send(linkedDataAuthorityTopic(tenant), resourceEvent(null, null, ldAuthority))); } } diff --git a/src/test/java/org/folio/search/utils/TestConstants.java b/src/test/java/org/folio/search/utils/TestConstants.java index a792bbce6..83ca7f3f1 100644 --- a/src/test/java/org/folio/search/utils/TestConstants.java +++ b/src/test/java/org/folio/search/utils/TestConstants.java @@ -37,8 +37,8 @@ public class TestConstants { public static final String INVENTORY_BOUND_WITH_TOPIC = "inventory.bound-with"; public static final String INVENTORY_CLASSIFICATION_TYPE_TOPIC = "inventory.classification-type"; public static final String CONSORTIUM_INSTANCE_TOPIC = "search.consortium.instance"; - public static final String BIBFRAME_TOPIC = "search.bibframe"; - public static final String BIBFRAME_AUTHORITY_TOPIC = "search.bibframe-authorities"; + public static final String LINKED_DATA_TOPIC = "linked-data.work"; + public static final String LINKED_DATA_AUTHORITY_TOPIC = "linked-data.authority"; public static final String CAMPUS_TOPIC = "inventory.campus"; public static final String INSTITUTION_TOPIC = "inventory.institution"; public static final String LIBRARY_TOPIC = "inventory.library"; @@ -124,12 +124,12 @@ public static String inventoryBoundWithTopic(String tenantId) { return getTopicName(tenantId, INVENTORY_BOUND_WITH_TOPIC); } - public static String bibframeTopic(String tenantId) { - return getTopicName(tenantId, BIBFRAME_TOPIC); + public static String linkedDataWorkTopic(String tenantId) { + return getTopicName(tenantId, LINKED_DATA_TOPIC); } - public static String bibframeAuthorityTopic(String tenantId) { - return getTopicName(tenantId, BIBFRAME_AUTHORITY_TOPIC); + public static String linkedDataAuthorityTopic(String tenantId) { + return getTopicName(tenantId, LINKED_DATA_AUTHORITY_TOPIC); } public static String inventoryCampusTopic(String tenantId) { diff --git a/src/test/resources/application.yml b/src/test/resources/application.yml index eac95ee07..c01b97598 100644 --- a/src/test/resources/application.yml +++ b/src/test/resources/application.yml @@ -111,10 +111,10 @@ folio: - name: inventory.location numPartitions: 1 replicationFactor: 1 - - name: search.bibframe + - name: linked-data.work numPartitions: 1 replicationFactor: 1 - - name: search.bibframe-authorities + - name: linked-data.authority numPartitions: 1 replicationFactor: 1 - name: inventory.campus @@ -155,10 +155,10 @@ folio: concurrency: 1 topic-pattern: (${folio.environment}\.)(.*\.)inventory\.(location|campus|institution|library) group-id: ${folio.environment}-mod-search-location-type-group - bibframe: + linked-data: concurrency: 1 - topic-pattern: (${folio.environment}\.)(.*\.)search\.(bibframe|bibframe-authorities) - group-id: ${folio.environment}-mod-search-bibframe-group + topic-pattern: (${folio.environment}\.)(.*\.)linked-data\.(work|authority) + group-id: ${folio.environment}-mod-search-linked-data-group okapiUrl: ${okapi.url} logging: request: diff --git a/src/test/resources/samples/bibframe/authority_concept.json b/src/test/resources/samples/linked-data/authority_concept.json similarity index 100% rename from src/test/resources/samples/bibframe/authority_concept.json rename to src/test/resources/samples/linked-data/authority_concept.json diff --git a/src/test/resources/samples/bibframe/authority_person.json b/src/test/resources/samples/linked-data/authority_person.json similarity index 100% rename from src/test/resources/samples/bibframe/authority_person.json rename to src/test/resources/samples/linked-data/authority_person.json diff --git a/src/test/resources/samples/bibframe/bibframe.json b/src/test/resources/samples/linked-data/work.json similarity index 100% rename from src/test/resources/samples/bibframe/bibframe.json rename to src/test/resources/samples/linked-data/work.json diff --git a/src/test/resources/samples/bibframe/bibframe2.json b/src/test/resources/samples/linked-data/work2.json similarity index 100% rename from src/test/resources/samples/bibframe/bibframe2.json rename to src/test/resources/samples/linked-data/work2.json