Merge branch 'issue-815-controlled-vocabulary-hierarchical-facets-7.2,' into issue-815-controlled-vocabulary-hierarchical-facets-7.4

This commit is contained in:
Jens Vannerum
2022-12-02 14:17:10 +01:00
8 changed files with 86 additions and 84 deletions

View File

@@ -132,11 +132,15 @@ public class DSpaceControlledVocabulary extends SelfNamedPlugin implements Hiera
String filename = vocabulariesPath + vocabularyName + ".xml"; String filename = vocabulariesPath + vocabularyName + ".xml";
log.info("Loading " + filename); log.info("Loading " + filename);
vocabulary = new InputSource(filename); vocabulary = new InputSource(filename);
hierarchyDelimiter = " " + hierarchyDelimiter + " ";
} }
} }
protected String buildString(Node node) { protected String buildString(Node node) {
if (node.getNodeType() == Node.DOCUMENT_NODE) { if (node.getNodeType() == Node.DOCUMENT_NODE || (
node.getParentNode() != null &&
node.getParentNode().getNodeType() == Node.DOCUMENT_NODE)) {
return (""); return ("");
} else { } else {
String parentValue = buildString(node.getParentNode()); String parentValue = buildString(node.getParentNode());

View File

@@ -86,7 +86,7 @@ public class DSpaceControlledVocabularyTest extends AbstractDSpaceTest {
CoreServiceFactory.getInstance().getPluginService().getNamedPlugin(Class.forName(PLUGIN_INTERFACE), "farm"); CoreServiceFactory.getInstance().getPluginService().getNamedPlugin(Class.forName(PLUGIN_INTERFACE), "farm");
assertNotNull(instance); assertNotNull(instance);
Choices result = instance.getMatches(text, start, limit, locale); Choices result = instance.getMatches(text, start, limit, locale);
assertEquals("the farm::north 40", result.values[0].value); assertEquals("north 40", result.values[0].value);
} }
/** /**

View File

@@ -45,7 +45,7 @@ public class VocabularyEntryDetailsChildrenLinkRepository extends AbstractDSpace
@Autowired @Autowired
private AuthorityUtils authorityUtils; private AuthorityUtils authorityUtils;
@PreAuthorize("hasAuthority('AUTHENTICATED')") @PreAuthorize("permitAll()")
public Page<VocabularyEntryDetailsRest> getChildren(@Nullable HttpServletRequest request, String name, public Page<VocabularyEntryDetailsRest> getChildren(@Nullable HttpServletRequest request, String name,
@Nullable Pageable optionalPageable, Projection projection) { @Nullable Pageable optionalPageable, Projection projection) {

View File

@@ -40,7 +40,7 @@ public class VocabularyEntryDetailsParentLinkRepository extends AbstractDSpaceRe
@Autowired @Autowired
private AuthorityUtils authorityUtils; private AuthorityUtils authorityUtils;
@PreAuthorize("hasAuthority('AUTHENTICATED')") @PreAuthorize("permitAll()")
public VocabularyEntryDetailsRest getParent(@Nullable HttpServletRequest request, String name, public VocabularyEntryDetailsRest getParent(@Nullable HttpServletRequest request, String name,
@Nullable Pageable optionalPageable, Projection projection) { @Nullable Pageable optionalPageable, Projection projection) {
Context context = obtainContext(); Context context = obtainContext();

View File

@@ -66,7 +66,7 @@ public class VocabularyEntryDetailsRestRepository extends DSpaceRestRepository<V
throw new RepositoryMethodNotImplementedException(ResourcePolicyRest.NAME, "findAll"); throw new RepositoryMethodNotImplementedException(ResourcePolicyRest.NAME, "findAll");
} }
@PreAuthorize("hasAuthority('AUTHENTICATED')") @PreAuthorize("permitAll()")
@Override @Override
public VocabularyEntryDetailsRest findOne(Context context, String name) { public VocabularyEntryDetailsRest findOne(Context context, String name) {
String[] parts = StringUtils.split(name, ":", 2); String[] parts = StringUtils.split(name, ":", 2);
@@ -82,7 +82,7 @@ public class VocabularyEntryDetailsRestRepository extends DSpaceRestRepository<V
} }
@SearchRestMethod(name = "top") @SearchRestMethod(name = "top")
@PreAuthorize("hasAuthority('AUTHENTICATED')") @PreAuthorize("permitAll()")
public Page<VocabularyEntryDetailsRest> findAllTop(@Parameter(value = "vocabulary", required = true) public Page<VocabularyEntryDetailsRest> findAllTop(@Parameter(value = "vocabulary", required = true)
String vocabularyId, Pageable pageable) { String vocabularyId, Pageable pageable) {
Context context = obtainContext(); Context context = obtainContext();

View File

@@ -53,7 +53,7 @@ public class VocabularyRestRepository extends DSpaceRestRepository<VocabularyRes
@Autowired @Autowired
private MetadataFieldService metadataFieldService; private MetadataFieldService metadataFieldService;
@PreAuthorize("hasAuthority('AUTHENTICATED')") @PreAuthorize("permitAll()")
@Override @Override
public VocabularyRest findOne(Context context, String name) { public VocabularyRest findOne(Context context, String name) {
ChoiceAuthority source = cas.getChoiceAuthorityByAuthorityName(name); ChoiceAuthority source = cas.getChoiceAuthorityByAuthorityName(name);

View File

@@ -57,12 +57,12 @@ public class VocabularyEntryDetailsIT extends AbstractControllerIntegrationTest
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$", .andExpect(jsonPath("$",
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB110", "Religion/Theology", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB110", "Religion/Theology",
"Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology"))) "HUMANITIES and RELIGION :: Religion/Theology")))
.andExpect(jsonPath("$.selectable", is(true))) .andExpect(jsonPath("$.selectable", is(true)))
.andExpect(jsonPath("$.otherInformation.id", is("SCB110"))) .andExpect(jsonPath("$.otherInformation.id", is("SCB110")))
.andExpect(jsonPath("$.otherInformation.note", is("Religionsvetenskap/Teologi"))) .andExpect(jsonPath("$.otherInformation.note", is("Religionsvetenskap/Teologi")))
.andExpect(jsonPath("$.otherInformation.parent", .andExpect(jsonPath("$.otherInformation.parent",
is("Research Subject Categories::HUMANITIES and RELIGION"))) is("HUMANITIES and RELIGION")))
.andExpect(jsonPath("$._links.parent.href", .andExpect(jsonPath("$._links.parent.href",
endsWith("api/submission/vocabularyEntryDetails/srsc:SCB110/parent"))) endsWith("api/submission/vocabularyEntryDetails/srsc:SCB110/parent")))
.andExpect(jsonPath("$._links.children.href", .andExpect(jsonPath("$._links.children.href",
@@ -73,7 +73,7 @@ public class VocabularyEntryDetailsIT extends AbstractControllerIntegrationTest
public void findOneUnauthorizedTest() throws Exception { public void findOneUnauthorizedTest() throws Exception {
String idAuthority = "srsc:SCB110"; String idAuthority = "srsc:SCB110";
getClient().perform(get("/api/submission/vocabularyEntryDetails/" + idAuthority)) getClient().perform(get("/api/submission/vocabularyEntryDetails/" + idAuthority))
.andExpect(status().isUnauthorized()); .andExpect(status().isOk());
} }
@Test @Test
@@ -102,30 +102,30 @@ public class VocabularyEntryDetailsIT extends AbstractControllerIntegrationTest
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.vocabularyEntryDetails", Matchers.containsInAnyOrder( .andExpect(jsonPath("$._embedded.vocabularyEntryDetails", Matchers.containsInAnyOrder(
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB11", "HUMANITIES and RELIGION", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB11", "HUMANITIES and RELIGION",
"Research Subject Categories::HUMANITIES and RELIGION"), "HUMANITIES and RELIGION"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB12", "LAW/JURISPRUDENCE", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB12", "LAW/JURISPRUDENCE",
"Research Subject Categories::LAW/JURISPRUDENCE"), "LAW/JURISPRUDENCE"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB13", "SOCIAL SCIENCES", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB13", "SOCIAL SCIENCES",
"Research Subject Categories::SOCIAL SCIENCES"), "SOCIAL SCIENCES"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB14", "MATHEMATICS", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB14", "MATHEMATICS",
"Research Subject Categories::MATHEMATICS"), "MATHEMATICS"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB15", "NATURAL SCIENCES", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB15", "NATURAL SCIENCES",
"Research Subject Categories::NATURAL SCIENCES"), "NATURAL SCIENCES"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB16", "TECHNOLOGY", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB16", "TECHNOLOGY",
"Research Subject Categories::TECHNOLOGY"), "TECHNOLOGY"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB17", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB17",
"FORESTRY, AGRICULTURAL SCIENCES and LANDSCAPE PLANNING", "FORESTRY, AGRICULTURAL SCIENCES and LANDSCAPE PLANNING",
"Research Subject Categories::FORESTRY, AGRICULTURAL SCIENCES and LANDSCAPE PLANNING"), "FORESTRY, AGRICULTURAL SCIENCES and LANDSCAPE PLANNING"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB18", "MEDICINE", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB18", "MEDICINE",
"Research Subject Categories::MEDICINE"), "MEDICINE"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB19", "ODONTOLOGY", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB19", "ODONTOLOGY",
"Research Subject Categories::ODONTOLOGY"), "ODONTOLOGY"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB21", "PHARMACY", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB21", "PHARMACY",
"Research Subject Categories::PHARMACY"), "PHARMACY"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB22", "VETERINARY MEDICINE", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB22", "VETERINARY MEDICINE",
"Research Subject Categories::VETERINARY MEDICINE"), "VETERINARY MEDICINE"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB23", "INTERDISCIPLINARY RESEARCH AREAS", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB23", "INTERDISCIPLINARY RESEARCH AREAS",
"Research Subject Categories::INTERDISCIPLINARY RESEARCH AREAS") "INTERDISCIPLINARY RESEARCH AREAS")
))) )))
.andExpect(jsonPath("$.page.totalElements", Matchers.is(12))); .andExpect(jsonPath("$.page.totalElements", Matchers.is(12)));
@@ -134,30 +134,30 @@ public class VocabularyEntryDetailsIT extends AbstractControllerIntegrationTest
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.vocabularyEntryDetails", Matchers.containsInAnyOrder( .andExpect(jsonPath("$._embedded.vocabularyEntryDetails", Matchers.containsInAnyOrder(
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB11", "HUMANITIES and RELIGION", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB11", "HUMANITIES and RELIGION",
"Research Subject Categories::HUMANITIES and RELIGION"), "HUMANITIES and RELIGION"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB12", "LAW/JURISPRUDENCE", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB12", "LAW/JURISPRUDENCE",
"Research Subject Categories::LAW/JURISPRUDENCE"), "LAW/JURISPRUDENCE"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB13", "SOCIAL SCIENCES", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB13", "SOCIAL SCIENCES",
"Research Subject Categories::SOCIAL SCIENCES"), "SOCIAL SCIENCES"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB14", "MATHEMATICS", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB14", "MATHEMATICS",
"Research Subject Categories::MATHEMATICS"), "MATHEMATICS"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB15", "NATURAL SCIENCES", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB15", "NATURAL SCIENCES",
"Research Subject Categories::NATURAL SCIENCES"), "NATURAL SCIENCES"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB16", "TECHNOLOGY", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB16", "TECHNOLOGY",
"Research Subject Categories::TECHNOLOGY"), "TECHNOLOGY"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB17", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB17",
"FORESTRY, AGRICULTURAL SCIENCES and LANDSCAPE PLANNING", "FORESTRY, AGRICULTURAL SCIENCES and LANDSCAPE PLANNING",
"Research Subject Categories::FORESTRY, AGRICULTURAL SCIENCES and LANDSCAPE PLANNING"), "FORESTRY, AGRICULTURAL SCIENCES and LANDSCAPE PLANNING"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB18", "MEDICINE", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB18", "MEDICINE",
"Research Subject Categories::MEDICINE"), "MEDICINE"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB19", "ODONTOLOGY", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB19", "ODONTOLOGY",
"Research Subject Categories::ODONTOLOGY"), "ODONTOLOGY"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB21", "PHARMACY", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB21", "PHARMACY",
"Research Subject Categories::PHARMACY"), "PHARMACY"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB22", "VETERINARY MEDICINE", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB22", "VETERINARY MEDICINE",
"Research Subject Categories::VETERINARY MEDICINE"), "VETERINARY MEDICINE"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB23", "INTERDISCIPLINARY RESEARCH AREAS", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB23", "INTERDISCIPLINARY RESEARCH AREAS",
"Research Subject Categories::INTERDISCIPLINARY RESEARCH AREAS") "INTERDISCIPLINARY RESEARCH AREAS")
))) )))
.andExpect(jsonPath("$.page.totalElements", Matchers.is(12))); .andExpect(jsonPath("$.page.totalElements", Matchers.is(12)));
} }
@@ -170,14 +170,14 @@ public class VocabularyEntryDetailsIT extends AbstractControllerIntegrationTest
.andExpect(jsonPath("$._embedded.children", Matchers.containsInAnyOrder( .andExpect(jsonPath("$._embedded.children", Matchers.containsInAnyOrder(
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB1401", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB1401",
"Algebra, geometry and mathematical analysis", "Algebra, geometry and mathematical analysis",
"Research Subject Categories::MATHEMATICS::Algebra, geometry and mathematical analysis"), "MATHEMATICS :: Algebra, geometry and mathematical analysis"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB1402", "Applied mathematics", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB1402", "Applied mathematics",
"Research Subject Categories::MATHEMATICS::Applied mathematics"), "MATHEMATICS :: Applied mathematics"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB1409", "Other mathematics", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB1409", "Other mathematics",
"Research Subject Categories::MATHEMATICS::Other mathematics") "MATHEMATICS :: Other mathematics")
))) )))
.andExpect(jsonPath("$._embedded.children[*].otherInformation.parent", .andExpect(jsonPath("$._embedded.children[*].otherInformation.parent",
Matchers.everyItem(is("Research Subject Categories::MATHEMATICS")))) Matchers.everyItem(is("MATHEMATICS"))))
.andExpect(jsonPath("$.page.totalElements", Matchers.is(3))); .andExpect(jsonPath("$.page.totalElements", Matchers.is(3)));
} }
@@ -191,15 +191,15 @@ public class VocabularyEntryDetailsIT extends AbstractControllerIntegrationTest
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.vocabularyEntryDetails", Matchers.containsInAnyOrder( .andExpect(jsonPath("$._embedded.vocabularyEntryDetails", Matchers.containsInAnyOrder(
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB11", "HUMANITIES and RELIGION", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB11", "HUMANITIES and RELIGION",
"Research Subject Categories::HUMANITIES and RELIGION"), "HUMANITIES and RELIGION"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB12", "LAW/JURISPRUDENCE", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB12", "LAW/JURISPRUDENCE",
"Research Subject Categories::LAW/JURISPRUDENCE"), "LAW/JURISPRUDENCE"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB13", "SOCIAL SCIENCES", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB13", "SOCIAL SCIENCES",
"Research Subject Categories::SOCIAL SCIENCES"), "SOCIAL SCIENCES"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB14", "MATHEMATICS", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB14", "MATHEMATICS",
"Research Subject Categories::MATHEMATICS"), "MATHEMATICS"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB15", "NATURAL SCIENCES", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB15", "NATURAL SCIENCES",
"Research Subject Categories::NATURAL SCIENCES") "NATURAL SCIENCES")
))) )))
.andExpect(jsonPath("$.page.totalElements", is(12))) .andExpect(jsonPath("$.page.totalElements", is(12)))
.andExpect(jsonPath("$.page.totalPages", is(3))) .andExpect(jsonPath("$.page.totalPages", is(3)))
@@ -213,16 +213,16 @@ public class VocabularyEntryDetailsIT extends AbstractControllerIntegrationTest
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.vocabularyEntryDetails", Matchers.containsInAnyOrder( .andExpect(jsonPath("$._embedded.vocabularyEntryDetails", Matchers.containsInAnyOrder(
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB16", "TECHNOLOGY", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB16", "TECHNOLOGY",
"Research Subject Categories::TECHNOLOGY"), "TECHNOLOGY"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB17", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB17",
"FORESTRY, AGRICULTURAL SCIENCES and LANDSCAPE PLANNING", "FORESTRY, AGRICULTURAL SCIENCES and LANDSCAPE PLANNING",
"Research Subject Categories::FORESTRY, AGRICULTURAL SCIENCES and LANDSCAPE PLANNING"), "FORESTRY, AGRICULTURAL SCIENCES and LANDSCAPE PLANNING"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB18", "MEDICINE", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB18", "MEDICINE",
"Research Subject Categories::MEDICINE"), "MEDICINE"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB19", "ODONTOLOGY", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB19", "ODONTOLOGY",
"Research Subject Categories::ODONTOLOGY"), "ODONTOLOGY"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB21", "PHARMACY", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB21", "PHARMACY",
"Research Subject Categories::PHARMACY") "PHARMACY")
))) )))
.andExpect(jsonPath("$.page.totalElements", is(12))) .andExpect(jsonPath("$.page.totalElements", is(12)))
.andExpect(jsonPath("$.page.totalPages", is(3))) .andExpect(jsonPath("$.page.totalPages", is(3)))
@@ -236,9 +236,9 @@ public class VocabularyEntryDetailsIT extends AbstractControllerIntegrationTest
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.vocabularyEntryDetails", Matchers.containsInAnyOrder( .andExpect(jsonPath("$._embedded.vocabularyEntryDetails", Matchers.containsInAnyOrder(
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB22", "VETERINARY MEDICINE", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB22", "VETERINARY MEDICINE",
"Research Subject Categories::VETERINARY MEDICINE"), "VETERINARY MEDICINE"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB23", "INTERDISCIPLINARY RESEARCH AREAS", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB23", "INTERDISCIPLINARY RESEARCH AREAS",
"Research Subject Categories::INTERDISCIPLINARY RESEARCH AREAS") "INTERDISCIPLINARY RESEARCH AREAS")
))) )))
.andExpect(jsonPath("$.page.totalElements", is(12))) .andExpect(jsonPath("$.page.totalElements", is(12)))
.andExpect(jsonPath("$.page.totalPages", is(3))) .andExpect(jsonPath("$.page.totalPages", is(3)))
@@ -256,8 +256,8 @@ public class VocabularyEntryDetailsIT extends AbstractControllerIntegrationTest
@Test @Test
public void searchTopUnauthorizedTest() throws Exception { public void searchTopUnauthorizedTest() throws Exception {
getClient().perform(get("/api/submission/vocabularyEntryDetails/search/top") getClient().perform(get("/api/submission/vocabularyEntryDetails/search/top")
.param("vocabulary", "srsc:SCB16")) .param("vocabulary", "srsc"))
.andExpect(status().isUnauthorized()); .andExpect(status().isOk());
} }
@Test @Test
@@ -271,9 +271,9 @@ public class VocabularyEntryDetailsIT extends AbstractControllerIntegrationTest
.andExpect(jsonPath("$._embedded.children", Matchers.containsInAnyOrder( .andExpect(jsonPath("$._embedded.children", Matchers.containsInAnyOrder(
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB1401", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB1401",
"Algebra, geometry and mathematical analysis", "Algebra, geometry and mathematical analysis",
"Research Subject Categories::MATHEMATICS::Algebra, geometry and mathematical analysis"), "MATHEMATICS :: Algebra, geometry and mathematical analysis"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB1402", "Applied mathematics", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB1402", "Applied mathematics",
"Research Subject Categories::MATHEMATICS::Applied mathematics") "MATHEMATICS :: Applied mathematics")
))) )))
.andExpect(jsonPath("$.page.totalElements", is(3))) .andExpect(jsonPath("$.page.totalElements", is(3)))
.andExpect(jsonPath("$.page.totalPages", is(2))) .andExpect(jsonPath("$.page.totalPages", is(2)))
@@ -286,7 +286,7 @@ public class VocabularyEntryDetailsIT extends AbstractControllerIntegrationTest
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.children", Matchers.contains( .andExpect(jsonPath("$._embedded.children", Matchers.contains(
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB1409", "Other mathematics", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:SCB1409", "Other mathematics",
"Research Subject Categories::MATHEMATICS::Other mathematics") "MATHEMATICS :: Other mathematics")
))) )))
.andExpect(jsonPath("$.page.totalElements", is(3))) .andExpect(jsonPath("$.page.totalElements", is(3)))
.andExpect(jsonPath("$.page.totalPages", is(2))) .andExpect(jsonPath("$.page.totalPages", is(2)))
@@ -300,13 +300,13 @@ public class VocabularyEntryDetailsIT extends AbstractControllerIntegrationTest
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.children", Matchers.containsInAnyOrder( .andExpect(jsonPath("$._embedded.children", Matchers.containsInAnyOrder(
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR140202", "Numerical analysis", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR140202", "Numerical analysis",
"Research Subject Categories::MATHEMATICS::Applied mathematics::Numerical analysis"), "MATHEMATICS :: Applied mathematics :: Numerical analysis"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR140203", "Mathematical statistics", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR140203", "Mathematical statistics",
"Research Subject Categories::MATHEMATICS::Applied mathematics::Mathematical statistics"), "MATHEMATICS :: Applied mathematics :: Mathematical statistics"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR140204", "Optimization, systems theory", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR140204", "Optimization, systems theory",
"Research Subject Categories::MATHEMATICS::Applied mathematics::Optimization, systems theory"), "MATHEMATICS :: Applied mathematics :: Optimization, systems theory"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR140205", "Theoretical computer science", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR140205", "Theoretical computer science",
"Research Subject Categories::MATHEMATICS::Applied mathematics::Theoretical computer science") "MATHEMATICS :: Applied mathematics :: Theoretical computer science")
))) )))
.andExpect(jsonPath("$.page.totalElements", Matchers.is(4))); .andExpect(jsonPath("$.page.totalElements", Matchers.is(4)));
} }
@@ -331,7 +331,7 @@ public class VocabularyEntryDetailsIT extends AbstractControllerIntegrationTest
public void srscSearchTopUnauthorizedTest() throws Exception { public void srscSearchTopUnauthorizedTest() throws Exception {
getClient().perform(get("/api/submission/vocabularyEntryDetails/search/top") getClient().perform(get("/api/submission/vocabularyEntryDetails/search/top")
.param("vocabulary", "srsc")) .param("vocabulary", "srsc"))
.andExpect(status().isUnauthorized()); .andExpect(status().isOk());
} }
@Test @Test
@@ -341,7 +341,7 @@ public class VocabularyEntryDetailsIT extends AbstractControllerIntegrationTest
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$", is( .andExpect(jsonPath("$", is(
VocabularyEntryDetailsMatcher.matchAuthorityEntry( VocabularyEntryDetailsMatcher.matchAuthorityEntry(
"srsc:SCB18", "MEDICINE","Research Subject Categories::MEDICINE") "srsc:SCB18", "MEDICINE","MEDICINE")
))); )));
} }
@@ -355,7 +355,7 @@ public class VocabularyEntryDetailsIT extends AbstractControllerIntegrationTest
@Test @Test
public void findParentByChildUnauthorizedTest() throws Exception { public void findParentByChildUnauthorizedTest() throws Exception {
getClient().perform(get("/api/submission/vocabularyEntryDetails/srsc:SCB180/parent")) getClient().perform(get("/api/submission/vocabularyEntryDetails/srsc:SCB180/parent"))
.andExpect(status().isUnauthorized()); .andExpect(status().isOk());
} }
@Test @Test
@@ -375,11 +375,11 @@ public class VocabularyEntryDetailsIT extends AbstractControllerIntegrationTest
.andExpect(jsonPath("$._embedded.parent", .andExpect(jsonPath("$._embedded.parent",
VocabularyEntryDetailsMatcher.matchAuthorityEntry( VocabularyEntryDetailsMatcher.matchAuthorityEntry(
"srsc:SCB11", "HUMANITIES and RELIGION", "srsc:SCB11", "HUMANITIES and RELIGION",
"Research Subject Categories::HUMANITIES and RELIGION"))) "HUMANITIES and RELIGION")))
.andExpect(jsonPath("$._embedded.children._embedded.children", matchAllSrscSC110Children())) .andExpect(jsonPath("$._embedded.children._embedded.children", matchAllSrscSC110Children()))
.andExpect(jsonPath("$._embedded.children._embedded.children[*].otherInformation.parent", .andExpect(jsonPath("$._embedded.children._embedded.children[*].otherInformation.parent",
Matchers.everyItem( Matchers.everyItem(
is("Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology")))); is("HUMANITIES and RELIGION :: Religion/Theology"))));
getClient(tokenAdmin).perform( getClient(tokenAdmin).perform(
get("/api/submission/vocabularyEntryDetails/srsc:SCB110").param("embed", "children")) get("/api/submission/vocabularyEntryDetails/srsc:SCB110").param("embed", "children"))
@@ -387,7 +387,7 @@ public class VocabularyEntryDetailsIT extends AbstractControllerIntegrationTest
.andExpect(jsonPath("$._embedded.children._embedded.children", matchAllSrscSC110Children())) .andExpect(jsonPath("$._embedded.children._embedded.children", matchAllSrscSC110Children()))
.andExpect(jsonPath("$._embedded.children._embedded.children[*].otherInformation.parent", .andExpect(jsonPath("$._embedded.children._embedded.children[*].otherInformation.parent",
Matchers.everyItem( Matchers.everyItem(
is("Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology")))); is("HUMANITIES and RELIGION :: Religion/Theology"))));
getClient(tokenAdmin).perform( getClient(tokenAdmin).perform(
get("/api/submission/vocabularyEntryDetails/srsc:SCB110").param("embed", "parent")) get("/api/submission/vocabularyEntryDetails/srsc:SCB110").param("embed", "parent"))
@@ -395,47 +395,47 @@ public class VocabularyEntryDetailsIT extends AbstractControllerIntegrationTest
.andExpect(jsonPath("$._embedded.parent", .andExpect(jsonPath("$._embedded.parent",
VocabularyEntryDetailsMatcher.matchAuthorityEntry( VocabularyEntryDetailsMatcher.matchAuthorityEntry(
"srsc:SCB11", "HUMANITIES and RELIGION", "srsc:SCB11", "HUMANITIES and RELIGION",
"Research Subject Categories::HUMANITIES and RELIGION"))); "HUMANITIES and RELIGION")));
} }
private Matcher<Iterable<? extends Object>> matchAllSrscSC110Children() { private Matcher<Iterable<? extends Object>> matchAllSrscSC110Children() {
return Matchers.containsInAnyOrder( return Matchers.containsInAnyOrder(
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110102", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110102",
"History of religion", "History of religion",
"Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::History of religion"), "HUMANITIES and RELIGION :: Religion/Theology :: History of religion"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110103", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110103",
"Church studies", "Church studies",
"Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::Church studies"), "HUMANITIES and RELIGION :: Religion/Theology :: Church studies"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110104", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110104",
"Missionary studies", "Missionary studies",
"Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::Missionary studies"), "HUMANITIES and RELIGION :: Religion/Theology :: Missionary studies"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110105", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110105",
"Systematic theology", "Systematic theology",
"Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::Systematic theology"), "HUMANITIES and RELIGION :: Religion/Theology :: Systematic theology"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110106", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110106",
"Islamology", "Islamology",
"Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::Islamology"), "HUMANITIES and RELIGION :: Religion/Theology :: Islamology"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110107", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110107",
"Faith and reason", "Faith and reason",
"Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::Faith and reason"), "HUMANITIES and RELIGION :: Religion/Theology :: Faith and reason"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110108", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110108",
"Sociology of religion", "Sociology of religion",
"Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::Sociology of religion"), "HUMANITIES and RELIGION :: Religion/Theology :: Sociology of religion"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110109", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110109",
"Psychology of religion", "Psychology of religion",
"Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::Psychology of religion"), "HUMANITIES and RELIGION :: Religion/Theology :: Psychology of religion"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110110", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110110",
"Philosophy of religion", "Philosophy of religion",
"Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::Philosophy of religion"), "HUMANITIES and RELIGION :: Religion/Theology :: Philosophy of religion"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110111", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110111",
"New Testament exegesis", "New Testament exegesis",
"Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::New Testament exegesis"), "HUMANITIES and RELIGION :: Religion/Theology :: New Testament exegesis"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110112", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110112",
"Old Testament exegesis", "Old Testament exegesis",
"Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::Old Testament exegesis"), "HUMANITIES and RELIGION :: Religion/Theology :: Old Testament exegesis"),
VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110113", VocabularyEntryDetailsMatcher.matchAuthorityEntry("srsc:VR110113",
"Dogmatics with symbolics", "Dogmatics with symbolics",
"Research Subject Categories::HUMANITIES and RELIGION::Religion/Theology::Dogmatics with symbolics") "HUMANITIES and RELIGION :: Religion/Theology :: Dogmatics with symbolics")
); );
} }

View File

@@ -151,8 +151,7 @@ public class VocabularyRestRepositoryIT extends AbstractControllerIntegrationTes
@Test @Test
public void findOneSRSC_Test() throws Exception { public void findOneSRSC_Test() throws Exception {
String token = getAuthToken(admin.getEmail(), password); getClient().perform(get("/api/submission/vocabularies/srsc"))
getClient(token).perform(get("/api/submission/vocabularies/srsc"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$", is( .andExpect(jsonPath("$", is(
VocabularyMatcher.matchProperties("srsc", "srsc", false, true) VocabularyMatcher.matchProperties("srsc", "srsc", false, true)
@@ -161,8 +160,7 @@ public class VocabularyRestRepositoryIT extends AbstractControllerIntegrationTes
@Test @Test
public void findOneCommonTypesTest() throws Exception { public void findOneCommonTypesTest() throws Exception {
String token = getAuthToken(admin.getEmail(), password); getClient().perform(get("/api/submission/vocabularies/common_types"))
getClient(token).perform(get("/api/submission/vocabularies/common_types"))
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$", is( .andExpect(jsonPath("$", is(
VocabularyMatcher.matchProperties("common_types", "common_types", true, false) VocabularyMatcher.matchProperties("common_types", "common_types", true, false)
@@ -179,9 +177,9 @@ public class VocabularyRestRepositoryIT extends AbstractControllerIntegrationTes
.andExpect(status().isOk()) .andExpect(status().isOk())
.andExpect(jsonPath("$._embedded.entries", Matchers.containsInAnyOrder( .andExpect(jsonPath("$._embedded.entries", Matchers.containsInAnyOrder(
VocabularyMatcher.matchVocabularyEntry("Research Subject Categories", VocabularyMatcher.matchVocabularyEntry("Research Subject Categories",
"Research Subject Categories", "vocabularyEntry"), "", "vocabularyEntry"),
VocabularyMatcher.matchVocabularyEntry("Family research", VocabularyMatcher.matchVocabularyEntry("Family research",
"Research Subject Categories::SOCIAL SCIENCES::Social sciences::Social work::Family research", "SOCIAL SCIENCES :: Social sciences :: Social work :: Family research",
"vocabularyEntry")))) "vocabularyEntry"))))
.andExpect(jsonPath("$.page.totalElements", Matchers.is(26))) .andExpect(jsonPath("$.page.totalElements", Matchers.is(26)))
.andExpect(jsonPath("$.page.totalPages", Matchers.is(13))) .andExpect(jsonPath("$.page.totalPages", Matchers.is(13)))