77489: Create TiltedRelationshipMetadataServiceIT and override #initPublicationAuthor

This commit is contained in:
Bruno Roemers
2021-03-04 18:11:48 +01:00
parent 46266f894c
commit f7f8121aeb
2 changed files with 32 additions and 2 deletions

View File

@@ -84,7 +84,7 @@ public class RelationshipMetadataServiceIT extends AbstractIntegrationTestWithDa
* Common function to convert leftItem to a publication item, convert rightItem to an author item, * Common function to convert leftItem to a publication item, convert rightItem to an author item,
* and relating them to each other stored in the relationship field * and relating them to each other stored in the relationship field
*/ */
private void initPublicationAuthor() { protected void initPublicationAuthor() throws Exception {
context.turnOffAuthorisationSystem(); context.turnOffAuthorisationSystem();
EntityType publicationEntityType = EntityTypeBuilder.createEntityTypeBuilder(context, "Publication").build(); EntityType publicationEntityType = EntityTypeBuilder.createEntityTypeBuilder(context, "Publication").build();
EntityType authorEntityType = EntityTypeBuilder.createEntityTypeBuilder(context, "Author").build(); EntityType authorEntityType = EntityTypeBuilder.createEntityTypeBuilder(context, "Author").build();
@@ -152,7 +152,7 @@ public class RelationshipMetadataServiceIT extends AbstractIntegrationTestWithDa
} }
@Test @Test
public void testGetAuthorRelationshipMetadata() { public void testGetAuthorRelationshipMetadata() throws Exception {
initPublicationAuthor(); initPublicationAuthor();
//leftItem is the publication //leftItem is the publication
//verify the dc.contributor.author virtual metadata //verify the dc.contributor.author virtual metadata

View File

@@ -0,0 +1,30 @@
/**
* The contents of this file are subject to the license and copyright
* detailed in the LICENSE and NOTICE files at the root of the source
* tree and available online at
*
* http://www.dspace.org/license/
*/
package org.dspace.content;
/**
* This class carries out the same test cases as {@link RelationshipMetadataServiceIT} with a few modifications.
*/
public class TiltedRelationshipMetadataServiceIT extends RelationshipMetadataServiceIT {
/**
* Call parent implementation and set the tilted property of {@link #isAuthorOfPublicationRelationshipType}.
*/
@Override
protected void initPublicationAuthor() throws Exception {
super.initPublicationAuthor();
context.turnOffAuthorisationSystem();
isAuthorOfPublicationRelationshipType.setTilted(RelationshipType.Tilted.LEFT);
relationshipTypeService.update(context, isAuthorOfPublicationRelationshipType);
context.restoreAuthSystemState();
}
}