Merge pull request #8260 from toniprieto/cc-section-not-loading

Fix Creative Commons step not loading
This commit is contained in:
Tim Donohue
2022-04-29 11:39:06 -05:00
committed by GitHub
3 changed files with 15 additions and 5 deletions

View File

@@ -306,7 +306,9 @@ public class SubmissionService {
result.setRights(creativeCommonsService.getLicenseName(item));
Bitstream licenseRdfBitstream = creativeCommonsService.getLicenseRdfBitstream(item);
result.setFile(converter.toRest(licenseRdfBitstream, Projection.DEFAULT));
if (licenseRdfBitstream != null) {
result.setFile(converter.toRest(licenseRdfBitstream, Projection.DEFAULT));
}
return result;
}

View File

@@ -10,7 +10,7 @@ package org.dspace.app.rest;
import static com.jayway.jsonpath.matchers.JsonPathMatchers.hasJsonPath;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.nullValue;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
@@ -118,7 +118,11 @@ public class CCLicenseAddPatchOperationIT extends AbstractControllerIntegrationT
.content(patchBody)
.contentType(MediaType.APPLICATION_JSON_PATCH_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$.sections", not(hasJsonPath("cclicense"))));
.andExpect(jsonPath("$.sections.cclicense", allOf(
hasJsonPath("$.uri", nullValue()),
hasJsonPath("$.rights",nullValue()),
hasJsonPath("$.file", nullValue())
)));
}

View File

@@ -10,7 +10,7 @@ package org.dspace.app.rest;
import static com.jayway.jsonpath.matchers.JsonPathMatchers.hasJsonPath;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.hamcrest.Matchers.nullValue;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.patch;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@@ -95,7 +95,11 @@ public class CCLicenseRemovePatchOperationIT extends AbstractControllerIntegrati
.content(removePatch)
.contentType(MediaType.APPLICATION_JSON_PATCH_JSON))
.andExpect(status().isOk())
.andExpect(jsonPath("$.sections", not(hasJsonPath("cclicense"))));
.andExpect(jsonPath("$.sections.cclicense", allOf(
hasJsonPath("$.uri", nullValue()),
hasJsonPath("$.rights",nullValue()),
hasJsonPath("$.file", nullValue())
)));
}