taskid 78099 ItemMetadata caching test

This commit is contained in:
Samuel
2021-03-30 10:42:16 +02:00
parent 3fe194ae09
commit 535f90e147

View File

@@ -9,6 +9,7 @@ package org.dspace.content;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
@@ -301,15 +302,21 @@ public class RelationshipMetadataServiceIT extends AbstractIntegrationTestWithDa
assertThat(authorList.get(0).getMetadataField().getQualifier(), equalTo("author"));
assertNull(authorList.get(0).getAuthority());
//verify there's relation.isPublicationOfAuthor actual metadata
assertEquals(1, rightItem.getMetadata().stream()
.filter(metadataValue -> metadataValue.getMetadataField().getElement().equals("isPublicationOfAuthor"))
.collect(Collectors.toList()).size());
assertEquals(1, itemService
.getMetadata(rightItem, MetadataSchemaEnum.RELATION.getName(), "isPublicationOfAuthor", null, Item.ANY)
.size());
//verify there's relation.isAuthorOfPublication actual metadata
plainRelationshipMetadataList = leftItem.getMetadata().stream()
assertEquals(1, leftItem.getMetadata().stream()
.filter(metadataValue -> metadataValue.getMetadataField().getElement().equals("isAuthorOfPublication"))
.collect(Collectors.toList());
assertThat(plainRelationshipMetadataList.size(), equalTo(1));
//verify there's relation.isAuthorOfPublication actual metadata
List<MetadataValue> relationshipMetadataList = itemService
.getMetadata(leftItem, MetadataSchemaEnum.RELATION.getName(), "isAuthorOfPublication", null, Item.ANY);
assertThat(relationshipMetadataList.size(), equalTo(1));
.collect(Collectors.toList()).size());
assertEquals(1, itemService
.getMetadata(leftItem, MetadataSchemaEnum.RELATION.getName(), "isAuthorOfPublication", null, Item.ANY)
.size());
}
@Test