@@ -660,8 +661,10 @@
data-toggle="tooltip" data-placement="auto right" data-original-title="#{DatasetPage.datasetVersionUI.datasetRelPublications.get(0).description}">
-
- #{DatasetPage.datasetVersionUI.relPublicationId}
+
+
+ #{empty DatasetPage.datasetVersionUI.relPublicationId ? DatasetPage.datasetVersionUI.relPublicationUrl:DatasetPage.datasetVersionUI.relPublicationId}
+
|
diff --git a/src/main/webapp/resources/css/structure.css b/src/main/webapp/resources/css/structure.css
index 64d07038f2f..274755046e2 100644
--- a/src/main/webapp/resources/css/structure.css
+++ b/src/main/webapp/resources/css/structure.css
@@ -1163,7 +1163,7 @@ a {
color:#3174AF;
}
-.label-warning a, .bg-citation a, .terms .help-block a, #panelCollapseTOU .help-block a {
+.label-warning a, .bg-citation a, .terms .help-block a, #panelCollapseTOU .help-block a, #dataset-summary-metadata a {
text-decoration: underline;
}
.pagination>.disabled>a {
diff --git a/src/test/java/edu/harvard/iq/dataverse/api/DataversesIT.java b/src/test/java/edu/harvard/iq/dataverse/api/DataversesIT.java
index f3c74f028e4..6fbe91c8405 100644
--- a/src/test/java/edu/harvard/iq/dataverse/api/DataversesIT.java
+++ b/src/test/java/edu/harvard/iq/dataverse/api/DataversesIT.java
@@ -777,7 +777,7 @@ public void testListMetadataBlocks() {
// Since the included property of notesText is set to false, we should retrieve the total number of fields minus one
int citationMetadataBlockIndex = geospatialMetadataBlockIndex == 0 ? 1 : 0;
listMetadataBlocksResponse.then().assertThat()
- .body(String.format("data[%d].fields.size()", citationMetadataBlockIndex), equalTo(78));
+ .body(String.format("data[%d].fields.size()", citationMetadataBlockIndex), equalTo(79));
// Since the included property of geographicCoverage is set to false, we should retrieve the total number of fields minus one
listMetadataBlocksResponse.then().assertThat()
diff --git a/src/test/java/edu/harvard/iq/dataverse/api/MetadataBlocksIT.java b/src/test/java/edu/harvard/iq/dataverse/api/MetadataBlocksIT.java
index 183d687b405..0153d8dc893 100644
--- a/src/test/java/edu/harvard/iq/dataverse/api/MetadataBlocksIT.java
+++ b/src/test/java/edu/harvard/iq/dataverse/api/MetadataBlocksIT.java
@@ -42,7 +42,7 @@ void testListMetadataBlocks() {
// returnDatasetFieldTypes=true
listMetadataBlocksResponse = UtilIT.listMetadataBlocks(false, true);
- int expectedNumberOfMetadataFields = 79;
+ int expectedNumberOfMetadataFields = 80;
listMetadataBlocksResponse.then().assertThat()
.statusCode(OK.getStatusCode())
.body("data[0].fields", not(equalTo(null)))
@@ -51,7 +51,7 @@ void testListMetadataBlocks() {
// onlyDisplayedOnCreate=true and returnDatasetFieldTypes=true
listMetadataBlocksResponse = UtilIT.listMetadataBlocks(true, true);
- expectedNumberOfMetadataFields = 25;
+ expectedNumberOfMetadataFields = 26;
listMetadataBlocksResponse.then().assertThat()
.statusCode(OK.getStatusCode())
.body("data[0].fields", not(equalTo(null)))
diff --git a/src/test/java/edu/harvard/iq/dataverse/export/OpenAireExportUtilTest.java b/src/test/java/edu/harvard/iq/dataverse/export/OpenAireExportUtilTest.java
index 2da15147255..8350c5d9875 100644
--- a/src/test/java/edu/harvard/iq/dataverse/export/OpenAireExportUtilTest.java
+++ b/src/test/java/edu/harvard/iq/dataverse/export/OpenAireExportUtilTest.java
@@ -617,7 +617,7 @@ public void testWriteRelatedIdentifierElement() throws XMLStreamException, IOExc
//then
assertEquals(""
- + ""
+ + ""
+ "RelatedPublicationIDNumber1"
+ ""
+ "RelatedPublicationIDNumber2"
diff --git a/src/test/java/edu/harvard/iq/dataverse/export/dataset-all-defaults.txt b/src/test/java/edu/harvard/iq/dataverse/export/dataset-all-defaults.txt
index 431f069cb03..6b3c7689bbf 100644
--- a/src/test/java/edu/harvard/iq/dataverse/export/dataset-all-defaults.txt
+++ b/src/test/java/edu/harvard/iq/dataverse/export/dataset-all-defaults.txt
@@ -324,6 +324,12 @@
"typeClass": "compound",
"value": [
{
+ "publicationRelationType": {
+ "typeName": "publicationRelationType",
+ "multiple": false,
+ "typeClass": "controlledVocabulary",
+ "value": "IsSupplementTo"
+ },
"publicationCitation": {
"typeName": "publicationCitation",
"multiple": false,
diff --git a/src/test/java/edu/harvard/iq/dataverse/pidproviders/doi/datacite/XmlMetadataTemplateTest.java b/src/test/java/edu/harvard/iq/dataverse/pidproviders/doi/datacite/XmlMetadataTemplateTest.java
new file mode 100644
index 00000000000..c03146904de
--- /dev/null
+++ b/src/test/java/edu/harvard/iq/dataverse/pidproviders/doi/datacite/XmlMetadataTemplateTest.java
@@ -0,0 +1,149 @@
+package edu.harvard.iq.dataverse.pidproviders.doi.datacite;
+
+import edu.harvard.iq.dataverse.Dataset;
+import edu.harvard.iq.dataverse.DatasetAuthor;
+import edu.harvard.iq.dataverse.DatasetField;
+import edu.harvard.iq.dataverse.DatasetFieldConstant;
+import edu.harvard.iq.dataverse.DatasetFieldType;
+import edu.harvard.iq.dataverse.DatasetFieldType.FieldType;
+import edu.harvard.iq.dataverse.DatasetVersion;
+import edu.harvard.iq.dataverse.DatasetVersion.VersionState;
+import edu.harvard.iq.dataverse.DataverseServiceBean;
+import edu.harvard.iq.dataverse.GlobalId;
+import edu.harvard.iq.dataverse.TermsOfUseAndAccess;
+import edu.harvard.iq.dataverse.branding.BrandingUtil;
+import edu.harvard.iq.dataverse.dataset.DatasetType;
+import edu.harvard.iq.dataverse.pidproviders.PidProviderFactoryBean;
+import edu.harvard.iq.dataverse.pidproviders.PidUtil;
+import edu.harvard.iq.dataverse.pidproviders.doi.DoiMetadata;
+import edu.harvard.iq.dataverse.pidproviders.doi.XmlMetadataTemplate;
+import edu.harvard.iq.dataverse.settings.JvmSettings;
+import edu.harvard.iq.dataverse.settings.SettingsServiceBean;
+import edu.harvard.iq.dataverse.util.SystemConfig;
+import edu.harvard.iq.dataverse.util.testing.JvmSetting;
+import edu.harvard.iq.dataverse.util.testing.LocalJvmSettings;
+import edu.harvard.iq.dataverse.util.xml.XmlValidator;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.transform.stream.StreamSource;
+
+import org.junit.jupiter.api.Disabled;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.BeforeAll;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+import org.mockito.Mockito;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.xml.sax.SAXException;
+
+import static org.junit.jupiter.api.Assertions.*;
+import static org.mockito.ArgumentMatchers.any;
+
+@ExtendWith(MockitoExtension.class)
+@LocalJvmSettings
+@JvmSetting(key = JvmSettings.SITE_URL, value = "https://example.com")
+
+public class XmlMetadataTemplateTest {
+
+ static DataverseServiceBean dataverseSvc;
+ static SettingsServiceBean settingsSvc;
+ static PidProviderFactoryBean pidService;
+ static final String DEFAULT_NAME = "LibraScholar";
+
+ @BeforeAll
+ public static void setupMocks() {
+ dataverseSvc = Mockito.mock(DataverseServiceBean.class);
+ settingsSvc = Mockito.mock(SettingsServiceBean.class);
+ BrandingUtil.injectServices(dataverseSvc, settingsSvc);
+
+ // initial values (needed here for other tests where this method is reused!)
+ Mockito.when(settingsSvc.getValueForKey(SettingsServiceBean.Key.InstallationName)).thenReturn(DEFAULT_NAME);
+ Mockito.when(dataverseSvc.getRootDataverseName()).thenReturn(DEFAULT_NAME);
+
+ pidService = Mockito.mock(PidProviderFactoryBean.class);
+ Mockito.when(pidService.isGlobalIdLocallyUnique(any(GlobalId.class))).thenReturn(true);
+ Mockito.when(pidService.getProducer()).thenReturn("RootDataverse");
+
+ }
+
+ /**
+ */
+ @Test
+ public void testDataCiteXMLCreation() throws IOException {
+ DoiMetadata doiMetadata = new DoiMetadata();
+ doiMetadata.setTitle("A Title");
+ DatasetFieldType dft = new DatasetFieldType(DatasetFieldConstant.authorName, FieldType.TEXT, false);
+ dft.setDisplayFormat("#VALUE");
+ DatasetFieldType dft2 = new DatasetFieldType(DatasetFieldConstant.authorAffiliation, FieldType.TEXT, false);
+ dft2.setDisplayFormat("#VALUE");
+ DatasetAuthor alice = new DatasetAuthor();
+ DatasetField df1 = new DatasetField();
+ df1.setDatasetFieldType(dft);
+ df1.setSingleValue("Alice");
+ alice.setName(df1);
+ DatasetField df2 = new DatasetField();
+ df2.setDatasetFieldType(dft2);
+ df2.setSingleValue("Harvard University");
+ alice.setAffiliation(df2);
+ DatasetAuthor bob = new DatasetAuthor();
+ DatasetField df3 = new DatasetField();
+ df3.setDatasetFieldType(dft);
+ df3.setSingleValue("Bob");
+ bob.setName(df3);
+ DatasetField df4 = new DatasetField();
+ df4.setDatasetFieldType(dft2);
+ df4.setSingleValue("QDR");
+ bob.setAffiliation(df4);
+ List authors = new ArrayList<>();
+ authors.add(alice);
+ authors.add(bob);
+ doiMetadata.setAuthors(authors);
+ doiMetadata.setPublisher("Dataverse");
+ XmlMetadataTemplate template = new XmlMetadataTemplate(doiMetadata);
+
+ Dataset d = new Dataset();
+ GlobalId doi = new GlobalId("doi", "10.5072", "FK2/ABCDEF", null, null, null);
+ d.setGlobalId(doi);
+ DatasetVersion dv = new DatasetVersion();
+ TermsOfUseAndAccess toa = new TermsOfUseAndAccess();
+ toa.setTermsOfUse("Some terms");
+ dv.setTermsOfUseAndAccess(toa);
+ dv.setDataset(d);
+ DatasetFieldType primitiveDSFType = new DatasetFieldType(DatasetFieldConstant.title,
+ DatasetFieldType.FieldType.TEXT, false);
+ DatasetField testDatasetField = new DatasetField();
+
+ dv.setVersionState(VersionState.DRAFT);
+
+ testDatasetField.setDatasetVersion(dv);
+ testDatasetField.setDatasetFieldType(primitiveDSFType);
+ testDatasetField.setSingleValue("First Title");
+ List fields = new ArrayList<>();
+ fields.add(testDatasetField);
+ dv.setDatasetFields(fields);
+ ArrayList dsvs = new ArrayList<>();
+ dsvs.add(0, dv);
+ d.setVersions(dsvs);
+ DatasetType dType = new DatasetType();
+ dType.setName(DatasetType.DATASET_TYPE_DATASET);
+ d.setDatasetType(dType);
+
+ String xml = template.generateXML(d);
+ System.out.println("Output is " + xml);
+ try {
+ StreamSource source = new StreamSource(new StringReader(xml));
+ source.setSystemId("DataCite XML for test dataset");
+ assertTrue(XmlValidator.validateXmlSchema(source, new URL("https://schema.datacite.org/meta/kernel-4/metadata.xsd")));
+ } catch (SAXException e) {
+ System.out.println("Invalid schema: " + e.getMessage());
+ }
+
+ }
+
+}
|