Skip to content

Commit

Permalink
Adjust test to new rules
Browse files Browse the repository at this point in the history
  • Loading branch information
solth committed Oct 22, 2024
1 parent fd9c882 commit 16b8f35
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ public class CatalogImportIT {
private static final int PROJECT_ID = 1;
private static final int TEMPLATE_ID = 1;
private static final int IMPORT_DEPTH = 2;
private static final String PUBLICATION_START_KEY = "PublicationStart";
private static final String PUBLICATION_VALUE_OLD = "2019";
private static final String PUBLICATION_VALUE_NEW = "2020";
private static final String PUBLICATION_YEAR = "PublicationYear";
private static final String PUBLICATION_YEAR_OLD = "1979";
private static final String PUBLICATION_YEAR_NEW = "1980";
private int testProcessId = 0;
private static final List<Locale.LanguageRange> languages = Locale.LanguageRange.parse("de, en");

Expand Down Expand Up @@ -108,18 +108,18 @@ public void shouldSuccessfullyUpdateMetadata() throws Exception {
existingMetadata, languages, "Monograph");
assertFalse(metadataComparisons.isEmpty(), "List of metadata comparisons should not be empty");
MetadataComparison firstComparison = metadataComparisons.get(0);
assertEquals(PUBLICATION_START_KEY, firstComparison.getMetadataKey(),
String.format("Changed metadata should be '%s'", PUBLICATION_START_KEY));
MetadataEntry publicationMetadataOld = new MetadataEntry();
publicationMetadataOld.setKey(PUBLICATION_START_KEY);
publicationMetadataOld.setValue(PUBLICATION_VALUE_OLD);
MetadataEntry publicationMetadataNew = new MetadataEntry();
publicationMetadataNew.setKey(PUBLICATION_START_KEY);
publicationMetadataNew.setValue(PUBLICATION_VALUE_NEW);
assertTrue(firstComparison.getOldValues().contains(publicationMetadataOld),
String.format("Old values should contain publication year %s", publicationMetadataOld.getValue()));
assertTrue(firstComparison.getNewValues().contains(publicationMetadataNew),
String.format("New values should contain publication year %s", publicationMetadataNew.getValue()));
assertEquals(PUBLICATION_YEAR, firstComparison.getMetadataKey(),
String.format("Changed metadata should be '%s'", PUBLICATION_YEAR));
MetadataEntry publicationYearOld = new MetadataEntry();
publicationYearOld.setKey(PUBLICATION_YEAR);
publicationYearOld.setValue(PUBLICATION_YEAR_OLD);
MetadataEntry publicationYearNew = new MetadataEntry();
publicationYearNew.setKey(PUBLICATION_YEAR);
publicationYearNew.setValue(PUBLICATION_YEAR_NEW);
assertTrue(firstComparison.getOldValues().contains(publicationYearOld),
String.format("Old values should contain publication year %s", publicationYearOld.getValue()));
assertTrue(firstComparison.getNewValues().contains(publicationYearNew),
String.format("New values should contain publication year %s", publicationYearNew.getValue()));
}

private static void setupServer() throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
</recordInfo>
<originInfo eventType="publication">
<publisher>Test Publisher</publisher>
<dateIssued encoding="w3cdtf">1980-07-22</dateIssued>
</originInfo>
</mods>
</srw:recordData>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<kitodo:kitodo xmlns:kitodo="http://meta.kitodo.org/v1/" version="1.0">
<kitodo:metadata name="PublisherName">Test Publisher</kitodo:metadata>
<kitodo:metadata name="document_type">Monograph</kitodo:metadata>
<kitodo:metadata name="PublicationStart">2019</kitodo:metadata>
<kitodo:metadata name="CatalogIDDigital">789</kitodo:metadata>
<kitodo:metadata name="PublicationYear">1979</kitodo:metadata>
</kitodo:kitodo>
</mets:xmlData>
</mets:mdWrap>
Expand Down
1 change: 1 addition & 0 deletions Kitodo/src/test/resources/rulesets/ruleset_test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
<permit key="CatalogIDDigital" minOccurs="1"/>
<permit key="CatalogIDSource" minOccurs="1"/>
<permit key="TSL_ATS"/>
<permit key="PublicationYear"/>
<permit key="ContributorPerson"/>
<permit key="Person">
<permit key="Role" unspecified="forbidden">
Expand Down

0 comments on commit 16b8f35

Please sign in to comment.