From 1af4996f4ca258eecaafac4f94146b01588573a4 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Thu, 7 Mar 2024 15:20:59 +0100 Subject: [PATCH 01/11] File size in the MetadataBitstreamWrapperRest changed to `long` type instead of String, the FE transfer all bytes into readable form. --- .../rest/converter/MetadataBitstreamWrapperConverter.java | 4 +--- .../app/rest/model/MetadataBitstreamWrapperRest.java | 8 ++++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/converter/MetadataBitstreamWrapperConverter.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/converter/MetadataBitstreamWrapperConverter.java index 49728da0b899..e42c023f72a5 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/converter/MetadataBitstreamWrapperConverter.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/converter/MetadataBitstreamWrapperConverter.java @@ -10,7 +10,6 @@ import org.dspace.app.rest.model.MetadataBitstreamWrapperRest; import org.dspace.app.rest.model.wrapper.MetadataBitstreamWrapper; import org.dspace.app.rest.projection.Projection; -import org.dspace.util.FileTreeViewGenerator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Lazy; import org.springframework.stereotype.Component; @@ -41,8 +40,7 @@ public MetadataBitstreamWrapperRest convert(MetadataBitstreamWrapper modelObject bitstreamWrapperRest.setId(modelObject.getBitstream().getID().toString()); bitstreamWrapperRest.setDescription(modelObject.getDescription()); bitstreamWrapperRest.setChecksum(modelObject.getBitstream().getChecksum()); - bitstreamWrapperRest.setFileSize(FileTreeViewGenerator.humanReadableFileSize( - modelObject.getBitstream().getSizeBytes())); + bitstreamWrapperRest.setFileSize(modelObject.getBitstream().getSizeBytes()); bitstreamWrapperRest.setFileInfo(modelObject.getFileInfo()); bitstreamWrapperRest.setHref(modelObject.getHref()); bitstreamWrapperRest.setFormat(modelObject.getFormat()); diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/model/MetadataBitstreamWrapperRest.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/model/MetadataBitstreamWrapperRest.java index 7e3c1c03568e..8e4d60d4bfab 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/model/MetadataBitstreamWrapperRest.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/model/MetadataBitstreamWrapperRest.java @@ -23,14 +23,14 @@ public class MetadataBitstreamWrapperRest extends BaseObjectRest { private String name; private String description; - private String fileSize; + private long fileSize; private String checksum; private List fileInfo; private String format; private String href; private boolean canPreview; - public MetadataBitstreamWrapperRest(String name, String description, String fileSize, String checksum, + public MetadataBitstreamWrapperRest(String name, String description, long fileSize, String checksum, List fileInfo, String format, String href, boolean canPreview) { this.name = name; this.description = description; @@ -93,11 +93,11 @@ public void setDescription(String description) { this.description = description; } - public String getFileSize() { + public long getFileSize() { return fileSize; } - public void setFileSize(String fileSize) { + public void setFileSize(long fileSize) { this.fileSize = fileSize; } From 40407e5e55232b5ce224134eb230e68178d45ab4 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Thu, 7 Mar 2024 16:01:08 +0100 Subject: [PATCH 02/11] Changed default sorting options --- dspace/config/spring/api/discovery.xml | 89 +++++++++++++++----------- 1 file changed, 51 insertions(+), 38 deletions(-) diff --git a/dspace/config/spring/api/discovery.xml b/dspace/config/spring/api/discovery.xml index c373051b848a..1756a37aaf9b 100644 --- a/dspace/config/spring/api/discovery.xml +++ b/dspace/config/spring/api/discovery.xml @@ -207,9 +207,10 @@ - - - + + + + @@ -355,9 +356,10 @@ - - - + + + + @@ -494,9 +496,10 @@ - - - + + + + @@ -636,9 +639,10 @@ - - - + + + + @@ -765,8 +769,10 @@ - - + + + + @@ -916,8 +922,10 @@ - - + + + + @@ -991,8 +999,10 @@ - - + + + + @@ -1066,8 +1076,10 @@ - - + + + + @@ -1150,9 +1162,10 @@ - - - + + + + @@ -1220,9 +1233,10 @@ - - - + + + + @@ -1285,7 +1299,6 @@ - @@ -1347,7 +1360,6 @@ - @@ -1520,7 +1532,6 @@ - @@ -1584,7 +1595,6 @@ - @@ -1645,7 +1655,6 @@ - @@ -1705,7 +1714,6 @@ - @@ -1765,7 +1773,6 @@ - @@ -1824,7 +1831,6 @@ - @@ -1884,7 +1890,6 @@ - @@ -1943,7 +1948,6 @@ - @@ -2015,7 +2019,6 @@ - @@ -2074,7 +2077,6 @@ - @@ -2995,6 +2997,17 @@ + + + + + + + + + + + From 91f8b7a225fe05ab14b14861e2bf7ed19616f312 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Fri, 8 Mar 2024 09:02:12 +0100 Subject: [PATCH 03/11] Added a new search configuration for the homepage, because searching by `dc.date.accesioned` must be removed because of clarin requirements, but the homepage uses searching by `dc.date.accesioned` --- dspace/config/spring/api/discovery.xml | 176 +++++++++++++++++++++++++ 1 file changed, 176 insertions(+) diff --git a/dspace/config/spring/api/discovery.xml b/dspace/config/spring/api/discovery.xml index 1756a37aaf9b..e09828c95aef 100644 --- a/dspace/config/spring/api/discovery.xml +++ b/dspace/config/spring/api/discovery.xml @@ -64,6 +64,7 @@ + @@ -319,6 +320,164 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + (search.resourcetype:Item AND latestVersion:true) OR search.resourcetype:Collection OR search.resourcetype:Community + -withdrawn:true AND -discoverable:false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + dc.title + dc.contributor.author + dc.creator + dc.subject + + + + + + + + + + + + + + @@ -360,6 +519,7 @@ + @@ -500,6 +660,7 @@ + @@ -643,6 +804,7 @@ + @@ -1166,6 +1328,7 @@ + @@ -1237,6 +1400,7 @@ + @@ -1299,6 +1463,7 @@ + @@ -1360,6 +1525,7 @@ + @@ -1532,6 +1698,7 @@ + @@ -1595,6 +1762,7 @@ + @@ -1655,6 +1823,7 @@ + @@ -1714,6 +1883,7 @@ + @@ -1773,6 +1943,7 @@ + @@ -1831,6 +2002,7 @@ + @@ -1890,6 +2062,7 @@ + @@ -1948,6 +2121,7 @@ + @@ -2019,6 +2193,7 @@ + @@ -2077,6 +2252,7 @@ + From de7603f42e33f2ae29571842e10918e48035ed0f Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Fri, 8 Mar 2024 10:11:12 +0100 Subject: [PATCH 04/11] Configured searching by Item Type in the search page. --- dspace/config/spring/api/discovery.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dspace/config/spring/api/discovery.xml b/dspace/config/spring/api/discovery.xml index e09828c95aef..10aa166e63a5 100644 --- a/dspace/config/spring/api/discovery.xml +++ b/dspace/config/spring/api/discovery.xml @@ -172,6 +172,7 @@ + @@ -2538,6 +2539,8 @@ dc.type + edm.type + metashare.ResourceInfo#ContentInfo.mediaType From 1afb9a4f50a8476f6179b687c3068d3726775dc6 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Mon, 11 Mar 2024 14:24:15 +0100 Subject: [PATCH 05/11] Updated community indexing - added _filter and _keyword because they are needed to work as facet and filter --- .../dspace/discovery/ClarinSolrItemsCommunityIndexPlugin.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dspace-api/src/main/java/org/dspace/discovery/ClarinSolrItemsCommunityIndexPlugin.java b/dspace-api/src/main/java/org/dspace/discovery/ClarinSolrItemsCommunityIndexPlugin.java index fe419cb6d2ff..36e60e3af816 100644 --- a/dspace-api/src/main/java/org/dspace/discovery/ClarinSolrItemsCommunityIndexPlugin.java +++ b/dspace-api/src/main/java/org/dspace/discovery/ClarinSolrItemsCommunityIndexPlugin.java @@ -39,7 +39,11 @@ public void additionalIndex(Context context, IndexableObject indexableObject, So Community owningCommunity = clarinItemService.getOwningCommunity(context, item); String communityName = Objects.isNull(owningCommunity) ? " " : owningCommunity.getName(); + // _keyword and _filter because + // they are needed in order to work as a facet and filter. document.addField("items_owning_community", communityName); + document.addField("items_owning_community_keyword", communityName); + document.addField("items_owning_community_filter", communityName); } } } From 10d58dcdd456b0b63f396ac2132212c8062e1826 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Mon, 11 Mar 2024 14:24:49 +0100 Subject: [PATCH 06/11] Updated `Rights` and `Community` configuration. Changed to `text` type. --- dspace/config/spring/api/discovery.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dspace/config/spring/api/discovery.xml b/dspace/config/spring/api/discovery.xml index 10aa166e63a5..ffb9d4c66a69 100644 --- a/dspace/config/spring/api/discovery.xml +++ b/dspace/config/spring/api/discovery.xml @@ -2504,7 +2504,7 @@ dc.rights.label - + @@ -2529,7 +2529,7 @@ - + From 30be9fe0a13e451c93e2125ba1729823e0f4b255 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Mon, 11 Mar 2024 15:50:26 +0100 Subject: [PATCH 07/11] Allow Site usage reports for the Anonymous user --- ...geReportRestPermissionEvaluatorPlugin.java | 10 ++++++++++ .../app/rest/StatisticsRestRepositoryIT.java | 19 +++++++++++++++++++ dspace/config/clarin-dspace.cfg | 3 +++ 3 files changed, 32 insertions(+) diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/UsageReportRestPermissionEvaluatorPlugin.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/UsageReportRestPermissionEvaluatorPlugin.java index 06254d561ace..8e0b57e6791a 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/UsageReportRestPermissionEvaluatorPlugin.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/UsageReportRestPermissionEvaluatorPlugin.java @@ -18,6 +18,7 @@ import org.dspace.app.rest.utils.DSpaceObjectUtils; import org.dspace.authorize.service.AuthorizeService; import org.dspace.content.DSpaceObject; +import org.dspace.content.Site; import org.dspace.core.Context; import org.dspace.services.ConfigurationService; import org.dspace.services.RequestService; @@ -93,6 +94,15 @@ public boolean hasDSpacePermission(Authentication authentication, Serializable t if (Objects.isNull(dso)) { return true; } + + // Show Site usage reports to anonymous users if the configuration is set to do so + // This Site usage reports are used in the home page and are not sensitive + if (dso instanceof Site) { + if (!configurationService.getBooleanProperty("site.usage-reports.enable.auth.anonymous", + false)) { + return true; + } + } return authorizeService.authorizeActionBoolean(context, dso, restPermission.getDspaceApiActionId()); } catch (SQLException e) { log.error(e.getMessage(), e); diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/StatisticsRestRepositoryIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/StatisticsRestRepositoryIT.java index 5544ecdb032b..2a07dc479807 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/StatisticsRestRepositoryIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/StatisticsRestRepositoryIT.java @@ -53,6 +53,7 @@ import org.dspace.content.DSpaceObject; import org.dspace.content.Item; import org.dspace.content.Site; +import org.dspace.content.service.SiteService; import org.dspace.core.Constants; import org.dspace.eperson.EPerson; import org.dspace.services.ConfigurationService; @@ -76,6 +77,8 @@ public class StatisticsRestRepositoryIT extends AbstractControllerIntegrationTes ConfigurationService configurationService; @Autowired protected AuthorizeService authorizeService; + @Autowired + protected SiteService siteService; private Community communityNotVisited; private Community communityVisited; @@ -1532,6 +1535,22 @@ public void usageReportsSearch_Bitstream_Visited() throws Exception { ))); } + // Show usage reports for the Anonymous user - it could be configured by cfg property + // `site.usage-reports.enable.auth.anonymous` + @Test + public void usageReportsSearch_Site_For_Anonymous() throws Exception { + // This property is set to `true` before each test + configurationService.setProperty("usage-statistics.authorization.admin.usage", false); + + // Get the site object UUID + Site site = siteService.findSite(context); + // Allow accessing Site usage reports for anonymous + getClient() + .perform(get("/api/statistics/usagereports/search/object?uri=http://localhost:8080/server/api/core" + + "/sites/" + site.getID())) + .andExpect(status().isOk()); + } + // Create expected points from -6 months to now, with given number of views in current month private List getListOfVisitsPerMonthsPoints(int viewsLastMonth) { List expectedPoints = new ArrayList<>(); diff --git a/dspace/config/clarin-dspace.cfg b/dspace/config/clarin-dspace.cfg index 7f47d9896cd5..9b1658f0ec0b 100644 --- a/dspace/config/clarin-dspace.cfg +++ b/dspace/config/clarin-dspace.cfg @@ -156,6 +156,9 @@ matomo.tracker.bitstream.site_id = 1 matomo.tracker.oai.site_id = 1 statistics.cache-server.uri = http://cache-server.none +#### Statistic usage reports #### +# site.usage-reports.enable.auth.anonymous = true + ##### Citacepro config ##### # citace.pro.url = https://www.citacepro.com/api/dspace/citace/oai From 8ef3ef4853451e39df95ca58ec1d38fbf525b924 Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Wed, 13 Mar 2024 16:46:05 +0100 Subject: [PATCH 08/11] Fixed MetadataBitstreamRestRepositoryIT - the Mather has a problem to compare long types. --- .../app/rest/MetadataBitstreamRestRepositoryIT.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/MetadataBitstreamRestRepositoryIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/MetadataBitstreamRestRepositoryIT.java index 59e39285bea1..ec0518e46d27 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/MetadataBitstreamRestRepositoryIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/MetadataBitstreamRestRepositoryIT.java @@ -7,6 +7,8 @@ */ package org.dspace.app.rest; +import static org.hamcrest.Matchers.contains; +import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; @@ -115,9 +117,9 @@ public void findByHandle() throws Exception { .andExpect(jsonPath("$._embedded.metadatabitstreams[*].format") .value(Matchers.containsInAnyOrder(Matchers.containsString( bts.getFormat(context).getMIMEType())))) + // Convert the long into int because Marchers has a problem to compare long format .andExpect(jsonPath("$._embedded.metadatabitstreams[*].fileSize") - .value(Matchers.containsInAnyOrder(Matchers.containsString( - FileTreeViewGenerator.humanReadableFileSize(bts.getSizeBytes()))))) + .value(hasItem(is((int) bts.getSizeBytes())))) .andExpect(jsonPath("$._embedded.metadatabitstreams[*].canPreview") .value(Matchers.containsInAnyOrder(Matchers.is(canPreview)))) .andExpect(jsonPath("$._embedded.metadatabitstreams[*].fileInfo").exists()) @@ -150,8 +152,7 @@ public void previewingIsDisabledByCfg() throws Exception { .value(Matchers.containsInAnyOrder(Matchers.containsString( bts.getFormat(context).getMIMEType())))) .andExpect(jsonPath("$._embedded.metadatabitstreams[*].fileSize") - .value(Matchers.containsInAnyOrder(Matchers.containsString( - FileTreeViewGenerator.humanReadableFileSize(bts.getSizeBytes()))))) + .value(hasItem(is((int) bts.getSizeBytes())))) .andExpect(jsonPath("$._embedded.metadatabitstreams[*].canPreview") .value(Matchers.containsInAnyOrder(Matchers.is(false)))) .andExpect(jsonPath("$._embedded.metadatabitstreams[*].fileInfo").exists()) From bc48963ef2fee071a6a492bf59fb822865a768fc Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Thu, 14 Mar 2024 09:35:37 +0100 Subject: [PATCH 09/11] Fixed DiscoveryScopeBasedRestControllerIT - the expected facets and Matchers did must be updated. --- .../app/rest/DiscoveryScopeBasedRestControllerIT.java | 9 ++++++--- .../org/dspace/app/rest/matcher/FacetEntryMatcher.java | 4 ++-- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/DiscoveryScopeBasedRestControllerIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/DiscoveryScopeBasedRestControllerIT.java index 67e514d5084d..4a83a0ea593b 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/DiscoveryScopeBasedRestControllerIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/DiscoveryScopeBasedRestControllerIT.java @@ -509,7 +509,8 @@ public void ScopeBasedIndexingAndSearchTestParentCommunity2() throws Exception { FacetEntryMatcher.entityTypeFacet(false), FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.clarinItemsLanguageFacet(false) + FacetEntryMatcher.clarinItemsLanguageFacet(false), + FacetEntryMatcher.typeFacet(false) )) ); } @@ -624,7 +625,8 @@ public void ScopeBasedIndexingAndSearchTestSubcommunity22() throws Exception { FacetEntryMatcher.entityTypeFacet(false), FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.clarinItemsLanguageFacet(false) + FacetEntryMatcher.clarinItemsLanguageFacet(false), + FacetEntryMatcher.typeFacet(false) )) ); } @@ -677,7 +679,8 @@ public void ScopeBasedIndexingAndSearchTestCollection222() throws Exception { FacetEntryMatcher.entityTypeFacet(false), FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.clarinItemsLanguageFacet(false) + FacetEntryMatcher.clarinItemsLanguageFacet(false), + FacetEntryMatcher.typeFacet(false) )) ); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/FacetEntryMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/FacetEntryMatcher.java index 9176a42616f9..23d66754dcc6 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/FacetEntryMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/FacetEntryMatcher.java @@ -124,7 +124,7 @@ public static Matcher matchFacet(boolean hasNext, String name, S public static Matcher clarinLicenseRightsFacet(boolean hasNext) { return allOf( hasJsonPath("$.name", is("rights")), - hasJsonPath("$.facetType", is("standard")), + hasJsonPath("$.facetType", is("text")), hasJsonPath("$.facetLimit", any(Integer.class)), hasJsonPath("$._links.self.href", containsString("api/discover/facets/rights")), hasJsonPath("$._links", matchNextLink(hasNext, "api/discover/facets/rights")) @@ -144,7 +144,7 @@ public static Matcher clarinItemsLanguageFacet(boolean hasNext) public static Matcher clarinItemsCommunityFacet(boolean hasNext) { return allOf( hasJsonPath("$.name", is("items_owning_community")), - hasJsonPath("$.facetType", is("standard")), + hasJsonPath("$.facetType", is("text")), hasJsonPath("$.facetLimit", any(Integer.class)), hasJsonPath("$._links.self.href", containsString("api/discover/facets/items_owning_community")), From 26009f3c64ba399b2249079b742b4c116742875b Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Thu, 14 Mar 2024 09:56:44 +0100 Subject: [PATCH 10/11] Fixed ClarinDiscoveryRestControllerIT - the expected facets and Matchers did must be updated. --- .../rest/ClarinDiscoveryRestControllerIT.java | 99 ++++++++++++------- .../app/rest/matcher/SearchFilterMatcher.java | 6 +- 2 files changed, 69 insertions(+), 36 deletions(-) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/ClarinDiscoveryRestControllerIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/ClarinDiscoveryRestControllerIT.java index 72b12c7962af..460373091d27 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/ClarinDiscoveryRestControllerIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/ClarinDiscoveryRestControllerIT.java @@ -122,7 +122,8 @@ public void discoverFacetsTestWithoutParameters() throws Exception { FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false))) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false))) ); } @@ -1006,9 +1007,11 @@ public void discoverSearchTest() throws Exception { SortOptionMatcher.sortOptionMatcher( "dc.title", DiscoverySortFieldConfiguration.SORT_ORDER.asc.name()), SortOptionMatcher.sortOptionMatcher( - "dc.date.issued", DiscoverySortFieldConfiguration.SORT_ORDER.desc.name()), + "dc.title", DiscoverySortFieldConfiguration.SORT_ORDER.desc.name()), + SortOptionMatcher.sortOptionMatcher( + "dc.date.issued", DiscoverySortFieldConfiguration.SORT_ORDER.asc.name()), SortOptionMatcher.sortOptionMatcher( - "dc.date.accessioned", DiscoverySortFieldConfiguration.SORT_ORDER.desc.name()) + "dc.date.issued", DiscoverySortFieldConfiguration.SORT_ORDER.desc.name()) ))); } @@ -1146,7 +1149,8 @@ public void discoverSearchObjectsTest() throws Exception { FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -1287,7 +1291,8 @@ public void discoverSearchObjectsTestHasMoreAuthorFacet() throws Exception { FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -1379,7 +1384,8 @@ public void discoverSearchObjectsTestHasMoreSubjectFacet() throws Exception { FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -1461,7 +1467,8 @@ public void discoverSearchObjectsTestWithBasicQuery() throws Exception { FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -1571,7 +1578,8 @@ public void discoverSearchObjectsTestWithScope() throws Exception { FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -1653,7 +1661,8 @@ public void discoverSearchObjectsTestWithDsoType() throws Exception { FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))); @@ -1690,7 +1699,8 @@ public void discoverSearchObjectsTestWithDsoType() throws Exception { FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))); @@ -1728,7 +1738,8 @@ public void discoverSearchObjectsTestWithDsoType() throws Exception { FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))); @@ -1770,7 +1781,8 @@ public void discoverSearchObjectsTestWithDsoType() throws Exception { FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))); @@ -1859,7 +1871,8 @@ public void discoverSearchObjectsTestWithDsoTypeAndSort() throws Exception { FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //We want to get the sort that's been used as well in the response .andExpect(jsonPath("$.sort", is( @@ -2073,7 +2086,8 @@ public void discoverSearchObjectsTestForPaginationAndNextLinks() throws Exceptio FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), FacetEntryMatcher.hasContentInOriginalBundleFacet(false), - FacetEntryMatcher.entityTypeFacet(false) + FacetEntryMatcher.entityTypeFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -2165,7 +2179,8 @@ public void discoverSearchObjectsTestWithContentInABitstream() throws Exception FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -2257,7 +2272,8 @@ public void discoverSearchObjectsTestForEmbargoedItemsAndPrivateItems() throws E FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -2343,7 +2359,8 @@ public void discoverSearchObjectsTestWithContentInAPrivateBitstream() throws Exc FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -2424,7 +2441,8 @@ public void discoverSearchObjectsTestForScope() throws Exception { FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -2511,7 +2529,8 @@ public void discoverSearchObjectsTestForScopeWithPrivateItem() throws Exception FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -2693,7 +2712,8 @@ public void discoverSearchObjectsTestForHitHighlights() throws Exception { FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -2839,7 +2859,8 @@ public void discoverSearchObjectsWithQueryOperatorContains_query() throws Except FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -2917,7 +2938,8 @@ public void discoverSearchObjectsWithQueryOperatorContains() throws Exception { FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -2993,7 +3015,8 @@ public void discoverSearchObjectsWithQueryOperatorNotContains_query() throws Exc FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -3070,7 +3093,8 @@ public void discoverSearchObjectsWithQueryOperatorNotContains() throws Exception FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -3157,7 +3181,8 @@ public void discoverSearchObjectsTestForMinMaxValues() throws Exception { FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -3228,7 +3253,8 @@ public void discoverSearchFacetsTestForMinMaxValues() throws Exception { FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/facets"))) @@ -3304,7 +3330,8 @@ public void discoverSearchObjectsWithQueryOperatorEquals_query() throws Exceptio FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -3381,7 +3408,8 @@ public void discoverSearchObjectsWithQueryOperatorEquals() throws Exception { FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -3458,7 +3486,8 @@ public void discoverSearchObjectsWithQueryOperatorNotEquals_query() throws Excep FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -3536,7 +3565,8 @@ public void discoverSearchObjectsWithQueryOperatorNotEquals() throws Exception { FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -3612,7 +3642,8 @@ public void discoverSearchObjectsWithQueryOperatorNotAuthority_query() throws Ex FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -3689,7 +3720,8 @@ public void discoverSearchObjectsWithQueryOperatorNotAuthority() throws Exceptio FacetEntryMatcher.clarinLicenseRightsFacet(false), FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), - FacetEntryMatcher.hasContentInOriginalBundleFacet(false) + FacetEntryMatcher.hasContentInOriginalBundleFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link available .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) @@ -4138,7 +4170,8 @@ public void discoverSearchObjectsWithInProgressSubmissionTest() throws Exception FacetEntryMatcher.clarinItemsLanguageFacet(false), FacetEntryMatcher.clarinItemsCommunityFacet(false), FacetEntryMatcher.hasContentInOriginalBundleFacet(false), - FacetEntryMatcher.entityTypeFacet(false) + FacetEntryMatcher.entityTypeFacet(false), + FacetEntryMatcher.typeFacet(false) ))) //There always needs to be a self link .andExpect(jsonPath("$._links.self.href", containsString("/api/discover/search/objects"))) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SearchFilterMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SearchFilterMatcher.java index 7700d5291249..b60f26940ff8 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SearchFilterMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SearchFilterMatcher.java @@ -160,7 +160,7 @@ public static Matcher clarinLicenseRightsFilter() { return allOf( hasJsonPath("$.filter", is("rights")), hasJsonPath("$.hasFacets", is(true)), - hasJsonPath("$.type", is("standard")), + hasJsonPath("$.type", is("text")), hasJsonPath("$.openByDefault", is(false)), checkOperators() ); @@ -180,7 +180,7 @@ public static Matcher clarinItemsCommunityFilter() { return allOf( hasJsonPath("$.filter", is("items_owning_community")), hasJsonPath("$.hasFacets", is(true)), - hasJsonPath("$.type", is("standard")), + hasJsonPath("$.type", is("text")), hasJsonPath("$.openByDefault", is(false)), checkOperators() ); @@ -189,7 +189,7 @@ public static Matcher clarinItemsCommunityFilter() { public static Matcher clarinItemsTypeFilter() { return allOf( hasJsonPath("$.filter", is("itemtype")), - hasJsonPath("$.hasFacets", is(false)), + hasJsonPath("$.hasFacets", is(true)), hasJsonPath("$.type", is("text")), hasJsonPath("$.openByDefault", is(false)), checkOperators() From 7356bceb96e6fd87269670a7dd6600c9571afd5e Mon Sep 17 00:00:00 2001 From: milanmajchrak Date: Thu, 14 Mar 2024 10:27:47 +0100 Subject: [PATCH 11/11] Removed unused imports --- .../org/dspace/app/rest/MetadataBitstreamRestRepositoryIT.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/MetadataBitstreamRestRepositoryIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/MetadataBitstreamRestRepositoryIT.java index ec0518e46d27..c966ecfa58e3 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/MetadataBitstreamRestRepositoryIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/MetadataBitstreamRestRepositoryIT.java @@ -7,7 +7,6 @@ */ package org.dspace.app.rest; -import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.hasItem; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.notNullValue; @@ -36,7 +35,6 @@ import org.dspace.content.service.clarin.ClarinLicenseResourceMappingService; import org.dspace.core.Constants; import org.dspace.services.ConfigurationService; -import org.dspace.util.FileTreeViewGenerator; import org.hamcrest.Matchers; import org.junit.Before; import org.junit.Test;