diff --git a/dspace-server-webapp/src/main/java/org/dspace/app/rest/model/RestAddressableModel.java b/dspace-server-webapp/src/main/java/org/dspace/app/rest/model/RestAddressableModel.java index 2740d428f712..326db71cbb49 100644 --- a/dspace-server-webapp/src/main/java/org/dspace/app/rest/model/RestAddressableModel.java +++ b/dspace-server-webapp/src/main/java/org/dspace/app/rest/model/RestAddressableModel.java @@ -8,6 +8,7 @@ package org.dspace.app.rest.model; import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonProperty; import org.dspace.app.rest.projection.Projection; /** @@ -45,7 +46,6 @@ public void setProjection(Projection projection) { this.projection = projection; } - @JsonIgnore /** * * @return an unique string useful to unambiguously identify the type of rest @@ -53,6 +53,7 @@ public void setProjection(Projection projection) { * singular form. Examples include core.item, core.community, * submission.workspaceitem, etc. */ + @JsonProperty(access = JsonProperty.Access.READ_ONLY) public String getUniqueType() { return getCategory() + "." + getType(); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/DiscoveryRestControllerIT.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/DiscoveryRestControllerIT.java index 3a40e14b0dfc..f5130e46327c 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/DiscoveryRestControllerIT.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/DiscoveryRestControllerIT.java @@ -6434,9 +6434,11 @@ public void discoverSearchFacetValuesTest() throws Exception { "/api/discover/facets/discoverable?configuration=administrativeView&sort=score,DESC"))) .andExpect(jsonPath("$._embedded.values", Matchers.containsInAnyOrder( SearchResultMatcher.matchEmbeddedFacetValues("true", 2, "discover", - "/api/discover/search/objects?configuration=administrativeView&f.discoverable=true,equals"), + "/api/discover/search/objects?configuration=administrativeView&f.discoverable=true,equals", + "discover"), SearchResultMatcher.matchEmbeddedFacetValues("false", 1, "discover", - "/api/discover/search/objects?configuration=administrativeView&f.discoverable=false,equals") + "/api/discover/search/objects?configuration=administrativeView&f.discoverable=false,equals", + "discover") ))); } @@ -6496,7 +6498,8 @@ public void discoverSearchFacetValuesPaginationTest() throws Exception { "/api/discover/facets/discoverable?configuration=administrativeView&sort=score,DESC&page=1&size=1"))) .andExpect(jsonPath("$._embedded.values", Matchers.contains( SearchResultMatcher.matchEmbeddedFacetValues("true", 2, "discover", - "/api/discover/search/objects?configuration=administrativeView&f.discoverable=true,equals") + "/api/discover/search/objects?configuration=administrativeView&f.discoverable=true,equals", + "discover") ))); getClient(adminToken).perform(get("/api/discover/facets/discoverable") @@ -6513,7 +6516,8 @@ public void discoverSearchFacetValuesPaginationTest() throws Exception { "/api/discover/facets/discoverable?configuration=administrativeView&sort=score,DESC&page=1&size=1"))) .andExpect(jsonPath("$._embedded.values", Matchers.contains( SearchResultMatcher.matchEmbeddedFacetValues("false", 1, "discover", - "/api/discover/search/objects?configuration=administrativeView&f.discoverable=false,equals") + "/api/discover/search/objects?configuration=administrativeView&f.discoverable=false,equals", + "discover") ))); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/AuditEventMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/AuditEventMatcher.java index c989e23808c1..1aba941ab944 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/AuditEventMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/AuditEventMatcher.java @@ -50,7 +50,8 @@ public static Matcher matchProperties(AuditEvent audit) { hasJsonPath("$.objectType", is(audit.getObjectType())), //we should apply the date formatter to make the check //hasJsonPath("$.timeStamp", is(audit.getDatetime())), - hasJsonPath("$.type", is("auditevent"))); + hasJsonPath("$.type", is("auditevent")), + hasJsonPath("$.uniqueType", is("system.auditevent"))); } public static Matcher matchLinks(AuditEvent audit) { diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/AuthorizationMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/AuthorizationMatcher.java index 849bd2400e85..75afec77ca55 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/AuthorizationMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/AuthorizationMatcher.java @@ -51,12 +51,14 @@ public static Matcher matchProperties(Authorization authz) { if (authz != null) { return allOf( hasJsonPath("$.id", is(authz.getID())), - hasJsonPath("$.type", is("authorization")) + hasJsonPath("$.type", is("authorization")), + hasJsonPath("$.uniqueType", is("authz.authorization")) ); } else { return allOf( hasJsonPath("$.id"), - hasJsonPath("$.type", is("authorization")) + hasJsonPath("$.type", is("authorization")), + hasJsonPath("$.uniqueType", is("authz.authorization")) ); } } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/BitstreamFormatMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/BitstreamFormatMatcher.java index 0bde0a2c54b4..a61316b5e2e4 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/BitstreamFormatMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/BitstreamFormatMatcher.java @@ -30,6 +30,7 @@ public static Matcher matchBitstreamFormat(int id, String mimety hasJsonPath("$.mimetype", is(mimetype)), hasJsonPath("$.description", is(description)), hasJsonPath("$.type", is("bitstreamformat")), + hasJsonPath("$.uniqueType", is("core.bitstreamformat")), hasJsonPath("$._links.self.href", startsWith(REST_SERVER_URL)), hasJsonPath("$._links.self.href", endsWith("/api/core/bitstreamformats/" + id)) ); @@ -43,6 +44,7 @@ public static Matcher matchBitstreamFormat(int id, String mimety hasJsonPath("$.shortDescription", is(shortDescription)), hasJsonPath("$.mimetype", is(mimetype)), hasJsonPath("$.type", is("bitstreamformat")), + hasJsonPath("$.uniqueType", is("core.bitstreamformat")), hasJsonPath("$._links.self.href", startsWith(REST_SERVER_URL)), hasJsonPath("$._links.self.href", endsWith("/api/core/bitstreamformats/" + id)) ); @@ -56,6 +58,7 @@ public static Matcher matchBitstreamFormat(int id, String mimety hasJsonPath("$.mimetype", is(mimetype)), hasJsonPath("$.supportLevel", is(supportLevel)), hasJsonPath("$.type", is("bitstreamformat")), + hasJsonPath("$.uniqueType", is("core.bitstreamformat")), hasJsonPath("$._links.self.href", startsWith(REST_SERVER_URL)), hasJsonPath("$._links.self.href", endsWith("/api/core/bitstreamformats/" + id)) ); @@ -65,14 +68,16 @@ public static Matcher matchBitstreamFormat(String mimetype, Stri return allOf( hasJsonPath("$.mimetype", is(mimetype)), hasJsonPath("$.description", is(description)), - hasJsonPath("$.type", is("bitstreamformat")) + hasJsonPath("$.type", is("bitstreamformat")), + hasJsonPath("$.uniqueType", is("core.bitstreamformat")) ); } public static Matcher matchBitstreamFormatMimeType(String mimetype) { return allOf( hasJsonPath("$.mimetype", is(mimetype)), - hasJsonPath("$.type", is("bitstreamformat")) + hasJsonPath("$.type", is("bitstreamformat")), + hasJsonPath("$.uniqueType", is("core.bitstreamformat")) ); } } \ No newline at end of file diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/BitstreamMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/BitstreamMatcher.java index 36fc2f2aa131..a6ed1dac29c9 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/BitstreamMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/BitstreamMatcher.java @@ -91,6 +91,7 @@ private static Matcher matchFormat() { return allOf( hasJsonPath("$.mimetype", not(empty())), hasJsonPath("$.type", is("bitstreamformat")), + hasJsonPath("$.uniqueType", is("core.bitstreamformat")), hasJsonPath("$._links.self.href", not(empty())) ); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/BrowseIndexMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/BrowseIndexMatcher.java index c6ec8db0387b..6303189f40b9 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/BrowseIndexMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/BrowseIndexMatcher.java @@ -35,6 +35,7 @@ public static Matcher subjectBrowseIndex(final String order) { hasJsonPath("$.metadata", contains("dc.subject.*")), hasJsonPath("$.browseType", equalToIgnoringCase(BROWSE_TYPE_VALUE_LIST)), hasJsonPath("$.type", equalToIgnoringCase("browse")), + hasJsonPath("$.uniqueType", equalToIgnoringCase("discover.browse")), hasJsonPath("$.dataType", equalToIgnoringCase("text")), hasJsonPath("$.order", equalToIgnoringCase(order)), hasJsonPath("$.sortOptions[*].name", containsInAnyOrder("title", "dateissued", "dateaccessioned")), @@ -49,6 +50,7 @@ public static Matcher titleBrowseIndex(final String order) { hasJsonPath("$.metadata", contains("dc.title")), hasJsonPath("$.browseType", equalToIgnoringCase(BROWSE_TYPE_FLAT)), hasJsonPath("$.type", equalToIgnoringCase("browse")), + hasJsonPath("$.uniqueType", equalToIgnoringCase("discover.browse")), hasJsonPath("$.dataType", equalToIgnoringCase("title")), hasJsonPath("$.order", equalToIgnoringCase(order)), hasJsonPath("$.sortOptions[*].name", containsInAnyOrder("title", "dateissued", "dateaccessioned")), @@ -62,6 +64,7 @@ public static Matcher contributorBrowseIndex(final String order) hasJsonPath("$.metadata", contains("dc.contributor.*", "dc.creator")), hasJsonPath("$.browseType", equalToIgnoringCase(BROWSE_TYPE_VALUE_LIST)), hasJsonPath("$.type", equalToIgnoringCase("browse")), + hasJsonPath("$.uniqueType", equalToIgnoringCase("discover.browse")), hasJsonPath("$.dataType", equalToIgnoringCase("text")), hasJsonPath("$.order", equalToIgnoringCase(order)), hasJsonPath("$.sortOptions[*].name", containsInAnyOrder("title", "dateissued", "dateaccessioned")), @@ -76,6 +79,7 @@ public static Matcher dateIssuedBrowseIndex(final String order) hasJsonPath("$.metadata", contains("dc.date.issued")), hasJsonPath("$.browseType", equalToIgnoringCase(BROWSE_TYPE_FLAT)), hasJsonPath("$.type", equalToIgnoringCase("browse")), + hasJsonPath("$.uniqueType", equalToIgnoringCase("discover.browse")), hasJsonPath("$.dataType", equalToIgnoringCase("date")), hasJsonPath("$.order", equalToIgnoringCase(order)), hasJsonPath("$.sortOptions[*].name", containsInAnyOrder("title", "dateissued", "dateaccessioned")), @@ -160,6 +164,7 @@ public static Matcher typesBrowseIndex() { hasJsonPath("$.browseType", is("hierarchicalBrowse")), hasJsonPath("$.facetType", is("itemtype")), hasJsonPath("$.type", is("browse")), + hasJsonPath("$.uniqueType", is("discover.browse")), hasJsonPath("$._links.self.href", is(REST_SERVER_URL + "discover/browses/types")), hasJsonPath("$._links.items.href", is(REST_SERVER_URL + "discover/browses/types/items")) ); @@ -172,6 +177,7 @@ public static Matcher hierarchicalBrowseIndex( hasJsonPath("$.metadata", contains(metadata)), hasJsonPath("$.browseType", equalToIgnoringCase(BROWSE_TYPE_HIERARCHICAL)), hasJsonPath("$.type", equalToIgnoringCase("browse")), + hasJsonPath("$.uniqueType", equalToIgnoringCase("discover.browse")), hasJsonPath("$.facetType", equalToIgnoringCase(facetType)), hasJsonPath("$.vocabulary", equalToIgnoringCase(vocabulary)), hasJsonPath("$._links.vocabulary.href", diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/BundleMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/BundleMatcher.java index 812daabf5832..3d03b0063452 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/BundleMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/BundleMatcher.java @@ -71,6 +71,7 @@ public static Matcher matchProperties(String name, UUID uuid, St hasJsonPath("$.name", is(name)), hasJsonPath("$.handle", is(handle)), hasJsonPath("$.type", is(Constants.typeText[type].toLowerCase())), + hasJsonPath("$.uniqueType", is(String.format("core.%s",Constants.typeText[type].toLowerCase()))), hasJsonPath("$.metadata", Matchers.allOf( MetadataMatcher.matchMetadata("dc.title", name) )) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/ClaimedTaskMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/ClaimedTaskMatcher.java index 4ab812f82cd4..8c35efe72a44 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/ClaimedTaskMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/ClaimedTaskMatcher.java @@ -52,7 +52,8 @@ public static Matcher matchClaimedTask(ClaimedTask cTask, String step) { public static Matcher matchProperties(ClaimedTask cTask) { return allOf( cTask != null ? hasJsonPath("$.id", is(cTask.getID())) : hasJsonPath("$.id"), - hasJsonPath("$.type", is("claimedtask")) + hasJsonPath("$.type", is("claimedtask")), + hasJsonPath("$.uniqueType", is("workflow.claimedtask")) ); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/CollectionMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/CollectionMatcher.java index 5afb4155bde2..97981a5f4b16 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/CollectionMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/CollectionMatcher.java @@ -73,6 +73,7 @@ public static Matcher matchProperties(String name, UUID uuid, St hasJsonPath("$.name", is(name)), hasJsonPath("$.handle", is(handle)), hasJsonPath("$.type", is("collection")), + hasJsonPath("$.uniqueType", is("core.collection")), hasJsonPath("$.metadata", Matchers.allOf( MetadataMatcher.matchMetadata("dc.title", name) ))); @@ -137,6 +138,7 @@ public static Matcher matchCollection(Collection collection) { return allOf(hasJsonPath("$.uuid", is(collection.getID().toString())), hasJsonPath("$.name", is(collection.getName())), hasJsonPath("$.type", is("collection")), + hasJsonPath("$.uniqueType", is("core.collection")), hasJsonPath("$.handle", is(collection.getHandle()))); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/CommunityMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/CommunityMatcher.java index 59f99794d807..95fc87e47470 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/CommunityMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/CommunityMatcher.java @@ -16,7 +16,6 @@ import java.util.List; import java.util.UUID; -import org.dspace.content.Collection; import org.dspace.content.Community; import org.hamcrest.Matcher; import org.hamcrest.Matchers; @@ -32,6 +31,7 @@ public static Matcher matchCommunityEntry(UUID uuid, String hand hasJsonPath("$.uuid", is(uuid.toString())), hasJsonPath("$.handle", is(handle)), hasJsonPath("$.type", is("community")), + hasJsonPath("$.uniqueType", is("core.community")), matchLinks(uuid) ); } @@ -45,6 +45,7 @@ public static Matcher matchCommunityEntryMultipleTitles(List matchProperties(String name, UUID uuid, St hasJsonPath("$.name", is(name)), hasJsonPath("$.handle", is(handle)), hasJsonPath("$.type", is("community")), + hasJsonPath("$.uniqueType", is("core.community")), hasJsonPath("$.metadata", Matchers.allOf( MetadataMatcher.matchMetadata("dc.title", name) )) @@ -129,18 +131,6 @@ public static Matcher matchLinks(UUID uuid) { ); } - public static Matcher matchCommunityWithCollectionEntry(String name, UUID uuid, String handle, - Collection col) { - return allOf( - matchProperties(name, uuid, handle), - hasJsonPath("$._embedded.collections._embedded.collections[0]", - CollectionMatcher - .matchCollectionEntry(col.getName(), col.getID(), col.getHandle(), col.getLogo())), - hasJsonPath("$._embedded.logo", Matchers.not(Matchers.empty())), - matchLinks(uuid) - ); - } - public static String getNonAdminEmbeds() { return "collections,logo,parentCommunity,subcommunities"; } @@ -149,6 +139,7 @@ public static Matcher matchCommunity(Community community) { return allOf(hasJsonPath("$.uuid", is(community.getID().toString())), hasJsonPath("$.name", is(community.getName())), hasJsonPath("$.type", is("community")), + hasJsonPath("$.uniqueType", is("core.community")), hasJsonPath("$.handle", is(community.getHandle()))); } } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/CrisMetricsMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/CrisMetricsMatcher.java index 6f8344eca5ad..54c89860455a 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/CrisMetricsMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/CrisMetricsMatcher.java @@ -38,17 +38,19 @@ public static Matcher matchCrisMetrics(CrisMetrics crisMetrics) hasJsonPath("$.deltaPeriod1", is(crisMetrics.getDeltaPeriod1())), hasJsonPath("$.deltaPeriod2", is(crisMetrics.getDeltaPeriod2())), hasJsonPath("$.rank", is(crisMetrics.getRank())), - hasJsonPath("$.type", is(CrisMetricsRest.NAME)) + hasJsonPath("$.type", is(CrisMetricsRest.NAME)), + hasJsonPath("$.uniqueType", is("cris.metric")) ); } public static Matcher matchCrisDynamicMetrics(UUID itemUuid, String type, String remark) { return allOf( hasJsonPath("$.id", itemUuid != null ? - is(itemUuid.toString() + ":" + type) : + is(itemUuid + ":" + type) : Matchers.endsWith("-" + type)), hasJsonPath("$.metricType", is(type)), hasJsonPath("$.type", is(CrisMetricsRest.NAME)), + hasJsonPath("$.uniqueType", is("cris.metric")), hasJsonPath("$.remark", containsString(remark)) ); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/EPersonMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/EPersonMatcher.java index 7b95d9b6f289..c535373d326c 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/EPersonMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/EPersonMatcher.java @@ -37,6 +37,7 @@ public static Matcher matchEPersonEntry(EPerson ePerson) { public static Matcher matchEPersonOnEmail(String email) { return allOf( hasJsonPath("$.type", is("eperson")), + hasJsonPath("$.uniqueType", is("eperson.eperson")), hasJsonPath("$.email", is(email)) ); } @@ -50,17 +51,12 @@ public static Matcher matchEPersonWithGroups(String email, Strin return allOf( hasJsonPath("$.type", is("eperson")), + hasJsonPath("$.uniqueType", is("eperson.eperson")), hasJsonPath("$.email", is(email)), hasJsonPath("$._embedded.groups._embedded.groups", containsInAnyOrder( matchers))); } - public static Matcher matchDefaultTestEPerson() { - return allOf( - hasJsonPath("$.type", is("eperson")) - ); - } - /** * Gets a matcher for all expected embeds when the full projection is requested. */ @@ -85,6 +81,7 @@ public static Matcher matchProperties(EPerson ePerson) { hasJsonPath("$.uuid", is(ePerson.getID().toString())), hasJsonPath("$.name", is(ePerson.getName())), hasJsonPath("$.type", is("eperson")), + hasJsonPath("$.uniqueType", is("eperson.eperson")), hasJsonPath("$.canLogIn", not(empty())), hasJsonPath("$.metadata", Matchers.allOf( MetadataMatcher.matchMetadata("eperson.firstname", ePerson.getFirstName()), diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/EntityTypeMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/EntityTypeMatcher.java index 6e86c2d3fe83..50105e42958b 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/EntityTypeMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/EntityTypeMatcher.java @@ -53,6 +53,7 @@ public static Matcher matchEntityTypeExplicitValuesEntry(int id, matchId(id), hasJsonPath("$.label", is(label)), hasJsonPath("$.type", is("entitytype")), + hasJsonPath("$.uniqueType", is("core.entitytype")), matchSelfLink(id) ); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/FacetValueMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/FacetValueMatcher.java index 9d5ae5d3bcf0..1ec3c810db28 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/FacetValueMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/FacetValueMatcher.java @@ -12,7 +12,6 @@ import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.is; -import static org.hamcrest.Matchers.nullValue; import org.hamcrest.Matcher; import org.hamcrest.Matchers; @@ -25,6 +24,7 @@ public static Matcher entryAuthor(String label) { return allOf( hasJsonPath("$.label", is(label)), hasJsonPath("$.type", is("discover")), + hasJsonPath("$.uniqueType", is("discover.discover")), hasJsonPath("$._links.search.href", containsString("api/discover/search/objects")), hasJsonPath("$._links.search.href", containsString( "f.author=" + urlPathSegmentEscaper().escape(label) + ",equals" @@ -32,61 +32,34 @@ public static Matcher entryAuthor(String label) { ); } - public static Matcher entryFacetWithoutSelfLink(String label) { - return allOf( - hasJsonPath("$.label", is(label)), - hasJsonPath("$.type", is("discover")) - ); - } - public static Matcher entryAuthorWithAuthority(String label, String authority, int count) { return allOf( hasJsonPath("$.authorityKey", is(authority)), hasJsonPath("$.count", is(count)), hasJsonPath("$.label", is(label)), hasJsonPath("$.type", is("discover")), + hasJsonPath("$.uniqueType", is("discover.discover")), hasJsonPath("$._links.search.href", containsString("api/discover/search/objects")), hasJsonPath("$._links.search.href", containsString("f.author=" + authority + ",authority")) ); } - public static Matcher entrySubject(String label, int count) { - return allOf( - hasJsonPath("$.label", is(label)), - hasJsonPath("$.type", is("discover")), - hasJsonPath("$.count", is(count)), - hasJsonPath("$._links.search.href", containsString("api/discover/search/objects")), - hasJsonPath("$._links.search.href", containsString( - "f.subject=" + urlPathSegmentEscaper().escape(label) + ",equals")) - ); - } - public static Matcher matchEntry(String facet, String label, int count) { return allOf( hasJsonPath("$.label", is(label)), hasJsonPath("$.type", is("discover")), + hasJsonPath("$.uniqueType", is("discover.discover")), hasJsonPath("$.count", is(count)), hasJsonPath("$._links.search.href", containsString("api/discover/search/objects")), hasJsonPath("$._links.search.href", containsString("f." + facet + "=" + label + ",equals")) ); } - - public static Matcher entrySubjectWithAuthority(String label, String authority, int count) { - return allOf( - hasJsonPath("$.authorityKey", is(authority)), - hasJsonPath("$.count", is(count)), - hasJsonPath("$.label", is(label)), - hasJsonPath("$.type", is("discover")), - hasJsonPath("$._links.search.href", containsString("api/discover/search/objects")), - hasJsonPath("$._links.search.href", containsString("f.subject=" + authority + ",authority")) - ); - } - public static Matcher entryDateIssued() { return allOf( hasJsonPath("$.label", Matchers.notNullValue()), hasJsonPath("$.type", is("discover")), + hasJsonPath("$.uniqueType", is("discover.discover")), hasJsonPath("$._links.search.href", containsString("api/discover/search/objects")), hasJsonPath("$._links.search.href", containsString("f.dateIssued=")), hasJsonPath("$._links.search.href", containsString(",equals")) @@ -97,6 +70,7 @@ public static Matcher entryDateIssuedWithCountOne() { return allOf( hasJsonPath("$.label", Matchers.notNullValue()), hasJsonPath("$.type", is("discover")), + hasJsonPath("$.uniqueType", is("discover.discover")), hasJsonPath("$.count", is(1)), hasJsonPath("$._links.search.href", containsString("api/discover/search/objects")), hasJsonPath("$._links.search.href", containsString("f.dateIssued=")), @@ -108,6 +82,7 @@ public static Matcher entryDateIssuedWithLabel(String label) { return allOf( hasJsonPath("$.label", is(label)), hasJsonPath("$.type", is("discover")), + hasJsonPath("$.uniqueType", is("discover.discover")), hasJsonPath("$._links.search.href", containsString("api/discover/search/objects")), hasJsonPath("$._links.search.href", containsString("f.dateIssued=")), hasJsonPath("$._links.search.href", containsString(",equals")) @@ -119,6 +94,7 @@ public static Matcher entryDateIssuedWithLabelAndCount(String la hasJsonPath("$.label", is(label)), hasJsonPath("$.count", is(count)), hasJsonPath("$.type", is("discover")), + hasJsonPath("$.uniqueType", is("discover.discover")), hasJsonPath("$._links.search.href", containsString(",equals")) ); } @@ -128,6 +104,7 @@ public static Matcher entryText(String facetName, String label, hasJsonPath("$.label", is(label)), hasJsonPath("$.count", is(count)), hasJsonPath("$.type", is("discover")), + hasJsonPath("$.uniqueType", is("discover.discover")), hasJsonPath("$._links.search.href", containsString("api/discover/search/objects")), hasJsonPath("$._links.search.href", containsString("f." + facetName + "=" + label + ",equals")) ); @@ -137,34 +114,19 @@ public static Matcher entryLanguage(String label) { return allOf( hasJsonPath("$.label", is(label)), hasJsonPath("$.type", is("discover")), + hasJsonPath("$.uniqueType", is("discover.discover")), hasJsonPath("$._links.search.href", containsString("api/discover/search/objects")), hasJsonPath("$._links.search.href", containsString("f.language=")) ); } - public static Matcher entryTypes(String label, String authorityKey) { - return allOf( - hasJsonPath("$.label", is(label)), - hasJsonPath("$.authorityKey", is(authorityKey)), - hasJsonPath("$.type", is("discover")), - hasJsonPath("$._links.search.href", containsString("api/discover/search/objects")) - ); - } - - public static Matcher entryTypes(String label) { - return allOf( - hasJsonPath("$.label", is(label)), - hasJsonPath("$.authorityKey", nullValue()), - hasJsonPath("$.type", is("discover")), - hasJsonPath("$._links.search.href", containsString("api/discover/search/objects"))); - } - public static Matcher entrySupervisedBy(String label, String authority, int count) { return allOf( hasJsonPath("$.authorityKey", is(authority)), hasJsonPath("$.count", is(count)), hasJsonPath("$.label", is(label)), hasJsonPath("$.type", is("discover")), + hasJsonPath("$.uniqueType", is("discover.discover")), hasJsonPath("$._links.search.href", containsString("api/discover/search/objects")), hasJsonPath("$._links.search.href", containsString("f.supervisedBy=" + authority + ",authority")) ); diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/GroupMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/GroupMatcher.java index a3f7e4fd2d8b..402720d7e3f8 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/GroupMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/GroupMatcher.java @@ -21,7 +21,8 @@ public class GroupMatcher { - private GroupMatcher() { } + private GroupMatcher() { + } public static Matcher matchGroupEntry(UUID uuid, String name) { return allOf( @@ -31,10 +32,11 @@ public static Matcher matchGroupEntry(UUID uuid, String name) { public static Matcher matchGroupWithName(String name) { return allOf( - hasJsonPath("$.name", is(name)), - hasJsonPath("$.type", is("group")), - hasJsonPath("$._links.self.href", containsString("/api/eperson/groups/")), - hasJsonPath("$._links.subgroups.href", endsWith("/subgroups")) + hasJsonPath("$.name", is(name)), + hasJsonPath("$.type", is("group")), + hasJsonPath("$.uniqueType", is("eperson.group")), + hasJsonPath("$._links.self.href", containsString("/api/eperson/groups/")), + hasJsonPath("$._links.subgroups.href", endsWith("/subgroups")) ); } @@ -66,6 +68,7 @@ private static Matcher matchProperties(UUID uuid, String name) { hasJsonPath("$.uuid", is(uuid.toString())), hasJsonPath("$.name", is(name)), hasJsonPath("$.type", is("group")), + hasJsonPath("$.uniqueType", is("eperson.group")), hasJsonPath("$._links.self.href", containsString("/api/eperson/groups/" + uuid.toString())), hasJsonPath("$._links.subgroups.href", endsWith(uuid.toString() + "/subgroups")), hasJsonPath("$._links.epersons.href", endsWith(uuid.toString() + "/epersons")) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/ItemAuthorityMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/ItemAuthorityMatcher.java index ed29e4081359..ce7b5b451e7e 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/ItemAuthorityMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/ItemAuthorityMatcher.java @@ -18,99 +18,125 @@ /** * Utility class to construct a Matcher for ItemAuthority - * + * * @author Mykhaylo Boychuk (4Science.it) */ public class ItemAuthorityMatcher { - private ItemAuthorityMatcher() {} + private ItemAuthorityMatcher() { + } public static Matcher matchItemAuthorityProperties(String authority, String display, String value, - String type) { + String type) { return allOf( - hasJsonPath("$.authority", is(authority)), - hasJsonPath("$.display", is(display)), - hasJsonPath("$.value", is(value)), - hasJsonPath("$.type", is(type)) + hasJsonPath("$.authority", is(authority)), + hasJsonPath("$.display", is(display)), + hasJsonPath("$.value", is(value)), + hasJsonPath("$.type", is(type)) ); } public static Matcher matchItemAuthorityWithOtherInformations(String authority, String display, - String value, String type, String otherInfMetadata, String metadataValue) { + String value, String type, + String otherInfMetadata, + String metadataValue) { return allOf( - hasJsonPath("$.authority", is(authority)), - hasJsonPath("$.display", is(display)), - hasJsonPath("$.value", is(value)), - hasJsonPath("$.type", is(type)), - hasJsonPath("$.otherInformation", aMapWithSize(2)), - hasJsonPath("$.otherInformation['" + otherInfMetadata + "']", is(metadataValue)), - hasJsonPath("$.otherInformation['" + "data-" + otherInfMetadata + "']", is(metadataValue)) + hasJsonPath("$.authority", is(authority)), + hasJsonPath("$.display", is(display)), + hasJsonPath("$.value", is(value)), + hasJsonPath("$.type", is(type)), + hasJsonPath("$.otherInformation", aMapWithSize(2)), + hasJsonPath("$.otherInformation['" + otherInfMetadata + "']", is(metadataValue)), + hasJsonPath("$.otherInformation['" + "data-" + otherInfMetadata + "']", is(metadataValue)) ); } public static Matcher matchItemAuthorityWithOtherInformations(String authority, String display, - String value, String type, String otherInfMetadata, String metadataValue, String source) { + String value, String type, + String otherInfMetadata, + String metadataValue, String source) { return allOf( - hasJsonPath("$.authority", is(authority)), - hasJsonPath("$.display", is(display)), - hasJsonPath("$.value", is(value)), - hasJsonPath("$.type", is(type)), - hasJsonPath("$.source", is(source)), - hasJsonPath("$.otherInformation", aMapWithSize(2)), - hasJsonPath("$.otherInformation['" + otherInfMetadata + "']", is(metadataValue)), - hasJsonPath("$.otherInformation['" + "data-" + otherInfMetadata + "']", is(metadataValue)) + hasJsonPath("$.authority", is(authority)), + hasJsonPath("$.display", is(display)), + hasJsonPath("$.value", is(value)), + hasJsonPath("$.type", is(type)), + hasJsonPath("$.source", is(source)), + hasJsonPath("$.otherInformation", aMapWithSize(2)), + hasJsonPath("$.otherInformation['" + otherInfMetadata + "']", is(metadataValue)), + hasJsonPath("$.otherInformation['" + "data-" + otherInfMetadata + "']", is(metadataValue)) ); } - public static Matcher matchItemAuthorityWithOtherInformations(String authority, String display, - String value, String type, Map otherInformation) { + public static Matcher matchItemAuthorityWithOtherInformations( + String authority, + String display, + String value, + String type, + Map otherInformation + ) { return allOf( - hasJsonPath("$.authority", is(authority)), - hasJsonPath("$.display", is(display)), - hasJsonPath("$.value", is(value)), - hasJsonPath("$.type", is(type)), - hasJsonPath("$.otherInformation", is(otherInformation)) + hasJsonPath("$.authority", is(authority)), + hasJsonPath("$.display", is(display)), + hasJsonPath("$.value", is(value)), + hasJsonPath("$.type", is(type)), + hasJsonPath("$.otherInformation", is(otherInformation)) ); } public static Matcher matchItemAuthorityWithOtherInformations(String authority, String display, - String value, String type, Map otherInformation, String source) { + String value, String type, + Map otherInformation, + String source) { return allOf( - hasJsonPath("$.authority", is(authority)), - hasJsonPath("$.display", is(display)), - hasJsonPath("$.value", is(value)), - hasJsonPath("$.type", is(type)), - hasJsonPath("$.otherInformation", is(otherInformation)), - hasJsonPath("$.source", is(source)) + hasJsonPath("$.authority", is(authority)), + hasJsonPath("$.display", is(display)), + hasJsonPath("$.value", is(value)), + hasJsonPath("$.type", is(type)), + hasJsonPath("$.otherInformation", is(otherInformation)), + hasJsonPath("$.source", is(source)) ); } - public static Matcher matchItemAuthorityWithTwoMetadataInOtherInformations(String authority, - String display, String value, String type, String firstOtherMetadata, String firstOtherValue, - String secondOtherMetadata, String secondOtherValue, String source) { + public static Matcher matchItemAuthorityWithTwoMetadataInOtherInformations( + String authority, + String display, + String value, + String type, + String firstOtherMetadata, + String firstOtherValue, + String secondOtherMetadata, + String secondOtherValue, + String source + ) { return allOf( - hasJsonPath("$.authority", is(authority)), - hasJsonPath("$.display", is(display)), - hasJsonPath("$.value", is(value)), - hasJsonPath("$.type", is(type)), - hasJsonPath("$.source", is(source)), - hasJsonPath("$.otherInformation", aMapWithSize(2)), - allOf ( - hasJsonPath("$.otherInformation." + firstOtherMetadata, is(firstOtherValue)), - hasJsonPath("$.otherInformation." + secondOtherMetadata, is(secondOtherValue)) - ) + hasJsonPath("$.authority", is(authority)), + hasJsonPath("$.display", is(display)), + hasJsonPath("$.value", is(value)), + hasJsonPath("$.type", is(type)), + hasJsonPath("$.source", is(source)), + hasJsonPath("$.otherInformation", aMapWithSize(2)), + allOf( + hasJsonPath("$.otherInformation." + firstOtherMetadata, is(firstOtherValue)), + hasJsonPath("$.otherInformation." + secondOtherMetadata, is(secondOtherValue)) + ) ); } - public static Matcher matchItemAuthorityWithTwoMetadataInOtherInformations(String authority, - String display, String value, String type, Map orcidAndAffiliation) { + public static Matcher matchItemAuthorityWithTwoMetadataInOtherInformations( + String authority, + String display, + String value, + String type, + Map orcidAndAffiliation + ) { + return allOf( hasJsonPath("$.authority", is(authority)), hasJsonPath("$.display", is(display)), hasJsonPath("$.value", is(value)), hasJsonPath("$.type", is(type)), hasJsonPath("$.otherInformation", aMapWithSize(4)), - allOf ( + allOf( hasJsonPath("$.otherInformation", is(orcidAndAffiliation)) ) ); diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/ItemMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/ItemMatcher.java index 3ee0a75b4a90..34320644d074 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/ItemMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/ItemMatcher.java @@ -93,7 +93,8 @@ public static Matcher matchItemProperties(Item item) { hasJsonPath("$.discoverable", is(item.isDiscoverable())), hasJsonPath("$.withdrawn", is(item.isWithdrawn())), hasJsonPath("$.lastModified", is(notNullValue())), - hasJsonPath("$.type", is("item")) + hasJsonPath("$.type", is("item")), + hasJsonPath("$.uniqueType", is("core.item")) ); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/MetadataFieldMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/MetadataFieldMatcher.java index 59f609cdfa37..80453664899b 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/MetadataFieldMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/MetadataFieldMatcher.java @@ -17,38 +17,30 @@ public class MetadataFieldMatcher { - private MetadataFieldMatcher() { } - - public static Matcher matchMetadataField() { - return allOf( - hasJsonPath("$.element", Matchers.not(Matchers.empty())), - hasJsonPath("$.qualifier", Matchers.not(Matchers.empty())), - hasJsonPath("$.type", is("metadatafield")), - hasJsonPath("$._embedded.schema", Matchers.not(Matchers.empty())), - hasJsonPath("$._links.schema.href", Matchers.containsString("/api/core/metadatafields")), - hasJsonPath("$._links.self.href", Matchers.containsString("/api/core/metadatafields")) - ); + private MetadataFieldMatcher() { } public static Matcher matchMetadataField(MetadataField metadataField) { return allOf( - hasJsonPath("$.element", is(metadataField.getElement())), - hasJsonPath("$.qualifier", is(metadataField.getQualifier())), - hasJsonPath("$.type", is("metadatafield")), - hasJsonPath("$._embedded.schema", Matchers.not(Matchers.empty())), - hasJsonPath("$._links.schema.href", Matchers.containsString("/api/core/metadatafields")), - hasJsonPath("$._links.self.href", Matchers.containsString("/api/core/metadatafields")) + hasJsonPath("$.element", is(metadataField.getElement())), + hasJsonPath("$.qualifier", is(metadataField.getQualifier())), + hasJsonPath("$.type", is("metadatafield")), + hasJsonPath("$.uniqueType", is("core.metadatafield")), + hasJsonPath("$._embedded.schema", Matchers.not(Matchers.empty())), + hasJsonPath("$._links.schema.href", Matchers.containsString("/api/core/metadatafields")), + hasJsonPath("$._links.self.href", Matchers.containsString("/api/core/metadatafields")) ); } public static Matcher matchMetadataFieldByKeys(String schema, String element, String qualifier) { return allOf( - hasJsonPath("$.element", is(element)), - hasJsonPath("$.qualifier", is(qualifier)), - hasJsonPath("$.type", is("metadatafield")), - hasJsonPath("$._embedded.schema.prefix", is(schema)), - hasJsonPath("$._links.schema.href", Matchers.containsString("/api/core/metadatafields")), - hasJsonPath("$._links.self.href", Matchers.containsString("/api/core/metadatafields")) + hasJsonPath("$.element", is(element)), + hasJsonPath("$.qualifier", is(qualifier)), + hasJsonPath("$.type", is("metadatafield")), + hasJsonPath("$.uniqueType", is("core.metadatafield")), + hasJsonPath("$._embedded.schema.prefix", is(schema)), + hasJsonPath("$._links.schema.href", Matchers.containsString("/api/core/metadatafields")), + hasJsonPath("$._links.self.href", Matchers.containsString("/api/core/metadatafields")) ); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/MetadataschemaMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/MetadataschemaMatcher.java index 42b70810a5c9..2670b1d1cb47 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/MetadataschemaMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/MetadataschemaMatcher.java @@ -17,14 +17,16 @@ public class MetadataschemaMatcher { - private MetadataschemaMatcher() { } + private MetadataschemaMatcher() { + } public static Matcher matchEntry() { return allOf( - hasJsonPath("$.prefix", Matchers.not(Matchers.empty())), - hasJsonPath("$.namespace", Matchers.not(Matchers.empty())), - hasJsonPath("$.type", is("metadataschema")), - hasJsonPath("$._links.self.href", Matchers.containsString("/api/core/metadataschemas")) + hasJsonPath("$.prefix", Matchers.not(Matchers.empty())), + hasJsonPath("$.namespace", Matchers.not(Matchers.empty())), + hasJsonPath("$.type", is("metadataschema")), + hasJsonPath("$.uniqueType", is("core.metadataschema")), + hasJsonPath("$._links.self.href", Matchers.containsString("/api/core/metadataschemas")) ); } @@ -37,6 +39,7 @@ public static Matcher matchEntry(String name, String nameSpace) hasJsonPath("$.prefix", is(name)), hasJsonPath("$.namespace", is(nameSpace)), hasJsonPath("$.type", is("metadataschema")), + hasJsonPath("$.uniqueType", is("core.metadataschema")), hasJsonPath("$._links.self.href", Matchers.containsString("/api/core/metadataschemas")) ); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/NBEventMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/NBEventMatcher.java index afb364bb0e3a..bbaab1489d55 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/NBEventMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/NBEventMatcher.java @@ -53,7 +53,8 @@ public static Matcher matchNBEventEntry(NBEvent event) { hasJsonPath("$._links.target.href", Matchers.endsWith(event.getEventId() + "/target")), hasJsonPath("$._links.related.href", Matchers.endsWith(event.getEventId() + "/related")), hasJsonPath("$._links.topic.href", Matchers.endsWith(event.getEventId() + "/topic")), - hasJsonPath("$.type", is("nbevent"))); + hasJsonPath("$.type", is("nbevent")), + hasJsonPath("$.uniqueType", is("integration.nbevent"))); } catch (JsonProcessingException e) { throw new RuntimeException(e); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/OrcidHistoryMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/OrcidHistoryMatcher.java index 746e41673a48..7e9defdab5c0 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/OrcidHistoryMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/OrcidHistoryMatcher.java @@ -33,7 +33,8 @@ public static Matcher matchOrcidHistory(OrcidHistory orcidHistor hasJsonPath("$.status", is(status)), hasJsonPath("$.putCode", is(putCode)), hasJsonPath("$.responseMessage", is(responseMessage)), - hasJsonPath("$.type", is("orcidhistory")) + hasJsonPath("$.type", is("orcidhistory")), + hasJsonPath("$.uniqueType", is("eperson.orcidhistory")) ); } } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/OrcidQueueMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/OrcidQueueMatcher.java index 677de5e1b421..80e6ddac94f9 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/OrcidQueueMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/OrcidQueueMatcher.java @@ -35,7 +35,8 @@ public static Matcher matchOrcidQueue(OrcidQueue orcidQueue) { hasJsonPath("$.description", is(orcidQueue.getDescription())), hasJsonPath("$.recordType", is(orcidQueue.getRecordType())), hasJsonPath("$.operation", is(orcidQueue.getOperation().name())), - hasJsonPath("$.type", is("orcidqueue")) + hasJsonPath("$.type", is("orcidqueue")), + hasJsonPath("$.uniqueType", is("eperson.orcidqueue")) ); } } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/PoolTaskMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/PoolTaskMatcher.java index 8d43acbb0fd0..622777f6d494 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/PoolTaskMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/PoolTaskMatcher.java @@ -52,7 +52,8 @@ public static Matcher matchPoolTask(PoolTask pTask, String step) { public static Matcher matchProperties(PoolTask pTask) { return allOf( pTask != null ? hasJsonPath("$.id", is(pTask.getID())) : hasJsonPath("$.id"), - hasJsonPath("$.type", is("pooltask")) + hasJsonPath("$.type", is("pooltask")), + hasJsonPath("$.uniqueType", is("workflow.pooltask")) ); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/RelationshipTypeMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/RelationshipTypeMatcher.java index 1fecf3376b36..801ae9fe9cec 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/RelationshipTypeMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/RelationshipTypeMatcher.java @@ -89,6 +89,7 @@ private static Matcher matchExplicitRelationshipTypeValuesAndExp hasJsonPath("$.rightMinCardinality", is(rightMinCardinality)), hasJsonPath("$.rightMaxCardinality", is(rightMaxCardinality)), hasJsonPath("$.type", is("relationshiptype")), + hasJsonPath("$.uniqueType", is("core.relationshiptype")), hasJsonPath("$._links.self.href", containsString("/api/core/relationshiptypes/" + id)), hasJsonPath("$._links.leftType.href", containsString("/api/core/entitytypes/" + leftEntityTypeId)), hasJsonPath("$._links.rightType.href", containsString("/api/core/entitytypes/" + rightEntityTypeId)) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/RequestCopyMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/RequestCopyMatcher.java index 70bf52ff2a06..de7cd33e9dee 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/RequestCopyMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/RequestCopyMatcher.java @@ -38,6 +38,7 @@ public static Matcher matchRequestCopy(RequestItem request) { hasJsonPath("$.decisionDate", dateMatcher(request.getDecision_date())), hasJsonPath("$.expires", dateMatcher(request.getExpires())), hasJsonPath("$.type", is(RequestItemRest.NAME)), + hasJsonPath("$.uniqueType", is("tools.itemrequest")), hasJsonPath("$._links.self.href", Matchers.containsString(RequestItemRepositoryIT.URI_ROOT)) ); diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/ResourcePolicyMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/ResourcePolicyMatcher.java index d80fb638cdd3..89ec5b6da322 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/ResourcePolicyMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/ResourcePolicyMatcher.java @@ -43,6 +43,7 @@ public static Matcher matchResourcePolicyProperties(@Nullable Gr hasJsonPath("$.policyType", is(rpType)) : hasNoJsonPath("$.policyType"), hasJsonPath("$.type", is("resourcepolicy")), + hasJsonPath("$.uniqueType", is("authz.resourcepolicy")), hasJsonPath("$._embedded.resource.uuid", is(dso.getID().toString())), eperson != null ? hasJsonPath("$._embedded.eperson.id", @@ -66,6 +67,7 @@ public static Matcher matchResourcePolicy(ResourcePolicy resourc hasJsonPath("$.policyType", is(resourcePolicy.getRpType())) : hasNoJsonPath("$.policyType"), hasJsonPath("$.type", is("resourcepolicy")), + hasJsonPath("$.uniqueType", is("authz.resourcepolicy")), hasJsonPath("$._embedded.resource.id", is(resourcePolicy.getdSpaceObject().getID().toString())), resourcePolicy.getEPerson() != null ? hasJsonPath("$._embedded.eperson.id", diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SearchResultMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SearchResultMatcher.java index 8fd320b3d16c..6f37b8e5c50b 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SearchResultMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SearchResultMatcher.java @@ -23,21 +23,23 @@ private SearchResultMatcher() { } public static Matcher match(String category, String type, String typePlural) { return allOf( hasJsonPath("$.type", is("discover")), + hasJsonPath("$.uniqueType", is("discover.discover")), hasJsonPath("$._links.indexableObject.href", containsString("/api/" + category + "/" + typePlural)), hasJsonPath("$._embedded", notNullValue()), hasJsonPath("$._embedded.indexableObject", is( - matchEmbeddedObject(type) + matchEmbeddedObject(category, type) )) ); } public static Matcher match() { return allOf( - hasJsonPath("$.type", is("discover")) + hasJsonPath("$.type", is("discover")), + hasJsonPath("$.uniqueType", is("discover.discover")) ); } - private static Matcher matchEmbeddedObject(String type) { + private static Matcher matchEmbeddedObject(String category, String type) { return allOf( Matchers.anyOf( allOf( @@ -46,13 +48,15 @@ private static Matcher matchEmbeddedObject(String type) { ), hasJsonPath("$.id", notNullValue()) ), - hasJsonPath("$.type", is(type)) + hasJsonPath("$.type", is(type)), + hasJsonPath("$.uniqueType", is(String.format("%s.%s", category, type))) ); } public static Matcher matchOnItemName(String type, String typePlural, String itemName) { return allOf( hasJsonPath("$.type", is("discover")), + hasJsonPath("$.uniqueType", is("discover.discover")), hasJsonPath("$._links.indexableObject.href", containsString("/api/core/" + typePlural)), hasJsonPath("$._embedded", notNullValue()), hasJsonPath("$._embedded.indexableObject", is( @@ -65,7 +69,8 @@ public static Matcher matchEmbeddedObjectOnItemName(String type, return allOf( hasJsonPath("$.uuid", notNullValue()), hasJsonPath("$.name", is(itemName)), - hasJsonPath("$.type", is(type)) + hasJsonPath("$.type", is(type)), + hasJsonPath("$.uniqueType", is(String.format("core.%s",type))) ); } @@ -74,6 +79,7 @@ public static Matcher matchOnItemNameAndHitHighlight(String type String expectedFieldInHitHighlightning) { return allOf( hasJsonPath("$.type", is("discover")), + hasJsonPath("$.uniqueType", is("discover.discover")), hasJsonPath("$.hitHighlights", is( HitHighlightMatcher.entry(hitHighlightQuery, expectedFieldInHitHighlightning))), hasJsonPath("$._links.indexableObject.href", containsString("/api/core/" + typePlural)), @@ -86,11 +92,12 @@ public static Matcher matchOnItemNameAndHitHighlight(String type public static Matcher matchEmbeddedFacetValues(String label, int count, String type, - String search_href) { + String search_href, String category) { return allOf( hasJsonPath("$.label", is(label)), hasJsonPath("$.count", is(count)), hasJsonPath("$.type", is(type)), + hasJsonPath("$.uniqueType", is(String.format("%s.%s", category, type))), hasJsonPath("$._links.search.href", containsString(search_href)) ); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SiteMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SiteMatcher.java index 8e92fe161e9b..ad4f3f3d894a 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SiteMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SiteMatcher.java @@ -24,6 +24,7 @@ public static Matcher matchEntry(Site site) { hasJsonPath("$.uuid", is(site.getID().toString())), hasJsonPath("$.name", is(site.getName())), hasJsonPath("$.type", is("site")), + hasJsonPath("$.uniqueType", is("core.site")), hasJsonPath("$._links.self.href", containsString("/api/core/sites/" + site.getID())) ); diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/StatisticsCategoryMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/StatisticsCategoryMatcher.java index bec345875db8..ea2877281341 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/StatisticsCategoryMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/StatisticsCategoryMatcher.java @@ -23,6 +23,7 @@ public static Matcher match(String id, String type) { hasJsonPath("$.id", is(id)), hasJsonPath("$.category-type", is(type)), hasJsonPath("$.type", is("category")), + hasJsonPath("$.uniqueType", is("statistics.category")), hasJsonPath("$._links.self.href", endsWith("/" + id)) ); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SubmissionDefinitionsMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SubmissionDefinitionsMatcher.java index 398097db6fba..bbfb8e784acf 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SubmissionDefinitionsMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SubmissionDefinitionsMatcher.java @@ -56,6 +56,7 @@ public static Matcher matchProperties(boolean isDefault, String hasJsonPath("$.name", is(name)), hasJsonPath("$.id", is(id)), hasJsonPath("$.type", is("submissiondefinition")), + hasJsonPath("$.uniqueType", is("config.submissiondefinition")), hasJsonPath("$._links.self.href", is(REST_SERVER_URL + "config/submissiondefinitions/" + id)), hasJsonPath("$._links.sections.href", is(REST_SERVER_URL + "config/submissiondefinitions/" + id + "/sections")) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SubmissionSectionMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SubmissionSectionMatcher.java index 95f5df358922..9a591f44a466 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SubmissionSectionMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SubmissionSectionMatcher.java @@ -34,6 +34,7 @@ public static Matcher matches(String id, boolean mandatory, Stri hasJsonPath("$.mandatory", is(mandatory)), hasJsonPath("$.sectionType", is(sectionType)), hasJsonPath("$.type", is("submissionsection")), + hasJsonPath("$.uniqueType", is("config.submissionsection")), hasNoJsonPath("$.visibility")); } @@ -44,6 +45,7 @@ public static Matcher matches(String id, boolean mandatory, Stri hasJsonPath("$.opened", is(opened)), hasJsonPath("$.sectionType", is(sectionType)), hasJsonPath("$.type", is("submissionsection")), + hasJsonPath("$.uniqueType", is("config.submissionsection")), hasNoJsonPath("$.visibility")); } @@ -54,6 +56,7 @@ public static Matcher matches(String id, boolean mandatory, Stri hasJsonPath("$.mandatory", is(mandatory)), hasJsonPath("$.sectionType", is(sectionType)), hasJsonPath("$.type", is("submissionsection")), + hasJsonPath("$.uniqueType", is("config.submissionsection")), hasJsonPath("$.visibility", is(visibilities))); } } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SuggestionMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SuggestionMatcher.java index 38be403cb222..cebff93585dc 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SuggestionMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SuggestionMatcher.java @@ -30,7 +30,8 @@ public static Matcher matchSuggestion(String source, Item target hasJsonPath("$.metadata['dc.source'][1].value", is("Source 2")), hasJsonPath("$.score"), hasJsonPath("$.evidences"), - hasJsonPath("$.type", is("suggestion")) + hasJsonPath("$.type", is("suggestion")), + hasJsonPath("$.uniqueType", is("integration.suggestion")) ); } @@ -50,7 +51,8 @@ public static Matcher matchSuggestion(String source, Item target hasJsonPath("$.score", is(String.format("%.2f", evidenceScore))), hasJsonPath("$.notes", is(evidenceNote)))) )), - hasJsonPath("$.type", is("suggestion")) + hasJsonPath("$.type", is("suggestion")), + hasJsonPath("$.uniqueType", is("integration.suggestion")) ); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SuggestionSourceMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SuggestionSourceMatcher.java index f9d70cef8681..42923d434b98 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SuggestionSourceMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SuggestionSourceMatcher.java @@ -22,7 +22,8 @@ public static Matcher matchSuggestionSource(String name, int tot return Matchers.allOf( hasJsonPath("$.id", is(name)), hasJsonPath("$.total", is(total)), - hasJsonPath("$.type", is("suggestionsource")) + hasJsonPath("$.type", is("suggestionsource")), + hasJsonPath("$.uniqueType", is("integration.suggestionsource")) ); } } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SuggestionTargetMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SuggestionTargetMatcher.java index b88b51020e76..ba33a57ed596 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SuggestionTargetMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/SuggestionTargetMatcher.java @@ -23,7 +23,8 @@ public static Matcher matchSuggestionTarget(String name, String hasJsonPath("$.display", is(name)), hasJsonPath("$.source", is(source)), hasJsonPath("$.total", is(total)), - hasJsonPath("$.type", is("suggestiontarget")) + hasJsonPath("$.type", is("suggestiontarget")), + hasJsonPath("$.uniqueType", is("integration.suggestiontarget")) ); } } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/UsageReportPointMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/UsageReportPointMatcher.java index f1c641b18a07..0fb9bfd79a21 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/UsageReportPointMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/UsageReportPointMatcher.java @@ -38,6 +38,7 @@ public static Matcher matchUsageReportPoint(String id, String la hasJsonPath("$.id", is(id)), hasJsonPath("$.label", is(label)), hasJsonPath("$.type", is(type)), + hasJsonPath("$.uniqueType", is(String.format("statistics.%s",type))), hasJsonPath("$.values.views", is(views)) ); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/VersionHistoryMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/VersionHistoryMatcher.java index d76aa535e6f0..19db02b6375c 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/VersionHistoryMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/VersionHistoryMatcher.java @@ -22,7 +22,8 @@ private VersionHistoryMatcher() { public static Matcher matchEntry(VersionHistory versionHistory) { return allOf( hasJsonPath("$.id", is(versionHistory.getID())), - hasJsonPath("$.type", is("versionhistory")) + hasJsonPath("$.type", is("versionhistory")), + hasJsonPath("$.uniqueType", is("versioning.versionhistory")) ); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/VersionMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/VersionMatcher.java index fbc87e21f286..e8ed7c769432 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/VersionMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/VersionMatcher.java @@ -24,7 +24,8 @@ public static Matcher matchEntry(Version version) { hasJsonPath("$.id", is(version.getID())), hasJsonPath("$.version", is(version.getVersionNumber())), hasJsonPath("$.summary", is(version.getSummary())), - hasJsonPath("$.type", is("version")) + hasJsonPath("$.type", is("version")), + hasJsonPath("$.uniqueType", is("versioning.version")) ); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/VocabularyEntryDetailsMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/VocabularyEntryDetailsMatcher.java index d645ef1e05c9..29cfa0e34430 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/VocabularyEntryDetailsMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/VocabularyEntryDetailsMatcher.java @@ -47,7 +47,8 @@ private static Matcher matchProperties(String id, String display hasJsonPath("$.id", is(id)), hasJsonPath("$.display", is(display)), hasJsonPath("$.value", is(value)), - hasJsonPath("$.type", is("vocabularyEntryDetail")) + hasJsonPath("$.type", is("vocabularyEntryDetail")), + hasJsonPath("$.uniqueType", is("submission.vocabularyEntryDetail")) ); } } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/VocabularyMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/VocabularyMatcher.java index b27b97d4c7d9..3a780cd7a9c2 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/VocabularyMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/VocabularyMatcher.java @@ -30,7 +30,8 @@ public static Matcher matchProperties(String id, String name, hasJsonPath("$.name", is(name)), hasJsonPath("$.scrollable", is(scrollable)), hasJsonPath("$.hierarchical", is(hierarchical)), - hasJsonPath("$.type", is("vocabulary")) + hasJsonPath("$.type", is("vocabulary")), + hasJsonPath("$.uniqueType", is("submission.vocabulary")) ); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/WorkflowDefinitionMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/WorkflowDefinitionMatcher.java index 215ad08eaee9..d0b53dd78b5f 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/WorkflowDefinitionMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/WorkflowDefinitionMatcher.java @@ -57,6 +57,7 @@ public static Matcher matchCollectionEntry(String name, UUID uui hasJsonPath("$.name", is(name)), hasJsonPath("$.handle", is(handle)), hasJsonPath("$.type", is("collection")), + hasJsonPath("$.uniqueType", is("core.collection")), hasJsonPath("$.metadata", Matchers.allOf( MetadataMatcher.matchMetadata("dc.title", name) )) diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/WorkflowItemMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/WorkflowItemMatcher.java index 7a1b0fcb92fd..6ba6ca79752f 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/WorkflowItemMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/WorkflowItemMatcher.java @@ -91,7 +91,8 @@ public static Matcher matchItemWithTitleAndDateIssuedAndSubject(XmlWorkflowItem public static Matcher matchProperties(XmlWorkflowItem witem) { return allOf( witem != null ? hasJsonPath("$.id", is(witem.getID())) : hasJsonPath("$.id"), - hasJsonPath("$.type", is("workflowitem")) + hasJsonPath("$.type", is("workflowitem")), + hasJsonPath("$.uniqueType", is("workflow.workflowitem")) ); } diff --git a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/WorkspaceItemMatcher.java b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/WorkspaceItemMatcher.java index 070518f7ed01..40f86a3c99d6 100644 --- a/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/WorkspaceItemMatcher.java +++ b/dspace-server-webapp/src/test/java/org/dspace/app/rest/matcher/WorkspaceItemMatcher.java @@ -146,12 +146,14 @@ public static Matcher matchProperties(WorkspaceItem witem) { if (witem != null) { return allOf( hasJsonPath("$.id", is(witem.getID())), - hasJsonPath("$.type", is("workspaceitem")) + hasJsonPath("$.type", is("workspaceitem")), + hasJsonPath("$.uniqueType", is("submission.workspaceitem")) ); } else { return allOf( hasJsonPath("$.id"), - hasJsonPath("$.type", is("workspaceitem")) + hasJsonPath("$.type", is("workspaceitem")), + hasJsonPath("$.uniqueType", is("submission.workspaceitem")) ); } }