Skip to content

Commit

Permalink
[DSC-1282] added addDepositLicense to CreateWorkspaceItemWithExternal…
Browse files Browse the repository at this point in the history
…Source#fillWorkspaceItems. Added new check for test CreateWorkspaceItemFromExternalServiceIT#creatingWorkspaceItemImportedFromScopusTest
  • Loading branch information
aliaksei.bykau committed Oct 9, 2023
1 parent 16d4c69 commit f8149bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.dspace.content.MetadataValue;
import org.dspace.content.WorkspaceItem;
import org.dspace.content.dto.MetadataValueDTO;
import org.dspace.content.packager.PackageUtils;
import org.dspace.core.Context;
import org.dspace.discovery.DiscoverQuery;
import org.dspace.discovery.DiscoverQuery.SORT_ORDER;
Expand Down Expand Up @@ -287,6 +288,8 @@ private int fillWorkspaceItems(Context context, int record, LiveImportDataProvid
if (!exist(dataObject.getMetadata())) {
WorkspaceItem wsItem = externalDataService.createWorkspaceItemFromExternalDataObject(context,
dataObject, this.collection);
Item itemFromWs = wsItem.getItem();
PackageUtils.addDepositLicense(context, null, itemFromWs, wsItem.getCollection());
for (List<MetadataValueDTO> metadataList : metadataValueToAdd(wsItem.getItem())) {
addMetadata(wsItem.getItem(), metadataList);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.notNullValue;
import static org.hamcrest.Matchers.nullValue;
import static org.hamcrest.Matchers.containsString;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.Mockito.verify;
Expand Down Expand Up @@ -199,6 +200,8 @@ public void creatingWorkspaceItemImportedFromScopusTest() throws Exception {
+ ".traditionalpageone['dc.identifier.scopus'][0].value", is(scopus2R.getValue())))
.andExpect(jsonPath("$._embedded.workflowitems[1].sections"
+ ".traditionalpageone['dc.identifier.doi'][0].value", is(doi2R.getValue())))
.andExpect(jsonPath("$._embedded.workflowitems[0].sections.license.url",
containsString("/api/core/bitstreams/")))
.andExpect(jsonPath("$.page.totalElements", is(2)));
}

Expand Down

0 comments on commit f8149bb

Please sign in to comment.