with
+ docBook = docBook.replace(//g, '').replace(/<\/literalLayout><\/para>/g, '
');
+
+ // Replace with
+ docBook = docBook.replace(//g, '').replace(/<\/para>/g, '
');
+
+ // Replace with
+ docBook = docBook.replace(//g, '').replace(/<\/emphasis>/g, '');
+
+ // Replace with and with
+ docBook = docBook.replace(//g, '').replace(/<\/subscript>/g, '');
+ docBook = docBook.replace(//g, '').replace(/<\/superscript>/g, '');
+
+ // Replace ... with ...
+ docBook = docBook.replace(/([^<]+)<\/citetitle><\/ulink>/g, '$2');
+
+ return docBook;
+}
+
+// Function to validate HTML (it must contain only allowed tags)
+function validateHTML(html) {
+ // Define allowed tags
+ // br - is not allowed but will be cleaned in the beginning
+ const allowedTags = [
+ 'div',
+ 'h1', 'h2', 'h3', 'h4', 'h5',
+ 'ul', 'ol', 'li',
+ 'p', 'b', 'sub', 'sup', 'pre', 'a',
+ 'br'
+ ];
+
+ // Match all HTML tags in the string
+ const regex = /<\/?([a-z][a-z0-9]*)\b[^>]*>/gi;
+ let match;
+
+ // Loop through all found tags
+ while ((match = regex.exec(html)) !== null) {
+ // Extract the tag name from the match
+ const tagName = match[1].toLowerCase();
+
+ // Check if the tag is not in the allowed list
+ if (!allowedTags.includes(tagName)) {
+ return { isValid: false, tag: match[0] }; // Forbidden tag found
+ }
+ }
+
+ return { isValid: true }; // No forbidden tags found
+}
diff --git a/src/main/webapp/styles/main.css b/src/main/webapp/styles/main.css
index ec4ffc0e0b..a4d91bd4f5 100644
--- a/src/main/webapp/styles/main.css
+++ b/src/main/webapp/styles/main.css
@@ -1366,7 +1366,7 @@ input[type="search"]:focus::-webkit-search-cancel-button {
}
.select2-container--bootstrap4.select2-container--focus .select2-selection {
- border-color: rgba(var(--color-gbif-primary), 0.5) !important;
+ border-color: rgb(var(--color-gbif-primary)) !important;
box-shadow: none !important;
}
@@ -2743,4 +2743,41 @@ header.shrink #accountDropdownLink {
left: 0;
z-index: 1030;
}
+}
+
+/* "This contact will be in the citation" badge */
+span.contact-citation-banner {
+ background: rgb(var(--color-gbif-primary));;
+ color: white;
+ padding: 0 3px;
+ font-size: 0.75rem;
+ font-weight: bolder;
+ border-radius: 3px;
+}
+
+.ul-contact-info {
+ display: inline;
+ padding: 0;
+}
+
+.ul-contact-info li {
+ display: inline-block;
+ margin: 0 2px;
+}
+
+.ul-contact-info li.item:after {
+ font-style: normal;
+ content: '\25CF';
+ font-size: 80%;
+ padding-left: 4px;
+ padding-right: 2px;
+}
+
+.break-all {
+ word-break: break-all;
+}
+
+/* HTML/DocBook textarea */
+.note-editor h1 {
+ font-size: 1.5rem;
}
\ No newline at end of file
diff --git a/src/test/java/org/gbif/ipt/service/manage/impl/ResourceManagerImplTest.java b/src/test/java/org/gbif/ipt/service/manage/impl/ResourceManagerImplTest.java
index 626d4b9af8..07554c95c3 100644
--- a/src/test/java/org/gbif/ipt/service/manage/impl/ResourceManagerImplTest.java
+++ b/src/test/java/org/gbif/ipt/service/manage/impl/ResourceManagerImplTest.java
@@ -364,7 +364,7 @@ public void testCreateFromZippedFile() throws Exception {
// eml properties loaded from eml.xml
assertEquals("TEST RESOURCE", res.getEml().getTitle());
- assertEquals("Test description", res.getEml().getDescription().get(0));
+ assertEquals("Test description
", res.getEml().getDescription());
assertEquals(Constants.INITIAL_RESOURCE_VERSION, res.getEml().getEmlVersion());
}
@@ -426,7 +426,7 @@ public void testCreateFromSingleZippedFile() throws Exception {
// there are no eml properties
assertNull(res.getEml().getTitle());
- assertTrue(res.getEml().getDescription().isEmpty());
+ assertNull(res.getEml().getDescription());
// properties that never get set on new resource creation
@@ -517,7 +517,7 @@ public void testCreateFromSingleGzipFile() throws Exception {
// there are no eml properties
assertNull(res.getEml().getTitle());
- assertTrue(res.getEml().getDescription().isEmpty());
+ assertNull(res.getEml().getDescription());
}
/**
@@ -1635,8 +1635,7 @@ public void testReconstructVersion() throws Exception {
resource.setOrganisation(organisation);
assertEquals(organisation.getKey(), resource.getOrganisation().getKey());
resource.getEml().setTitle("Title for pending version 1.2");
- List description = new ArrayList<>();
- description.add("Title description for pending version 1.2");
+ String description = "Title description for pending version 1.2";
resource.getEml().setDescription(description);
// retrieve previous persisted Eml file for version 1.1
@@ -1656,7 +1655,7 @@ public void testReconstructVersion() throws Exception {
assertEquals(1, reconstructed.getRecordsPublished()); // changed
// ensure reconstructed resource uses eml-1.1.xml
assertEquals("Title for version 1.1", reconstructed.getEml().getTitle()); // changed
- assertEquals("Test description for version 1.1", reconstructed.getEml().getDescription().get(0)); // changed
+ assertEquals("Test description for version 1.1
", reconstructed.getEml().getDescription()); // changed
}
/**
@@ -1696,8 +1695,7 @@ public void testReconstructRegisteredVersion() throws Exception {
resource.setKey(key);
resource.getEml().setTitle("Title for pending version 5.1");
- List description = new ArrayList<>();
- description.add("Description for pending version 5.1");
+ String description = "Description for pending version 5.1";
resource.getEml().setDescription(description);
// retrieve previous persisted Eml file for version 5.0
@@ -1718,7 +1716,7 @@ public void testReconstructRegisteredVersion() throws Exception {
assertEquals(0, reconstructed.getRecordsPublished()); // unchanged
// ensure reconstructed resource uses eml-5.0.xml
assertEquals("Test Dataset Please Ignore", reconstructed.getEml().getTitle()); // changed
- assertEquals("This dataset covers mosses and lichens from Russia.", reconstructed.getEml().getDescription().get(0)); // changed
+ assertEquals("This dataset covers mosses and lichens from Russia.
", reconstructed.getEml().getDescription()); // changed
// creator populated
assertNotNull(resource.getCreator());
assertEquals(creator, resource.getCreator());
diff --git a/src/test/java/org/gbif/ipt/service/registry/impl/RegistryManagerImplIT.java b/src/test/java/org/gbif/ipt/service/registry/impl/RegistryManagerImplIT.java
index 6e967032ed..4f0e7b7435 100644
--- a/src/test/java/org/gbif/ipt/service/registry/impl/RegistryManagerImplIT.java
+++ b/src/test/java/org/gbif/ipt/service/registry/impl/RegistryManagerImplIT.java
@@ -133,9 +133,8 @@ public void testRegisterResource() {
res.setLastPublished(new Date());
Eml eml = new Eml();
- List description = new ArrayList<>();
- description.add(
- "An IPT unit test resource that can be deleted. Testing unicode characters like ą ć ę ł ń ś ź ż (for polish) ť ů ž č ď ě ň ř š (for czech) and other taken from http://www.alanflavell.org.uk/unicode/unidata.html ᠀᠔ᡎᢥ(mongolian) ⅛ Ⅳ ⅸ ↂ (numbers) ∀ ∰ ⊇ ⋩ (maths) CJK Symbols and Punctuation U+3000 – U+303F (12288–12351) 々 〒 〣 〰 Hiragana U+3040 – U+309F (12352–12447) あ ぐ る ゞ Katakana U+30A0 – U+30FF (12448–12543) ア ヅ ヨ ヾ Bopomofo U+3100 – U+312F (12544–12591) ㄆ ㄓ ㄝ ㄩ Hangul Compatibility Jamo U+3130 – U+318F (12592–12687) ㄱ ㄸ ㅪ ㆍ Kanbun U+3190 – U+319F (12688–12703) ㆐ ㆕ ㆚ ㆟ Bopomofo Extended U+31A0 – U+32BF (12704–12735) ㆠ ㆧ ㆯ ㆷ Katakana Phonetic Extensions U+31F0 – U+31FF (12784–12799) ㇰ ㇵ ㇺ ㇿ Enclosed CJK Letters and Months U+3200 – U+32FF (12800–13055) ㈔ ㈲ ㊧ ㋮ CJK Compatibility U+3300 – U+33FF (13056–13311) ㌃ ㍻ ㎡ ㏵ CJK Unified Ideographs Extension A U+3400 – U+4DB5 (13312–19893) 㐅 㒅 㝬 㿜 Yijing Hexagram Symbols U+4DC0 – U+4DFF (19904–19967) ䷂ ䷫ ䷴ ䷾ CJK Unified Ideographs U+4E00 – U+9FFF (19968–40959) 一 憨 田 龥 Yi Syllables U+A000 – U+A48F (40960–42127) ꀀ ꅴ ꊩ ꒌ Yi Radicals U+A490 – U+A4CF (42128–42191) ꒐ ꒡ ꒰ ꓆ ");
+ String description =
+ "An IPT unit test resource that can be deleted. Testing unicode characters like ą ć ę ł ń ś ź ż (for polish) ť ů ž č ď ě ň ř š (for czech) and other taken from http://www.alanflavell.org.uk/unicode/unidata.html ᠀᠔ᡎᢥ(mongolian) ⅛ Ⅳ ⅸ ↂ (numbers) ∀ ∰ ⊇ ⋩ (maths) CJK Symbols and Punctuation U+3000 – U+303F (12288–12351) 々 〒 〣 〰 Hiragana U+3040 – U+309F (12352–12447) あ ぐ る ゞ Katakana U+30A0 – U+30FF (12448–12543) ア ヅ ヨ ヾ Bopomofo U+3100 – U+312F (12544–12591) ㄆ ㄓ ㄝ ㄩ Hangul Compatibility Jamo U+3130 – U+318F (12592–12687) ㄱ ㄸ ㅪ ㆍ Kanbun U+3190 – U+319F (12688–12703) ㆐ ㆕ ㆚ ㆟ Bopomofo Extended U+31A0 – U+32BF (12704–12735) ㆠ ㆧ ㆯ ㆷ Katakana Phonetic Extensions U+31F0 – U+31FF (12784–12799) ㇰ ㇵ ㇺ ㇿ Enclosed CJK Letters and Months U+3200 – U+32FF (12800–13055) ㈔ ㈲ ㊧ ㋮ CJK Compatibility U+3300 – U+33FF (13056–13311) ㌃ ㍻ ㎡ ㏵ CJK Unified Ideographs Extension A U+3400 – U+4DB5 (13312–19893) 㐅 㒅 㝬 㿜 Yijing Hexagram Symbols U+4DC0 – U+4DFF (19904–19967) ䷂ ䷫ ䷴ ䷾ CJK Unified Ideographs U+4E00 – U+9FFF (19968–40959) 一 憨 田 龥 Yi Syllables U+A000 – U+A48F (40960–42127) ꀀ ꅴ ꊩ ꒌ Yi Radicals U+A490 – U+A4CF (42128–42191) ꒐ ꒡ ꒰ ꓆ ";
eml.setAbstract(description);
res.setEml(eml);
diff --git a/src/test/java/org/gbif/ipt/task/GenerateDCATTest.java b/src/test/java/org/gbif/ipt/task/GenerateDCATTest.java
index a76f2ddeab..5b54bf9af7 100644
--- a/src/test/java/org/gbif/ipt/task/GenerateDCATTest.java
+++ b/src/test/java/org/gbif/ipt/task/GenerateDCATTest.java
@@ -181,14 +181,10 @@ public void testCreateDCATDatasetNewline() throws Exception {
File resourceXML = FileUtils.getClasspathFile("resources/res1/resource.xml");
Resource res = getResource(resourceXML);
- // add another paragraph to description
- res.getEml().getDescription().add("Second paragraph");
- assertEquals(2, res.getEml().getDescription().size());
-
String dcat = mockGenerateDCAT.createDCATDatasetInformation(res);
assertTrue(dcat.contains("a dcat:Dataset"));
// ensure line break is properly escaped
- assertTrue(dcat.contains("dct:description \"" + "Test \\\"description\\\"" + "\\n" + "Second paragraph" + "\""));
+ assertTrue(dcat.contains("dct:description \"" + "Test \\\"description\\\""));
assertTrue(dcat.contains("dcat:distribution "));
}
@@ -201,15 +197,10 @@ public void testCreateDCATDatasetNewlineInsideParagraph() throws Exception {
File resourceXML = FileUtils.getClasspathFile("resources/res1/resource.xml");
Resource res = getResource(resourceXML);
- // add another paragraph with '\n' character to description
- res.getEml().getDescription().add("Second paragraph\nwith line break");
- assertEquals(2, res.getEml().getDescription().size());
-
String dcat = mockGenerateDCAT.createDCATDatasetInformation(res);
assertTrue(dcat.contains("a dcat:Dataset"));
// ensure line break is properly escaped
- assertTrue(dcat.contains("dct:description \"\"\"Test \\\"description\\\"\\nSecond paragraph\n" +
- "with line break\"\"\""));
+ assertTrue(dcat.contains("dct:description \"" + "Test \\\"description\\\""));
assertTrue(dcat.contains("dcat:distribution "));
}
@@ -330,7 +321,7 @@ private Resource getResource(@NotNull File resourceXML) throws Exception {
// update resource title and description, to have double quotation marks which need to be escaped
resource.setTitle("TEST \"RESOURCE\"");
- resource.getEml().getDescription().set(0, "Test \"description\"");
+ resource.getEml().setDescription("Test \"description\"");
// update keyword sets: should be three, with "Occurrence" and "Observation" repeating more than once which breaks the feed
resource.getEml().getKeywords().clear();
@@ -362,7 +353,7 @@ private Resource getResource(@NotNull File resourceXML) throws Exception {
Agent agent = new Agent();
agent.setFirstName("Eric");
agent.setLastName("Stienen");
- agent.setEmail("eric.stienen@inbo.be");
+ agent.addEmail("eric.stienen@inbo.be");
resource.getEml().addCreator(agent);
resource.getEml().addContact(agent);
resource.getEml().addMetadataProvider(agent);
diff --git a/src/test/java/org/gbif/ipt/utils/DataCiteMetadataBuilderTest.java b/src/test/java/org/gbif/ipt/utils/DataCiteMetadataBuilderTest.java
index f24a028c7d..f4a6a4fa3e 100644
--- a/src/test/java/org/gbif/ipt/utils/DataCiteMetadataBuilderTest.java
+++ b/src/test/java/org/gbif/ipt/utils/DataCiteMetadataBuilderTest.java
@@ -83,9 +83,7 @@ public void testBuilder() throws InvalidMetadataException {
resource.setEml(eml);
eml.setTitle("Ants of New York State");
- List description = new ArrayList<>();
- description.add("Comprehensive ants collection.");
- description.add("Mostly dried preserved.");
+ String description = "Comprehensive ants collection. Mostly dried preserved.";
eml.setDescription(description);
eml.setMetadataLanguage("eng");
eml.setLanguage("heb");
@@ -124,14 +122,14 @@ public void testBuilder() throws InvalidMetadataException {
// associatedProvider = contributor
Agent contributor3 = new Agent();
- contributor3.setPosition("Insects Curator");
+ contributor3.addPosition("Insects Curator");
contributor3.setRole("curator");
List contributorUserIds3 = new ArrayList<>();
contributor3.setUserIds(contributorUserIds3);
eml.addAssociatedParty(contributor3);
Agent contributor4 = new Agent();
- contributor4.setPosition("Programmer");
+ contributor4.addPosition("Programmer");
contributor4.setRole("programmer");
eml.addAssociatedParty(contributor4);
// TODO add more associatedParties covering all roles
@@ -336,10 +334,8 @@ public void testBuilder() throws InvalidMetadataException {
dataCiteMetadata.getRightsList().getRights().get(0).getValue());
// Abstract aka description
- assertEquals("Comprehensive ants collection.",
+ assertEquals("Comprehensive ants collection. Mostly dried preserved.",
dataCiteMetadata.getDescriptions().getDescription().get(0).getContent().get(0));
- assertEquals("Mostly dried preserved.",
- dataCiteMetadata.getDescriptions().getDescription().get(1).getContent().get(0));
assertEquals(DescriptionType.ABSTRACT,
dataCiteMetadata.getDescriptions().getDescription().get(0).getDescriptionType());
assertEquals("eng", dataCiteMetadata.getDescriptions().getDescription().get(0).getLang());
@@ -444,7 +440,7 @@ public void testConvertEmlCreatorsWithEmptyList() {
@Test
public void testConvertEmlCreatorsWithPositionName() {
Agent creator1 = new Agent();
- creator1.setPosition("President");
+ creator1.addPosition("President");
List creators = new ArrayList<>();
creators.add(creator1);
assertThrows(InvalidMetadataException.class, () -> DataCiteMetadataBuilder.convertEmlCreators(creators));
diff --git a/src/test/java/org/gbif/ipt/validation/EmlValidatorTest.java b/src/test/java/org/gbif/ipt/validation/EmlValidatorTest.java
index 6a051e707c..5cc6439544 100644
--- a/src/test/java/org/gbif/ipt/validation/EmlValidatorTest.java
+++ b/src/test/java/org/gbif/ipt/validation/EmlValidatorTest.java
@@ -33,13 +33,13 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.Date;
-import java.util.List;
import java.util.UUID;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.Test;
import org.xml.sax.SAXException;
@@ -165,17 +165,16 @@ public void testBasicPartTitleMissing() {
assertFalse(validator.isValid(resource, MetadataSection.BASIC_SECTION));
}
+ @Disabled("Currently not applicable because of DocBook")
@Test
public void testBasicPartDescriptionMissing() {
// invalid
- List description = new ArrayList<>();
- eml.setDescription(description);
+ eml.setDescription("");
assertFalse(validator.isValid(resource, MetadataSection.BASIC_SECTION));
- description.add("shrt");
+ eml.setDescription("shrt");
assertFalse(validator.isValid(resource, MetadataSection.BASIC_SECTION));
// valid
- description.clear();
- description.add("long_enough");
+ eml.setDescription("long_enough");
assertTrue(validator.isValid(resource, MetadataSection.BASIC_SECTION));
}
@@ -218,7 +217,7 @@ public void testBasicPartUpdateFrequencyMissing() {
eml.setUpdateFrequency(null);
resource.setUpdateFrequency(null);
assertTrue(validator.isValid(resource, MetadataSection.BASIC_SECTION));
- assertEquals("unkown", eml.getUpdateFrequency().getIdentifier());
+ assertEquals("unknown", eml.getUpdateFrequency().getIdentifier());
// valid, because will reuse auto-publishing interval as update frequency
eml.setUpdateFrequency(null);
@@ -242,7 +241,7 @@ public void testBasicPartDefaultsSet() {
// defaults correct?
assertEquals("eng", resource.getEml().getLanguage());
assertEquals("eng", resource.getEml().getMetadataLanguage());
- assertEquals("unkown", eml.getUpdateFrequency().getIdentifier());
+ assertEquals("unknown", eml.getUpdateFrequency().getIdentifier());
}
/**
@@ -269,10 +268,10 @@ public void testDecimalGeographicIssues() {
public void testBasicPartContactIncomplete() {
// invalid
eml.addContact(badAgent);
- assertFalse(validator.isValid(resource, MetadataSection.BASIC_SECTION));
+ assertFalse(validator.isValid(resource, MetadataSection.CONTACTS_SECTION));
badAgent.setLastName("Smith");
// valid
- assertTrue(validator.isValid(resource, MetadataSection.BASIC_SECTION));
+ assertTrue(validator.isValid(resource, MetadataSection.CONTACTS_SECTION));
// no user ids to begin
assertTrue(badAgent.getUserIds().isEmpty());
@@ -281,10 +280,10 @@ public void testBasicPartContactIncomplete() {
UserId invalidId = new UserId("", "1234-5678-9101-1213");
badAgent.getUserIds().add(invalidId);
assertFalse(badAgent.getUserIds().isEmpty());
- assertFalse(validator.isValid(resource, MetadataSection.BASIC_SECTION));
+ assertFalse(validator.isValid(resource, MetadataSection.CONTACTS_SECTION));
// make user id valid by setting its directory
badAgent.getUserIds().get(0).setDirectory("http://orcid.org");
- assertTrue(validator.isValid(resource, MetadataSection.BASIC_SECTION));
+ assertTrue(validator.isValid(resource, MetadataSection.CONTACTS_SECTION));
// clear user ids
badAgent.getUserIds().clear();
@@ -294,10 +293,10 @@ public void testBasicPartContactIncomplete() {
invalidId = new UserId("http://orcid.org", "");
badAgent.getUserIds().add(invalidId);
assertFalse(badAgent.getUserIds().isEmpty());
- assertFalse(validator.isValid(resource, MetadataSection.BASIC_SECTION));
+ assertFalse(validator.isValid(resource, MetadataSection.CONTACTS_SECTION));
// make user id valid by setting its identifier
badAgent.getUserIds().get(0).setIdentifier("1234-5678-9101-1213");
- assertTrue(validator.isValid(resource, MetadataSection.BASIC_SECTION));
+ assertTrue(validator.isValid(resource, MetadataSection.CONTACTS_SECTION));
}
/**
@@ -309,10 +308,10 @@ public void testBasicPartContactIncomplete() {
public void testBasicPartCreatorIncomplete() {
// invalid
eml.addCreator(badAgent);
- assertFalse(validator.isValid(resource, MetadataSection.BASIC_SECTION));
+ assertFalse(validator.isValid(resource, MetadataSection.CONTACTS_SECTION));
badAgent.setLastName("Smith");
// valid
- assertTrue(validator.isValid(resource, MetadataSection.BASIC_SECTION));
+ assertTrue(validator.isValid(resource, MetadataSection.CONTACTS_SECTION));
// no user ids to begin
assertTrue(badAgent.getUserIds().isEmpty());
@@ -321,10 +320,10 @@ public void testBasicPartCreatorIncomplete() {
UserId invalidId = new UserId("", "1234-5678-9101-1213");
badAgent.getUserIds().add(invalidId);
assertFalse(badAgent.getUserIds().isEmpty());
- assertFalse(validator.isValid(resource, MetadataSection.BASIC_SECTION));
+ assertFalse(validator.isValid(resource, MetadataSection.CONTACTS_SECTION));
// make user id valid by setting its directory
badAgent.getUserIds().get(0).setDirectory("http://orcid.org");
- assertTrue(validator.isValid(resource, MetadataSection.BASIC_SECTION));
+ assertTrue(validator.isValid(resource, MetadataSection.CONTACTS_SECTION));
// clear user ids
badAgent.getUserIds().clear();
@@ -334,10 +333,10 @@ public void testBasicPartCreatorIncomplete() {
invalidId = new UserId("http://orcid.org", "");
badAgent.getUserIds().add(invalidId);
assertFalse(badAgent.getUserIds().isEmpty());
- assertFalse(validator.isValid(resource, MetadataSection.BASIC_SECTION));
+ assertFalse(validator.isValid(resource, MetadataSection.CONTACTS_SECTION));
// make user id valid by setting its identifier
badAgent.getUserIds().get(0).setIdentifier("1234-5678-9101-1213");
- assertTrue(validator.isValid(resource, MetadataSection.BASIC_SECTION));
+ assertTrue(validator.isValid(resource, MetadataSection.CONTACTS_SECTION));
}
/**
@@ -349,10 +348,10 @@ public void testBasicPartCreatorIncomplete() {
public void testBasicPartMetaProviderIncomplete() {
// invalid
eml.addMetadataProvider(badAgent);
- assertFalse(validator.isValid(resource, MetadataSection.BASIC_SECTION));
+ assertFalse(validator.isValid(resource, MetadataSection.CONTACTS_SECTION));
badAgent.setLastName("Smith");
// valid
- assertTrue(validator.isValid(resource, MetadataSection.BASIC_SECTION));
+ assertTrue(validator.isValid(resource, MetadataSection.CONTACTS_SECTION));
// no user ids to begin
assertTrue(badAgent.getUserIds().isEmpty());
@@ -361,10 +360,10 @@ public void testBasicPartMetaProviderIncomplete() {
UserId invalidId = new UserId("", "1234-5678-9101-1213");
badAgent.getUserIds().add(invalidId);
assertFalse(badAgent.getUserIds().isEmpty());
- assertFalse(validator.isValid(resource, MetadataSection.BASIC_SECTION));
+ assertFalse(validator.isValid(resource, MetadataSection.CONTACTS_SECTION));
// make user id valid by setting its directory
badAgent.getUserIds().get(0).setDirectory("http://orcid.org");
- assertTrue(validator.isValid(resource, MetadataSection.BASIC_SECTION));
+ assertTrue(validator.isValid(resource, MetadataSection.CONTACTS_SECTION));
// clear user ids
badAgent.getUserIds().clear();
@@ -374,10 +373,10 @@ public void testBasicPartMetaProviderIncomplete() {
invalidId = new UserId("http://orcid.org", "");
badAgent.getUserIds().add(invalidId);
assertFalse(badAgent.getUserIds().isEmpty());
- assertFalse(validator.isValid(resource, MetadataSection.BASIC_SECTION));
+ assertFalse(validator.isValid(resource, MetadataSection.CONTACTS_SECTION));
// make user id valid by setting its identifier
badAgent.getUserIds().get(0).setIdentifier("1234-5678-9101-1213");
- assertTrue(validator.isValid(resource, MetadataSection.BASIC_SECTION));
+ assertTrue(validator.isValid(resource, MetadataSection.CONTACTS_SECTION));
}
@Test
@@ -494,11 +493,11 @@ public void testProjectPartTitleIncomplete() {
}
@Test
- public void testProjectPartPersonnelOptional() {
+ public void testProjectPartPersonnelMissing() {
assertNotNull(eml.getProject().getTitle());
eml.getProject().getPersonnel().clear();
assertTrue(eml.getProject().getPersonnel().isEmpty());
- assertTrue(validator.isValid(resource, MetadataSection.PROJECT_SECTION));
+ assertFalse(validator.isValid(resource, MetadataSection.PROJECT_SECTION));
}
@Test
@@ -740,7 +739,7 @@ public void testAreAllSectionsValid() {
resource.setUpdateFrequency(MaintenanceUpdateFrequency.ANNUALLY.toString());
empty.setTitle("Title");
- empty.addDescriptionPara("Description");
+ empty.setDescription("Description");
empty.setMetadataLanguage(Language.FRENCH.getIso3LetterCode());
empty.setLanguage(Language.SPANISH.getIso3LetterCode());
empty.setIntellectualRights("CC-BY");
diff --git a/src/test/resources/resources/event/eml.xml b/src/test/resources/resources/event/eml.xml
index ba8f714be5..88328bb4d5 100644
--- a/src/test/resources/resources/event/eml.xml
+++ b/src/test/resources/resources/event/eml.xml
@@ -1,8 +1,8 @@
-
diff --git a/src/test/resources/resources/res1/eml.xml b/src/test/resources/resources/res1/eml.xml
index 648b6f8031..b2e99aa29e 100644
--- a/src/test/resources/resources/res1/eml.xml
+++ b/src/test/resources/resources/res1/eml.xml
@@ -1,8 +1,8 @@
-