Skip to content

Commit

Permalink
116542: resolve issues after merge with latest main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Jens Vannerum committed Jul 23, 2024
1 parent e03c402 commit be179ba
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
18 changes: 9 additions & 9 deletions dspace-api/src/test/java/org/dspace/content/ItemTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ public void testAddMetadata_5args_no_values() throws Exception {
String schema = "dc";
String element = "contributor";
String qualifier = "author";
String lang = Item.ANY;
String lang = null;
String[] values = {};
itemService.addMetadata(context, it, schema, element, qualifier, lang, Arrays.asList(values));
fail("IllegalArgumentException expected");
Expand Down Expand Up @@ -632,7 +632,7 @@ public void testAddMetadata_7args_no_values() throws Exception {
String schema = "dc";
String element = "contributor";
String qualifier = "author";
String lang = Item.ANY;
String lang = null;
List<String> values = new ArrayList();
List<String> authorities = new ArrayList();
List<Integer> confidences = new ArrayList();
Expand All @@ -645,7 +645,7 @@ public void testAddMetadata_list_with_virtual_metadata() throws Exception {
String schema = "dc";
String element = "contributor";
String qualifier = "author";
String lang = Item.ANY;
String lang = null;
// Create two fake virtual metadata ("virtual::[relationship-id]") values
List<String> values = new ArrayList<>(Arrays.asList("uuid-1", "uuid-2"));
List<String> authorities = new ArrayList<>(Arrays.asList(Constants.VIRTUAL_AUTHORITY_PREFIX + "relationship-1",
Expand Down Expand Up @@ -674,7 +674,7 @@ public void testAddMetadata_list_with_virtual_metadata() throws Exception {
assertEquals(1, valuesAdded.size());

// Get metadata and ensure new value is the ONLY ONE for this metadata field
List<MetadataValue> dc = itemService.getMetadata(it, schema, element, qualifier, lang);
List<MetadataValue> dc = itemService.getMetadata(it, schema, element, qualifier, Item.ANY);
assertNotNull(dc);
assertEquals(1, dc.size());
assertEquals(schema, dc.get(0).getMetadataField().getMetadataSchema().getName());
Expand All @@ -693,11 +693,11 @@ public void testAddMetadata_5args_2() throws SQLException {
String schema = "dc";
String element = "contributor";
String qualifier = "author";
String lang = Item.ANY;
String lang = null;
String value = "value0";
itemService.addMetadata(context, it, schema, element, qualifier, lang, value);

List<MetadataValue> dc = itemService.getMetadata(it, schema, element, qualifier, lang);
List<MetadataValue> dc = itemService.getMetadata(it, schema, element, qualifier, Item.ANY);
assertThat("testAddMetadata_5args_2 0", dc, notNullValue());
assertTrue("testAddMetadata_5args_2 1", dc.size() == 1);
assertThat("testAddMetadata_5args_2 2", dc.get(0).getMetadataField().getMetadataSchema().getName(),
Expand Down Expand Up @@ -772,7 +772,7 @@ public void testAddMetadata_single_virtual_metadata() throws Exception {
String schema = "dc";
String element = "contributor";
String qualifier = "author";
String lang = Item.ANY;
String lang = null;
// Create a single fake virtual metadata ("virtual::[relationship-id]") value
String value = "uuid-1";
String authority = Constants.VIRTUAL_AUTHORITY_PREFIX + "relationship-1";
Expand All @@ -786,7 +786,7 @@ public void testAddMetadata_single_virtual_metadata() throws Exception {
assertNull(valuesAdded);

// Verify this metadata field does NOT exist on the item
List<MetadataValue> mv = itemService.getMetadata(it, schema, element, qualifier, lang);
List<MetadataValue> mv = itemService.getMetadata(it, schema, element, qualifier, Item.ANY);
assertNotNull(mv);
assertTrue(mv.isEmpty());

Expand All @@ -797,7 +797,7 @@ public void testAddMetadata_single_virtual_metadata() throws Exception {
assertNull(valuesAdded);

// Verify this metadata field does NOT exist on the item
mv = itemService.getMetadata(it, schema, element, qualifier, lang);
mv = itemService.getMetadata(it, schema, element, qualifier, Item.ANY);
assertNotNull(mv);
assertTrue(mv.isEmpty());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ public void preserveMetadataOrder() throws Exception {

// now just add one metadata to be the last
itemService.addMetadata(
context, item, dcSchema, contributorElement, authorQualifier, Item.ANY, "test, latest", null, 0
context, item, dcSchema, contributorElement, authorQualifier, null, "test, latest", null, 0
);
// now just remove first metadata
itemService.removeMetadataValues(context, item, List.of(placeZero));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@
import org.dspace.builder.WorkflowItemBuilder;
import org.dspace.content.Collection;
import org.dspace.content.Community;
import org.dspace.content.Item;
import org.dspace.core.I18nUtil;
import org.dspace.eperson.EPerson;
import org.dspace.eperson.Group;
Expand Down Expand Up @@ -2120,7 +2119,7 @@ public void patchMultipleReplaceMetadataByAdmin() throws Exception {
.build();

this.ePersonService
.addMetadata(context, ePerson, "eperson", "firstname", null, Item.ANY, List.of(first, second, third));
.addMetadata(context, ePerson, "eperson", "firstname", null, null, List.of(first, second, third));

context.restoreAuthSystemState();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -748,7 +748,7 @@ public void findTypedLinkForBitstreamWithType() throws Exception {
.withMimeType(bitstreamMimeType)
.build();
}
bitstreamService.addMetadata(context, bitstream, "dc", "type", null, Item.ANY, "Article");
bitstreamService.addMetadata(context, bitstream, "dc", "type", null, null, "Article");

context.restoreAuthSystemState();

Expand Down Expand Up @@ -836,7 +836,7 @@ public void findTypedLinkForBitstreamOfWorkspaceItem() throws Exception {
.withTitle("Workspace Item")
.build();
Item item = workspaceItem.getItem();
itemService.addMetadata(context, item, "dc", "identifier", "doi", Item.ANY, doi);
itemService.addMetadata(context, item, "dc", "identifier", "doi", null, doi);

Bitstream bitstream = null;
try (InputStream is = IOUtils.toInputStream(bitstreamContent, CharEncoding.UTF_8)) {
Expand Down

0 comments on commit be179ba

Please sign in to comment.